{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#IsDigit := c -> c in \"0123456789\";\n#var.prefix := meth( self )\n#    local p;\n#    p := FirstPosition(self.id,IsDigit);\n#    p := SplitAt(self.id,When(p>0,p-1,0))[1];\n#    Constraint(p <> \"\");\n#    return p;\n#end;\n\nClass(VarGenBase, rec(\n    __call__ := self >> WithBases(self, rec(counter:=rec(), pfx := \"\")),\n\n    suffix := n -> StringInt(n),\n\n    reset := meth(self) self.counter := rec(); end,\n\n    nextu := (self, t) >> When(self.pfx=\"\", self.next(t, \"u\"), self.next(t, \"\")),\n\n    next := meth(self, t, pfx)\n        local p;\n\tConstraint(IsString(pfx)); Constraint(IsType(t));\n\tpfx := Concat(self.pfx, pfx);\n\tif not IsBound(self.counter.(pfx)) then \n            # first will be plain \"pfx\", then \"pfx2\" \n\t    p := self.var(t, pfx); \n\t    self.counter.(pfx) := 2;\n\telse\n\t    p := self.var(t, Concat(pfx,  self.suffix(self.counter.(pfx))));\n\t    self.counter.(pfx) := self.counter.(pfx) + 1;\n\tfi;\n\treturn p;\n    end,\n\n    nextName := (self, pfx) >> self.next(TInt, pfx).id,\n        \n    var := (t, pfx) -> Error(\"must be implemented in subclasses\"),\n\n    # creates a cloned generator with aliased .counter, and an extra prefix\n    # that will be added to all params created with .next()\n    withPrefix := (self, pfx) >> When(\n        pfx=\"i\",\n        Error(\"i prefix is RESERVED for loop variables!\"),\n        WithBases(self, rec(pfx := Concat(self.pfx, pfx))))\n));\n\n\nClass(VarGenNumeric, VarGenBase, rec(\n    var := (t, name) -> var(name, t)\n));\n\n\nClass(VarGenSymbolic, VarGenBase, rec(\n    var := (t, name) -> var(name, t),\n    suffix := VarNameInt\n));\n\n\nClass(ParamGenNumeric, VarGenBase, rec(\n    var := (t, name) -> param(t, name)\n));\n\n\nClass(ParamGenSymbolic, VarGenBase, rec(\n    var := (t, name) -> param(t, name),\n    suffix := VarNameInt\n));\n\n\nClass(NewInt,rec(\n\t__call__ := meth(self)\n\t    self.n := self.n + 1;\n\t    return self.n;\n\tend,\n\n\tn := 0,\n));\n\n\nClass(VarMapper, rec(\n    __call__ := (self, vargen) >> WithBases(self, rec(\n\t    sn := NewInt(),\n\t    bindings := tab(),\n\t    vargen := vargen)),\n\n    reset := meth(self)\n\tself.vargen.reset();\n\tself.bindings := tab();\n\tself.sn := NewInt();\n    end,\n\n    ignore := (self, var) >> false,\n\n    alreadyMapped := (self,var) >> IsBound(var.sn) and var.sn = self.sn,\n\n    map := meth(self, var) \n        local newvar;\n\tif self.ignore(var) or (IsBound(var.NoReMap) and var.NoReMap) or self.alreadyMapped(var) then\n\t    return var;\n\tfi;\n        if IsBound(self.bindings.(var.id)) then \n\t    return self.bindings.(var.id);\n\telse\n\t    newvar := self.vargen.next(var.t, var.id{[1]});\n\t    newvar.sn := self.sn;\n\t    self.bindings.(var.id):=newvar;\n\t    return newvar;\n\tfi;\n    end\n));\n\nProperName := function(o)\n    o.properName := true;\n    return o;\nend;\n\n_RemapVars := function(c, ignore_list, varGen )\n    local vmapper;\n    vmapper := CopyFields(VarMapper(varGen), \n        rec(ignore := (self, var) >> IsBound(var.properName) and var.properName=true\n                                     or var.id in ignore_list));\n    return SubstTopDownRules(c, [\n\t    [var,v->vmapper.map(v)],\n\t    [decl,d->decl(List(d.vars,v->vmapper.map(v)),d.cmd)],\n\t    [data,d->data(vmapper.map(d.var),d.value,d.cmd)] ]);\nend;\n\nRemapVars := c -> _RemapVars(c, [\"X\", \"Y\"], VarGenNumeric);\n\nRemapVarsIgnore := (c, ignore_list) -> _RemapVars(c, Concatenation([\"X\", \"Y\"], ignore_list));\n\nRemapVarsSafe := function(c, ignore_list)\n    local free, args, init;\n    free := c.free();\n    args := Set(ConcatList( Collect(c, @(1, [func])), x->x.params));\n    init := Collect(c, @(1, [var,param], x->IsBound(x.value) or IsBound(x.init))); # .value and .init: this is a hack!\n    return  _RemapVars(c, List(free::args, x->x.id) :: init :: ignore_list, ParamGenSymbolic());\nend;\n\n\nClass(RemoveUnusedVars,rec(__call__:=function(code)\n    local usedvars,declvars,unusedvars;\n  \n    usedvars := Set(Flat([\n\t\t  \tCollect(code,var)\t# all used vars in operands of assign-cmds\n\t\t]));\n\n    declvars := Set(Flat([\n##  \t\t\t X, Y, # implicitly they are arguments of DFT kernel\n\t\t\t List(Collect(code,decl),d->d.vars)\n\t\t]));\n\n    unusedvars := declvars;\n    SubtractSet(unusedvars,usedvars);\n\n    # remove unused vars\n\tcode := SubstTopDown(code,decl,d->decl(Difference(d.vars, unusedvars),d.cmd));\n\n    return code;\nend));\n\n##  # Maybe, it would be usefull to add someting else to remove unused loops, data...\n##  Class(RemoveUnused...,rec(__call__:=function(code)\n##      local usedvars,declvars,unusedvars,v;\n##      declvars := Set(Flat([\n##  \t\t\t List(Collect(code,data),d->d.var),\n##  \t\t\t List(Collect(code,loop),l->l.var)\n##  \t\t]));\n##      unusedvars := declvars;\n##      SubtractSet(unusedvars,usedvars);\n##  \n##\t\t\t# NOTE: prefixes for data and loop var-names?\n##      for v in unusedvars do\n##        if v.id[1] = 'D' then\n##          code := SubstTopDown(code,data,d->Cond(d.var=v,d.cmd,d));\n##        elif v.id[1] = 'i' then\n##          code := SubstTopDown(code,loop,d->Cond(d.var=v,d.cmd,d));\n##        else # decls\n##          code := SubstTopDown(code,decl,d->decl(RemoveList(d.vars,v),d.cmd));\n##        fi;\n##      od;\n", "meta": {"hexsha": "5fdb14ab590596ac89ba091c2ebb7e157dfe81de", "size": 5126, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/gen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/gen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/gen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.5591397849, "max_line_length": 118, "alphanum_fraction": 0.5926648459, "num_tokens": 1531, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4416730056646256, "lm_q2_score": 0.09670578743859412, "lm_q1q2_score": 0.04271233580316826}}
{"text": "for i in [1 .. 11] do\n    if RemInt(i, 5) = 0 then\n        Print(i, \"\\n\");\n        continue;\n    fi;\n    Print(i, \", \");\nod;\n\n# 1, 2, 3, 4, 5\n# 6, 7, 8, 9, 10\n", "meta": {"hexsha": "294de024abea5510e3f64f558db15857dad1ceb0", "size": 159, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Loops-Continue/GAP/loops-continue.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Loops-Continue/GAP/loops-continue.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Loops-Continue/GAP/loops-continue.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 14.4545454545, "max_line_length": 28, "alphanum_fraction": 0.3899371069, "num_tokens": 78, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.47657965106367595, "lm_q2_score": 0.08509905080783367, "lm_q1q2_score": 0.0405564759398474}}
{"text": "n := 10;\nfor i in [1 .. n] do\n    Print(i);\n    if i < n then\n        Print(\", \");\n    else\n        Print(\"\\n\");\n    fi;\nod;\n", "meta": {"hexsha": "77f07835566e7b07d811265e8c8a74402df3f373", "size": 125, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Loops-N-plus-one-half/GAP/loops-n-plus-one-half.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Loops-N-plus-one-half/GAP/loops-n-plus-one-half.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Loops-N-plus-one-half/GAP/loops-n-plus-one-half.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 12.5, "max_line_length": 20, "alphanum_fraction": 0.368, "num_tokens": 43, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3886180267058489, "lm_q2_score": 0.10230470310290449, "lm_q1q2_score": 0.03975745184257848}}
{"text": "# See section 7.5 of reference manual\n\n# GAP has assertions levels. An assertion is tested if its level\n# is less then the global level.\n\n# Set global level\nSetAssertionLevel(10);\n\na := 1;\nAssert(20, a > 1, \"a should be greater than one\");\n# nothing happens\n\na := 1;\nAssert(4, a > 1, \"a should be greater than one\");\n# error\n\n# Show current global level\nAssertionLevel();\n# 10\n", "meta": {"hexsha": "c2f2a6a54cbcad09da2356d9df05086aec1c34fe", "size": 377, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Assertions/GAP/assertions.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Assertions/GAP/assertions.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Assertions/GAP/assertions.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 18.85, "max_line_length": 64, "alphanum_fraction": 0.6976127321, "num_tokens": 108, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.3629692055196168, "lm_q2_score": 0.10521053810590077, "lm_q1q2_score": 0.03818818542859017}}
{"text": "#############################################################################\n####\n##\n#A  anusp.gi                    ANUPQ package                  Eamonn O'Brien\n#A                                                             Alice Niemeyer \n##\n#Y  Copyright 1993-2001,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany\n#Y  Copyright 1993-2001,  School of Mathematical Sciences, ANU,     Australia\n##\n\n#############################################################################\n##\n#F  ANUPQSPerror( <param> )  . . . . . . . . . . . . report illegal parameter\n##\nInstallGlobalFunction( ANUPQSPerror, function( param )\n    Error(\n    \"Valid Options:\\n\",\n    \"    \\\"ClassBound\\\", <bound>\\n\",\n    \"    \\\"PcgsAutomorphisms\\\"\\n\",\n    \"    \\\"Exponent\\\", <exponent>\\n\",\n    \"    \\\"Metabelian\\\"\\n\",\n    \"    \\\"OutputLevel\\\", <level>\\n\",\n    \"    \\\"SetupFile\\\", <file>\\n\",\n    \"Illegal Parameter: \\\"\", param, \"\\\"\" );\nend );\n\n#############################################################################\n##\n#F  ANUPQSPextractArgs( <args> )  . . . . . . . . . . . . parse argument list\n##\nInstallGlobalFunction( ANUPQSPextractArgs, function( args )\n    local   CR,  i,  act,  G,  match;\n\n    # allow to give only a prefix\n    match := function( g, w )\n    \treturn 1 < Length(g) and \n            Length(g) <= Length(w) and \n            w{[1..Length(g)]} = g;\n    end;\n\n    # extract arguments\n    G  := args[2];\n    CR := rec( group := G );\n    i  := 3;\n    while i <= Length(args)  do\n        act := args[i];\n\n        # \"ClassBound\", <class>\n        if match( act, \"ClassBound\" )  then\n            i := i + 1;\n            CR.ClassBound := args[i];\n            if CR.ClassBound <= PClassPGroup(G)  then\n                Error( \"\\\"ClassBound\\\" must be at least \", PClassPGroup(G)+1 );\n            fi;\n\n        # \"PcgsAutomorphisms\"\n        elif match( act, \"PcgsAutomorphisms\" )  then\n            CR.PcgsAutomorphisms := true;\n\n        #this may be available later\n        # \"SpaceEfficient\"\n        #elif match( act, \"SpaceEfficient\" ) then\n        #    CR.SpaceEfficient := true;\n\n        # \"Exponent\", <exp>\n        elif match( act, \"Exponent\" )  then\n            i := i + 1;\n            CR.Exponent := args[i];\n\n        # \"Metabelian\"\n        elif match( act, \"Metabelian\" ) then\n            CR.Metabelian := true;\n\n        # \"Verbose\"\n        elif match( act, \"Verbose\" )  then\n            CR.Verbose := true;\n\n        # \"SetupFile\", <file>\n        elif match( act, \"SetupFile\" )  then\n            i := i + 1;\n            CR.SetupFile := args[i];\n\n    \t# \"TmpDir\", <dir>\n    \telif match( act, \"TmpDir\" )  then\n    \t    i := i + 1;\n    \t    CR.TmpDir := args[i];\n\n        # \"Output\", <level>\n        elif match( act, \"OutputLevel\" )  then\n            i := i + 1;\n            CR.OutputLevel := args[i];\n            CR.Verbose     := true;\n\n        # signal an error\n        else\n            ANUPQSPerror(act);\n        fi;\n        i := i + 1;\n    od;\n    return CR;\n\nend );\n\n#############################################################################\n##\n#F  PqFpGroupPcGroup( <G> ) . . . . . .  corresponding fp group of a pc group\n##\nInstallGlobalFunction( PqFpGroupPcGroup, \n    G -> Image( IsomorphismFpGroup( G ) )\n);\n\n#############################################################################\n##\n#M  FpGroupPcGroup( <G> ) . . . . . . .  corresponding fp group of a pc group\n##\nInstallMethod( FpGroupPcGroup, \"pc group\", [IsPcGroup], 0, PqFpGroupPcGroup );\n\n#############################################################################\n##\n#F  PQ_EPIMORPHISM_STANDARD_PRESENTATION( <args> ) . (epi. onto) SP for group\n##\nInstallGlobalFunction( PQ_EPIMORPHISM_STANDARD_PRESENTATION, \nfunction( args )\n    local   datarec, rank, Q, Qclass, automorphisms, generators, x,\n            images, i, r, j, aut, result, desc, k;\n\n    datarec := ANUPQ_ARG_CHK(\"StandardPresentation\", args);\n\n    if datarec.calltype = \"interactive\" and IsBound(datarec.SPepi) then\n       # Note: the `pq' binary seg-faults if called twice to \n       # calculate the standard presentation of a group\n      return datarec.SPepi;\n    fi;\n\n    if VALUE_PQ_OPTION(\"pQuotient\") = fail and\n       VALUE_PQ_OPTION(\"Prime\", datarec) <> fail then\n       # Ensure a saved value of `Prime' has precedence\n       # over a saved value of `pQuotient'.\n        Unbind(datarec.pQuotient);\n    fi;\n\n    if VALUE_PQ_OPTION(\"pQuotient\", datarec) <> fail then\n        PQ_AUT_GROUP( datarec.pQuotient );\n        datarec.Prime := PrimePGroup( datarec.pQuotient );\n    elif VALUE_PQ_OPTION(\"Prime\", datarec) <> fail then\n        rank := Number( List( AbelianInvariants(datarec.group), \n                              x -> Gcd(x, datarec.Prime) ),\n                        y -> y = datarec.Prime );\n\n        # construct free group with <rank> generators\n        Q := FreeGroup( IsSyllableWordsFamily, rank, \"q\" );\n    \n        # construct power-relation\n        Q := Q / List( GeneratorsOfGroup(Q), x -> x^datarec.Prime );\n    \n        # construct pc group\n        Q := PcGroupFpGroup(Q);\n    \n        # construct automorphism\n        automorphisms := [];\n        generators := GeneratorsOfGroup(Q);\n        for x in GeneratorsOfGroup( GL(rank, datarec.Prime) ) do\n            images := [];\n            for i  in [ 1 .. rank ]  do\n                r := One(Q);\n                for j  in [ 1 .. rank ]  do\n                    r := r * generators[j]^Int(x[i][j]);\n                od;\n                images[i] := r;\n            od;\n            aut := GroupHomomorphismByImages( Q, Q, generators, images );\n            SetIsBijective( aut, true );\n            Add( automorphisms, aut );\n        od;\n        SetAutomorphismGroup( Q, GroupByGenerators( automorphisms ) );\n        datarec.pQuotient := Q;\n    fi;\n    \n    #PushOptions(rec(nonuser := true));\n    Qclass := PClassPGroup( datarec.pQuotient );\n    if VALUE_PQ_OPTION(\"ClassBound\", 63) <= Qclass then\n        Error( \"option `ClassBound' must be greater than `pQuotient' class (\",\n               Qclass, \")\\n\" );\n    fi;\n    PQ_PC_PRESENTATION(datarec, \"SP\" : ClassBound := Qclass);\n\n    PQ_SP_STANDARD_PRESENTATION(datarec);\n\n    PQ_SP_ISOMORPHISM(datarec);\n\n    if datarec.calltype = \"non-interactive\" then\n        PQ_COMPLETE_NONINTERACTIVE_FUNC_CALL(datarec);\n        if IsBound( datarec.setupfile ) then\n            #PopOptions();\n            return true;\n        fi;\n    fi;\n\n    # try to read output\n    result := ANUPQReadOutput( ANUPQData.SPimages );\n\n    if not IsBound(result.ANUPQmagic)  then\n        Error(\"something wrong with `pq' binary. Please check installation\\n\");\n    fi;\n\n    desc := rec();\n    result.ANUPQgroups[Length(result.ANUPQgroups)](desc);\n#    if result.ANUPQautos <> fail and \n#       Length( result.ANUPQautos ) = Length( result.ANUPQgroups ) then\n#    \tresult.ANUPQautos[ Length(result.ANUPQgroups) ]( desc.group );\n#    fi;\n\n    # revise images to correspond to images of user-supplied generators \n    datarec.SP := desc.group;\n    x  := Length( desc.map );\n    k  := Length( GeneratorsOfGroup( datarec.group ) );\n    # images of user supplied generators are last k entries in .pqImages \n\n    datarec.SPepi := GroupHomomorphismByImagesNC( \n                         datarec.group, \n                         datarec.SP, \n                         GeneratorsOfGroup(datarec.group),\n                         desc.map{[x - k + 1..x]} );\n    #PopOptions();\n    return datarec.SPepi;\nend );\n\n#############################################################################\n##\n#F  EpimorphismPqStandardPresentation( <arg> ) . . . epi. onto SP for p-group\n##\nInstallGlobalFunction( EpimorphismPqStandardPresentation, function( arg )\n    return PQ_EPIMORPHISM_STANDARD_PRESENTATION( arg );\nend );\n\n#############################################################################\n##\n#F  PqStandardPresentation( <arg> : <options> ) . . . . . . .  SP for p-group\n##\nInstallGlobalFunction( PqStandardPresentation, function( arg )\n    local SPepi;\n\n    SPepi := PQ_EPIMORPHISM_STANDARD_PRESENTATION( arg );\n    if SPepi = true then\n      return true; # the SetupFile case\n    fi;\n    return Range( SPepi );\nend );\n\n#############################################################################\n##\n#M  EpimorphismStandardPresentation( <F> ) . . . . . epi. onto SP for p-group\n#M  EpimorphismStandardPresentation( [<i>] )\n##\nInstallMethod( EpimorphismStandardPresentation, \n               \"fp group\", [IsFpGroup], 0,\n               EpimorphismPqStandardPresentation );\n\nInstallMethod( EpimorphismStandardPresentation, \n               \"pc group\", [IsPcGroup], 0,\n               EpimorphismPqStandardPresentation );\n\nInstallMethod( EpimorphismStandardPresentation, \n               \"positive integer\", [IsPosInt], 0,\n               EpimorphismPqStandardPresentation );\n\nInstallOtherMethod( EpimorphismStandardPresentation,\n                    \"\", [], 0,\n                    EpimorphismPqStandardPresentation );\n\n#############################################################################\n##\n#M  StandardPresentation( <F> ) . . . . . . . . . . . . . . .  SP for p-group\n#M  StandardPresentation( [<i>] )\n##\nInstallMethod( StandardPresentation, \n               \"fp group\", [IsFpGroup], 0,\n               PqStandardPresentation );\n\nInstallMethod( StandardPresentation, \n               \"pc group\", [IsPcGroup], 0,\n               PqStandardPresentation );\n\nInstallMethod( StandardPresentation, \n               \"positive integer\", [IsPosInt], 0,\n               PqStandardPresentation );\n\nInstallOtherMethod( StandardPresentation,\n                    \"\", [], 0,\n                    PqStandardPresentation );\n\n#############################################################################\n##\n#F  IsPqIsomorphicPGroup( <G>, <H> )  . . . . . . . . . . .  isomorphism test\n##\nInstallGlobalFunction( IsPqIsomorphicPGroup, function( G, H )\n    local   p,  class,  SG,  SH,  Ggens,  Hgens;\n    \n    # <G> and <H> must both be pc groups and p-groups\n    if not IsPcGroup(G)  then\n        Error( \"<G> must be a pc group\" );\n    fi;\n    if not IsPcGroup(H)  then\n        Error( \"<H> must be a pc group\" );\n    fi;\n    if Size(G) <> Size(H)  then\n        return false;\n    fi;\n    p := SmallestRootInt(Size(G));\n    if not IsPrimeInt(p)  then\n        Error( \"<G> must be a p-group\" );\n    fi;\n    \n    # check the Frattini factor\n    if RankPGroup(G) <> RankPGroup(H)  then\n        return false;\n    fi;\n\n    # check the exponent-p length and the sizes of the groups in the\n    # p-central series of both groups \n    if List(PCentralSeries(G,p), Size) <> List(PCentralSeries(H,p), Size) then\n        return false;\n    fi;\n\n    # if the groups are elementary abelian they are isomorphic\n    class := PClassPGroup(G);\n    if class = 1  then\n        return true;\n    fi;\n    \n    # compute a standard presentation for both\n    SG := PqStandardPresentation(PqFpGroupPcGroup(G)\n                                 : Prime := p, ClassBound := class);\n    SH := PqStandardPresentation(PqFpGroupPcGroup(H)\n                                 : Prime := p, ClassBound := class);\n    \n    # the groups are equal if the presentation are equal\n    Ggens := GeneratorsOfGroup( FreeGroupOfFpGroup( SG ) );\n    Hgens := GeneratorsOfGroup( FreeGroupOfFpGroup( SH ) );\n    return RelatorsOfFpGroup(SG)\n           = List( RelatorsOfFpGroup(SH), \n                   x -> MappedWord( x, Hgens, Ggens ) );\n    \nend );\n\n#############################################################################\n##\n#M  IsIsomorphicPGroup( <F>, <G> )\n##\nInstallMethod( IsIsomorphicPGroup, \"pc group, pc group\",\n               [IsPcGroup, IsPcGroup], 0,\n               IsPqIsomorphicPGroup );\n\n#E  anusp.gi  . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here\n", "meta": {"hexsha": "d05fc54d8a21ceed427978fd8a8b7887634e6090", "size": 11719, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/anusp.gi", "max_stars_repo_name": "gap-system/anupq", "max_stars_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_stars_repo_licenses": ["Artistic-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/anusp.gi", "max_issues_repo_name": "gap-system/anupq", "max_issues_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_issues_repo_licenses": ["Artistic-2.0"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2015-03-04T12:41:28.000Z", "max_issues_repo_issues_event_max_datetime": "2015-09-27T22:17:27.000Z", "max_forks_repo_path": "lib/anusp.gi", "max_forks_repo_name": "gap-system/anupq", "max_forks_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_forks_repo_licenses": ["Artistic-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.0112676056, "max_line_length": 79, "alphanum_fraction": 0.5184742725, "num_tokens": 3045, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.49218813572079556, "lm_q2_score": 0.0747700506393715, "lm_q1q2_score": 0.03680093183194174}}
{"text": "\nmyvar := 5;\nmycode := function (x)\n\t   return 2*x;\n  end;\n", "meta": {"hexsha": "39ea6ce7f0b6b6260ff52d07513eff739e5d2295", "size": 59, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "example/mycode.gap", "max_stars_repo_name": "jorants/gap-loader", "max_stars_repo_head_hexsha": "975d76618bd69a0026460de6040748a28266f12b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "example/mycode.gap", "max_issues_repo_name": "jorants/gap-loader", "max_issues_repo_head_hexsha": "975d76618bd69a0026460de6040748a28266f12b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example/mycode.gap", "max_forks_repo_name": "jorants/gap-loader", "max_forks_repo_head_hexsha": "975d76618bd69a0026460de6040748a28266f12b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 9.8333333333, "max_line_length": 22, "alphanum_fraction": 0.5423728814, "num_tokens": 23, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4339814648038985, "lm_q2_score": 0.08389037839420965, "lm_q1q2_score": 0.03640686929847242}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Below we define includes mandated by SSE Intel C+ compiler\n# Due to known incompatibilities between gcc and icc, you can turn\n# off hasXXX if compiler doesnt support it\n# No crosscompilation support. \n\n_hasSSE4_2 := arg -> LocalConfig.cpuinfo.SIMD().hasSSE4_2() and  LocalConfig.compilerinfo.SIMD().hasSSE4_2();\n_hasSSE4_1 := arg -> LocalConfig.cpuinfo.SIMD().hasSSE4_1() and  LocalConfig.compilerinfo.SIMD().hasSSE4_1();\n_hasSSSE3  := arg -> LocalConfig.cpuinfo.SIMD().hasSSSE3()  and  LocalConfig.compilerinfo.SIMD().hasSSSE3();\n_hasSSE3   := arg -> LocalConfig.cpuinfo.SIMD().hasSSE3()   and  LocalConfig.compilerinfo.SIMD().hasSSE3();\n_hasSSE2   := arg -> LocalConfig.cpuinfo.SIMD().hasSSE2()   and  LocalConfig.compilerinfo.SIMD().hasSSE2();\n_hasSSE    := arg -> LocalConfig.cpuinfo.SIMD().hasSSE()    and  LocalConfig.compilerinfo.SIMD().hasSSE();\n_hasMMX    := arg -> LocalConfig.cpuinfo.SIMD().hasMMX()    and  LocalConfig.compilerinfo.SIMD().hasMMX();\n\n_MM_MALLOC := () -> When(not LocalConfig.osinfo.isDarwin(), [\"<include/mm_malloc.h>\"], []);\n_MMINTRIN  := () -> When(_hasMMX(),    [\"<mmintrin.h>\"], []);\n_XMMINTRIN := () -> When(_hasSSE(),    [\"<xmmintrin.h>\"], []);\n_EMMINTRIN := () -> When(_hasSSE2(),   [\"<emmintrin.h>\"], []);\n_PMMINTRIN := () -> When(_hasSSE3(),   [\"<pmmintrin.h>\"], []);\n_TMMINTRIN := () -> When(_hasSSSE3(),  [\"<tmmintrin.h>\"], []);\n_SMMINTRIN := () -> When(_hasSSE4_1(), [\"<smmintrin.h>\"], []);\n_NMMINTRIN := () -> When(_hasSSE4_2(), [\"<nmmintrin.h>\"], []);\n\n#F ==============================================================================================\n#F SIMD_Intel  --  Base class for Intel ISAs\n#F\nClass(SIMD_Intel, SIMD_ISA, rec(\n    info := \"Intel SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, MMX architecture definition base\",\n    arch := \"Intel_SSE\",\n    file := \"sse\",\n    unparser := SSEUnparser,\n\n    # Should vector values be inlined or declared as constants\n    declareConstants := false,\n\n    # This is applied as the final pass of compileStrategy. Below we apply ISA specific strength\n    # reduction rules, in particular some unaligned stores can only be eliminated in the final pass\n    fixProblems := (self, c, opts) >> BUA(c, MergedRuleSet(RulesStrengthReduce, RulesSSEPostProcess), opts),\n\n    autolib := rec(\n\tincludes := () -> _NMMINTRIN() :: _SMMINTRIN() :: _TMMINTRIN() :: _PMMINTRIN() ::\n\t                  _EMMINTRIN() :: _XMMINTRIN(), \n        timerIncludes := () -> [\"<include/sp_rdtsc.h>\"]),\n\n    unsigned := meth(self) self.isSigned:=false; return self; end,\n\n    vzero := self >> self.t.zero(),\n\n    intelCommonIncludes := self >> _NMMINTRIN() :: _SMMINTRIN() :: _TMMINTRIN() :: \n                                   _PMMINTRIN() :: _EMMINTRIN() :: _XMMINTRIN() :: _MMINTRIN(),\n\n    simpIndicesInside := SSE_LDST.list\n));\n\n# ==============================================================================================\n# 2-way double precision real\n#\nClass(SSE_2x64f, SIMD_Intel, rec(\n    info := \"SSE2 2 x 64-bit double\",\n\n    countrec := rec(\n        ops := [\n            [ add, sub, chslo_2x64f, chshi_2x64f, addsub_2x64f, hadd_2x64f], \n\t    [ mul ],\n            [ vunpacklo_2x64f, vunpackhi_2x64f, vshuffle_2x64f, vushuffle_2x64f ],\n            [ vload1sd_2x64f,  vload_1l_2x64f,  vload_1h_2x64f, vloadu_2x64f, \n\t      vstore_1l_2x64f, vstore_1h_2x64f, vstoreu_2x64f ],\n            [ deref ],\n            Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\"],\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n    \n    includes     := self >> [\"<include/omega64.h>\", \"<include/mm_malloc.h>\"] :: self.intelCommonIncludes(), \n    active       := true,\n    isFixedPoint := false,\n    isFloat      := true,\n\n    v     := 2,\n    t     := TVect(TReal, 2),\n    ctype := \"double\",\n    instr := [vunpacklo_2x64f, vunpackhi_2x64f, vshuffle_2x64f],\n    bits  := 64,\n\n    splopts  := rec(precision := \"double\"),\n    dupload  := (y, x) -> assign(y, vdup(x, 2)),\n    duploadn := (y, x, n) -> assign(y, vushuffle_2x64f(x, [n,n])),\n    hadd     := (x1,x2) -> hadd_2x64f(x1,x2),\n\n    # load full vectors using subvectors of length 1 or 2\n    svload:= [ [ (y,x,opts) -> assign(y, vload1sd_2x64f(x[1].toPtr(TReal))),\n                 (y,x,opts) -> let(u := var.fresh_t(\"U\", TVectDouble(2)),\n                      decl([u], chain(assign(u, vload1sd_2x64f(x[1].toPtr(TReal))),\n                                      assign(y, vload_1h_2x64f(u, x[2].toPtr(TReal)))))) ],\n               [ (y,x,opts) -> assign(y, nth(x[1].toPtr(TVect(TReal, 2)), 0)) ]\n\t     ],\n\n    # store full vector using subvectors of length 1 or 2\n    svstore := [ [ (y,x,opts) -> vstore_1l_2x64f(y[1].toPtr(TReal), x),\n                   (y,x,opts) -> chain(vstore_1l_2x64f(y[1].toPtr(TReal), x),\n                                       vstore_1h_2x64f(y[2].toPtr(TReal), x)) ],\n                 [ (y,x,opts) -> assign(nth(y[1].toPtr(TVect(TReal, 2)), 0), x) ]\n\t       ],\n\n    # keep the n lower scalars and zero the other ones\n    optional_mask :=  (c, n, opts) -> When(IsBound(opts.trueSVSemantics) and opts.trueSVSemantics and not(n=2),\n        let(f:=\"0xFFFFFFFF\", z:=\"0x0\", bin_and(c,tcast(TVect(TReal, 2), vhex(List([1..4],x->When(x/2<=n,f,z)))))),\n        c),\n\n    # load contiguous with unaligned loads\n    loadc := (self, sv, opts) >> (\n\t(y,x) -> assign(y, self.optional_mask(vloadu_2x64f(x.toPtr(TReal)), sv, opts))),\n\n    # load contiguous + known alignment -> using 2 aligned load to be smarter\n    loadc_align := (self, sv, align, opts) >> ((y,x,addr) -> let(\n        v1 := nth(nth(x,add(addr,-align)).toPtr(TVect(TReal, 2)),0),\n        v2 := nth(nth(x,add(addr,2-align)).toPtr(TVect(TReal, 2)), 0),\n        m := x -> self.optional_mask(x, sv, opts),\n\n        Cond(align=0,  assign(y, m(v1)),\n             sv=1,     assign(y, m(vushuffle_2x64f(v1, [2, 2]))),\n             sv=2,     assign(y, m(vshuffle_2x64f(v1, v2, [2, 3]))),\n             Error(\"bad parameters\")))),\n\n    # store contiguous unaligned\n    storec := [ (y,x) -> vstore_1l_2x64f(y.toPtr(TReal), x),\n                (y,x) -> vstoreu_2x64f  (y.toPtr(TReal), x) ],\n\n    reverse := (y,x) -> assign(vref(y,0,2), vushuffle_2x64f(vref(x,0,2), [2,1])),\n\n    mul_cx := (self, opts) >> Cond(\n                    # SSE and MMX can't do double precision\n                    opts.vector.SIMD in [\"MMX\", \"SSE\"],\n                    Error(\"SSE2 required for double precision\"),\n                    # SSE2 only\n                    opts.vector.SIMD = \"SSE2\",\n                    (y,x,c) -> let(u1 := var.fresh_t(\"U\", TVectDouble(2)), u2 := var.fresh_t(\"U\", TVectDouble(2)),\n                        u3 := var.fresh_t(\"U\", TVectDouble(2)), u4 := var.fresh_t(\"U\", TVectDouble(2)),\n                        decl([u1, u2, u3, u4], chain(\n                            assign(u1, mul(x, vushuffle_2x64f(c, [1,1]))),\n                            assign(u2, chshi_2x64f(x)),\n                            assign(u3, mul(u2, vushuffle_2x64f(c, [2,2]))),\n                            assign(u4, vushuffle_2x64f(u3, [2,1])),\n                            assign(y, add(u1, u4))))),\n                    # SSE3 or higher\n                    (y, x, c) -> let(u1 := var.fresh_t(\"U\", TVectDouble(2)),\n                                 u2 := var.fresh_t(\"U\", TVectDouble(2)),\n                                 u3 := var.fresh_t(\"U\", TVectDouble(2)),\n                        decl([u1, u2, u3], chain(\n                            assign(u1, mul(x, vushuffle_2x64f(c, [1,1]))),\n                            assign(u2, vushuffle_2x64f(x, [2,1])),\n                            assign(u3, mul(u2, vushuffle_2x64f(c, [2,2]))),\n                            assign(y, addsub_2x64f(u1, u3)))))\n            ),\n\n   mul_cx_conj := (self, opts) >> Cond(\n                    # SSE and MMX can't do double precision\n                    opts.vector.SIMD in [\"MMX\", \"SSE\"],\n                    Error(\"SSE2 required for double precision\"),\n                    # SSE2 only\n                    (y,x,c) -> let(u1 := var.fresh_t(\"U\", TVectDouble(2)), u2 := var.fresh_t(\"U\", TVectDouble(2)),\n                        u3 := var.fresh_t(\"U\", TVectDouble(2)), u4 := var.fresh_t(\"U\", TVectDouble(2)),\n                        decl([u1, u2, u3, u4], chain(\n                            assign(u1, mul(x, vushuffle_2x64f(c, [1,1]))),\n                            assign(u2, chslo_2x64f(x)),\n                            assign(u3, mul(u2, vushuffle_2x64f(c, [2,2]))),\n                            assign(u4, vushuffle_2x64f(u3, [2,1])),\n                            assign(y, add(u1, u4)))))\n\t\t    ),\n\n    bin_shl1 := (y,x,opts) -> assign(y, vec_shl(x, 1)),\n    bin_shl2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],1))),\n    bin_shr1 := (y,x,opts) -> assign(y, vec_shr(x, 1)),\n    bin_shr2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],1))),\n    # support for VO1dsJ(n, v)\n    bin_shrev := (y,x,opts) -> assign(y, vshuffle_2x64f(x[1], x[2], [1,2])),\n    swap_cx := (y, x, opts) -> assign(y, vushuffle_2x64f(x, [2,1])),\n    RCVIxJ2 := (y, x, opts) -> assign(y, vushuffle_2x64f(x, [2,1])) # ???? maybe shuf3 rule is invalid\n\n));\n\n\n#==============================================================================================\n#\nClass(SSE_2x64i, SIMD_Intel, rec(\n    info := \"SSE2 2 x 64-bit integer\",\n\n    includes     := self >> [\"<include/omega64i.h>\"] :: self.intelCommonIncludes(), \n    active       := true,\n    isFixedPoint := true,\n    isFloat      := false,\n    saturatedArithmetic := false,\n\n    v     := 2,\n    t     := TVect(TReal, 2),\n    ctype := \"__int64\",\n    instr := [vunpacklo_2x64i, vunpackhi_2x64i, vshuffle_2x64i],\n    bits  := 64,\n    fracbits := 62,\n\n    splopts := rec(precision := \"double\"),\n#    dupload := (y, x) -> assign(y, vushuffle_2x64i(vload1sd_2x64i(x.toPtr(TReal)), [1,1])),\n    reverse := (y,x) -> assign(vref(y,0,2), vushuffle_2x64f(vref(x,0,2), [2,1])),\n    bin_shl1 := (y,x,opts) -> assign(y, vec_shl(x, 1)),\n    bin_shl2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],1))),\n    bin_shr1 := (y,x,opts) -> assign(y, vec_shr(x, 1)),\n    bin_shr2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],1))),\n));\n\n#==============================================================================================\nClass(SSE_2x32f, SIMD_Intel, rec(\n    info := \"SSE 2 x 32-bit float\",\n    countrec := rec(\n        ops := [\n            [add, sub, addsub_4x32f, hadd_4x32f], [mul],\n            [vunpacklo_4x32f, vunpackhi_4x32f, vshuffle_4x32f, vushuffle_4x32f],\n            [vload1_4x32f,  vloadu_4x32f,  vloadu2_4x32f,\n             vstore1_4x32f, vstoreu_4x32f, vstoreu2_4x32f, vstoremsk_4x32f],\n            [deref, vload_2l_4x32f, vload_2h_4x32f, vstore_2l_4x32f, vstore_2h_4x32f],\n            Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\"],\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n    includes     := self >> [\"<include/omega32.h>\"] :: self.intelCommonIncludes(), \n    active       := true,\n    isFixedPoint := false,\n    isFloat      := true,\n\n    v      := 2,\n    t      := TVect(TReal, 2),\n    ctype  := \"float\",\n    instr  := [vunpacklo_2x32f, vunpackhi_2x32f, vshuffle_2x32f],\n    bits   := 32,\n\n    splopts  := rec(precision := \"single\"),\n    dupload  := (y, x) -> assign(y, vdup(x, 2)),\n    duploadn := (y, x, n) -> assign(y, vushuffle_2x32f(x, [n,n])),\n    hadd     := (x1,x2) -> hadd_2x32f(x1,x2),\n\n    # NOTE: Hacks. YSV: these are still alive as of svn 9206.\n    #\n    requireLoad := true,\n    loadop := l -> vload_2x32f(vzero_2x32f(), l),\n    requireStore := true,\n    storeop := (l, v) -> vstore_2x32f(l.loc, v),\n    needScalarVarFix := true,\n    scalarVar := () -> var.fresh_t(\"P\", TVectDouble(4)),\n    ##\n\n    svload:= [ [     # load full vectors using subvectors of length 1 or 2\n                (y,x,opts) -> assign(y, vload1sd_2x32f(x[1].toPtr(TReal))),\n                (y,x,opts) -> let(u := var.fresh_t(\"U\", TVectDouble(2)),\n                    decl([u], chain(assign(u, vload1sd_2x32f(x[1].toPtr(TReal))),\n                                    assign(y, vload_1h_2x32f(u, x[2].toPtr(TReal))))))\n                ],\n                [(y,x,opts) -> assign(y, nth(x[1].toPtr(TVect(TReal, 2)), 0)) ]\n        ],\n    svstore := [[    # store full vector using subvectors of length 1 or 2\n                (y,x,opts) -> vstore_1l_2x32f(y[1].toPtr(TReal), x),\n                (y,x,opts) -> chain(vstore_1l_2x32f(y[1].toPtr(TReal), x),\n                               vstore_1h_2x32f(y[2].toPtr(TReal), x))\n                ],\n                [\n                (y,x,opts) -> assign(nth(y[1].toPtr(TVect(TReal, 2)), 0), x)\n                ]],\n\n    # keep the n lower scalars and zero the other ones\n    optional_mask :=  (self, c, n, opts) >> Cond(IsBound(opts.trueSVSemantics) and opts.trueSVSemantics and n<>2,\n\tbin_and(c, tcast(self.t, vhex(List([1..4], x -> When(x/2<=n, \"0xFFFFFFFF\", \"0x0\"))))),\n        c),\n\n    # load contiguous with unaligned loads\n    loadc := (self, sv, opts) >> (\n\t(y,x) -> assign(y, self.optional_mask(vloadu_2x32f(x.toPtr(TReal)), sv, opts))),\n\n    # load contiguous + known alignment -> using 2 aligned load to be smarter\n    loadc_align := (self, sv, align, opts)>>\n    ((y,x,addr) -> let(\n        v1 := nth(nth(x,add(addr,-align)).toPtr(TVect(TReal, 2)),0),\n        v2 := nth(nth(x,add(addr,2-align)).toPtr(TVect(TReal, 2)), 0),\n        m := x-> self.optional_mask(x, sv, opts),\n        Cond(align=0,\n                 assign(y, m(v1)),\n\t     sv=1,\n                 assign(y, m(vushuffle_2x32f(v1, [2, 2]))),\n             sv=2,\n                 assign(y, m(vshuffle_2x32f(v1, v2, [2, 3]))),\n\t     # else\n\t\t Error(\"bad parameters\")))),\n\n    # store contiguous unaligned\n    storec := [    \n        (y,x) -> vstore_1l_2x32f(y.toPtr(TReal), x),\n        (y,x) -> vstoreu_2x32f(y.toPtr(TReal), x)\n    ],\n\n    reverse := (y,x) -> assign(vref(y,0,2), vushuffle_2x32f(vref(x,0,2), [2,1])),\n\n    mul_cx := (self, opts) >> Cond(\n        # SSE and MMX can't do double precision\n        opts.vector.SIMD in [\"MMX\", \"SSE\"],\n            Error(\"SSE2 required for double precision\"),\n\n        # SSE2 only\n        opts.vector.SIMD = \"SSE2\",\n            (y,x,c) -> let(\n\t\tu := var.fresh_t(\"U\", self.t), w := var.fresh_t(\"U\", self.t),\n                decl([u, w], chain(\n                     assign(u,             x  * vushuffle_2x32f(c, [1,1])),\n                     assign(w, chshi_2x32f(x) * vushuffle_2x32f(c, [2,2])),\n                     assign(y, u + vushuffle_2x32f(w, [2,1]))))),\n        # SSE3 or higher\n            (y, x, c) -> let(\n\t\tu := var.fresh_t(\"U\", self.t), w := var.fresh_t(\"U\", self.t),\n                decl([u, w], chain(\n                     assign(u,                       x   * vushuffle_2x32f(c, [1,1])),\n                     assign(w, vushuffle_2x32f(x, [2,1]) * vushuffle_2x32f(c, [2,2])),\n                     assign(y, addsub_2x32f(u, w)))))\n    ),\n\n    bin_shl1 := (y,x,opts) -> assign(y, vec_shl(x, 8)),\n    bin_shl2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],1))),\n    bin_shr1 := (y,x,opts) -> assign(y, vec_shr(x, 1)),\n    bin_shr2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],1))),\n    # support for VO1dsJ(n, v)\n    bin_shrev := (y,x,opts) -> assign(y, vshuffle_2x32f(x[1], x[2], [1,2]))\n));\n\n#==============================================================================================\n\nClass(SSE_4x32f, SIMD_Intel, rec(\n    info := \"SSE 4 x 32-bit float\",\n\n    # experimental -- parametized ISA, <el_t> is the type of each slot in the vector\n    __call__ := (self, el_t) >> WithBases(self, rec(\n        t            := TVect(el_t, 4), \n\tisSigned     := el_t.isSigned(),\n\tisFloat      := IsRealT(el_t),\n\tisFixedPoint := IsFixedPtT(el_t),\n\tsplopts      := CopyFields(self.splopts, rec(XType := TPtr(el_t), YType := TPtr(el_t))),\n\tsvload       := self.svload_init(TVect(el_t, 4)),\n\tsvstore      := self.svstore_init(TVect(el_t, 4)),\n\tstorec       := self.storec_init(TVect(el_t, 4)),\n\toperations   := ISAOps,\n\tprint        := self >> Print(self.__name__, \"(\", self.t.t, \")\"),\n\tid           := self >> self.__name__ :: \"_\" :: el_t.strId(),\n    )),\n\n    countrec := rec(\n        ops := [\n            [ add, sub, addsub_4x32f, hadd_4x32f, chshi_4x32f, chslo_4x32f ], \n\t    [ mul ],\n            [ vunpacklo_4x32f, vunpackhi_4x32f, vshuffle_4x32f, vushuffle_4x32f ],\n            [ vload1_4x32f,    vload_2l_4x32f,  vload_2h_4x32f,  vloadu_4x32f,  vloadu2_4x32f,\n              vstore1_4x32f,   vstore_2l_4x32f, vstore_2h_4x32f, vstoreu_4x32f, vstoreu2_4x32f, \n\t      vstoremsk_4x32f, vinsert_4x32f,   vextract_4x32f ],\n            [ deref ],\n            Value,      # Value without [] is a keyword in countOps !!\n            [vcvt_4x32_i2f]\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\", \"[vcvt]\"],\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n    includes     := self >> [\"<include/omega32.h>\"] :: self.intelCommonIncludes(), \n    active       := true,\n    isFixedPoint := false,\n    isFloat      := true,\n\n    v      := 4,\n    t      := TVect(TReal, 4),\n    ctype  := \"float\",\n    instr  := [vunpacklo_4x32f, vunpackhi_4x32f, vshuffle_4x32f, vushuffle_4x32f],\n    bits   := 32,\n\n    splopts  := rec(precision := \"single\"),\n\n    #dupload := (self, y, x) >> self.duploadn(y, vload1_4x32f(x.toPtr(self.t.t)), 1),\n    dupload := (self, y, x) >> assign(y, vdup(x, self.v)),\n    duploadn := (y, x, n) -> assign(y, vushuffle_4x32f(x, [n,n,n,n])),\n\n    hadd     := (x1,x2) -> hadd_4x32f(x1,x2),\n\n    svload_init := (vt) -> [\n        # load using subvectors of length 1\n\t[\n            (y,x,opts) -> assign(y, vload1_4x32f(x[1].toPtr(vt.t))),\n\n            (y,x,opts)->When(_hasSSE4_1(opts),\n                let(u := var.fresh_t(\"U\", vt),\n                    decl([u], chain(\n                            assign(u, vload1_4x32f(x[1].toPtr(vt.t))),\n                            assign(y, vinsert_4x32f(u, deref(x[2].toPtr(T_Int(32))), 2))\n                            ))),\n                let(u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt),\n                    decl([u1, u2], chain(\n                            assign(u1, vload1_4x32f(x[1].toPtr(vt.t))),\n                            assign(u2, vload1_4x32f(x[2].toPtr(vt.t))),\n                            assign(y, vunpacklo_4x32f(u1, u2))\n                            )))\n                ),\n\n            (y,x,opts)->When(_hasSSE4_1(opts),\n                let(u := var.fresh_t(\"U\", vt),\n                    decl([u], chain(\n                            assign(u, vload1_4x32f(x[1].toPtr(vt.t))),\n                            assign(u, vinsert_4x32f(u, deref(x[2].toPtr(T_Int(32))), 2)),\n                            assign(y, vinsert_4x32f(u, deref(x[3].toPtr(T_Int(32))), 3))\n                            ))),\n                let(u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt),\n                    u3 := var.fresh_t(\"U\", vt), u4 := var.fresh_t(\"U\", vt),\n                    decl([u1, u2, u3, u4], chain(\n                            assign(u1, vload1_4x32f(x[1].toPtr(vt.t))),\n                            assign(u2, vload1_4x32f(x[2].toPtr(vt.t))),\n                            assign(u3, vshuffle_4x32f(u1, u2, [1,2,1,2])),\n                            assign(u4, vload1_4x32f(x[3].toPtr(vt.t))),\n                            assign(y, vshuffle_4x32f(u3, u4, [1,3,1,3]))\n                            )))\n                ),\n\n            (y,x,opts)->When(_hasSSE4_1(opts),\n                let(u := var.fresh_t(\"U\", vt),\n                    decl([u], chain(\n                            assign(u, vload1_4x32f(x[1].toPtr(vt.t))),\n                            assign(u, vinsert_4x32f(u, deref(x[2].toPtr(T_Int(32))), 2)),\n                            assign(u, vinsert_4x32f(u, deref(x[3].toPtr(T_Int(32))), 3)),\n                            assign(y, vinsert_4x32f(u, deref(x[4].toPtr(T_Int(32))), 4))\n                            ))),\n                let(u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt),\n                    u3 := var.fresh_t(\"U\", vt), u4 := var.fresh_t(\"U\", vt),\n                    u5 := var.fresh_t(\"U\", vt), u6 := var.fresh_t(\"U\", vt),\n                    decl([u1, u2, u3, u4, u5, u6], chain(\n                            assign(u1, vload1_4x32f(x[1].toPtr(vt.t))),\n                            assign(u2, vload1_4x32f(x[2].toPtr(vt.t))),\n                            assign(u3, vshuffle_4x32f(u1, u2, [1,2,1,2])),\n                            assign(u4, vload1_4x32f(x[3].toPtr(vt.t))),\n                            assign(u5, vload1_4x32f(x[4].toPtr(vt.t))),\n                            assign(u6, vshuffle_4x32f(u4, u5, [1,2,1,2])),\n                            assign(y,  vshuffle_4x32f(u3, u6, [1,3,1,3]))\n                            )))\n                ),\n\t],\n        # load using subvectors of length 2\n        [    \n            (y,x,opts) -> assign(y, vload_2l_4x32f(vzero_4x32f(), x[1].toPtr(TVect(vt.t,2)))),\n            (y,x,opts) -> let(u := var.fresh_t(\"U\", vt),\n                decl(u, chain(\n                        assign(u, vload_2l_4x32f(vzero_4x32f(), x[1].toPtr(TVect(vt.t,2)))),\n                        assign(y, vload_2h_4x32f(u, x[2].toPtr(TVect(vt.t,2)))))\n                    ))\n        ]],\n\n    svload := ~.svload_init(~.t),\n\n    # keep the n lower scalars and zero the other ones\n    optional_mask :=  (c, n, opts) -> Cond(IsBound(opts.trueSVSemantics) and opts.trueSVSemantics and n <> 4,\n\tbin_and(c, vhex(List([1..4], x -> When(x<=n, \"0xFFFFFFFF\", \"0x0\")))),\n        c),\n\n    # load contiguous with unaligned loads\n    loadc := (self, sv, opts) >> ((y,x) -> assign(y, self.optional_mask(vloadu_4x32f(x.toPtr(self.t.t)), sv, opts))),\n\n    #load contiguous + known alignment -> using 2 aligned load to be smarter\n    loadc_align := (self, sv, align, opts)>>\n    ((y,x,addr) -> let(\n        v1 := nth(nth(x, addr-align)  .toPtr(self.t), 0),\n        v2 := nth(nth(x, addr-align+4).toPtr(self.t), 0),\n        m := x -> self.optional_mask(x, sv, opts),\n        Cond(align=0,\n            assign(y, m(v1)),\n\n            _hasSSSE3(opts),\n            assign(y, m(alignr_4x32f(v2, v1, align*4))),\n\n            assign(y, m(bin_or(\n                        vec_shr(v1, align),\n                        vec_shl(v2, (4-align))\n                        )))))),\n\n    svstore_init := (vt) -> [\n        [\n            (y,x,opts) -> vstore1_4x32f(y[1].toPtr(vt.t), x),\n            (y,x,opts)->When(_hasSSE4_1(opts),\n                chain(\n                    vstore1_4x32f(y[1].toPtr(vt.t), x),\n                    vextract_4x32f(y[2].toPtr(T_Int(32)), x, 2)\n                    ),\n                let(u1 := var.fresh_t(\"U\", vt),\n                    decl([u1], chain(\n                            vstore1_4x32f(y[1].toPtr(vt.t), x),\n                            assign(u1, vushuffle_4x32f(x, [2,3,4,1])),\n                            vstore1_4x32f(y[2].toPtr(vt.t), u1)\n                            )))\n                ),\n            (y,x,opts)->When(_hasSSE4_1(opts),\n                chain(\n                    vstore1_4x32f(y[1].toPtr(vt.t), x),\n                    vextract_4x32f(y[2].toPtr(T_Int(32)), x, 2),\n                    vextract_4x32f(y[3].toPtr(T_Int(32)), x, 3)\n                    ),\n                let(u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt),\n                    decl([u1, u2], chain(\n                            vstore1_4x32f(y[1].toPtr(vt.t), x),\n                            assign(u1, vushuffle_4x32f(x, [2,3,4,1])),\n                            vstore1_4x32f(y[2].toPtr(vt.t), u1),\n                            assign(u2, vushuffle_4x32f(u1, [2,3,4,1])),\n                            vstore1_4x32f(y[3].toPtr(vt.t), u2)\n                            )))\n                ),\n            (y,x,opts)->When(_hasSSE4_1(opts),\n                chain(\n                    vstore1_4x32f(y[1].toPtr(vt.t), x),\n                    vextract_4x32f(y[2].toPtr(T_Int(32)), x, 2),\n                    vextract_4x32f(y[3].toPtr(T_Int(32)), x, 3),\n                    vextract_4x32f(y[4].toPtr(T_Int(32)), x, 4)\n                    ),\n                let(u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt),\n                    u3 := var.fresh_t(\"U\", vt),\n                    decl([u1, u2, u3], chain(\n                            vstore1_4x32f(y[1].toPtr(vt.t), x),\n                            assign(u1, vushuffle_4x32f(x, [2,3,4,1])),\n                            vstore1_4x32f(y[2].toPtr(vt.t), u1),\n                            assign(u2, vushuffle_4x32f(u1, [2,3,4,1])),\n                            vstore1_4x32f(y[3].toPtr(vt.t), u2),\n                            assign(u3, vushuffle_4x32f(u2, [2,3,4,1])),\n                            vstore1_4x32f(y[4].toPtr(vt.t), u3)\n                            )))\n                )\n        ],\n        [\n            (y,x,opts) -> vstore_2l_4x32f(y[1].toPtr(TVect(vt.t,2)), x),\n            (y,x,opts) -> chain(vstore_2l_4x32f(y[1].toPtr(TVect(vt.t,2)), x),\n                                vstore_2h_4x32f(y[2].toPtr(TVect(vt.t,2)), x))\n        ]\n    ],\n\n    svstore := ~.svstore_init(~.t),\n\n    # Store contiguous unaligned\n    storec_init := (vt) -> [    \n        (y,x) -> vstore1_4x32f(y.toPtr(vt.t), x),\n        (y,x) -> vstoreu2_4x32f(y.toPtr(TVect(T_Int(64),2)), x),\n        (y,x) -> vstoremsk_4x32f(y.toPtr(vt.t), x, [\"0xFFFFFFFF\", \"0xFFFFFFFF\", \"0xFFFFFFFF\", \"0x0\"]),\n        (y,x) -> vstoreu_4x32f(y.toPtr(vt.t), x)\n    ],\n\n    storec := ~.storec_init(~.t),\n\n    reverse := (y,x) -> assign(vref(y,0,4), vushuffle_4x32f(vref(x,0,4), [4,3,2,1])),\n\n    # support for VS and VS.transpose()\n    bin_shl1 := (y,x,opts) -> assign(y, vec_shl(x, 1)),\n#   bin_shl2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],3), vec_shl(x[2],1))),\n    bin_shl2 := (self,y,x,opts) >> When(\n\t_hasSSSE3(opts),\n            assign(y, alignr_4x32f(x[2], x[1], 12)),\n\t# else\n        let(u := self.freshU(),\n            chain(\n                assign(u, vshuffle_4x32f(x[1], x[2], [3,4,1,2])),\n                assign(y, vshuffle_4x32f(u,    x[2], [2,3,2,3]))))\n    ),\n\n    bin_shr1 := (y,x,opts) -> assign(y, vec_shr(x, 1)), \n\n    bin_shr2 := (self,y,x,opts) >> Cond(\n\t_hasSSSE3(opts),\n            assign(y, alignr_4x32f(x[2], x[1], 4)),\n\t# else, no SSSE3\n            let(u := self.freshU(), chain(                           # x = [a,b,c,d] [e,f,g,h] \n                assign(u, vshuffle_4x32f(x[1], x[2], [3,4,1,2])),    # u = [c,d,e,f]\n                assign(y, vshuffle_4x32f(x[1], u,    [2,3,2,3]))))), # y = [b,c,d,e]\n\t# another way\n\t#   assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],3)))\n\n    # support for VO1dsJ(n, v)\n    bin_shrev := (self, y, x, opts) >> let(\n\tu := self.freshU(),                                     # data = [a b c d] [e f g h]\n        chain(                                                  # x = [e,f,g,h] [a,b,c,d] \n            assign(u, vshuffle_4x32f(x[1], x[2], [1,2,3,4])),   # u = [e f c d]\n            assign(y, vshuffle_4x32f(u,    x[2], [1,4,3,2])))), # y = [e d c b]\n\n    # returns function (y,x,c) -> <code for y=x*c>\n    mul_cx := (self, opts) >> Cond(\n        # MMX can't do single precision\n        opts.vector.SIMD in [\"MMX\"], Error(\"SSE required for single precision\"),\n        # SSE only\n        opts.vector.SIMD in [\"SSE\", \"SSE2\"],\n            (y,x,c) -> let(\n\t\tu := self.freshU(),  v := self.freshU(),\n                decl([u, v], chain(\n                    assign(u,                             x * vushuffle_4x32f(c, [1,1,3,3])),\n                    assign(v, vushuffle_4x32f(x, [2,1,4,3]) * vushuffle_4x32f(c, [2,2,4,4])),\n                    assign(y, u + chslo_4x32f(v))))),\n        # SSE3 or higher\n            (y,x,c) -> let(\n\t\tu := self.freshU(),  v := self.freshU(),\n                decl([u, v], chain(\n                    assign(u,                             x * vushuffle_4x32f(c, [1,1,3,3])),\n                    assign(v, vushuffle_4x32f(x, [2,1,4,3]) * vushuffle_4x32f(c, [2,2,4,4])),\n                    assign(y, addsub_4x32f(u, v)))))\n    ),\n\n    # returns function (y,x,c) -> <code for y=x*conj(c)>\n    mul_cx_conj := (self, opts) >> Cond(\n        # MMX can't do single precision\n        opts.vector.SIMD in [\"MMX\"], Error(\"SSE required for single precision\"),\n        # SSE \n            (y,x,c) -> let(\n\t\tu := self.freshU(),  v := self.freshU(),\n                decl([u, v], chain(\n                    assign(u,             x  * vushuffle_4x32f(c, [1,1,3,3])),\n                    assign(v, chslo_4x32f(x) * vushuffle_4x32f(c, [2,2,4,4])),\n                    assign(v, vushuffle_4x32f(v, [2,1,4,3])),\n                    assign(y, u + v))))\n    ),\n\n    swap_cx := (y, x, opts) -> assign(y, vushuffle_4x32f(x, [2,1,4,3])),\n    RCVIxJ2 := (y, x, opts) -> assign(y, vushuffle_4x32f(x, [3,4,1,2])),\n\n    freshU  := self >> var.fresh_t(\"U\", self.t),\n\n    hmin := (self, y, x, opts) >> let( u := self.freshU(),\n       decl( [u], chain( \n           assign(u, min(x, vushuffle_4x32f(x, [2,1,4,3]))),\n           assign(y, min(u, vushuffle_4x32f(u, [3,4,1,2]))) \n       ))),\n    \n    rotate_left := (self, shift) >> Cond(\n            shift mod 4=0,\n                ((y, x) -> assign(vtref(self.t, y, 0), vtref(self.t, x, 0))),\n            shift mod 4=1,                         \n                ((y, x) -> assign(vtref(self.t, y, 0), vushuffle_4x32f(vtref(self.t, x, 0), [4,1,2,3]))),\n            shift mod 4=2,                                                              \n                ((y, x) -> assign(vtref(self.t, y, 0), vushuffle_4x32f(vtref(self.t, x, 0), [3,4,1,2]))),\n            shift mod 4=3,                                                              \n                ((y, x) -> assign(vtref(self.t, y, 0), vushuffle_4x32f(vtref(self.t, x, 0), [2,3,4,1]))),\n            #else                                  \n                ((y, x) -> assign(vtref(self.t, y, 0),\n                    bin_or( vec_shl(vtref(self.t, x, 0), imod(shift,4)),\n                            vec_shr(vtref(self.t, x, 0), 4-imod(shift,4)))))),\n));\n\n#==============================================================================================\n\nClass(SSE_4x32i, SIMD_Intel, rec(\n    active := true,\n    isFixedPoint := true,\n    isFloat := false,\n    saturatedArithmetic := false,\n    info := \"SSE 4 x 32-bit integer\",\n    v := 4,\n    t := TVect(TReal, 4),\n    instr := [vunpacklo_4x32i, vunpackhi_4x32i, vshuffle_4x32i, vushuffle_4x32i],\n    bits := 32,\n    fracbits := 30,\n    includes := self >> [\"<include/omega32i.h>\"] :: self.intelCommonIncludes(), \n    splopts := DataTypes.i32re,\n\n#    dupload := (y, x) -> assign(y, vushuffle_4x32i(vload1_4x32i(x.toPtr(TReal)), [1,1,1,1])),\n    reverse := (y,x) -> assign(vref(y,0,4), vushuffle_4x32i(vref(x,0,4), [4,3,2,1])),\n    # support for VS and VS.transpose()\n    bin_shl1 := (y,x,opts) -> assign(y, vec_shl(x, 1)),\n    bin_shl2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],3), vec_shl(x[2],1))),\n    bin_shr1 := (y,x,opts) -> assign(y, vec_shr(x, 1)),\n    bin_shr2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],3))),\n    interleavedmask := (b,idx,x1,x2) -> assign(nth(tcast(TPtr(TUChar), b),idx),interleavedmask_4x32i(x1,x2)),\n    vrshift := \"_mm_srli_epi32\",\n    vlshift := \"_mm_slli_epi32\",\n    vmul := \"_mm_mulhi_epi32\"\n));\n\n#==============================================================================================\n\nClass(SSE_8x16i, SIMD_Intel, rec(\n    info := \"SSE2 8 x 16-bit int\",\n    \n    # experimental -- parametized ISA, <el_t> is the type of each 8-bit slot in the vector\n    __call__ := (self, el_t) >> WithBases(self, rec(\n        t            := TVect(el_t, 8), \n\tisSigned     := el_t.isSigned(),\n\tisFloat      := IsRealT(el_t),\n\tisFixedPoint := IsFixedPtT(el_t),\n\tsplopts      := CopyFields(self.splopts, rec(XType := TPtr(el_t), YType := TPtr(el_t))),\n\tsvload       := self.svload_init(TVect(el_t, 8)),\n\tsvstore      := self.svstore_init(TVect(el_t, 8)),\n\tstorec       := self.storec_init(TVect(el_t, 8)),\n        operations   := ISAOps,\n\tprint        := self >> Print(self.__name__, \"(\", self.t.t, \")\"),\n\tid           := self >> self.__name__ :: \"_\" :: el_t.strId(),\n    )),\n\n    countrec := rec(\n        ops := [\n            [ add, sub, chs_8x16i ], \n\t    [ fpmul ],\n            [ vunpacklo_8x16i,   vunpackhi_8x16i,  vunpacklo2_8x16i, vunpackhi2_8x16i,\n              vunpacklo4_8x16i,  vunpackhi4_8x16i, vushuffle2_8x16i, vushufflelo_8x16i, \n\t      vushufflehi_8x16i, vushuffle_8x16i,  vshuffle2_8x16i,  vshuffle4_8x16i, \n\t      alignr_8x16i ],\n            [ vload1_8x16i, vload2_8x16i, vload4_8x16i, vloadu_8x16i,\n              vextract1_8x16i, vextract2_8x16i, vstoreu_8x16i, vstore4_8x16i, vstoremsk_8x16i ],\n            [ deref ],\n            Value\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\"],\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]*2\n    ),\n\n    includes     := self >> [\"<include/omega16i.h>\"] :: self.intelCommonIncludes(), \n    active       := true,\n    isFixedPoint := true,\n    isFloat      := false,\n    saturatedArithmetic := false,\n\n    v     := 8,\n    t     := TVect(TReal, 8),\n    ctype := \"short int\",\n    instr := [vunpacklo_8x16i,   vunpackhi_8x16i,   vunpacklo2_8x16i, vunpackhi2_8x16i,\n              vunpacklo4_8x16i,  vunpackhi4_8x16i,  vushuffle2_8x16i, vushufflelo_8x16i, \n\t      vushufflehi_8x16i, vshuffle2_8x16i ], #vshuffle4_8x16i\n    bits     := 16,\n    fracbits := 14,\n    vrshift  := \"_mm_srai_epi16\", # \"_mm_srli_epi16\",\n    vlshift  := \"_mm_slli_epi16\",\n\n    splopts := rec(customDataType := \"short_fp14\"),\n\n    dupload := (self, y, x) >> assign(y, vdup(x, self.v)),\n\n    svload_init := (vt) -> [\n        # ------------------------------------\n        # Load using subvectors of length 1\n\t[ \n\t  (y,x,opts) -> assign(y, vload1_8x16i(vt.zero(), x[1], 0)),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..2], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..3], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..4], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..5], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..6], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..7], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),\n          (y,x,opts) -> let(\n\t      u  := var.fresh_t(\"U\", vt),\n\t      cc := List([1..8], i -> assign(u, vload1_8x16i(u, x[i], i-1))),\n              decl([u], chain(assign(u, vt.zero()), cc, assign(y, u)))),                 \n        ],\n\n        # ------------------------------------\n        # Load using subvectors of length 2\n        [ (y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", vt), \n              decl([u], chain(\n                      assign(u, vload2_8x16i(nth(x[1].toPtr(T_Int(32)), 0))),\n                      assign(u, vunpacklo2_8x16i(u, vt.zero())),\n                      assign(y, vunpacklo4_8x16i(u, vt.zero()))))),\n          (y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", vt), v := var.fresh_t(\"U\", vt),\n              decl([u, v], chain(\n                      assign(u, vload2_8x16i(nth(x[1].toPtr(T_Int(32)), 0))), \n\t\t      assign(v, vload2_8x16i(nth(x[2].toPtr(T_Int(32)), 0))),\n                      assign(u, vunpacklo2_8x16i(u, v)),\n                      assign(y, vunpacklo4_8x16i(u, vt.zero()))))),\n          (y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", vt), v := var.fresh_t(\"U\", vt), \n\t      w := var.fresh_t(\"U\", vt),\n              decl([u, v, w], chain(\n                      assign(u, vload2_8x16i(nth(x[1].toPtr(T_Int(32)), 0))), \n\t\t      assign(v, vload2_8x16i(nth(x[2].toPtr(T_Int(32)), 0))),\n                      assign(u, vunpacklo2_8x16i(u, v)),\n                      assign(w, vload2_8x16i(nth(x[3].toPtr(T_Int(32)), 0))),\n                      assign(w, vunpacklo2_8x16i(w, vt.zero())),\n                      assign(y, vunpacklo4_8x16i(u, w))))),\n          (y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", vt),  v := var.fresh_t(\"U\", vt),\n\t      uu := var.fresh_t(\"U\", vt), vv := var.fresh_t(\"U\", vt),\n              decl([u, v, uu, vv], chain(\n                      assign(u, vload2_8x16i(nth(x[1].toPtr(T_Int(32)), 0))),\n\t\t      assign(v, vload2_8x16i(nth(x[2].toPtr(T_Int(32)), 0))),\n                      assign(u, vunpacklo2_8x16i(u, v)),\n                      assign(uu, vload2_8x16i(nth(x[3].toPtr(T_Int(32)), 0))), \n\t\t      assign(vv, vload2_8x16i(nth(x[4].toPtr(T_Int(32)), 0))),\n                      assign(uu, vunpacklo2_8x16i(uu, vv)),\n                      assign(y,  vunpacklo4_8x16i(u, uu)))))\n        ]\n    ],\n\n    svload := ~.svload_init(~.t),\n\n    svstore_init := (vt) -> [\n        # ------------------------------------\n        # Store subvectors of length 1\n\t#\n\t[ (y,x,opts) -> chain(List([1..1], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..2], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..3], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..4], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..5], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..6], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..7], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n          (y,x,opts) -> chain(List([1..8], i -> assign(y[i], vextract1_8x16i(x, i-1)))),\n        ],\n        # ------------------------------------\n        # Store subvectors of length 2\n\t#\n        [ (y,x,opts) -> assign(nth(y[1].toPtr(T_Int(32)),0), vextract2_8x16i(x)),\n\n          (y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", vt),\n              decl([u], chain(\n                      assign(nth(y[1].toPtr(T_Int(32)),0), vextract2_8x16i(x)),\n                      assign(u, vushuffle2_8x16i(x, [2,3,4,1])), \n\t\t      assign(nth(y[2].toPtr(T_Int(32)),0), vextract2_8x16i(u))\n                      ))),\n          (y,x,opts) -> let(\n\t      u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt),\n              decl([u1, u2], chain(\n                      assign(nth(y[1].toPtr(T_Int(32)),0), vextract2_8x16i(x)),\n                      assign(u1, vushuffle2_8x16i(x,  [2,3,4,1])), assign(nth(y[2].toPtr(T_Int(32)),0), vextract2_8x16i(u1)),\n                      assign(u2, vushuffle2_8x16i(u1, [2,3,4,1])), assign(nth(y[3].toPtr(T_Int(32)),0), vextract2_8x16i(u2))\n                      ))),\n          (y,x,opts) -> let(\n\t      u1 := var.fresh_t(\"U\", vt), u2 := var.fresh_t(\"U\", vt), u3 := var.fresh_t(\"U\", vt),\n              decl([u1, u2, u3], chain(\n                      assign(nth(y[1].toPtr(T_Int(32)),0), vextract2_8x16i(x)),\n                      assign(u1, vushuffle2_8x16i(x,  [2,3,4,1])), assign(nth(y[2].toPtr(T_Int(32)),0), vextract2_8x16i(u1)),\n                      assign(u2, vushuffle2_8x16i(u1, [2,3,4,1])), assign(nth(y[3].toPtr(T_Int(32)),0), vextract2_8x16i(u2)),\n                      assign(u3, vushuffle2_8x16i(u2, [2,3,4,1])), assign(nth(y[4].toPtr(T_Int(32)),0), vextract2_8x16i(u3))\n                      )))\n        ]\n    ],\n\n    svstore := ~.svstore_init(~.t),\n\n    # keep the n lower scalars and zero the other ones\n    optional_mask :=  (c, n, opts) -> Cond(IsBound(opts.trueSVSemantics) and opts.trueSVSemantics and n<>8, \n        bin_and(c, vhex(List([1..8], x -> When(x<=n, \"0xFFFF\", \"0x0\")))),\n        c),\n\n    # Load contiguous with unaligned loads\n    loadc := (self, sv, opts) >> (\n\t(y,x) -> assign(y, self.optional_mask(vloadu_8x16i(x.toPtr(self.t.t)), sv, opts))),\n\n    # Load contiguous + known alignment -> using 2 aligned load to be smarter\n    loadc_align := (self, sv, align, opts) >>\n    ((y,x,addr) -> let(\n        v1 := nth(nth(x, addr-align  ).toPtr(self.t), 0),\n        v2 := nth(nth(x, addr-align+8).toPtr(self.t), 0),\n        mask := x -> self.optional_mask(x, sv, opts),\n        Cond(align=0,\n                 assign(y, mask(v1)),\n\t     _hasSSSE3(opts),\n                 assign(y, mask(alignr_8x16i(v2, v1, align*2))),\n\t     # else\n                 assign(y, mask(bin_or(vec_shr(v1, align), vec_shl(v2, 8-align))))\n\t))),\n\n    # Store contiguous unaligned\n    storec_init := (vt) -> [    \n        (y,x) -> assign(y, vextract1_8x16i(x, 0)),\n        (y,x) -> assign(nth(y.toPtr(T_Int(32)),0), vextract2_8x16i(x)),\n        (y,x) -> vstoremsk_8x16i(y.toPtr(vt.t), x, [\"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstore4_8x16i(y.toPtr(vt), x),\n        (y,x) -> vstoremsk_8x16i(y.toPtr(vt.t), x, [\"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_8x16i(y.toPtr(vt.t), x, [\"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_8x16i(y.toPtr(vt.t), x, [\"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0xFFFF\", \"0x0\"]),\n        (y,x) -> vstoreu_8x16i(y.toPtr(vt), x)\n    ],\n\n    storec := ~.storec_init(~.t),\n\n    reverse := (y,x) -> assign(vref(y,0,8), \n\tvushufflehi_8x16i(vushufflelo_8x16i(vushuffle2_8x16i(vref(x,0,8), [3,4,1,2]), [4,3,2,1]), [4,3,2,1])),\n\n    # support for VS and VS.transpose()\n    bin_shl1 := (self,y,x,opts) >> assign(y, vec_shl(x, 1)),\n    bin_shl2 := (self,y,x,opts) >> When(_hasSSSE3(opts),\n        assign(y, alignr_8x16i(x[2], x[1], 14)),\n        assign(y, bin_or(vec_shr(x[1], 7), vec_shl(x[2], 1)))\n    ),\n\n    bin_shr1 := (self,y,x,opts) >> assign(y, vec_shr(x, 1)),\n    bin_shr2 := (self,y,x,opts) >> When(_hasSSSE3(opts),\n        assign(y, alignr_8x16i(x[2], x[1], 2)),\n        assign(y, bin_or(vec_shr(x[1], 1), vec_shl(x[2], 7)))\n    ),\n\n    interleavedmask := (b,idx,x1,x2) -> assign(nth(tcast(TPtr(TSym(\"short int\")), b),idx),interleavedmask_8x16i(x1,x2)),\n\n    # support for VO1dsJ(n, v)\n    bin_shrev := (y,x,opts) -> let(\n\tu := var.fresh_t(\"U\", TVectDouble(8)),\n        chain(\n            opts.vector.isa.bin_shr2(u, [x[2], x[1]], opts),\n            assign(y, vushufflehi_8x16i(vushufflelo_8x16i(vushuffle2_8x16i(u, [3,4,1,2]), [4,3,2,1]), [4,3,2,1])))\n    ),\n\n    mul_cx := (self, opts) >> Cond(\n        # MMX and SSE can't do 8x16i\n        opts.vector.SIMD in [\"MMX\", \"SSE\"],\n            Error(\"SSE2 required for 8-way 16-bit integer\"),\n\n        opts.vector.SIMD in [\"SSE2\", \"SSE3\"],\n            (y,x,c) -> let(\n\t\tu1 := var.fresh_t(\"U\", self.t), u2 := var.fresh_t(\"U\", self.t),\n                u3 := var.fresh_t(\"U\", self.t), u4 := var.fresh_t(\"U\", self.t),\n                decl([u1, u2, u3, u4], chain(\n                        assign(u1, x * vushufflehi_8x16i(vushufflelo_8x16i(c, [1,1,3,3]), [1,1,3,3])),\n                        assign(u2, x * self.t.value([1,-1,1,-1,1,-1,1,-1])),\n                        assign(u3, u2 * vushufflehi_8x16i(vushufflelo_8x16i(c, [2,2,4,4]), [2,2,4,4])),\n                        assign(u4, vushufflehi_8x16i(vushufflelo_8x16i(u3, [2,1,4,3]), [2,1,4,3])),\n                        assign(y, add(u1, u4))))),\n        # SSSE3 and higher\n            (y,x,c) -> let(\n\t\tu1 := var.fresh_t(\"U\", self.t), u2 := var.fresh_t(\"U\", self.t),\n                u3 := var.fresh_t(\"U\", self.t), u4 := var.fresh_t(\"U\", self.t),\n                decl([u1, u2, u3, u4], chain(\n                        assign(u1, x * vushuffle_8x16i(c, TVect(T_Int(8), 16).value([0,1,0,1, 4,5,4,5, 8,9,8,9, 12,13,12,13]))),\n                        assign(u2, chs_8x16i(x, TVect(T_Int(16), 8).value([1,-1,1,-1,1,-1,1,-1]))),\n                        assign(u3, u2 * vushuffle_8x16i(c, TVect(T_Int(8), 16).value([2,3,2,3, 6,7,6,7, 10,11,10,11, 14,15,14,15]))),\n                        assign(u4, vushuffle_8x16i(u3, TVect(T_Int(8), 16).value([2,3,0,1, 6,7,4,5, 10,11,8,9, 14,15,12,13]))),\n                        assign(y,  u1 + u4))))\n    ),\n\n    swap_cx := (y, x, opts) -> assign(y, vushuffle_8x16i(x, TVect(T_Int(8), 16).value([2,1,4,3, 6,5,8,7, 10,9,12,11, 14,13,16,15]))),\n    RCVIxJ2 := (y, x, opts) -> assign(y, vushuffle_8x16i(x, TVect(T_Int(8), 16).value([4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11]))),\n\n    # computes the horizontal minimum of the vector and splats it\n    hmin := (self,y,x,opts) >> Cond(\n        # MMX and SSE can't do 8x16i\n        opts.vector.SIMD in [\"MMX\", \"SSE\"],\n            Error(\"SSE2 required for 8-way 16-bit integer\"),\n\n        opts.vector.SIMD in [\"SSE2\", \"SSE3\", \"SSSE3\"], let(\n\t    z := var.fresh_t(\"m\", self.t),\n\t    decl([z], chain(\n\t        assign(z, Cond(self.t.isSigned(), x, add(x, self.t.value(-128)))),\n\t        assign(z, min(z, vushufflelo_8x16i(vushufflehi_8x16i(z, [2,1,4,3]), [2,1,4,3]))),\n\t        assign(z, min(z, vushuffle_4x32i(z, [2,1,4,3]))),\n\t        assign(z, min(z, vushuffle_4x32i(z, [3,4,1,2]))),\n\t        assign(y, Cond(self.t.isSigned(), z, add(z, self.t.value(-128))))))),\n\t# else SSE4 - there is hmin instruction, need to put it here \n\tlet( z := var.fresh_t(\"m\", self.t),\n\t    decl([z], chain(\n\t        assign(z, min(x, vushufflelo_8x16i(vushufflehi_8x16i(x, [2,1,4,3]), [2,1,4,3]))),\n\t        assign(z, min(z, vushuffle_4x32i(z, [2,1,4,3]))),\n\t        assign(y, min(z, vushuffle_4x32i(z, [3,4,1,2]))))))\n    ),\n\n));\n\n#==============================================================================================\n\n_svload_16x8i_sv1 := (cnt) -> (\n\t(y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", y.t),\n\t      i := Ind(idiv(cnt, 2)),\n\t      c := [assign(u, vzero_8x16i())]\n\t           :: List( [1..IntDouble(cnt/2.0)], i->assign(u, vload1_8x16i(u, bin_or(x[2*i-1],  vec_shl(x[2*i],  1)), i-1)) )\n\t           :: When( cnt mod 2 = 0, [], [assign(u, vload1_8x16i(u, x[cnt]), idiv(cnt, 2))] ),\n              decl([u], chain(c, assign(y, u)))\n        )\n);\n\n_svstore_16x8i_sv1 := (cnt) -> (\n\t(y,x,opts) -> let(\n\t      u := var.fresh_t(\"U\", T_UInt(16)),\n\t      c := ConcatList( [1..IntDouble(cnt/2.0)], i -> \n\t               [ assign(u, vextract1_8x16i(x, i-1)),\n\t                 assign(y[2*i-1], u),\n\t                 assign(y[2*i  ], vec_shr(u, 1)) ] )\n\t           :: When( cnt mod 2 = 0, [], \n\t               [ assign(u, vextract1_8x16i(x, idiv(cnt,2))),\n\t                 assign(y[cnt], u) ]),\n              decl([u], chain(c))\n        )\n);\n\nClass(SSE_16x8i, SIMD_Intel, rec(\n    info := \"SSE2 16 x 8-bit int\",\n\n    # experimental -- parametized ISA, <el_t> is the type of each 8-bit slot in the vector\n    __call__ := (self, el_t) >> WithBases(self, rec(\n        t            := TVect(el_t, 16), \n\tisSigned     := el_t.isSigned(),\n\tisFloat      := IsRealT(el_t),\n\tisFixedPoint := IsFixedPtT(el_t),\n\tsplopts      := CopyFields(self.splopts, rec(XType := TPtr(el_t), YType := TPtr(el_t))),\n\tsvload       := self.svload_init(TVect(el_t, 16)),\n\tsvstore      := self.svstore_init(TVect(el_t, 16)),\n\tstorec       := self.storec_init(TVect(el_t, 16)),\n        operations   := ISAOps,\n\tprint        := self >> Print(self.__name__, \"(\", self.t.t, \")\"),\n\tid           := self >> self.__name__ :: \"_\" :: el_t.strId(),\n    )),\n\n    includes     := self >> [\"<include/omega8i.h>\"] :: self.intelCommonIncludes(), \n    active       := true,\n    isFixedPoint := true,\n    isFloat      := false,\n\n    isSigned            := true,\n    saturatedArithmetic := false,\n\n    v     := 16,\n    t     := TVect(TReal, 16),\n    ctype := \"__int8\",\n    instr := [vunpacklo_16x8i,  vunpackhi_16x8i,    vunpacklo2_16x8i, vunpackhi2_16x8i,\n              vunpacklo4_16x8i, vunpackhi4_16x8i,   vunpacklo8_16x8i, vunpackhi8_16x8i,\n              vushuffle4_16x8i, vushufflelo2_16x8i, vushufflehi2_16x8i, \n\t      vshuffle4_16x8i,  vshuffle8_16x8i],\n    bits     := 8,\n    fracbits := 6,\n    vrshift := \"_mm_srli_epi8\",\n    vlshift := \"_mm_slli_epi8\",\n    splopts := rec(customDataType := \"char_fp4\"),\n\n    # NOTE: missing .loadCont, .storeCont, .svstore\n\n    # keep the n lower scalars and zero the other ones\n    optional_mask :=  (c, n, opts) -> When(IsBound(opts.trueSVSemantics) and opts.trueSVSemantics and not(n=16),\n        let(f:=\"0xFF\", z:=\"0x0\", bin_and(c,vhex(List([1..16],x->When(x<=n,f,z))))),\n        c),\n\n    loadCont := (self, n, y, yofs, x, xofs, xofs_align, opts) >> let(\n\ta := _unwrap(xofs_align),\n\tnn := _unwrap(n),\n\tyy := vtref(self.t, y, yofs),\n\tassign(yy, self.optional_mask(vloadu_16x8i(x + xofs), n, opts))),\n\n#    ((y,x,addr) -> let(\n#        v1 := nth(nth(x, addr-align  ).toPtr(TVectDouble(8)), 0),\n#        v2 := nth(nth(x, addr-align+8).toPtr(TVectDouble(8)), 0),\n#        mask := x -> self.optional_mask(x, sv, opts),\n#        Cond(align=0,\n#                 assign(y, mask(v1)),\n#\t     _hasSSSE3(opts),\n#                 assign(y, mask(alignr_8x16i(v2, v1, align*2))),\n#\t     # else\n#                 assign(y, mask(bin_or(vec_shr(v1, align),\n#                                       vec_shl(v2, (8-align))))))\n#\t)),\n\n    # NOTE: rewrite using a method, and add missing.\n    svload_init := (vt) -> [\n\t[ _svload_16x8i_sv1(1),\n\t  _svload_16x8i_sv1(2),\n\t  _svload_16x8i_sv1(3),\n\t  _svload_16x8i_sv1(4),\n\t  _svload_16x8i_sv1(5),\n\t  _svload_16x8i_sv1(6),\n\t  _svload_16x8i_sv1(7),\n\t  _svload_16x8i_sv1(8),\n\t  _svload_16x8i_sv1(9),\n\t  _svload_16x8i_sv1(10),\n\t  _svload_16x8i_sv1(11),\n\t  _svload_16x8i_sv1(12),\n\t  _svload_16x8i_sv1(13),\n\t  _svload_16x8i_sv1(14),\n\t  _svload_16x8i_sv1(15),\n\t  _svload_16x8i_sv1(16)\n        ]\n    ],\n\n    svload := ~.svload_init(~.t),\n\n    svstore_init := (vt) -> [\n\t[ _svstore_16x8i_sv1(1),\n\t  _svstore_16x8i_sv1(2),\n\t  _svstore_16x8i_sv1(3),\n\t  _svstore_16x8i_sv1(4),\n\t  _svstore_16x8i_sv1(5),\n\t  _svstore_16x8i_sv1(6),\n\t  _svstore_16x8i_sv1(7),\n\t  _svstore_16x8i_sv1(8),\n\t  _svstore_16x8i_sv1(9),\n\t  _svstore_16x8i_sv1(10),\n\t  _svstore_16x8i_sv1(11),\n\t  _svstore_16x8i_sv1(12),\n\t  _svstore_16x8i_sv1(13),\n\t  _svstore_16x8i_sv1(14),\n\t  _svstore_16x8i_sv1(15),\n\t  _svstore_16x8i_sv1(16)\n        ]\n    ],\n\n    svstore := ~.svstore_init(~.t),\n\n    bin_shl1 := (y,x,opts) -> assign(y, vec_shl(x, 1)),\n    bin_shl2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],15), vec_shl(x[2],1))),\n    bin_shr1 := (y,x,opts) -> assign(y, vec_shr(x, 1)),\n    bin_shr2 := (y,x,opts) -> assign(y, bin_or(vec_shr(x[1],1), vec_shl(x[2],15))),\n\n    bin_shr  := (self, y, x, shift, opts) >> assign(y, bin_and( tcast(self.t, bin_shr(tcast(TVect(T_Int(16), 8), x), shift)), \n\t                                                        TVect(T_UInt(8), 16).value(idiv(255, 2^shift)))),\n\n    interleavedmask := (b,idx,x1,x2) -> chain(\n        assign(nth(tcast(TPtr(TSym(\"short int\")), b), 2*idx),   interleavedmasklo_16x8i(x1,x2)),\n        assign(nth(tcast(TPtr(TSym(\"short int\")), b), 2*idx+1), interleavedmaskhi_16x8i(x1,x2))),\n\n    average := (x1,x2) -> average_16x8i(x1,x2),\n\n    #splats the first slot of the vector across the full vector\n    dupload := (self, y, x) >> assign(y, vdup(x, self.v)),\n    # computes the horizontal minimum of the vector and splats it\n    hmin := (self,y,x,opts) >> let(\n        sh_t := TVect(T_Int(64), 2),\n\tz := var.fresh_t(\"m\", self.t),\n\tdecl([z], chain(\n\t    assign(z, min(vec_shr(x, 8), x)),\n\t    assign(z, min(vec_shr(z, 4), z)),\n            assign(z, min(vec_shr(z, 2), z)),\n            assign(z, min(vec_shr(z, 1), z)),\n\t    assign(z, vunpacklo_16x8i(z, z)),\n\t    assign(z, vushufflelo_8x16i(z, [1,1,1,1])),\n\t    assign(y, vunpacklo_2x64i(z, z))))\n    ),\n\n    # keep the n lower scalars and zero the other ones    \n    optional_mask :=  (c, n, opts) -> When(IsBound(opts.trueSVSemantics) and opts.trueSVSemantics and not(n=16),\n                          let(f:=\"0xFF\", z:=\"0x0\", bin_and(c,vhex(List([1..16],x->When(x<=n,f,z))))),\n                          c),\n    # load contiguous with unaligned loads\n    loadc := (self, sv, opts) >> ((y,x) -> assign(y, self.optional_mask(vloadu_16x8i(x.toPtr(self.t.t)), sv, opts))),\n\n    # Store contiguous unaligned\n    storec_init := (vt) -> [    \n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        #(y,x) -> assign(y, vextract2_16x8i(x, 0)),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        #(y,x) -> assign(nth(y.toPtr(TVect(vt.t, 4)),0), vextract4_16x8i(x)),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        #(y,x) -> vstore8_16x8i(y.toPtr(TVect(vt.t, 8)), x),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\", \"0x0\"]),\n        (y,x) -> vstoremsk_16x8i(y.toPtr(vt.t), x, [\"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0xFF\", \"0x0\"]),\n        (y,x) -> vstoreu_16x8i(y.toPtr(vt), x)\n    ],\n\n    storec := ~.storec_init(~.t),\n));\n\nSIMD_ISA_DB.addISA(SSE_2x64f);\nSIMD_ISA_DB.addISA(SSE_2x64i);\nSIMD_ISA_DB.addISA(SSE_2x32f);\nSIMD_ISA_DB.addISA(SSE_4x32f);\nSIMD_ISA_DB.addISA(SSE_4x32i);\nSIMD_ISA_DB.addISA(SSE_8x16i);\nSIMD_ISA_DB.addISA(SSE_16x8i);\n\n\n\n\n\n\n", "meta": {"hexsha": "0c5ca5cd1cc9002d719b7d119f2247147f2e7f45", "size": 55746, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/sse/isa.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/sse/isa.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/sse/isa.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 46.8847771236, "max_line_length": 180, "alphanum_fraction": 0.4961611595, "num_tokens": 20074, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3775406687981454, "lm_q2_score": 0.09009299396195183, "lm_q1q2_score": 0.034013769194422575}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nImport(simt);\n\nClass(FFTXCUDAOpts, FFTXOpts, simt.TitanVDefaults, rec(\n    tags := [],\n    operations := rec(Print := s -> Print(\"<FFTX CUDA options record>\")),    \n    max_threads := 1024\n));\n\ncudaOpts := function(arg)\n    local opts;\n    opts := Copy(FFTXCUDAOpts);\n    opts.breakdownRules.Circulant := [Circulant_PRDFT_FDataNT];\n    opts.breakdownRules.PRDFT := List([PRDFT1_Base1, PRDFT1_Base2, PRDFT1_CT, PRDFT1_PF, PRDFT_PD, PRDFT_Rader], _noT);\n    opts.breakdownRules.IPRDFT := List([ IPRDFT1_Base1, IPRDFT1_Base2, IPRDFT1_CT, IPRDFT_PD, IPRDFT_Rader ], _noT);\n    opts.breakdownRules.PRDFT3 := List([ PRDFT3_Base1, PRDFT3_Base2, PRDFT3_CT ], _noT);\n    return opts;  \n\n    return opts;\nend;\n\nDeclare(ParseOptsCUDA);\n\nClass(FFTXCUDADefaultConf, rec(\n    getOpts := (self, t) >> ParseOptsCUDA(self, t),\n    operations := rec(Print := s -> Print(\"<FFTX CUDA Default Configuration>\")),\n    useCUDA := true\n));\n\nClass(FFTXCUDADeviceDefaultConf, rec(\n    getOpts := (self, t) >> ParseOptsCUDA(self, t),\n    operations := rec(Print := s -> Print(\"<FFTX CUDA Device Default Configuration>\")),\n    useCUDADevice := true\n));\n\n\ncudaConf := rec(\n    defaultName := \"defaultCUDAConf\",\n    defaultOpts := (arg) >> FFTXCUDADefaultConf,\n    devFunc := true,\n    confHandler := cudaOpts \n);\n\nfftx.FFTXGlobals.registerConf(cudaConf);\n\ngetTargetOS := function()\n    local tgt;\n    \n    if LocalConfig.osinfo.isWindows() then\n        tgt := \"win-x64-cuda\";\n    elif LocalConfig.osinfo.isLinux() then\n        tgt := \"linux-cuda\";\n    elif LocalConfig.osinfo.isDarwin() then\n        tgt := \"linux-cuda\";    ## may work\n    fi;\n    return tgt;\nend;\n\n#--\nClass(FFTXCUDADeviceOpts, FFTXOpts, simt.TitanVDefaults, rec(\n    tags := [],\n    devFunc := true,\n    target := rec ( name := getTargetOS() ),\n    operations := rec(Print := s -> Print(\"<FFTX CUDA Device options record>\"))    \n));\n\ncudaDeviceOpts := function(arg) # specific to WarpX size 100...\n    local opts;\n    opts := Copy(FFTXCUDADeviceOpts);\n    opts.breakdownRules.Circulant := [Circulant_PRDFT_FDataNT];\n    opts.breakdownRules.PRDFT := List([PRDFT1_Base1, PRDFT1_Base2, CopyFields(PRDFT1_CT, \n            rec(allChildren := P ->Filtered(PRDFT1_CT.allChildren(P), i->When(P[1] = 100, Cols(i[1]) = 4, true)))), \n        PRDFT_PD], _noT);\n    opts.breakdownRules.IPRDFT := List([ IPRDFT1_Base1, IPRDFT1_Base2, IPRDFT1_CT, IPRDFT_PD ], _noT);\n    opts.breakdownRules.PRDFT3 := List([ PRDFT3_Base1, PRDFT3_Base2, PRDFT3_CT ], _noT);\n    opts.breakdownRules.DFT := [ DFT_Base, \n        CopyFields(DFT_CT, rec(children := nt ->Filtered(DFT_CT.children(nt), i->When(nt.params[1] = 100, Cols(i[1]) = 4, true)))), \n        DFT_PD ];\n    opts.breakdownRules.TTensorInd := [dsA_base, L_dsA_L_base, dsA_L_base, L_dsA_base];    \n    return opts;\nend;\n\n\ncudaDeviceConf := rec(\n    defaultName := \"defaultCUDADeviceConf\",\n    defaultOpts := (arg) >> FFTXCUDADeviceDefaultConf,\n    confHandler := cudaDeviceOpts \n);\n\nfftx.FFTXGlobals.registerConf(cudaDeviceConf);\n\n\n# this is a first experimental opts-deriving logic. This needs to be done extensible and properly\nParseOptsCUDA := function(conf, t)\n    local tt, _tt, _conf, _opts, _HPCSupportedSizesCUDA, _thold;\n    \n    # all dimensions need to be inthis array for the high perf MDDFT conf to kick in for now\n    # size 320 is problematic at this point and needs attention. Need support for 3 stages to work first\n\n    _HPCSupportedSizesCUDA := [80, 96, 100, 224, 320];\n    _thold := 16;\n    \n    if IsBound(conf.useCUDADevice) then \n        # detect real MD convolution\n        _tt := Collect(t, RCDiag)::Collect(t, MDPRDFT)::Collect(t, IMDPRDFT)::Collect(t, TTensorI);\n        if Length(_tt) = 4 then\n            _conf := FFTXGlobals.confWarpXCUDADevice();\n            _opts := FFTXGlobals.getOpts(_conf);        \n            return _opts;\n        fi;        \n\n        # detect batch of DFT/PRDFT/MDDFT/MDPRDFT\n        if ((Length(Collect(t, TTensorInd)) >= 1) or (Length(Collect(t, TTensorI)) >= 1)) and \n            ((Length(Collect(t, DFT)) = 1) or (Length(Collect(t, PRDFT)) = 1) or (Length(Collect(t, IPRDFT)) = 1) or\n              (Length(Collect(t, MDDFT)) >= 1) or (Length(Collect(t, MDPRDFT)) >= 1) or (Length(Collect(t, IMDPRDFT)) >= 1)) then\n            _conf := FFTXGlobals.confBatchFFTCUDADevice();\n            _opts := FFTXGlobals.getOpts(_conf);\n            return _opts;\n        fi;\n       \n        # detect 3D DFT\n        _tt := Collect(t, MDDFT)::Collect(t, MDPRDFT)::Collect(t, IMDPRDFT);\n        if Length(_tt) = 1 and Length(_tt[1].params[1]) = 3 then\n            _conf := FFTXGlobals.confFFTCUDADevice();\n            _opts := FFTXGlobals.getOpts(_conf);\n\n            # opts for high performance CUDA cuFFT\n            if Length(Filtered(_tt, i -> ObjId(i) = MDDFT)) > 0 and ForAll(_tt[1].params[1], i-> i in _HPCSupportedSizesCUDA) then\n                _opts.breakdownRules.MDDFT := [fftx.platforms.cuda.MDDFT_tSPL_Pease_SIMT];\n                _opts.breakdownRules.TTwiddle := [ TTwiddle_Tw1 ];\n                _opts.tags := [ASIMTKernelFlag(ASIMTGridDimX), ASIMTBlockDimY, ASIMTBlockDimX];\n                \n                _opts.globalUnrolling := 2*_thold + 1;\n\n                _opts.breakdownRules.TTensorI := [CopyFields(IxA_L_split, rec(switch := true)), fftx.platforms.cuda.L_IxA_SIMT]::_opts.breakdownRules.TTensorI;\n                _opts.breakdownRules.DFT := [CopyFields(DFT_tSPL_CT, rec(switch := true, \n                    filter := e-> When(e[1]*e[2] <= _thold^2, e[1] <= _thold and e[2] <= _thold, e[1] <= _thold and e[2] >= _thold)))]::_opts.breakdownRules.DFT;\n                \n                _opts.unparser.simt_synccluster := _opts.unparser.simt_syncblock;\n                _opts.postProcessSums := (s, opts) -> let(s1 := ApplyStrategy(s, [ MergedRuleSet(RulesFuncSimp, RulesSums, RulesSIMTFission) ], BUA, opts),\n                    FixUpCUDASigmaSPL_3Stage(s1, opts)); \n\n                _opts.operations.Print := s -> Print(\"<FFTX CUDA HPC MDDFT options record>\");\n\n            fi;\n            \n            return _opts;\n        fi;\n    \n        # promote with default conf rules\n        tt := _promote1(Copy(t));\n\n        if ObjId(tt) = TFCall then\n            _tt := tt.params[1];\n            # check for convolution\n            if (ObjId(_tt) in [MDRConv, MDRConvR]) or ((ObjId(_tt) = TTensorI) and (ObjId(_tt.params[1]) in [MDRConv, MDRConvR])) then \n                _conf := FFTXGlobals.confMDRConvCUDADevice();\n                _opts := FFTXGlobals.getOpts(_conf);\n                return _opts;\n            fi;\n            # check for Hockney. This is for N=130\n            if ObjId(_tt) = IOPrunedMDRConv  and _tt.params[1] = [130,130,130] then\n                _conf := FFTXGlobals.confHockneyMlcCUDADevice();\n                _opts := FFTXGlobals.getOpts(_conf);\n                return _opts;\n            fi;\n            # check for general Hockney. \n            if ObjId(_tt) = IOPrunedMDRConv then\n                _conf := FFTXGlobals.confMDRConvCUDADevice();\n                _opts := FFTXGlobals.getOpts(_conf);\n                _opts.tags := [ASIMTKernelFlag(ASIMTGridDimY), ASIMTGridDimX, ASIMTBlockDimZ];\n                return _opts;\n            fi;\n        fi;\n\n        # check for WarpX\n        _conf := FFTXGlobals.confWarpXCUDADevice();\n        _opts := FFTXGlobals.getOpts(_conf);\n        tt := _opts.preProcess(Copy(t));\n        if ObjId(tt) = TFCall and ObjId(tt.params[1]) = TCompose then\n            _tt := tt.params[1].params[1];\n            # detect promoted WarpX\n            if IsList(_tt) and Length(_tt) = 3 and List(_tt, ObjId) = [ TNoDiagPullinRight, TRC, TNoDiagPullinLeft ] then\n                return _opts;\n            fi;\n        fi;\n        # we are doing nothing special\n        return FFTXGlobals.getOpts(conf); \n    fi;\n    if IsBound(conf.useCUDA) then \n        return FFTXGlobals.getOpts(conf); \n    fi;\n    \n    # Here we have to handle GPU configs\n    Error(\"Don't know how to derive opts!\\n\");\nend; \n", "meta": {"hexsha": "101c32f3cf6f675817471db5fa98be4e04236d5d", "size": 8060, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/cuda/opts.gi", "max_stars_repo_name": "broderickpt/spiral-package-fftx", "max_stars_repo_head_hexsha": "f6c0faea418e5f876ab695a1f7bbc88ed35c88cc", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "platforms/cuda/opts.gi", "max_issues_repo_name": "broderickpt/spiral-package-fftx", "max_issues_repo_head_hexsha": "f6c0faea418e5f876ab695a1f7bbc88ed35c88cc", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "platforms/cuda/opts.gi", "max_forks_repo_name": "broderickpt/spiral-package-fftx", "max_forks_repo_head_hexsha": "f6c0faea418e5f876ab695a1f7bbc88ed35c88cc", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 40.3, "max_line_length": 161, "alphanum_fraction": 0.6135235732, "num_tokens": 2427, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46879061178313897, "lm_q2_score": 0.07159119845413339, "lm_q1q2_score": 0.033561281721601305}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Here we define shorter print functions for common constructs.\n# Loading this file will cause more compact printing of formulas,\n# but the output can not be pasted back into GAP.\n#\n\nImport(formgen, code);\n\nDiag.print := (s,i,is) >> Print(\"D\");\nBlk.print := (s,i,is) >> Print(\"B\");\n\nGath._sym := true;\nScat._sym := true;\nDiag._sym := true;\nBlk._sym := true;\n\nHideRTWrap := function()\n   RTWrap._origprint := RTWrap.print;\n   RTWrap.print := (self,i,is) >> Print(self.rt.node);\nend;\n\nShowRTWrap := function()\n   if IsBound(RTWrap._origprint)\n       then RTWrap.print := RTWrap._origprint;\n   fi;\nend;\n", "meta": {"hexsha": "5af23e345445563f5d7937dffcff6f680878ac23", "size": 683, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/veryshortprint.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/veryshortprint.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/veryshortprint.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 22.0322580645, "max_line_length": 65, "alphanum_fraction": 0.6808199122, "num_tokens": 191, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4532618480153861, "lm_q2_score": 0.07055960351653444, "lm_q1q2_score": 0.03198197628513733}}
{"text": "#In GAP strings are lists of characters. An affectation simply copy references\na := \"more\";\nb := a;\nb{[1..4]} := \"less\";\na;\n# \"less\"\n\n# Here is a true copy\na := \"more\";\nb := ShallowCopy(a);\nb{[1..4]} := \"less\";\na;\n# \"more\"\n", "meta": {"hexsha": "876fab4fc58d172b8172b0c5d8f9a0cd8dea9b00", "size": 223, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Copy-a-string/GAP/copy-a-string.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Copy-a-string/GAP/copy-a-string.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Copy-a-string/GAP/copy-a-string.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 15.9285714286, "max_line_length": 78, "alphanum_fraction": 0.5784753363, "num_tokens": 78, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.5, "lm_q2_score": 0.06278920640484009, "lm_q1q2_score": 0.031394603202420046}}
{"text": "# At top level, global variables are declared when they are assigned, so one only writes\nglobal_var := 1;\n\n# In a function, local variables are declared like this\nfunc := function(n)\n    local a;\n    a := n*n;\n    return n + a;\nend;\n\n# One can test whether a variable is assigned\nIsBound(global_var);\n# true;\n\n# And destroy a variable\nUnbind(global_var);\n\n# This works with list elements too\nu := [11, 12, , 14];\nIsBound(u[4]);\n# true\nIsBound(u[3]);\n# false\nUnbind(u[4]);\n", "meta": {"hexsha": "0be16d9f6d8ff0241f1f594228595cfef3dea9fc", "size": 472, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Variables/GAP/variables.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Variables/GAP/variables.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Variables/GAP/variables.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 18.88, "max_line_length": 88, "alphanum_fraction": 0.6779661017, "num_tokens": 133, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.34510527095787247, "lm_q2_score": 0.09009300129119968, "lm_q1q2_score": 0.03109156962200742}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F VTCast(<n>, <to_type>, <from_type>, <v>)\n#F\nClass(VTCast, TCast, rec( # TCast is a symbol. So all parameters go into .params \n    abbrevs := [],\n    def := (n, to_type, from_type, v) -> Perm((), n)\n));\n\n", "meta": {"hexsha": "ce0411376d658a60a93d977cc0126a256c962f82", "size": 289, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/sigmaspl/vtcast.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/sigmaspl/vtcast.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/sigmaspl/vtcast.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 22.2307692308, "max_line_length": 81, "alphanum_fraction": 0.6262975779, "num_tokens": 96, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.48438008427698437, "lm_q2_score": 0.06278921473524327, "lm_q1q2_score": 0.0304138451251428}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(SymSPL, BaseContainer, SumsBase, rec(\n    isBlock:=true,\n    transpose := self >> self,\n    rng:=self>>self._children[1].rng(),\n    dmn:=self>>self._children[1].dmn(),\n    vcost := self >> self._children[1].vcost()\n));\n", "meta": {"hexsha": "19d64e88868fed52f61bd8ef1fcc75ab3dd5b095", "size": 308, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/common/sigmaspl.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/common/sigmaspl.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/common/sigmaspl.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 23.6923076923, "max_line_length": 53, "alphanum_fraction": 0.6525974026, "num_tokens": 95, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.42250463481418826, "lm_q2_score": 0.07055960351653445, "lm_q1q2_score": 0.0298117595163873}}
{"text": "#############################################################################\n####\n##\n#A  anupq.gi                    ANUPQ package                  Eamonn O'Brien\n#A                                                             & Frank Celler\n##\n#Y  Copyright 1992-1994,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany\n#Y  Copyright 1992-1994,  School of Mathematical Sciences, ANU,     Australia\n##\n\n#############################################################################\n##\n#F  ANUPQDirectoryTemporary( <dir> ) . . . . .  redefine ANUPQ temp directory\n##\n##  calls the UNIX command `mkdir' to create <dir>, which must be  a  string,\n##  and if successful a directory  object  for  <dir>  is  both  assigned  to\n##  `ANUPQData.tmpdir' and returned. The field  `ANUPQData.outfile'  is  also\n##  set to be a file in `ANUPQData.tmpdir', and on exit from {\\GAP} <dir>  is\n##  removed.\n##\nInstallGlobalFunction(ANUPQDirectoryTemporary, function(dir)\nlocal created;\n\n  # check arguments\n  if not IsString(dir) then\n    Error(\n      \"usage: ANUPQDirectoryTemporary( <dir> ) : <dir> must be a string.\\n\");\n  fi; \n\n  # create temporary directory\n  CreateDir(dir);\n  if not IsDirectoryPath(dir) then\n    return fail;\n  fi;\n\n  Add( GAPInfo.DirectoriesTemporary, dir );\n  ANUPQData.tmpdir  := Directory(dir);\n  ANUPQData.outfile := Filename(ANUPQData.tmpdir, \"PQ_OUTPUT\");\n  return ANUPQData.tmpdir;\nend);\n\n#############################################################################\n##\n#F  ANUPQerrorPq( <param> ) . . . . . . . . . . . . . . . . . report an error\n##\nInstallGlobalFunction( ANUPQerrorPq, function( param )\n    Error(\n    \"Valid Options:\\n\",\n    \"    \\\"ClassBound\\\", <bound>\\n\",\n    \"    \\\"Prime\\\", <prime>\\n\",\n    \"    \\\"Exponent\\\", <exponent>\\n\",\n    \"    \\\"Metabelian\\\"\\n\",\n    \"    \\\"OutputLevel\\\", <level>\\n\",\n    \"    \\\"Verbose\\\"\\n\",\n    \"    \\\"SetupFile\\\", <file>\\n\",\n    \"    \\\"PqWorkspace\\\", <workspace>\\n\",\n    \"Illegal Parameter: \\\"\", param, \"\\\"\" );\nend );\n\n#############################################################################\n##\n#F  ANUPQextractPqArgs( <args> )  . . . . . . . . . . . . . extract arguments\n##\nInstallGlobalFunction( ANUPQextractPqArgs, function( args )\n    local   CR,  i,  act,  match;\n\n    # allow to give only a prefix\n    match := function( g, w )\n    \treturn 1 < Length(g) \n               and Length(g) <= Length(w) \n               and w{[1..Length(g)]} = g;\n    end;\n\n    # extract arguments\n    CR := rec();\n    i  := 2;\n    while i <= Length(args)  do\n        act := args[i];\n        if not IsString( act ) then ANUPQerrorPq( act ); fi;\n\n    \t# \"ClassBound\", <class>\n        if match( act, \"ClassBound\" ) then\n            i := i + 1;\n            CR.ClassBound := args[i];\n\n    \t# \"Prime\", <prime>\n        elif match( act, \"Prime\" )  then\n            i := i + 1;\n            CR.Prime := args[i];\n\n    \t# \"Exponent\", <exp>\n        elif match( act, \"Exponent\" )  then\n            i := i + 1;\n            CR.Exponent := args[i];\n\n        # \"Metabelian\"\n        elif match( act, \"Metabelian\" ) then\n            CR.Metabelian := true;\n\n    \t# \"Output\", <level>\n        elif match( act, \"OutputLevel\" )  then\n            i := i + 1;\n            CR.OutputLevel := args[i];\n    \t    CR.Verbose     := true;\n\n    \t# \"SetupFile\", <file>\n        elif match( act, \"SetupFile\" )  then\n    \t    i := i + 1;\n            CR.SetupFile := args[i];\n\n    \t# \"PqWorkspace\", <workspace>\n        elif match( act, \"PqWorkspace\" )  then\n    \t    i := i + 1;\n            CR.PqWorkspace := args[i];\n\n    \t# \"Verbose\"\n        elif match( act, \"Verbose\" ) then\n            CR.Verbose := true;\n\n    \t# signal an error\n    \telse\n            ANUPQerrorPq( act );\n\n    \tfi; \n    \ti := i + 1; \n    od;\n    return CR;\n\nend );\n\n#############################################################################\n##\n#V  ANUPQGlobalVariables\n##\nInstallValue( ANUPQGlobalVariables, \n              [ \"F\",          #  a free group\n                \"MapImages\"   #  images of the generators in G\n                ] );\n\n#############################################################################\n##\n#F  ANUPQReadOutput . . . . read pq output without affecting global variables\n##\nInstallGlobalFunction( ANUPQReadOutput, function( file )\n    local globalvars, var, result;\n\n    globalvars := [ \"ANUPQmagic\", \"ANUPQautos\", \"ANUPQgroups\" ];\n\n    for var in globalvars do\n        HideGlobalVariables( var );\n    od;\n\n    Read( file );\n\n    result := rec();\n\n    for var in globalvars do\n        if IsBoundGlobal( var ) then\n            result.(var) := ValueGlobal( var );\n        else\n            result.(var) := fail;\n        fi;\n    od;\n\n    for var in globalvars do\n        UnhideGlobalVariables( var );\n    od;\n    \n    return result;\nend );\n\n#############################################################################\n##\n#F  PqEpimorphism( <arg> : <options> ) . . . . .  epimorphism onto p-quotient\n##\nInstallGlobalFunction( PqEpimorphism, function( arg )\n    return PQ_EPI_OR_PCOVER(arg : PqEpiOrPCover := \"pQepi\");\nend );\n\n#############################################################################\n##\n#F  Pq( <arg> : <options> ) . . . . . . . . . . . . . . . . . . .  p-quotient\n##\nInstallGlobalFunction( Pq, function( arg )\n    return PQ_EPI_OR_PCOVER(arg : PqEpiOrPCover := \"pQuotient\");\nend );\n\n#############################################################################\n##\n#F  PqPCover( <arg> : <options> ) . . . . . .  p-covering group of p-quotient\n##\nInstallGlobalFunction( PqPCover, function( arg )\n    return PQ_EPI_OR_PCOVER(arg : PqEpiOrPCover := \"pCover\");\nend );\n\n#############################################################################\n##\n#F  PQ_GROUP_FROM_PCP(<datarec>,<out>) . extract gp from pq pcp file into GAP\n##\nInstallGlobalFunction( PQ_GROUP_FROM_PCP, function( datarec, out )\n    local gens;\n    HideGlobalVariables( \"F\", \"MapImages\" );\n    Read( datarec.outfname );\n    if out = \"pCover\" then\n      datarec.pCover := ValueGlobal( \"F\" );\n      IsPGroup( datarec.pCover );\n    else\n      if IsBound(datarec.pcgs) then\n        gens := datarec.pcgs;\n      else\n        gens := GeneratorsOfGroup( datarec.group );\n      fi;\n      datarec.pQepi := GroupHomomorphismByImagesNC( \n                           datarec.group,\n                           ValueGlobal( \"F\" ),\n                           gens,\n                           ValueGlobal( \"MapImages\" )\n                           );\n      SetIsSurjective( datarec.pQepi, true );\n      datarec.pQuotient := Image( datarec.pQepi );\n      IsPGroup( datarec.pQuotient );\n    fi;\n    UnhideGlobalVariables( \"F\", \"MapImages\" );\nend );\n\n#############################################################################\n##\n#F  TRIVIAL_PQ_GROUP(<datarec>, <out>) . . . extract gp when trivial into GAP\n##\nInstallGlobalFunction( TRIVIAL_PQ_GROUP, function( datarec, out )\nlocal Q;\n    Q := TrivialGroup( IsPcGroup );\n    if out = \"pCover\" then\n      datarec.pCover := Q;\n      IsPGroup( datarec.pCover );\n    else\n      datarec.pQepi := GroupHomomorphismByFunction( \n                           datarec.group, Q, g -> One(Q) );\n      SetIsSurjective( datarec.pQepi, true );\n      datarec.pQuotient := Image( datarec.pQepi );\n      IsPGroup( datarec.pQuotient );\n    fi;\nend );\n\n#############################################################################\n##\n#F  PQ_EPI_OR_PCOVER(<args>:<options>) .  p-quotient, its epi. or its p-cover\n##\nInstallGlobalFunction( PQ_EPI_OR_PCOVER, function( args )\n    local   out, datarec, AtClass, trivial;\n\n    out := ValueOption(\"PqEpiOrPCover\");\n    datarec := ANUPQ_ARG_CHK(\"Pq\", args);\n    datarec.filter := [\"Output file in\", \"Group presentation\"];\n    VALUE_PQ_OPTION(\"Identities\", [], datarec);\n    if datarec.calltype = \"GAP3compatible\" then\n        # ANUPQ_ARG_CHK calls PQ_EPI_OR_PCOVER itself in this case\n        # (so datarec.(out) has already been computed)\n        return datarec.(out);\n    fi;\n    trivial := IsEmpty( datarec.group!.GeneratorsOfMagmaWithInverses );\n    if trivial then\n        ; #the `pq' binary spits out nonsense if given a trivial pres'n\n    elif datarec.calltype = \"interactive\" and \n         ( IsBound(datarec.pQuotient) or IsBound(datarec.pCover) ) then\n        AtClass := function()\n          return IsBound(datarec.complete) and datarec.complete or\n                 IsBound(datarec.class) and datarec.class = datarec.ClassBound;\n        end;\n\n        if IsBound(datarec.pcoverclass) and \n           datarec.pcoverclass = datarec.class and not AtClass() then\n            # ``reduce'' the p-cover to a p-class\n            PQ_FINISH_NEXT_CLASS( datarec );\n        fi;\n        while not AtClass() do\n            PQ_NEXT_CLASS( datarec );\n        od;\n        # the following is not executed if the while-loop is \n        # executed at least once\n        if IsBound( datarec.(out) ) then\n            return datarec.(out); # it had already been computed\n        fi;\n    else\n        PQ_PC_PRESENTATION(datarec, \"pQ\");\n        if datarec.class < Minimum(63, datarec.ClassBound) then\n            datarec.complete := true;\n        fi;\n    fi;\n\n    trivial := trivial or IsEmpty(datarec.ngens) or datarec.ngens[1] = 0;\n    if not trivial then\n        if out = \"pCover\" then\n          PQ_P_COVER( datarec );\n        fi;\n\n        PushOptions( rec(nonuser := true) );\n        PQ_WRITE_PC_PRESENTATION(datarec, datarec.outfname);\n        PopOptions();\n    fi;\n    \n    if datarec.calltype = \"non-interactive\" then\n        PQ_COMPLETE_NONINTERACTIVE_FUNC_CALL(datarec);\n        if IsBound( datarec.setupfile ) then\n          if trivial then\n            return fail;\n          fi;\n          return true;\n        fi;\n    fi;\n            \n    if trivial then\n        TRIVIAL_PQ_GROUP( datarec, out );\n    else\n        # read group and images from file\n        PQ_GROUP_FROM_PCP( datarec, out );\n    fi;\n    return datarec.(out);\nend );\n\n#############################################################################\n##\n#F  PqRecoverDefinitions( <G> ) . . . . . . . . . . . . . . . . . definitions\n##\n##  This function finds a definition for each generator of the p-group <G>.\n##  These definitions need not be the same as the ones used by pq.  But\n##  they serve the purpose of defining each generator as a commutator or\n##  power of earlier ones.  This is useful for extending an automorphism that\n##  is given on a set of minimal generators of <G>.\n##\nInstallGlobalFunction( PqRecoverDefinitions, function( G )\n    local   col,  gens,  definitions,  h,  g,  rhs,  gen;\n\n    col  := ElementsFamily( FamilyObj( G ) )!.rewritingSystem;\n    gens := GeneratorsOfRws( col );\n\n    definitions := [];\n\n    for h in [1..NumberGeneratorsOfRws( col )] do\n        rhs := GetPowerNC( col, h );\n        if Length( rhs ) = 1 then\n            gen := Position( gens, rhs );\n            if not IsBound( definitions[gen] ) then\n                definitions[gen] := h;\n            fi;\n        fi;\n        \n        for g in [1..h-1] do\n            rhs := GetConjugateNC( col, h, g );\n            if Length( rhs ) = 2 then\n                gen := SubSyllables( rhs, 2, 2 );\n                gen := Position( gens, gen );\n                if not IsBound( definitions[gen] ) then\n                    definitions[gen] := [h, g];\n                fi;\n            fi;\n        od;\n    od;\n    return definitions;\nend );\n\n#############################################################################\n##\n#F  PqAutomorphism( <epi>, <autoimages> ) . . . . . . . . . . . . definitions\n##\n##  Take an automorphism of the preimage and produce the induced automorphism\n##  of the image of the epimorphism.\n##\nInstallGlobalFunction( PqAutomorphism, function( epi, autoimages )\n    local   G,  p,  gens,  definitions,  d,  epimages,  i,  pos,  def,  \n            phi;\n\n    G      := Image( epi );\n    p      := PrimePGroup( G );\n    gens   := GeneratorsOfGroup( G );\n    \n    autoimages := List( autoimages, im->Image( epi, im ) );\n\n    ##  Get a definition for each generator.\n    definitions := PqRecoverDefinitions( G );\n    d := Number( [1..Length(definitions)], \n                 i->not IsBound( definitions[i] ) );\n\n    ##  Find the images for the defining generators of G under the\n    ##  automorphism.  We have to be careful, as some of the generators for\n    ##  the source might be redundant as generators of G.\n    epimages := List( GeneratorsOfGroup(Source(epi)), g->Image(epi,g) );\n    for i in [1..d] do\n        ##  Find G.i ...\n        pos := Position( epimages, G.(i) );\n        if pos = fail then \n            Error( \"generators \", i, \"not image of a generators\" );\n        fi;\n        ##  ... and set its image.\n        definitions[i] := autoimages[pos];\n    od;\n        \n    ##  Replace each definition by its image under the automorphism.\n    for i in [d+1..Length(definitions)] do\n        def := definitions[i];\n        if IsInt( def ) then\n            definitions[i] := definitions[ def ]^p;\n        else\n            definitions[i] := Comm( definitions[ def[1] ],\n                                    definitions[ def[2] ] );\n        fi;\n    od;\n            \n    phi := GroupHomomorphismByImages( G, G, gens, definitions );\n    SetIsBijective( phi, true );\n\n    return phi;\nend );\n\n#############################################################################\n##\n#F  PqLeftNormComm( <words> ) . . . . . . . . . . . . .  left norm commutator\n##\n##  returns for a list <words> of words in the generators of a group the left\n##  norm commutator of <words>, e.g.~if <w1>, <w2>, <w3>  are  words  in  the\n##  generators of some free or fp group then  `PqLeftNormComm(  [<w1>,  <w2>,\n##  <w3>] );' is equivalent to `Comm( Comm( <w1>, <w2> ), <w3> );'. Actually,\n##  the only restrictions on <words> are that <words> must constitute a  list\n##  of group elements of the  same  group  (so  a  list  of  permutations  is\n##  allowed, for example) and that <words> must contain at least *two* words.\n##\nInstallGlobalFunction( PqLeftNormComm, function( words )\nlocal fam, comm, word;\n  if not IsList(words) or 2 > Length(words) or \n     not ForAll(words, IsMultiplicativeElementWithInverse) then\n    Error( \"<words> should be a list of at least 2 group elements\\n\" );\n  else\n    fam := FamilyObj(words[1]);\n    if not ForAll(words, w -> IsIdenticalObj(FamilyObj(w), fam)) then\n      Error( \"<words> should belong to the same group\\n\" );\n    fi;\n  fi;\n  comm := words[1];\n  for word in words{[2 .. Length(words)]} do\n    comm := Comm(comm, word);\n  od;\n  return comm;\nend );\n\n#############################################################################\n##\n#F  PqGAPRelators( <group>, <rels> ) . . . . . . . . pq relators as GAP words\n##\n##  returns a list of words that {\\GAP} understands, given a list  <rels>  of\n##  strings in the string representations of the generators of the  fp  group\n##  <group> prepared as a list of relators for the `pq' program.\n##\n##  *Note:*\n##  The `pq' program does not  use  `/'  to  indicate  multiplication  by  an\n##  inverse and uses square brackets to represent (left normed)  commutators.\n##  Also, even though the `pq' program accepts  relations,  all  elements  of\n##  <rels> *must* be in relator form, i.e.~a relation of form `<w1>  =  <w2>'\n##  must be written as `<w1>*(<w2>)^-1'.\n##\n##  Here is an example:\n##\n##  \\beginexample\n##  gap> F := FreeGroup(\"a\", \"b\");\n##  gap> PqGAPRelators(F, [ \"a*b^2\", \"[a,b]^2*a\", \"([a,b,a,b,b]*a*b)^2*a\" ]);\n##  [ a*b^2, a^-1*b^-1*a*b*a^-1*b^-1*a*b*a, b^-1*a^-1*b^-1*a^-1*b*a*b^-1*a*b*a^\n##      -1*b*a^-1*b^-1*a*b*a*b^-1*a^-1*b^-1*a^-1*b*a*b^-1*a*b^-1*a^-1*b*a^-1*b^\n##      -1*a*b*a*b*a^-1*b*a*b^-1*a*b*a^-1*b*a^-1*b^-1*a*b*a*b^-1*a^-1*b^-1*a^\n##      -1*b*a*b^-1*a*b^-1*a^-1*b*a^-1*b^-1*a*b*a*b^2*a*b*a ]\n##  \\endexample\n##\nInstallGlobalFunction( PqGAPRelators, function( group, rels )\nlocal gens, relgens, diff, g;\n  if not( IsFpGroup(group) ) then\n    Error(\"<group> must be an fp group\\n\");\n  fi;\n  gens := List( FreeGeneratorsOfFpGroup(group), String );\n  if not ForAll(rels, rel -> Position(rel, '/') = fail) then\n    Error( \"pq binary does not understand `/' in relators\\n\" );\n  fi;\n  relgens := Set( Concatenation( \n                      List( rels, rel -> Filtered(\n                                             SplitString(rel, \"\", \"*[]()^, \"),\n                                             str -> Int(str) = fail) ) ) );\n  diff := Difference(relgens, gens);\n  if not IsEmpty(diff) then\n    Error( \"generators: \", diff, \n           \"\\nare not among the generators of the group supplied\\n\" );\n  fi;\n  CallFuncList(HideGlobalVariables, gens);\n  for g in FreeGeneratorsOfFpGroup(group) do\n    ASS_GVAR(String(g), g);\n  od;\n  rels := List( rels, rel -> EvalString(\n                                 ReplacedString(\n                                     ReplacedString(rel, \"]\", \"])\"),\n                                     \"[\", \"PqLeftNormComm([\"\n                                     ) ) );\n  CallFuncList(UnhideGlobalVariables, gens);\n  return rels;\nend );\n\n#############################################################################\n##\n#F  PqParseWord( <F>, <word> ) . . . . . . . . . . . . parse word through GAP\n#F  PqParseWord( <n>, <word> )\n##\n##  parse <word> through {\\GAP}, where <word> is a string representing a word\n##  in the generators of <F> (the first form  of  `PqParseWord')  or  <n>  pc\n##  generators `x1,...,x<n>'. `PqParseWord' is provided as a  rough-and-ready\n##  check of <word> for syntax errors. A syntax error will cause the entering\n##  of a `break'-loop,  in  which  the  error  message  may  or  may  not  be\n##  meaningful (depending on whether the syntax  error  gets  caught  at  the\n##  {\\GAP} or kernel level).\n##\n##  *Note:*\n##  The reason the generators *must* be `x1,...,x<n>' in the second  form  of\n##  `PqParseWord' is that these are the pc generator names used by  the  `pq'\n##  program (as distinct from the generator names for the group  provided  by\n##  the user to a function like `Pq' that invokes the `pq' program).\n##\nInstallGlobalFunction( PqParseWord, function( n, word )\nlocal ParseOnBreak, ParseOnBreakMessage, NormalOnBreak, NormalOnBreakMessage,\n      parts, gens;\n\n  if IsGroup(n) or\n     Position(word, '[') <> fail or Position(word, '(') <> fail then\n    #pass word through GAP's parser to see if it's ok\n      \n    NormalOnBreak := OnBreak;\n    ParseOnBreak := function()\n      Where(0);\n      OnBreak := NormalOnBreak;\n    end;\n    OnBreak := ParseOnBreak;\n\n    if IsFunction(OnBreakMessage) then\n      NormalOnBreakMessage := OnBreakMessage;\n      ParseOnBreakMessage := function()\n        Print( \" syntax error in: \", word, \"\\n\" );\n        Print( \" you can type: 'quit;' to quit to outer loop.\\n\" );\n        OnBreakMessage := NormalOnBreakMessage;\n      end;\n      OnBreakMessage := ParseOnBreakMessage;\n    fi;\n\n    if IsGroup(n) then\n      PqGAPRelators(n, [ word ]);\n    else\n      PqGAPRelators(FreeGroup(n, \"x\"), [ word ]);\n    fi;\n\n    OnBreak := NormalOnBreak;\n    if IsFunction(OnBreakMessage) then\n      OnBreakMessage := NormalOnBreakMessage;\n    fi;\n    \n  else\n    parts := List( SplitString(word, \"*\"), part -> SplitString(part, \"^\") );\n    if ForAny( parts, part -> 2 < Length(part) or\n                              2 = Length(part) and not IsInt( Int(part[2]) ) )\n       then\n      Error( \"detected invalid exponent in argument <word>: \", word, \"\\n\");\n    fi;\n    if ForAny( parts, part -> IsEmpty( part[1] ) or part[1][1] <> 'x' ) then\n      Error( \"generators in argument <word> must all be of form:\\n\",\n             \"`x<i>' for some integer <i>\\n\" );\n    fi;\n    gens := List( parts, part -> Int( part[1]{[2 .. Length(part[1])]} ) );\n    if not ForAll(gens, gen -> IsPosInt(gen) and gen <= n) then\n      Error( \"generators in argument <word> must be in the range: \",\n             \"x1,...,x\", n, \"\\n\" );\n    fi;\n  fi;\n  return true;\nend );\n\n#############################################################################\n##\n#F  PQ_EVALUATE( <string> ) . . . . . . . . . evaluate a string emulating GAP\n##\n##  For each substring of the string <string> that is a statement (i.e.  ends\n##  in a `;'), `PQ_EVALUATE( <string> )' evaluates it in the same way  {\\GAP}\n##  would. If the substring is further followed by  a  `;'  (i.e.  there  was\n##  `;;'), this is an indication that the statement would produce no  output;\n##  otherwise the output that the user would normally see if  she  typed  the\n##  statement interactively is displayed.\n##\nInstallGlobalFunction(PQ_EVALUATE, function(string)\nlocal from, pos, statement, parts, var;\n  from := 0;\n  pos := Position(string, ';', from);\n  while pos <> fail do\n    statement := string{[from + 1..pos]};\n    statement := ReplacedString(statement,\" last \",\" ANUPQData.example.last \");\n    if pos < Length(string) and string[pos + 1] = ';' then\n      Read( InputTextString(statement) );\n      from := pos + 1;\n    else\n      parts := SplitString(statement, \"\", \" \\n\");\n      if 1 < Length(parts) and parts[2] = \":=\" then\n        Read( InputTextString(statement) );\n        Read( InputTextString( \n                  Concatenation( \"View(\", parts[1], \"); Print(\\\"\\\\n\\\");\" ) ) );\n        ANUPQData.example.last := parts[1];\n      else\n        var := EvalString(statement);\n        View( var );\n        Print( \"\\n\" );\n        ANUPQData.example.last := var;\n      fi;\n      from := pos;\n    fi;\n    pos := Position(string, ';', from);\n  od;\nend );\n\n#############################################################################\n##\n#F  PqExample() . . . . . . . . . . execute a pq example or display the index\n#F  PqExample( <example>[, PqStart][, Display] )\n#F  PqExample( <example>[, PqStart][, <filename>] )\n##\n##  With no arguments,  or  with  single  argument  `\"index\"',  or  a  string\n##  <example> that is not the name of a file in the `examples' directory,  an\n##  index of available examples is displayed.\n##\n##  With just the one argument <example> that is the name of a  file  in  the\n##  `examples' directory, the example contained in that file is  executed  in\n##  its simplest form. Some examples accept options  which  you  may  use  to\n##  modify some of the options used in the commands of the example.  To  find\n##  out which options an example accepts,  use  one  of  the  mechanisms  for\n##  displaying the example described below.\n##\n##  Some examples have both non-interactive and interactive forms; those that\n##  are non-interactive only have a name ending  in  `-ni';  those  that  are\n##  interactive only have a name ending in `-i'; examples with  names  ending\n##  in  `.g'  also  have  only  one  form;  all  other  examples  have   both\n##  non-interactive and interactive forms and for these giving  `PqStart'  as\n##  second argument invokes `PqStart' initially  and  makes  the  appropriate\n##  adjustments  so  that  the  example  is  executed  or   displayed   using\n##  interactive functions.\n##\n##  If `PqExample' is called with last (second or third)  argument  `Display'\n##  then the example  is  displayed  without  being  executed.  If  the  last\n##  argument is a non-empty  string  <filename>  then  the  example  is  also\n##  displayed without being executed but is also written to a file with  that\n##  name. Passing an empty string as last argument has  the  same  effect  as\n##  passing `Display'.\n##\n##  *Note:*\n##  The  variables  used  in  `PqExample'  are  local  to  the   running   of\n##  `PqExample', so there's no  danger  of  having  some  of  your  variables\n##  over-written. However, they are not  completely  lost  either.  They  are\n##  saved to a record `ANUPQData.examples.vars', i.e.~if `F'  is  a  variable\n##  used in the example then you will be able to access it after  `PqExample'\n##  has finished as `ANUPQData.examples.vars.F'.\n##\nInstallGlobalFunction(PqExample, function(arg)\nlocal name, file, instream, line, input, doPqStart, vars, var, printonly,\n      filename, DoAltAction, GetNextLine, PrintLine, action, datarec, optname,\n      linewidth, sizescreen, CheckForCompoundKeywords, hasFunctionExpr, parts,\n      iscompoundStatement, compoundDepth;\n\n  sizescreen := SizeScreen();\n  if sizescreen[1] < 80 then\n    SizeScreen([80, sizescreen[2]]);\n    linewidth := 80;\n  else\n    linewidth := sizescreen[1];\n  fi;\n\n  if IsEmpty(arg) then\n    name := \"index\";\n  else\n    name := arg[1];\n  fi;\n\n  if name = \"README\" then\n    file := fail;\n  else\n    file := Filename(DirectoriesPackageLibrary( \"anupq\", \"examples\"), name);\n  fi;\n  if file = fail then\n    Info(InfoANUPQ + InfoWarning, 1,\n         \"Sorry! There is no ANUPQ example with name `\", name, \"'\",\n         \" ... displaying index.\");\n    name := \"index\";\n    file := Filename(DirectoriesPackageLibrary( \"anupq\", \"examples\"), name);\n  fi;\n\n  if name <> \"index\" then\n    doPqStart := false;\n    if Length(arg) > 1 then\n      # At this point the name of the variable <printonly> doesn't make\n      # sense; however, if the value assigned to <printonly> is `Display'\n      # or an empty string then we ``print only'' and if it is a non-empty\n      # string then it is assumed to be a filename and we `LogTo' that filename.\n      printonly := arg[Minimum(3, Length(arg))];\n      if arg[2] = PqStart then\n        if 2 < Length(name) and \n           name{[Length(name) - 1 .. Length(name)]} in [\"-i\", \"ni\", \".g\"] then\n          Error( \"example does not have a (different) interactive form\\n\" );\n        fi;\n        doPqStart := true;\n      fi;\n    else\n      printonly := false;\n    fi;\n\n    DoAltAction := function()\n      if doPqStart then\n        if action[2] = \"do\" then\n          # uncomment line\n          line := line{[2..Length(line)]};\n        else\n          # replace a variable with a proc id\n          line := ReplacedString( line, action[5], action[3] ); \n        fi;\n      fi;\n    end;\n\n    if printonly = Display or IsString(printonly) then\n      GetNextLine := function()\n        local from, to;\n        line := ReadLine(instream);\n        if line = fail then\n          return;\n        elif IsBound(action) then\n          action := SplitString(action, \"\", \"# <>\\n\");\n          DoAltAction();\n          Unbind(action);\n        elif 3 < Length(line) and line{[1..4]} = \"#alt\" then\n          # only \"#alt\" actions recognised\n          action := line;\n        elif IsMatchingSublist(line, \"#comment:\") then\n          line := ReplacedString(line, \" supplying\", \"\");\n          from := Position(line, ' ');\n          to   := Position(line, '<', from);\n          Info(InfoANUPQ, 1, \n               \"In the next command, you may\", line{[from .. to - 1]});\n          from := to + 1;\n          to   := Position(line, '>') - 1;\n          Info(InfoANUPQ, 1, \"supplying to `PqExample' the option: `\", \n                             line{[from .. to]}, \"'\");\n        fi;\n      end;\n\n      if IsString(printonly) and printonly <> \"\" then\n        filename := printonly;\n        LogTo( filename ); #Make sure it's empty and writable\n      fi;\n      PrintLine := function()\n        if IsMatchingSublist(line, \"##\") then \n          line := line{[2..Length(line)]};\n        elif line[1] = '#' then\n          return;\n        fi;\n        Print( ReplacedString(line, \";;\", \";\") );\n      end;\n      printonly := true; #now the name of the variable makes sense\n    else\n      printonly := false;\n      ANUPQData.example := rec(options := rec());\n      datarec := ANUPQData.example.options;\n\n      CheckForCompoundKeywords := function()\n        local compoundkeywords;\n        compoundkeywords := Filtered( SplitString(line, \"\", \"( ;\\n\"),\n                                      w -> w in [\"do\", \"od\", \"if\", \"fi\",\n                                                 \"repeat\", \"until\",\n                                                 \"function\", \"end\"] );\n        hasFunctionExpr := \"function\" in compoundkeywords;\n        compoundDepth := compoundDepth \n                         + Number(compoundkeywords,\n                                  w -> w in [\"do\", \"if\", \"repeat\", \"function\"])\n                         - Number(compoundkeywords,\n                                  w -> w in [\"od\", \"fi\", \"until\",  \"end\"]);\n        return not IsEmpty(compoundkeywords);\n      end;\n\n      GetNextLine := function()\n        local from, to, bhsinput;\n        repeat\n          line := ReadLine(instream);\n          if line = fail then return; fi;\n        until not IsMatchingSublist(line, \"#comment:\");\n        if IsBound(action) then\n          action := SplitString(action, \"\", \"# <>\\n\");\n          if action[1] = \"alt:\" then\n            DoAltAction();\n          else\n            # action[2] = name of a possible option passed to `PqExample'\n            # action[4] = string to be replaced in <line> with the value\n            #             of the option if ok and set\n            optname := action[2];\n            if IsDigitChar(optname[ Length(optname) ]) then\n              optname := optname{[1..Length(optname) - 1]};\n            fi;\n            datarec.(action[2]) := ValueOption(action[2]);\n            if datarec.(action[2]) = fail then\n              Unbind( datarec.(action[2]) );\n            else\n              if not ANUPQoptionChecks.(optname)( datarec.(action[2]) ) then\n                Info(InfoANUPQ, 1, \"\\\"\", action[2], \"\\\" value must be a \",\n                                   ANUPQoptionTypes.(optname), \n                                   \": option ignored.\");\n                Unbind( datarec.(action[2]) );\n              else\n                if action[1] = \"add\" then\n                  line[1] := ' ';\n                fi;\n                if IsString( datarec.(action[2]) ) then\n                  line := ReplacedString( line, action[4],\n                                          Flat(['\"',datarec.(action[2]),'\"']) );\n                else\n                  line := ReplacedString( line, action[4], \n                                          String( datarec.(action[2]) ) );\n                fi;\n              fi;\n            fi;\n          fi;\n          Unbind(action);\n        elif IsMatchingSublist(line, \"##\") then\n          ; # do nothing\n        elif 3 < Length(line) and line{[1..4]} in [\"#sub\", \"#add\", \"#alt\"] then\n          action := line;\n        elif line[1] = '#' then\n          # execute instructions behind the scenes\n          bhsinput := \"\";\n          repeat\n            Append( bhsinput, \n                    ReplacedString(line{[2..Length(line)]},\n                                   \"datarec\",\n                                   \"ANUPQData.example.options\") );\n            line := ReadLine(instream);\n          until line[1] <> '#' or\n                (3 < Length(line) and line{[1..4]} in [\"#sub\", \"#add\", \"#com\"]);\n          Read( InputTextString(bhsinput) );\n        fi;\n      end;\n\n      PrintLine := function()\n        if IsMatchingSublist(line, \"##\") then \n          line := line{[2..Length(line)]};\n        elif line[1] = '#' then\n          return;\n        fi;\n        if input = \"\" then\n          Print(\"gap> \");\n        else\n          Print(\">    \");\n        fi;\n        Print( ReplacedString(line, \";;\", \";\") );\n      end;\n    fi;\n  fi;\n  \n  instream := InputTextFile(file);\n  if name <> \"index\" then\n    FLUSH_PQ_STREAM_UNTIL( instream, 10, 1, ReadLine,\n                           line -> IsMatchingSublist(line, \"#Example\") );\n    line := FLUSH_PQ_STREAM_UNTIL( instream, 1, 10, ReadLine,\n                                   line -> IsMatchingSublist(line, \"#vars:\") );\n    if Length(line) + 21 < linewidth then\n      Info(InfoANUPQ, 1, line{[Position(line, ' ')+1..Position(line, ';')-1]},\n                         \" are local to `PqExample'\");\n    else\n      #this assumes one has been careful to ensure the `#vars:' line is not\n      #longer than 72 characters.\n      Info(InfoANUPQ, 1, line{[Position(line, ' ')+1..Position(line, ';')-1]},\n                         \" are\");\n      Info(InfoANUPQ, 1, \"local to `PqExample'\");\n    fi;\n    vars := SplitString(line, \"\", \" ,;\\n\");\n    vars := vars{[2 .. Length(vars)]};\n    if not printonly then\n      CallFuncList(HideGlobalVariables, vars);\n    fi;\n    line := FLUSH_PQ_STREAM_UNTIL(instream, 1, 10, ReadLine,\n                                  line -> IsMatchingSublist(line, \"#options:\"));\n    input := \"\";\n    GetNextLine();\n    while line <> fail do\n      PrintLine();\n      if line[1] <> '#' then\n        if not printonly then\n          if input = \"\" then\n            compoundDepth := 0;\n            iscompoundStatement := CheckForCompoundKeywords();\n          elif iscompoundStatement and compoundDepth > 0 then\n            CheckForCompoundKeywords();\n          fi;\n          if line <> \"\\n\" then\n            Append(input, line);\n            if iscompoundStatement then\n              if compoundDepth = 0 and Position(input, ';') <> fail then\n                Read( InputTextString(input) );           \n                if hasFunctionExpr then\n                  parts := SplitString(input, \"\", \":= \\n\");\n                  Read( InputTextString( \n                            Concatenation( \n                                \"View(\", parts[1], \"); Print(\\\"\\\\n\\\");\" ) ) );\n                  ANUPQData.example.last := parts[1];\n                fi;\n                iscompoundStatement := false;\n                input := \"\";\n              fi;\n            elif Position(input, ';') <> fail then\n              PQ_EVALUATE(input);\n              input := \"\";\n            fi;\n          fi;\n        fi;\n      fi;\n      GetNextLine();\n    od;\n    if printonly then\n      if IsBound(filename) then\n        LogTo();\n      fi;\n    else\n      ANUPQData.example.vars := rec();\n      for var in Filtered(vars, ISBOUND_GLOBAL) do \n        ANUPQData.example.vars.(var) := VALUE_GLOBAL(var);\n      od;\n      Info(InfoANUPQ, 1, \"Variables used in `PqExample' are saved \",\n                         \"in `ANUPQData.example.vars'.\");\n      CallFuncList(UnhideGlobalVariables, vars);\n    fi;\n  else\n    FLUSH_PQ_STREAM_UNTIL(instream, 1, 10, ReadLine, line -> line = fail);\n  fi;\n  CloseStream(instream);\n  if linewidth <> sizescreen[1] then\n    SizeScreen( sizescreen ); # restore what was there before\n  fi;\nend);\n\n#############################################################################\n##\n#F  AllPqExamples() . . . . . . . . . .  list the names of all ANUPQ examples\n##\nInstallGlobalFunction( AllPqExamples, function()\n  local dir,  files;\n\n  dir   := DirectoriesPackageLibrary( \"anupq\", \"examples\" )[1];\n  files := DirectoryContents( Filename( dir, \"\" ));\n  # Remove certain files\n  files := Difference( files, [\".\", \"..\", \"index\", \"README\", \"CVS\", \n                                         \"5gp-PG-e5-i\", \"7gp-a-x-Rel-i\"] );\n  # Remove files ending with a tilde\n  files := Filtered( files, file -> file[ Length(file) ] <> '~' );\n  return files;\nend );\n\n#############################################################################\n##\n#F  GrepPqExamples( <string> ) . . . . . . . grep ANUPQ examples for a string\n##\n##  runs the UNIX command `grep <string>'  over  the  {\\ANUPQ}  examples  and\n##  returns the list of examples for which  there  is  a  match.  The  actual\n##  matches are `Info'-ed at `InfoANUPQ' level 2.\n##\nInstallGlobalFunction( GrepPqExamples, function( string )\n  local dir,  str,  grep,  out,  opts,  lines,  matches,  line;\n\n  dir := DirectoriesPackageLibrary( \"anupq\", \"examples\" )[1];\n  grep := Filename( DirectoriesSystemPrograms(), \"grep\" );\n  str := \"\";\n  out := OutputTextString( str, true );\n  opts := Concatenation( [ string ], AllPqExamples() );\n  Process( dir, grep, InputTextNone(), out, opts );\n  CloseStream( out );\n  lines := SplitString( str, \"\",  \"\\n\" );\n  matches := [];\n  for line in lines do\n    Info(InfoANUPQ, 2, line);\n    Add( matches, SplitString(line, \"\", \":\")[1] );\n  od;\n  return Set(matches);\nend );\n\n#E  anupq.gi  . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here \n", "meta": {"hexsha": "6018c69a647ec4a198f2ec909093e1120d6ed8c0", "size": 35711, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/anupq.gi", "max_stars_repo_name": "gap-system/anupq", "max_stars_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_stars_repo_licenses": ["Artistic-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/anupq.gi", "max_issues_repo_name": "gap-system/anupq", "max_issues_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_issues_repo_licenses": ["Artistic-2.0"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2015-03-04T12:41:28.000Z", "max_issues_repo_issues_event_max_datetime": "2015-09-27T22:17:27.000Z", "max_forks_repo_path": "lib/anupq.gi", "max_forks_repo_name": "gap-system/anupq", "max_forks_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_forks_repo_licenses": ["Artistic-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.2916666667, "max_line_length": 80, "alphanum_fraction": 0.5314328918, "num_tokens": 9564, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.47657966593214324, "lm_q2_score": 0.060975182571362606, "lm_q1q2_score": 0.029059532140011432}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(SMPGlobals, rec(\n    pthreads := self >> \"pthreads\",\n    OSThreads := self >> Cond(LocalConfig.osinfo.isWindows(), \"winthreads\", \"LinuxThreads\"),\n    threads := self >> \"threads\",\n    OpenMP := self >> \"OpenMP\",\n    maxThreads := self >> LocalConfig.cpuinfo.cores,\n    getOpts := meth(arg)\n        local self, opts, optrec, tid;\n\n        self := arg[1];\n        opts := CopyFields(SpiralDefaults);\n        optrec := rec(api := self.OpenMP(), numproc := self.maxThreads(), parOdd := false);\n        if Length(arg) >= 2 then optrec := CopyFields(optrec, arg[2]); fi;\n\n        opts.breakdownRules.GT := Concat([ GT_Base, GT_NthLoop, CopyFields(GT_Par, rec(parEntireLoop := false, splitLoop := true))],\n            When(optrec.parOdd, [GT_Par_odd ], []));\n        opts.breakdownRules.TTensorI := [ CopyFields(TTensorI_toGT, rec(applicable := (self, t) >> t.hasTags() and ObjId(t.getTags()[1])=AParSMP ))];\n        opts.breakdownRules.TTensorInd := [ dsA_base_smp, dsA_smp, L_dsA_L_base_smp, L_dsA_L_smp ];\n\n        tid := When(optrec.api = \"OpenMP\", threadId(), CopyFields(var(\"tid\", TInt), rec(isParallelLoopIndex := true)));\n        opts.tags := [ AParSMP(optrec.numproc, tid) ];\n\n#        if optrec.api = \"threads\" then opts.subParams := [var(\"num_threads\", TInt), var(\"tid\", TInt)]; fi;\n        opts.smp := optrec;\n\n        return opts;\n    end\n));\n", "meta": {"hexsha": "a4d4d9f21d11708cabbb95695200eae337bf9c6f", "size": 1438, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/smp/opts.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/smp/opts.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/smp/opts.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 42.2941176471, "max_line_length": 149, "alphanum_fraction": 0.6230876217, "num_tokens": 408, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45713671682749485, "lm_q2_score": 0.06187598875104791, "lm_q1q2_score": 0.028285786348109045}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(TDA, _ApplyAllRulesTopDown, limit_cx);\n\nIsRewriteRule := r -> IsRec(r) and IsBound(r.isRewriteRule) and r.isRewriteRule;\n\nClass(RewriteRuleBase, rec(\n\tisRewriteRule := true,\n\t\n\tregularize := self >> Error(\"Not implemented. This method needs to convert \",\n\t\"a special kind of rewrite rule into a regular RewriteRule\"),\n));\n\n#F RewriteRule(<rewrite-rule>)\t-- returns <rewrite-rule> object unchanged\n#F RewriteRule(<from>, <to_func>) -- creates an unnamed rewrite rule\n#F RewriteRule(<from>, <to_func>, <name>) -- creates a rewrite rule\n#F\nClass(RewriteRule, RewriteRuleBase, rec(\n\tregularize := self >> self,\n\n\t__call__ := meth(arg)\n\t\tlocal op, from, to, name, self;\n\t\n\t\tself := arg[1]; \n\t\targ := Drop(arg, 1);\n\n\t\tif Length(arg)=1 and IsList(arg[1]) then\n\t\t\targ := arg[1];\n\t\tfi;\n\t\tif Length(arg)=1 then \n\t\t\treturn Checked(IsRewriteRule(arg[1]), arg[1]); \n\t\telif Length(arg)=2 then\n\t\t\tfrom := arg[1];\n\t\t\tto   := Checked(IsCallableN(arg[2], 1) or IsCallableN(arg[2], 2), arg[2]);\n\t\t\tname := \"unnamed\";\n\t\telif Length(arg)=3 then\n\t\t\tfrom := arg[1];\n\t\t\tto   := Checked(IsCallableN(arg[2], 1) or IsCallableN(arg[2], 2), arg[2]);\n\t\t\tname := Checked(IsString(arg[3]), arg[3]); \n\t\telse \n\t\t\tError(\"Rule requires 1, 2 or 3 arguments. See Doc(ARule)\");\n\t\tfi;\n\n\t\tif IsList(from) then\n\t\t\tif Length(from)=0 then\n\t\t\t\tError(\"Rule must have non-empty left-side\");\n\t\t\tfi;\n\t\t\top := from[1];\n\t\telse\n\t\t\top := from;\n\t\tfi;\n\t\tif Is@(op) or not IsRec(op) or not IsBound(op.name) then\n\t\t\tif IsBound(op._target) and Length(op._target)=1 then \n\t\t\t\top := op._target[1];\n\t\t\telse \n\t\t\t\top := @;\n\t\t\tfi;\n\t\tfi;\n\t\treturn WithBases(self, rec(op := op, from := from, to := to, name := name, operations := PrintOps));\n\tend,\n\n\tprint := self >> PrintEval(\"$1($2, $3, \\\"$4\\\")\", self.__name__, self.from, self.to, self.name),\n\n));\n\n# Rule(..), alias for RewriteRule, see Doc(RewriteRule)\n#\nRule := arg -> ApplyFunc(RewriteRule, arg);\n\n#F ARule(<rewrite-rule>) - returns <rewrite-rule> object unchanged\n#F ARule(<op>, <from>, <to_func>) - creates an unnamed rewrite rule for associative <op>\n#F ARule(<op>, <from>, <to_func>, <name>) - creates a rewrite rule for associative <op>\n#F\n#F Create a rewrite rule for an associative operator\n#F\nClass(AssociativeRewriteRule, RewriteRuleBase, rec(\n\t__call__ := meth(arg)\n\t\tlocal op, from, to, name, lhs, rhs, self;\n\t\t\n\t\tself := arg[1];\n\t\targ := Drop(arg, 1);\n\n\t\tif Length(arg)=1 and IsList(arg[1]) then\n\t\t\targ := arg[1];\n\t\tfi;\n\t\t\n\t\tif Length(arg)=1 then \n\t\t\treturn Checked(IsRewriteRule(arg[1]), arg[1]); \n\t\telif Length(arg)=3 then\n\t\t\top   := Checked(IsClass(arg[1]), arg[1]);\n\t\t\tfrom := Checked(IsList(arg[2]),  arg[2]);\n\t\t\tto   := Checked(IsCallableN(arg[3], 1) or IsCallableN(arg[3], 2), arg[3]);\n\t\t\tname := \"unnamed\";\n\t\telif Length(arg)=4 then\n\t\t\top   := Checked(IsClass(arg[1]), arg[1]);\n\t\t\tfrom := Checked(IsList(arg[2]),  arg[2]);\n\t\t\tto   := Checked(IsCallableN(arg[3], 1) or IsCallableN(arg[3], 2), arg[3]);\n\t\t\tname := Checked(IsString(arg[4]), arg[4]); \n\t\telse \n\t\t\tError(\"ARule requires 1, 3 or 4 arguments. See Doc(ARule)\");\n\t\tfi;\n\n\t\treturn WithBases(self, rec(op := op, from := from, to := to, name := name, operations := PrintOps));\n\tend,\n\n\tregularize := meth(self)\n\t\tlocal op, from, to, lhs, rhs;\n\t\t\n\t\t[op, from, to] := [self.op, self.from, self.to];\n\t\tlhs := [op, ...] :: from :: [...];\n\t\tif NumArgs(to)=1 then\n\t\t\trhs := DetachFunc(Subst(\n\t\t\t\tfunction(e)\n\t\t\t\tlocal rch;\n\t\t\t\trch := _children(e); \n\t\t\t\t\t# ....left means O.left, where O is the '...' object, defined in rules.gi\n\t\t\t\treturn _fromChildren(e, Concatenation(\n\t\t\t\trch{[1 .. ....left]}, \n\t\t\t\t$to(e),\n\t\t\t\trch{[....right .. Length(rch)]}));\n\t\t\tend));\n\t\telse\n\t\t\trhs := DetachFunc(Subst(\n\t\t\tfunction(e,cx)\n\t\t\t\tlocal rch;\n\t\t\t\trch := _children(e); \n\t\t\t\t\t # ....left means O.left, where O is the '...' object, defined in rules.gi\n\t\t\t\treturn _fromChildren(e, Concatenation(\n\t\t\t\t\trch{[1 .. ....left]},\n\t\t\t\t\t$to(e,cx),\n\t\t\t\t\trch{[....right .. Length(rch)]}));\n\t\t\tend));\n\t\tfi;\n\t\treturn RewriteRule(lhs, rhs, self.name);\n\tend,\n\n\tprint := self >> PrintEval(\"$1($2, $3, $4, \\\"$5\\\")\", self.__name__, self.op, self.from, self.to, self.name),\n));\n\n# ARule(..), alias for AssociativeRewriteRule, see Doc(AssociativeRewriteRule)\n#\nARule := arg -> ApplyFunc(AssociativeRewriteRule, arg);\n\n_ARule_Transparent := (op, transp_ops, from, to) -> Checked(\n\tIsClass(op), IsList(transp_ops), ForAll(transp_ops, IsClass),\n\tIsList(from), IsCallableN(to, 1) or IsCallableN(to, 2),\n\tList(transp_ops, tr_op -> \n\tARule(op, List(from, f -> [tr_op, f]), \n\t\tWhen(IsCallableN(to, 1), Subst(x -> List($to(x), y->$tr_op(y))),\n\t\t\t\t\t\t\t Subst((x,cx) -> List($to(x, cx), y->$tr_op(y))))))\n);\n\n\nIsRuleSet := x -> IsRec(x) and IsBound(x.isRuleSet) and x.isRuleSet;\n\nClass(RuleSet, rec(\n\tisRuleSet\t:= true,\n\trules\t\t:= rec(),\n\t# counts how many time this RuleSet changed\n\t_changes\t := 0,\n\t# change index of compiled ruleset, need to recompile if\n\t# '_comp_id' is not equal to '_changes'\n\t_comp_id\t := -1,\n\t\n\t__transparent__ := [],\n\n\taddRules := meth(self, rules)\n\t\tlocal f, rr;\n\t\tConstraint(IsRec(rules));\n\t\tself.rules := ShallowCopy(self.rules);\n\t\trules := ShallowCopy(rules);\n\n\t\tfor f in UserRecFields(rules) do\n\t\t\trr := rules.(f);\n\t\t\tConstraint(IsRewriteRule(rr) or (IsList(rr) and ForAll(rr, IsRewriteRule)));\n\t\t\trr := When(IsList(rr), rr, [rr]);\n\t\t\trr := ConcatList(rr, r -> \n\t\t\tCond(r _is AssociativeRewriteRule, \n\t\t\t\t[r] ::\n\t\t\t\tConcatList(Filtered(self.__transparent__, t->t[1]=r.op),\n\t\t\t\tt -> _ARule_Transparent(r.op, t[2], r.from, r.to)),\n\t\t\t\t[r]));\n\t\t\trules.(f) := rr;\n\t\tod;\n\n\t\tMergeIntoRecord(self.rules, rules);\n\t\n\t\t# ruleset changed\n\t\tself._changes := self._changes + 1;\n\t\treturn self;\n\tend,\n\n\tcompileRule := meth(self, name, rule)\n\t\tlocal op, from, to_func, owner, head;\n\t\towner := rule.owner;\n\t\trule := rule.regularize();\n\t\t[op, from, to_func] := [rule.op, rule.from, rule.to];\n\t\top := op.__name__;\n\t\thead := When(IsList(from) and from<>[], from[1], from);\n\n\t\tif op = \"@\" and IsRec(head) and IsBound(head._target) then\n\t\t\tDoForAll(head._target, t ->\n\t\t\t\tself.compileRule(name, CopyFields(rule, rec(op := t))));\n\t\telse\n\t\t\tif not IsBound(self._compiled.(op)) then\n\t\t\t\tself._compiled.(op) := [ CopyFields(rule, rec(name := name)) ]; #[from, to_func, name, owner] ];\n\t\t\telse\n\t\t\t\tAdd(self._compiled.(op), CopyFields(rule, rec(name := name))); #[from, to_func, name, owner]);\n\t\t\tfi;\n\t\tfi;\n\tend,\n\n\tcompile := meth(self)\n\t\tself._compiled := tab();\n\t\t# save the owner ruleset, it will be used to produce warnings of duplicate \n\t\t# rule definitions, when dealing with merged rule sets\n\t\tDoForAll(self.rules, function(name, rule)\n\t\t\tlocal r;\n\t\t\tif IsRewriteRule(rule) then rule.owner := self; \n\t\t\telif IsList(rule) and not IsString(rule) then  for r in rule do r.owner := self; od;\n\t\t\tfi;\n\t\tend);\n\n\t\tDoForAll(self.rules, (name, rule) ->\n\t\t\tCond(IsRewriteRule(rule), self.compileRule(name, rule),\n\t\t\t\tIsList(rule) and not IsString(rule), DoForAll(rule, r -> self.compileRule(name, r)), 0)\n\t\t);\n\t\t# remember change number\n\t\tself._comp_id := self._changes;\n\t\treturn self;\n\tend,\n\n\t__call__ := (self, s) >> TDA(s, self, rec()),\n\n\tapply1 := (self, s) >> _ApplyAllRulesTopDown(s, limit_cx(1), self),\n\n\tget_changes  := self >> self._changes,\n\tget_comp_ids := self >> self._comp_id,\n\n\tchanged  := self >> self.get_comp_ids() <> self.get_changes(),\n\n\tcompiled := self >> When(IsBound(self._locked) or not self.changed(), self, self.compile())._compiled, \n\n\t# locked ruleset doesn't check changes and doesn't recompile rules when asked for compiled() table\n\tlocked   := self >> CopyFields(When(self.changed(), self.compile(), self), rec(_locked := true)),\n));\n\n\nClass(EmptyRuleSet, RuleSet);\n\nAnonRuleSet := rules -> WithBases(RuleSet, rec()).addRules(rules);\n\nClass(MergedRuleSet, RuleSet, rec(\n\t _mergedConflictWarnings := [],\n\t warnConflicts := false,\n\t warnDuplicates := true,\n\n\t __call__ := arg >> let(\n\t\t self\t := arg[1],\n\t\t rulesets := Drop(arg, 1),\n\t\t comp_id  := Sum(rulesets, e -> e.get_changes())-1,\n\t\t Checked(Length(rulesets) >= 1,\n\t\t\t When( Length(rulesets)=1,\n\t\t\t\t rulesets[1],\n\t\t\t\t WithBases(self, rec(operations := PrintOps,\n\t\t\t\t\t __call__ := RuleSet.__call__,\n\t\t\t\t\t rulesets := rulesets,\n\t\t\t\t\t _comp_id := comp_id))))),\n\n\t get_changes  := self >> Sum(self.rulesets, e -> e.get_changes()),\n\t get_comp_ids := self >> self._comp_id,\n\n\t checkConflicts := meth(self, rules1, rules2, rulesets)\n\t\t local conflicts, c;\n\t\t conflicts := Intersection(UserRecFields(rules1), UserRecFields(rules2));\n\t\t # make sure the origins of the rules are different\n\t\t # origin == RuleSet where the rule first appears, i.e., not the MergedRuleSet\n\t\t conflicts := Filtered(conflicts, c -> rules1.(c).owner.__name__ <> rules2.(c).owner.__name__);\n\n\t\t # prevent duplicate warnings\n\t\t if not self.warnDuplicates then\n\t\t\t SubtractSet(conflicts, self._mergedConflictWarnings); fi;\n\n\t\t if conflicts <> [] then\n\t\t\t PrintErr(\"Warning: rewrite rule conflict when merging \", rulesets, \"\\n\");\n\t\t\t for c in conflicts do\n\t\t\t\t Add(self._mergedConflictWarnings, c);\n\t\t\t\t PrintErr(Blanks(9), c, \"  \", rules1.(c).owner, \"<->\", rules2.(c).owner, \"\\n\");\n\t\t\t od;\n\t\t fi;\n\t end,\n\n\t compile := meth(self)\n\t\tlocal rules, r;\n\t\trules := rec();\n\t\tfor r in self.rulesets do\n\t\t\tr.compile();\n\t\t\tif self.warnConflicts then\n\t\t\t\tself.checkConflicts(rules, r.rules, self.rulesets);\n\t\t\tfi;\n\t\t\tMergeIntoRecord(rules, r.rules);\n\t\tod;\n\t\tself.rules := rules;\n\n\t\tself._compiled := tab();\n\n\t\tDoForAll(self.rules, (name, rule) ->\n\t\t\tCond(IsRewriteRule(rule), self.compileRule(name, rule),\n\t\t\t\tIsList(rule) and not IsString(rule), \n\t\t\t\tDoForAll(rule, r -> self.compileRule(name, r)),0)\n\t\t);\n\n\t\tself._comp_id := self.get_changes();\n\t\treturn self;\n\tend,\n\n\tprint := self >> Print(self.name, \"(\", PrintCS(self.rulesets), \")\")\n));\n\nRewriteRules := (rule_set, rules) -> rule_set.addRules(rules);\n\n\n_LookupRules := (expr, ruleset) -> let(\n\tname := ObjId(expr).__name__, \n\tR := When(IsBound(ruleset._locked), ruleset._compiled, ruleset.compiled()),\n\tWhen(IsBound(R.(name)), R.(name), []) :: When(IsBound(R.@), R.@, []));\n\n#_AddRule2 := function(op, from, to_func)\n#\t local rules;\n#\t rules := _AddRule_old(op, from, to_func);\n#\t if not IsBound(op._rules) then op._rules := BagAddr(rules); fi;\n#end;\n#_LookupRules2 := op -> When(IsBound(op._rules), BagFromAddr(op._rules), []);\n\n\nChkSPL := function(a,b, rule)\n\tlocal diff;\n#\tError();\n\tif spiral.spl.IsSPL(a) and spiral.spl.IsSPL(b) then\n\t\tdiff := spiral.code.InfinityNormMat(spiral.spl.MatSPL(a) -spiral.spl.MatSPL(b));\n\t\tif diff > 1E-4 then\n\t\t\tPrint(\"Broken SPL rule: \", rule, \"\\nold:\\n\", a, \"\\nnew:\\n\", b);\n\t\t\tError(\"bad SPL rule\");\n\t\tfi;\n\telse\n\t\treturn true;\n\tfi;\nend;\n\nRuleTrace := Ignore;\nRuleStrategyTrace := Ignore;\nRuleStrategyTiming := Ignore;\nRuleStatus := Ignore;\nRuleCheckSPL := false;\n\napply_rules := function(rules, expr, context)\n\tlocal rule, lhs, rhs, old;\n\tfor rule in rules do\n\t\tlhs := rule.from;\n\t\trhs := rule.to;\n\t\twhile PatternMatch(expr, lhs, context) and context.rlimit <> 0 do\n\t\t\tcontext.rlimit := context.rlimit - 1;\n\t\t\tcontext.applied := context.applied + 1;\n\t\t\told := Copy(expr);\n\t\t\tRuleTrace(rule);\n\t\t\tRuleStatus(rule, \"OLD: \", [expr, \"\\n\"]);\n\t\t\tif RuleCheckSPL then old := Copy(expr); fi;\n\t\t\tif NumArgs(rhs)=1 then expr := rhs(expr);\n\t\t\telse expr := rhs(expr, context);\n\t\t\tfi;\n\t\t\tRuleStatus(rule, \"NEW: \", [expr, \"\\n\"]);\n\t\t\ttrace_log.addRewrite(rule.name,old,expr, []);\n\t\t\tif RuleCheckSPL then ChkSPL(old, expr, rule); fi;\n\t\tod;\n\tod;\n\treturn expr;\nend;\n\n# non-iterative version (no more: while PatternMatch(...) do ...)\napply_rules_ni := function(rules, expr, context)\n\tlocal rule, lhs, rhs, old;\n\tfor rule in rules do\n\t\tlhs := rule.from;\n\t\trhs := rule.to;\n\t\tif PatternMatch(expr, lhs, context) and context.rlimit <> 0 then\n\t\t\tcontext.rlimit := context.rlimit - 1;\n\t\t\tcontext.applied := context.applied + 1;\n\t\t\told := Copy(expr);\n\t\t\tRuleTrace(rule);\n\t\t\tRuleStatus(rule, \"OLD: \", [expr, \"\\n\"]);\n\t\t\tif NumArgs(rhs)=1 then expr := rhs(expr);\n\t\t\telse expr := rhs(expr, context);\n\t\t\tfi;\n\t\t\tRuleStatus(rule, \"NEW: \", [expr, \"\\n\"]);\n\t\t\ttrace_log.addRewrite(rule.name,old,expr, []);\n\t\tfi;\n\tod;\n\treturn expr;\nend;\n\ncx_enter := function(cx, expr)\n\tlocal opname;\n\tif IsRec(expr) and IsBound(expr.name) then\n\topname := expr.name;\n\tif not IsBound(cx.(opname)) then cx.(opname) := [ expr ];\n\telse Add(cx.(opname), expr); fi;\n\tfi;\n\tAdd(cx.parents, expr);\nend;\n\ncx_leave := function(cx, expr)\n\t# unupdate context back to original\n\tif IsRec(expr) and IsBound(expr.name) then\n\tRemoveLast(cx.(expr.name), 1);\n\tfi;\n\tRemoveLast(cx.parents, 1);\nend;\n\nmap_children := function(expr, to_func)\n\tlocal ch, i;\n\tch := _children(expr);\n\tfor i in [1..Length(ch)] do\n\t\t_setChild(expr, i, to_func(ch[i]));\n\tod;\n\treturn expr;\nend;\n\nmap_children_safe := function(expr, to_func)\n\tlocal ch, i;\n\tch := ShallowCopy(_children(expr));\n\tif ch=[] then return expr; fi;\n\tfor i in [1..Length(ch)] do\n\t\tch[i] := to_func(ch[i]);\n\tod;\n\treturn _fromChildren(expr, ch);\nend;\n\n# Rule application context fields\n#\tparents - list of parents of current node,\n#\t\t\t  immediate parent is last, farthest parent is first,\n#\t\t\t  this field is updated by apply_rules()\n#\trlimit  - maximum number of rules to apply, this is a parameter\n#\t\t\t  to apply_rules()\n#\tapplied - number of rules applied so far, updated by apply_rules()\n#\n#\t<objid> - for each <objid> list of parents with that id only,\n#\t\t\t  immediate parent is last. For instance Last(context.ISum)\n#\t\t\t  is the enclosing ISum.\n#\n\n_meth_cx_isInside := (self, oid) >> let(nam := Cond(IsString(oid), oid, oid.__name__),\n\tIsBound(self.(nam)) and self.(nam)<>[]\n);\n\n# construct an empty context, but set a limit on the number of applied rules\nlimit_cx := lim -> tab(\n\tisInside := _meth_cx_isInside,\n\tparents := [], rlimit := lim, applied := 0\n);\n\n# construct an empty initial context\nempty_cx := () -> tab(\n\tisInside := _meth_cx_isInside,\n\tparents := [], rlimit := -1, applied := 0\n);\n\n\n_ApplyAllRulesTopDown := function(expr, context, ruleset)\n\tif (not IsRec(expr) or not IsBound(expr.name)) and (not IsList(expr) or BagType(expr) in [T_STRING, T_RANGE]) then\n\t\treturn expr;\n\tfi;\n\tif IsBound(ruleset.__avoid__) and ObjId(expr) in ruleset.__avoid__ then\n\t\treturn expr;\n\tfi;\n\t# apply rules\n\texpr := apply_rules(_LookupRules(expr, ruleset), expr, context);\n\t# recurse\n\t# NOTE: do not enter context if expr has no children!\n\tcx_enter(context, expr);\n\texpr := map_children(expr, c -> _ApplyAllRulesTopDown(c, context, ruleset));\n\tcx_leave(context, expr);\n\treturn expr;\nend;\n\nApplyAllRulesTopDown := (expr, ruleset) ->\n\t_ApplyAllRulesTopDown(expr, empty_cx(), ruleset.locked());\n\n_ApplyAllRulesBottomUp := function(expr, context, ruleset)\n\tif (not IsRec(expr) or not IsBound(expr.name)) and (not IsList(expr) or BagType(expr) in [T_STRING, T_RANGE]) then\n\t\treturn expr;\n\tfi;\n\tif IsBound(ruleset.__avoid__) and ObjId(expr) in ruleset.__avoid__ then\n\t\treturn expr;\n\tfi;\n\t# recurse\n\tcx_enter(context, expr);\n\texpr := map_children(expr, c -> _ApplyAllRulesBottomUp(c, context, ruleset));\n\tcx_leave(context, expr);\n\t# apply rules\n\texpr := apply_rules(_LookupRules(expr, ruleset), expr, context);\n\treturn expr;\nend;\n\nApplyAllRulesBottomUp := (expr, ruleset) ->\n\t_ApplyAllRulesBottomUp(expr, empty_cx(), ruleset.locked());\n\n_apply_strategy_step := function(expr, rset, apply_func, opts)\n\tif IsFunc(rset) then\n\t\tif NumArgs(rset)=2 then\n\t\t\texpr := rset(expr, opts);\n\t\telse\n\t\t\texpr := rset(expr);\n\t\tfi;\n\telse\n\t\texpr := apply_func(expr, rset.locked(), opts); \n\tfi;\n\treturn expr;\nend;\n\n##\n## ApplyStrategy(<expr>, <list-of-rulesets>, <apply_func>, <opts>)\n##\n## <expr>\t\t\t - expression to transform\n## <list-of-rulesets> - list of rulesets to apply\n## <apply_func>\t   - of type (expr, rset) -> expr\n##\nApplyStrategy := function(expr, strategy, apply_func, opts)\n\tlocal rset, l, r, i, t;\n\t# a hack to make this function reentrant\n\t# (e.g. to make it possible to call this function from within rhs of a rule)\n\tl := ....left; r := ....right; i := 1;\n\tfor rset in strategy do\n\t\tRuleStrategyTrace(i, rset, expr);\n\t[expr, t] := UTimedAction(_apply_strategy_step(expr, rset, apply_func, opts));\n\t\tRuleStrategyTrace(i, \"DONE\", expr);\n\tRuleStrategyTiming(i, t);\n\t\ti := i + 1;\n\tod;\n\t....left := l;\n\t....right := r;\n\treturn expr;\nend;\n\nTD := ApplyAllRulesTopDown;\nBU := ApplyAllRulesBottomUp;\n\nTDA := function(s, ruleset, opts)\n\tlocal cx;\n\tcx := empty_cx();\n\tcx.opts := opts;\n\tcx.applied := 1;\n\twhile cx.applied > 0 do\n\t\tcx.applied := 0; \n\t\ts := _ApplyAllRulesTopDown(s, cx, ruleset);\n\tod;\n\treturn s;\nend;\n\nBUA := function(s, ruleset, opts)\n\tlocal cx;\n\t\n\tcx := empty_cx();\n\tcx.opts := opts;\n\tcx.applied := 1;\n\twhile cx.applied > 0 do\n\t\tcx.applied := 0;\n\t\ts := _ApplyAllRulesBottomUp(s, cx, ruleset);\n\tod;\n\treturn s;\nend;\n\nUntilDone := TDA;\n\nRewrite := function(expr, rset, opts)\n\tlocal res;\n\t\n\tif IsList(rset) then\n\t\treturn FoldL(rset, (a,b)->Rewrite(a, b, opts), expr); \n\tfi;\n\n\ttrace_log.beginRuleset(rset, expr);\n\tres := UntilDone(expr, rset, opts);\t\n\ttrace_log.endRuleset(rset, res);\n\t\t\n\treturn res;\nend;\n\n\n#F TDA_1by1(<s>, <expr>, <after_each_rule>)\n#F\n#F This function applies rules in a top-down fashion to <s> until\n#F it converges, just like TDA.  However after each application of the\n#F rule it runs after_each_rule(s) on the newly transformed <s>.\n#F This allows stepwise verification among other things.\n#F\n#F Example:\n#F\tr := RandomRuleTree(DFT(4));\n#F\t# following line (unlike SumsRuleTree) gives non-simplified Sigma-SPL\n#F\ts := SumsSPL(SPLRuleTree(r));\n#F\tTDA_1by1(s, MergedRuleSet(RulesSums, RulesDiag, RulesFuncSimp),\n#F\t\t\t\tx->PrintLine(MatSPL(x)-MatSPL(DFT(4))));\n#F\nTDA_1by1 := function(s, ruleset, after_each_rule)\n\tlocal cx;\n\t\n\tcx := limit_cx(1); cx.applied := 1;\n\twhile cx.applied > 0 do\n\t\tcx := limit_cx(1); cx.applied := 0;\n\t\ts := _ApplyAllRulesTopDown(s, cx, ruleset);\n\t\tafter_each_rule(s);\n\tod;\n\treturn s;\nend;\n", "meta": {"hexsha": "1c5f1b9052c4af7bc89ff79af2bf9257440d6d45", "size": 17823, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/rewrite/ruleset.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/rewrite/ruleset.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/rewrite/ruleset.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.886547812, "max_line_length": 115, "alphanum_fraction": 0.6530887056, "num_tokens": 5476, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4263215925474903, "lm_q2_score": 0.06465348700453777, "lm_q1q2_score": 0.02756317754352301}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nImportAll(paradigms.smp);\nImportAll(paradigms.vector);\n\nClass(FFTXPOWER9Opts, FFTXOpts, rec(\n    tags := [],\n    operations := rec(Print := s -> Print(\"<FFTX POWER9 options record>\")),    \n));\n\npower9Opts := function(arg)\n    local opts, optrec, vsxopts;\n    \n    optrec := rec(dataType := T_Real(64), globalUnrolling := 32);\n    vsxopts := rec(svct := true, splitL := false, oddSizes := false, stdTTensor := true, tsplPFA := false, realVect := false, cplxVect := true);\n    \n    opts := CopyFields(FFTXOpts, SIMDGlobals.getOpts(POWER9_2xf, vsxopts));\n    opts.breakdownRules.TFCall := FFTXOpts.breakdownRules.TFCall;\n    \n    opts.globalUnrolling := optrec.globalUnrolling;\n    \n    # FFTX specific breakdown rules\n    opts.breakdownRules.Circulant := [Circulant_PRDFT_FDataNT];\n    opts.breakdownRules.PRDFT := List([PRDFT1_Base1, PRDFT1_Base2, PRDFT1_CT, PRDFT1_PF, PRDFT_PD, PRDFT_Rader], _noT);\n    opts.breakdownRules.IPRDFT := List([ IPRDFT1_Base1, IPRDFT1_Base2, IPRDFT1_CT, IPRDFT_PD, IPRDFT_Rader ], _noT);\n    opts.breakdownRules.PRDFT3 := List([ PRDFT3_Base1, PRDFT3_Base2, PRDFT3_CT ], _noT);\n\n    return opts;\nend;\n\nDeclare(ParseOptsPOWER);\n\nClass(FFTXPOWER9DefaultConf, rec(\n    __call__ := self >> self,\n    getOpts := (self, t) >> ParseOptsPOWER(self, t),\n    operations := rec(Print := s -> Print(\"<FFTX POWER9 Default Configuration>\")),\n    useOMP := false,\n    useSIMD := true\n));\n\npower9Conf := rec(\n    defaultName := \"defaultPOWER9Conf\",\n    defaultOpts := (arg) >> FFTXPOWER9DefaultConf,\n    useOMP := false,\n    useSIMD := true,\n    confHandler := power9Opts \n);\n\nfftx.FFTXGlobals.registerConf(power9Conf);\n\ngetTargetOS := function()\n    local tgt;\n    \n    if LocalConfig.osinfo.isWindows() then\n        tgt := \"win-x64-cuda\";\n    elif LocalConfig.osinfo.isLinux() then\n        tgt := \"linux-cuda\";\n    elif LocalConfig.osinfo.isDarwin() then\n        tgt := \"linux-cuda\";    ## may work\n    fi;\n    return tgt;\nend;\n\n#-----------------------------------------\n# OpenMP + VSX\n\nClass(FFTXPOWER9OMPOpts, FFTXOpts, rec(\n    tags := [],\n    operations := rec(Print := s -> Print(\"<FFTX POWER9 OpenMP options record>\")),    \n));\n\npower9OMPOpts := function(arg)\n    local opts, optrec, vsxopts, smpopts, tid;\n    \n    optrec := rec(dataType := T_Real(64), globalUnrolling := 32);\n    vsxopts := rec(svct := true, splitL := false, oddSizes := false, stdTTensor := true, tsplPFA := false);\n    smpopts := rec(numproc := LocalConfig.cpuinfo.cores, api := \"OpenMP\");\n    \n    opts := CopyFields(FFTXOpts, SIMDGlobals.getOpts(POWER9_2xf, vsxopts));\n    opts.breakdownRules.TFCall := FFTXOpts.breakdownRules.TFCall;\n    \n    #-- OpenMP opts merging-- \n    opts.unparser := When(IsBound(smpopts.OmpMode) and smpopts.OmpMode = \"for\", \n                            OpenMP_POWERUnparser_ParFor, \n                            OpenMP_POWERUnparser);\n    opts.codegen := spiral.libgen.VecRecCodegen;\n    \n    opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, \n        CopyFields(GT_Par, rec(parEntireLoop := false, splitLoop := true)), GT_Par_odd,\n        GT_Vec_AxI, GT_Vec_IxA, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA        \n    ];\n    opts.breakdownRules.TTensorI := Concat([ \n    CopyFields(TTensorI_toGT, rec(\n        applicable := (self, t) >> t.hasTags() and ObjId(t.getTags()[1])=AParSMP ))], \n        opts.breakdownRules.TTensorI);\n        \n    opts.breakdownRules.TTensorInd := \n        Concat([dsA_base_smp, dsA_smp, L_dsA_L_base_smp, L_dsA_L_smp], \n            opts.breakdownRules.TTensorInd);    \n    \n    tid := When(smpopts.api = \"OpenMP\", threadId(), var(\"tid\", TInt));\n    opts.tags := Concat([ AParSMP(smpopts.numproc, tid)  ], opts.tags);\n    #----------\n    opts.globalUnrolling := optrec.globalUnrolling;\n    \n    # FFTX specific breakdown rules\n    opts.breakdownRules.Circulant := [Circulant_PRDFT_FDataNT];\n    opts.breakdownRules.PRDFT := List([PRDFT1_Base1, PRDFT1_Base2, PRDFT1_CT, PRDFT1_PF, PRDFT_PD, PRDFT_Rader], _noT);\n    opts.breakdownRules.IPRDFT := List([ IPRDFT1_Base1, IPRDFT1_Base2, IPRDFT1_CT, IPRDFT_PD, IPRDFT_Rader ], _noT);\n    opts.breakdownRules.PRDFT3 := List([ PRDFT3_Base1, PRDFT3_Base2, PRDFT3_CT ], _noT);\n\n    return opts;\nend;\n\nDeclare(ParseOptsPOWER);\n\nClass(FFTXPOWER9OMPConf, rec(\n    __call__ := self >> self,\n    getOpts := (self, t) >> ParseOptsPOWER(self, t),\n    operations := rec(Print := s -> Print(\"<FFTX POWER9 OpenMP Configuration>\")),\n    useOMP := true,\n    useSIMD := true\n));\n\npower9OMPConf := rec(\n    defaultName := \"defaultPOWER9OMPConf\",\n    defaultOpts := (arg) >> FFTXPOWER9OMPConf,\n    useOMP := true,\n    useSIMD := true,\n    confHandler := power9OMPOpts \n);\n\nfftx.FFTXGlobals.registerConf(power9OMPConf);\n\ngetTargetOS := function()\n    local tgt;\n    \n    if LocalConfig.osinfo.isWindows() then\n        tgt := \"win-x64-cuda\";\n    elif LocalConfig.osinfo.isLinux() then\n        tgt := \"linux-cuda\";\n    elif LocalConfig.osinfo.isDarwin() then\n        tgt := \"linux-cuda\";    ## may work\n    fi;\n    return tgt;\nend;\n\n# this is a first experimental opts-deriving logic. This needs to be done extensible and properly\nParseOptsPOWER := function(conf, t)\n    local tt, _tt, _conf, _opts;\n    \n    if conf.useOMP then\n        _opts := power9OMPOpts();\n    else\n        _opts := power9Opts();\n    fi;\n    return _opts;\n    \n    Error(\"Don't know how to derive opts!\\n\");\nend; \n\n", "meta": {"hexsha": "0e50eef8c23085e390bfbe60ca2f6e599751cb8b", "size": 5444, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/power/opts.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "platforms/power/opts.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "platforms/power/opts.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 33.1951219512, "max_line_length": 144, "alphanum_fraction": 0.6491550331, "num_tokens": 1649, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46101677931231594, "lm_q2_score": 0.05834583447147869, "lm_q1q2_score": 0.026898408694330606}}
{"text": "#############################################################################\n####\n##\n#W  options.gi                 ACE Package                        Greg Gamble\n##\n##  This file installs functions and records for manipulating ACE options.\n##    \n#Y  Copyright (C) 2000  Centre for Discrete Mathematics and Computing\n#Y                      Department of Information Technology & Electrical Eng.\n#Y                      University of Queensland, Australia.\n##\n\n\n#############################################################################\n####\n##\n#V  KnownACEOptions . . . . . . record whose fields are the known ACE options\n##  . . . . . . . . . . . . . . . . . .  each field is assigned a list of two \n##  . . . . . . . . . . . . . . . . . .  components:  [leastlength, listorfn]\n##\n##  The known ACE options  are the RecNames of KnownACEOptions.  The value of \n##  of each RecName is a list [ leastlength, listorfn ], where leastlength is\n##  an integer specifying the least length of an abbreviation of the  RecName\n##  that will match an ACE option,  and listorfn is either a list of  allowed \n##  values or a function that can be used to test that the value of an option \n##  is valid e.g. for the RecName \"lookahead\", we have knownOptions.lookahead \n##  equal to [ 4, [0..4] ] which indicates that \"look\", \"looka\", etc. are all \n##  valid abbreviations of the \"lookahead\" option,  and the values  that that \n##  option can take are in the (integer) range 0 to 4. \n##\n##  If the allowed values listed for an option are 0 and 1,  then  false  and \n##  true are also permitted (we translate false and true to 0 and 1, respect-\n##  ively when we call ACE). The empty string signifies that ACE  expects  no\n##  value for that option.\n##\n##  Only single-word versions of options can be used by a user of ACE via the \n##  GAP interface e.g. \"cc\" is a synonym for \"coset coincidence\"  as  an  ACE\n##  option,  but the latter,  being 2 words,  is  not available via  the  GAP \n##  interface.\n##\n##  The commented out options are known ACE options that probably  won't work\n##  via the GAP interface ... if the user uses these  the  interface  program\n##  CALL_ACE will complain: `unknown (possibly new) or bad'  but  still  pass \n##  these options to ACE ... at least the user will then know if ACE does not\n##  respond as expected that the options should not be used.  We usually only \n##  warn that certain options might be bad, so that this interface has a good\n##  chance of still being functional if new options are added to the ACE bin-\n##  ary.\n##\n##  Some  options  are  `GAP-introduced'  i.e. technically they are  not  ACE \n##  options  ...  there is a comment beside such options;  and  they are also \n##  listed in NonACEbinOptions below.\n##\n\nInstallValue(KnownACEOptions, rec(\n  # aceinfile, aceignore, aceignoreunknown, acenowarnings, silent (and \n  # further down: aceoutfile) are GAP-introduced options ... they  are\n  # not ACE binary options.\n  aceinfile := [5, IsString],\n  aceignore := [5, x -> IsList(x) and ForAll(x, xi -> IsString(xi))],\n  aceignoreunknown := [10, x -> IsList(x) and ForAll(x, xi -> IsString(xi))],\n  acenowarnings := [6, [0,1]],\n  aceecho := [7, [\"\"]],\n  aceincomment := [6, IsString],\n  aceexampleoptions := [17, [0,1]],\n  silent := [6, [0,1]],\n  lenlex := [6, [0,1]],\n  semilenlex := [10, [0,1]],\n  incomplete := [10, [0,1]],\n  sg := [2, IS_ACE_STRINGS],\n  rl := [2, IS_ACE_STRINGS],\n  aep  := [3, [1..7]],\n  ai := [2, IsString],\n  ao   := [2, IsString],      # \"aceoutfile\" is a GAP-introduced \n  aceoutfile := [4, IsString],# synonym for \"ao\"\n  asis := [2, [0,1]],\n  begin := [3, [\"\"]],         # \"begin\" and \"start\" are synomyms\n  start := [5, [\"\"]],         # ... \"end\" synonym omitted (it is a GAP keyword)\n  bye := [3, [\"\"]],           # \"bye\", \"exit\" and \"qui\" are synonyms\n  exit := [4, [\"\"]],\n  qui := [1, [\"\"]],           # the \"quit\" form is not available since\n                              # it's a GAP keyword\n  cc   := [2, x -> IsInt(x) and x > 1],\n  cfactor := [1, IsInt],      # \"cfactor\" and \"ct\" are synonyms\n  ct   := [2, IsInt],\n  check := [5, [\"\"]],\n  redo := [4, [\"\"]],\n  compaction := [3, [0..100]],\n  continu := [4, [\"\"]],       # \"continue\" is a GAP 4.3+ keyword\n  cycles := [2, [\"\"]],\n  dmode := [4, [0..4]],\n  dsize := [4, x -> x = 0 or IsPosInt(x)],\n  default := [3, [\"\"]],\n  ds := [2, IS_INC_POS_INT_LIST],\n  dr := [2, IS_INC_POS_INT_LIST],\n  dump := [1, x -> x in [\"\",0,1,2] or\n                   (IsList(x) and x[1] in [0..2] and\n                    (Length(x) = 1 or (Length(x) = 2 and x[2] in [0,1])))],\n  easy := [4, [\"\"]],\n  echo := [4, [0,1,2]],       # hijacked! ... we don't pass this to ACE\n  enumeration := [4, IsString],\n  felsch := [3, [\"\",0,1]],\n  ffactor := [1, x -> x = 0 or IsPosInt(x)],# \"ffactor\" and \"fill\"\n  fill := [3, x -> x = 0 or IsPosInt(x)],   # are synonyms ... there is\n                                            # no \"fi\" since it's a GAP\n                                            # keyword\n  ## Most interface functions require the next 3 ACE options to be\n  ## passed as arguments rather than options\n  group := [2, x -> IsInt(x) or IsString(x) or\n                    (IsList(x) and \n                     ForAll(x, xi -> IsString(xi) and\n                                     (Length(xi) = 1) and\n                                     IsLowerAlphaChar( xi[1] )))], \n                                               # For group generators\n  generators := [3, IS_ACE_STRINGS],           # For subgroup generators\n  relators := [3, IS_ACE_STRINGS],             # For group relators\n\n  hard := [2, [\"\"]],\n  help := [1, [\"\"]],\n  hlt  := [3, [\"\"]],\n  hole := [2, [-1..100]],\n  lookahead := [4, [0..4]],\n  loop := [4, x -> x = 0 or IsPosInt(x)],\n  max  := [3, x -> x = 0 or (IsInt(x) and x >= 2)],\n  mendelsohn := [4, [0,1]],\n  messages := [4, IsInt],   # \"messages\" and \"monitor\" are synonyms\n  monitor := [3, IsInt],\n  mode := [2, [\"\"]],\n  nc   := [2, [\"\",0,1]],    # \"nc\" and \"normal\" are synonyms\n  normal := [6, [\"\",0,1]],\n  no   := [2, x -> IsInt(x) and x >= -1],\n  options := [3, [\"\"]],\n  oo   := [2, IsInt],       # \"oo\" and \"order\" are synonyms\n  order := [5, IsInt],\n  #parameters := [3, [\"\"]], # decommissioned ACE option\n  path := [4, [0,1]],\n  pmode := [4, [0..3]],\n  psize := [4, x -> x = 0 or \n                    (IsInt(x) and IsEvenInt(x) and IsPrimePowerInt(x))],\n  sr := [2, [\"\",0,1,2,3,4,5]],\n  print := [2, x -> x = \"\" or IsInt(x) or\n                    (IsList(x) and Length(x) <= 3 and IsInt(x[1]) and\n                     ForAll(x{[2..Length(x)]}, IsPosInt)) ],\n  purec := [5, [\"\"]],       # the ACE option is \"pure c\"\n  purer := [5, [\"\"]],       # the ACE option is \"pure r\"\n  rc   := [2, x -> x = \"\" or IsInt(x) or \n                   (IsList(x) and Length(x) <= 2 and ForAll(x, IsInt))],\n  recover := [4, [\"\"]],     # \"recover\" and \"contiguous\"\n  contiguous := [6, [\"\"]],  # are synonyms ... \"rec\" is\n                            # not an allowed abbreviation\n                            # since it's a GAP  keyword\n  rep  := [2, x -> x in [1..7] or\n                   (IsList(x) and Length(x) <= 2 and x[1] in [1..7] and\n                    ForAll(x{[2..Length(x)]}, IsInt))],\n  #restart := [7, [\"\"]],    # decommissioned ACE option\n  rfactor := [1, IsInt],    # \"rfactor\" and \"rt\" are synonyms\n  rt   := [2, IsInt],\n  row  := [3, [0,1]],\n  sc   := [2, IsInt],       # \"sc\" and \"stabilising\" are synonyms\n  stabilising := [6, IsInt],\n  sims := [4, [1,3,5,7,9]],\n  standard := [2, [\"\"]],\n  statistics := [4, [\"\"]],  # \"statistics\" and \"stats\" are synonyms\n  stats := [5, [\"\"]],\n  style := [5, [\"\"]],\n  subgroup := [4, IsString],\n  system := [3, IsString],\n  text := [4, IsString],\n  time := [2, x -> IsInt(x) and x >= -1],\n  tw   := [2, x -> IsList(x) and Length(x) = 2 and \n                   IsInt(x[1]) and IsWord(x[2])],\n  trace := [2, x -> IsList(x) and Length(x) = 2 and \n                    IsInt(x[1]) and IsWord(x[2])],\n  workspace := [2, x -> IsInt(x) or \n                        (IsString(x) and x[Length(x)] in \"0123456789kmgKMG\")]\n));\n\n#############################################################################\n####\n##\n#V  ACEOptionSynonyms . . . . . record whose fields are `preferred' known ACE\n##  . . . . . . . . . . . . . . options that have synonyms.  The  values  are\n##  . . . . . . . . . . . . . . . . . . . . lists of synonymous alternatives.\n##\n##\n\nInstallValue(ACEOptionSynonyms, rec(\n  ao   := [\"aceoutfile\"],\n  ct   := [\"cfactor\"],\n  fill := [\"ffactor\"],\n  messages := [\"monitor\"],\n  nc   := [\"normal\"],\n  order := [\"oo\"],\n  recover := [\"contiguous\"],\n  rt   := [\"rfactor\"],\n  sc   := [\"stabilising\"],\n  tw   := [\"trace\"],\n  stats := [\"statistics\"],\n  start := [\"begin\"],\n  bye  := [\"exit\", \"qui\"],\n  redo := [\"check\"]\n));\n\n#############################################################################\n####\n##\n#V  NonACEbinOptions . . . . . . . list of known ACE options that are not ACE\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . binary options.\n##\n\nInstallValue(NonACEbinOptions,\n  [ \"aceinfile\",     \"aceoutfile\", \"aceignore\",    \"aceignoreunknown\",\n    \"acenowarnings\", \"aceecho\",    \"aceincomment\", \"aceexampleoptions\",\n    \"echo\",          \"silent\",     \"lenlex\",       \"semilenlex\",\n    \"incomplete\" ]\n);\n\n#############################################################################\n####\n##\n#V  ACE_INTERACT_FUNC_OPTIONS . . . . . list of non ACE options that are used\n##  . . . . . . . . . . . . . . . . . . . .  by the interaction ACE functions\n##\n\nInstallValue(ACE_INTERACT_FUNC_OPTIONS,\n  [ # used by: ACEConjugatesForNormalClosure\n    \"add\",\n    # used by: ACEOrders\n    \"suborder\", \n    # used by: ACERandomlyApplyCosetCoincidence\n    \"attempts\", \"hibound\", \"lobound\", \"subindex\" ]\n);\n\n#############################################################################\n####\n##\n#V  ACEParameterOptions . .  record whose fields are the known ACE  parameter\n##  . . . . . . . . . . . .  options.  Each  field is  assigned   the   known \n##  . . . . . . . . . . . .  default value, or is a record of default values.\n##\n##  An ACE `parameter' option, is a known ACE option for which the ACE binary\n##  has a default value.  These are the `Run Parameters' that ACE lists  with \n##  the `sr: 1' command,  except for  `group',  `relators'  and  `generators'\n##  (which the user provides a value for via arguments rather than options).\n##\n##  For the case that the value of a field of the ACEParameterOptions  record\n##  is itself  a  record,  the  fields  of  that  record  are  `default'  and \n##  strategies for which the value assigned by that strategy differs from the\n##  `default' strategy. A strategy here means a strategy option  concatenated\n##  with any of its possible values (as strings).\n##\n\nInstallValue(ACEParameterOptions, rec(\n  asis := 0,\n  # `ct' is synonymous with `cfactor' but here we list just once.\n  ct   := rec(default := 0, felsch0 := 1000, felsch1 := 1000, \n              hard := 1000, purec := 1000,   sims9 := 1000),\n  compaction := rec(default := 10, easy := 100, purec := 100, purer := 100),\n  dmode := rec(default := 4, easy := 0,  hlt := 0,\n               purer := 0,   sims1 := 0, sims5 := 0),\n  dsize := rec(default := 1000),\n  enumeration := \"G\",\n  # `fill' is synonymous with `ffactor' but here we list just once.\n  fill := rec(default := 0, easy := 1,  felsch0 := 1, hlt := 1,\n              purec := 1,   purer := 1, sims1 := 1,   sims3 := 1,\n              sims5 := 1,   sims7 := 1, sims9 := 1),\n  hole := -1,\n  lookahead := rec(default := 0, hlt := 1),\n  loop := 0,\n  max  := 0,\n  mendelsohn := rec(default := 0, sims5 := 1, sims7 := 1),\n  messages := 0, # Synonymous with `monitor' but here we list just once.\n  no   := rec(default := -1, easy := 0,  felsch0 := 0, hlt := 0,\n              purec := 0,    purer := 0, sims1 := 0,   sims3 := 0,\n              sims5 := 0,    sims7 := 0, sims9 := 0),\n  path := rec(default := 0),\n  pmode := rec(default := 3, easy := 0,  felsch0 := 0, hlt := 0,\n               purec := 0,   purer := 0, sims1 := 0,   sims3 := 0,\n               sims5 := 0,   sims7 := 0, sims9 := 0),\n  psize := rec(default := 256),\n  # `rt' is synonymous with `rfactor' but here we list just once.\n  rt   := rec(default := 0,   easy := 1000,  hard := 1, \n              hlt := 1000,    purer := 1000, sims1 := 1000,\n              sims3 := -1000, sims5 := 1000, sims7 := -1000),\n  row  := rec(default := 1, felsch0 := 0, felsch1 := 0, \n              purec := 0,   purer := 0,   sims9 := 0),\n  subgroup := \"H\",\n  time := -1,\n  workspace := 1000000\n));\n\n#############################################################################\n####\n##\n#V  ACEStrategyOptions  . list of known ACE options that are strategy options\n##\n\nInstallValue(ACEStrategyOptions,\n  [ \"default\", \"easy\", \"felsch\", \"hard\", \"hlt\", \"purec\", \"purer\", \"sims\" ]\n);\n\n#############################################################################\n####\n##\n#V  ACE_OPT_TRANSLATIONS  . . . . . record of ACE interface options for which\n##  . . . . . . . . . . . . . . . . . the  ACE  binary has a different  name; \n##  . . . . . . . . . . . . . . . . . its fields are the ACE interface names,\n##  . . . . . . . . . . . . . . . . . its values are the  ACE  binary  names.\n##\n\nInstallValue(ACE_OPT_TRANSLATIONS, rec(\n  purec := \"pure c\", # These first two haven't been called NonACEbinOptions\n  purer := \"pure r\", \n  aceoutfile := \"ao\",\n  aceecho := \"echo\", \n  aceincomment := \"#\"\n));\n\n#############################################################################\n####\n##\n#V  ACE_OPT_ACTIONS . . . . . . . record of special actions  of  ACE  options\n##  . . . . . . . . . . . . . . . its fields are the ACE  option  names  with\n##  . . . . . . . . . . . . . . . special actions, its values are the actions\n##\n\nInstallValue(ACE_OPT_ACTIONS, rec(\n  purec := \"passed to ACE via option: pure c\",\n  purer := \"passed to ACE via option: pure r\", \n  aceoutfile := \"passed to ACE via option: ao\",\n  aceecho := \"passed to ACE via option: echo\",\n  aceincomment := \"passed as an ACE comment, behind a '#'\",\n  aceexampleoptions := \"inserted by ACEExample, not passed to ACE\"\n));\n\n#############################################################################\n####\n##\n#V  ACE_ERRORS . . . . . . . . . . . . record of ACE interface error messages\n##\n##\n\nInstallValue(ACE_ERRORS, rec(\n  argnotopt := \"should be passed as an argument, NOT an option\"\n));\n\n#############################################################################\n####\n##\n#V  ACE_OPT_SENTINELS . . . . . . . . . . . . . .  record of option sentinels\n##\n##  is a record whose fields are the  preferred  option  name  of  those  ACE\n##  options that normally produce output and whose values are  either  `fail'\n##  if there is no reliable way of detecting the last line  of  output  or  a\n##  function of an input line <line> that returns `true'  if  <line>  is  the\n##  last line of output expected for an option.\n##\n\nInstallValue(ACE_OPT_SENTINELS, rec(\n  start := line -> Length(line) > 1 and line[ Length(line) - 1 ] = ')',\n  redo  := line -> Length(line) > 1 and line[ Length(line) - 1 ] = ')',\n  continu := line -> Length(line) > 1 and line[ Length(line) - 1 ] = ')',\n  aep  := line -> IsMatchingSublist(line, \"* P\"),\n  rep  := fail,\n  cc   := line -> IsMatchingSublist(line, \"Coset\"),\n  mode := line -> IsMatchingSublist(line, \"start =\"),\n  nc   := fail,\n  order := fail,\n  options := line -> IsMatchingSublist(line, \"  host info\"),\n  dump  := line -> IsMatchingSublist(line, \"  #----\"),\n  sr    := line -> IsMatchingSublist(line, \"  #----\"),\n  stats := line -> IsMatchingSublist(line, \"  #----\"),\n  print := fail,\n  rc   := line -> Length(line) > 12 and\n                  line{[1..13]} in [\"* No success;\", \"* An appropri\",\n                                    \"   finite ind\", \"   * Unable t\"],\n  cycles := line -> Length(line) > 1 and line{[1..2]} in [\"CO\", \"co\"],\n  recover := line -> Length(line) > 1 and line{[1..2]} in [\"CO\", \"co\"],\n  standard := line -> Length(line) > 1 and line{[1..2]} in [\"CO\", \"co\"],\n  sc   := fail,\n  style := line -> IsMatchingSublist(line, \"style =\"),\n  test := fail,\n  tw   := line -> PositionSublist(line, \"* word =\") <> fail or\n                  IsMatchingSublist(line, \"* Trace \")\n));\n\n#############################################################################\n####\n##\n#F  IS_INC_POS_INT_LIST . . . . . . Internal function used in KnownACEOptions\n##  . . . . . . . .  returns true if argument is a single positive integer or\n##  . . . . . . . . . . .  is a strictly increasing list of positive integers\n##\nInstallGlobalFunction(IS_INC_POS_INT_LIST, \n  x -> IsPosInt(x) or (IsPosInt(x[1]) and IsSSortedList(x)));\n\n#############################################################################\n####\n##\n#F  IS_ACE_STRINGS  . . . . . . . . Internal function used in KnownACEOptions\n##  . . . . . . . . . returns true if argument is a string or list of strings\n##\nInstallGlobalFunction(IS_ACE_STRINGS, \n  x -> IsString(x) or (IsList(x) and ForAll(x, xi -> IsString(xi))));\n\n#############################################################################\n####\n##\n#F  IsKnownACEOption  . . . . . . . . Returns true if optname is a mixed case\n##  . . . . . . . . . . . . . . . . . abbreviation    of    a    field     of\n##  . . . . . . . . . . . . . . . . . .  KnownACEOptions, or false otherwise.\n##\nInstallGlobalFunction(IsKnownACEOption, \n  optname -> ACEOptionData(optname).known);\n\n#############################################################################\n####\n##\n#F  ACEPreferredOptionName  . . . . Returns the lowercase unabbreviated first\n##  . . . . . . . . . . . . . . . . alternative of optname if it is  a  known\n##  . . . . . . . . . . . . . . . . ACE  option,  or  optname  in  lowercase,\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  otherwise.\n##\nInstallGlobalFunction(ACEPreferredOptionName, \n  optname -> ACEOptionData(optname).synonyms[1]);\n\n#############################################################################\n####\n##\n#F  IsACEParameterOption  . . Returns true if ACEPreferredOptionName(optname) \n##  . . . . . . . . . . . . . . . . . . . . is a field of ACEParameterOptions\n##\nInstallGlobalFunction(IsACEParameterOption, \n  optname -> ACEPreferredOptionName(optname) in RecNames(ACEParameterOptions));\n\n#############################################################################\n####\n##\n#F  IsACEStrategyOption . . . Returns true if ACEPreferredOptionName(optname) \n##  . . . . . . . . . . . . . . . . . . . . . . . .  is in ACEStrategyOptions\n##\nInstallGlobalFunction(IsACEStrategyOption, \n  optname -> ACEPreferredOptionName(optname) in ACEStrategyOptions);\n\n#############################################################################\n####\n##\n#F  ACE_OPTIONS . . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . returns the options passed to an ACE interface function\n##\n##\nInstallGlobalFunction(ACE_OPTIONS, function()\n  if IsEmpty(OptionsStack) then\n    return rec();\n  else\n    return OptionsStack[ Length(OptionsStack) ];\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_OPT_NAMES . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . .  returns option names passed to an ACE interface function\n##  . . . . . . . . . . . . . if acenowarnings is not an option it also warns\n##  . . . . . . . . . . . . . . . . . . . . . . . .  about deprecated options\n##\nInstallGlobalFunction(ACE_OPT_NAMES, function()\nlocal optnames;\n  optnames := RecNames(ACE_OPTIONS());\n  if not VALUE_ACE_OPTION(optnames, false, \"acenowarnings\") then\n    if \"messfile\" in optnames then\n      Info(InfoACE + InfoWarning, 1,\n           \"ACE Warning: \", \n           \"Option `messfile' deprecated: use `ACEoutfile' instead\");\n    elif \"outfile\" in optnames then\n      Info(InfoACE + InfoWarning, 1,\n           \"ACE Warning: \", \n           \"Option `outfile' deprecated: use `ACEinfile' instead\");\n    fi;\n  fi;\n  return optnames;\nend);\n\n#############################################################################\n####\n##\n#F  MATCHES_KNOWN_ACE_OPT_NAME  . . . . . . . . . . . . . . Internal function\n##  . . . .  returns true iff optname is a valid abbreviation of knownoptname\n##  . . . . . . . . . . . . . . . . . optname should be in lowercase already!\n##\nInstallGlobalFunction(MATCHES_KNOWN_ACE_OPT_NAME, \nfunction(knownoptname, optname)\n  return IsMatchingSublist(knownoptname, optname) and\n         KnownACEOptions.(knownoptname)[1] <= Length(optname);\nend);\n\n#############################################################################\n####\n##\n#F  FULL_ACE_OPT_NAME . . . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . sets opt.fullname to be the unabbreviated version of opt.name\n##  . . . . . . . . . . .  if one exists among the fields of KnownACEOptions,\n##  . . . . . . . . . . . . . . in which case, opt.known is also set to true;\n##  . . . . . . . . . . .  otherwise,  opt.fullname  is set  to  opt.name  in \n##  . . . . . . . . . . . . . . lower case,  and  opt.known  is set to false.\n##\nInstallGlobalFunction(FULL_ACE_OPT_NAME, function(opt)\nlocal lcaseoptname, list;\n  lcaseoptname := LowercaseString(opt.name);\n  list := Filtered(RecNames(KnownACEOptions), \n                   s -> MATCHES_KNOWN_ACE_OPT_NAME(s, lcaseoptname));\n  opt.known := not( IsEmpty(list) );\n  if opt.known then\n    opt.fullname := list[1];  # We assume any match is unique!\n  else\n    opt.fullname := lcaseoptname;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_OPTION_SYNONYMS . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . . returns a list of synonyms of optname\n##\n##\nInstallGlobalFunction(ACE_OPTION_SYNONYMS, function(optname)\nlocal list, recname;\n  list := [ optname ];\n  for recname in RecNames(ACEOptionSynonyms) do\n    if recname = optname or optname in ACEOptionSynonyms.(recname) then\n      list := Concatenation( [ recname ], ACEOptionSynonyms.(recname) );\n      break;\n    fi;\n  od;\n  return list;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_IF_EXPR . . . . . . . . . . . . . . . . . . . . . .  An expression if\n##\n##\nInstallGlobalFunction(ACE_IF_EXPR, function(bool, trueval, falseval, failval)\n  if bool = true then\n    return trueval;\n  elif bool = false then\n    return falseval;\n  else\n    return failval;\n  fi;\nend);\n  \n#############################################################################\n####\n##\n#F  ACE_VALUE_OPTION  . . . . . . . . Essentially an extension of ValueOption\n##  . . . . . . . . . . . . . . .  but also removes optname from OptionsStack\n##\n##  ACE_VALUE_OPTION(optname,  defaultval)  returns  ValueOption(optname)  if\n##  optname is set and defaultval, otherwise.\n##\n##  ACE_VALUE_OPTION(optname, val,  trueval,  elseval).  If optname has value\n##  val then return trueval else return elseval.\n##\n##  If ACE_VALUE_OPTION is called with a different no. of aguments to 1 or 2,\n##  all but  the  first  argument  is  ignored,  and  ValueOption(arg[1])  is\n##  returned. Calling ACE_VALUE_OPTION with no arguments is an error.\n##\nInstallGlobalFunction(ACE_VALUE_OPTION, function(arg)\nlocal optval;\n  optval := ValueOption(arg[1]);\n  if not IsEmpty(OptionsStack) then\n    Unbind( OptionsStack[ Length(OptionsStack) ].(arg[1]) );\n  fi;\n  if Length(arg) = 2 then\n    return ACE_IF_EXPR(optval <> fail, optval, arg[2], arg[2]);\n  elif Length(arg) = 4 then\n    return ACE_IF_EXPR(optval = arg[2], arg[3], arg[4], arg[4]);\n  elif not IsEmpty(arg) then\n    # Ignore all but the first argument\n    return optval;\n  fi;\nend);\n  \n#############################################################################\n####\n##\n#F  ACE_VALUE_OPTION_ERROR(<optrec>, <optname>, <defaultval>, <IsOK>, <errmsg>)\n##\n##  returns:\n##    `false' if `ValueOption(<option>) = fail' \n##               (and sets `<optrec>.(<optname>) := <defaultval>') or\n##            if `<IsOK>( ValueOption(<option>) )'\n##               (and sets `<optrec>.(<optname>) := ValueOption(<option>)')\n##    `true'  if `not <IsOK>( ValueOption(<option>) )'\n##               (and sets `<optrec>.errmsg := [<errmsg>]')\n##\nInstallGlobalFunction(ACE_VALUE_OPTION_ERROR, \nfunction(optrec, optname, defaultval, IsOK, errmsg)\nlocal optval;\n  optval := ValueOption(optname);\n  if optval = fail then\n    optrec.(optname) := defaultval;\n  elif IsOK(optval) then\n    optrec.(optname) := optval;\n  else\n    optrec.errmsg := [errmsg];\n    return true;\n  fi;\n  return false;\nend);\n  \n#############################################################################\n####\n##\n#F  VALUE_ACE_OPTION  . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . checks among optnames for any settings of synonyms of optnm\n##  . . . . . . . (or if optnm is a list  any  synonyms  of  the  members  of\n##  . . . . . . . optnm). The latest such optname in  optnames  will  prevail\n##  . . . . . . . and its value will be returned. Otherwise, if  there  isn't\n##  . . . . . . . . . . . . . . . .  such an optname, defaultval is returned.\n##\nInstallGlobalFunction(VALUE_ACE_OPTION, function(optnames, defaultval, optnm)\nlocal optname, optval, optnmlist;\n  optval := defaultval;\n  if IsString(optnm) then\n    optnmlist := [ optnm ];\n  else\n    optnmlist := optnm; # This situation is special ... useful for checking\n                        # whether a list of options have been set\n  fi;\n  optnmlist := Union( List(optnmlist, \n                           optname -> ACE_OPTION_SYNONYMS(optname)) );\n  for optname in Filtered(optnames, \n                          optname -> ForAny(optnmlist,\n                                            s ->\n                                            MATCHES_KNOWN_ACE_OPT_NAME(\n                                                s, \n                                                LowercaseString(optname)\n                                                )\n                                            )) \n  do\n    optval := ValueOption(optname);\n  od;\n  return optval;\nend);\n  \n#############################################################################\n####\n##\n#F  DATAREC_VALUE_ACE_OPTION  . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . checks among RecNames(datarec.options) for any settings  of\n##  . . . . . . . synonyms of optnm The latest such optname prevails and  its\n##  . . . . . . . value is  returned.  Otherwise,  if  there  isn't  such  an\n##  . . . . . . . optname  or  datarec.options  is  unbound,  defaultval   is\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . returned.\n##\nInstallGlobalFunction(DATAREC_VALUE_ACE_OPTION, \n                      function(datarec, defaultval, optnm)\nlocal optname, optval;\n  optval := defaultval;\n  if IsBound(datarec.options) then\n    for optname in Filtered(RecNames(datarec.options), \n                            optname -> ForAny(ACE_OPTION_SYNONYMS(optnm), \n                                              s ->\n                                              MATCHES_KNOWN_ACE_OPT_NAME(\n                                                  s, \n                                                  LowercaseString(optname)\n                                                  )\n                                              )) \n    do\n      optval := datarec.options.(optname);\n    od;\n  fi;\n  return optval;\nend);\n  \n#############################################################################\n####\n##\n#F  ACE_COSET_TABLE_STANDARD  . . . . . . Return either the user's choice for\n##  . . . . . . . . . . . . . . . . . . . the CosetTableStandard or,  if  the\n##  . . . . . . . . . . . . . . . . . . . user has made no choice,  a  string\n##  . . . . . . . . . . . . . . . . . . . representing   the   current    GAP\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . standard.\n##\n##  A check among options for any settings of `lenlex' or  `semilenlex'.  The\n##  latest such optname that is set to true is returned, or if  there  is  no\n##  such setting a string representing the current GAP default  is  returned:\n##  for  GAP  4.2  \"GAPsemilenlex\"  was  returned;  since  GAP   4.3,   \"GAP\"\n##  concatenated  with  the  value  of  `CosetTableStandard'   (by   default,\n##  \"lenlex\") is returned.\n##\nInstallGlobalFunction(ACE_COSET_TABLE_STANDARD, function(options)\nlocal optname;\n  for optname in Filtered(Reversed( RecNames(options) ), \n                          optname -> ForAny([\"lenlex\", \"semilenlex\"],\n                                            s ->\n                                            MATCHES_KNOWN_ACE_OPT_NAME(\n                                                s, \n                                                LowercaseString(optname)\n                                                )\n                                            )) \n  do\n    if options.(optname) = true then\n      return ACEPreferredOptionName(optname);\n    fi;\n  od;\n  return Concatenation(\"GAP\", CosetTableStandard);\nend);\n  \n#############################################################################\n####\n##\n#F  ACE_VALUE_ECHO  . . . . . . . . . . . . . . . . . . . . Internal function\n##\n##\nInstallGlobalFunction(ACE_VALUE_ECHO, function(optnames)\nlocal echoval;\n  echoval := VALUE_ACE_OPTION(optnames, 0, \"echo\");\n  if echoval in KnownACEOptions.echo[2] then\n    return echoval;\n  else \n    return ACE_IF_EXPR(echoval = true, 1, 0, 0);\n  fi;\nend);\n  \n#############################################################################\n####\n##\n#F  TO_ACE_GENS . . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . from the GAP free group generators fgens  returns\n##  . . . . . . . . . . . . a record used to create the equivalent ACE  group\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  generators\n##\n##  Returns a record with fields: \n##\n##    acegens\n##        the ACE equivalent of fgens; and \n##\n##    toace\n##        the ACE directive string needed for the `group' option so that  ACE\n##        uses acegens for its generators.\n##\nInstallGlobalFunction(TO_ACE_GENS, function(fgens)\nlocal n, acegens;\n\n  n := Length(fgens);\n  # Define the generators ACE will use\n  if n <= 26 then\n    # if #generators <= 26 tell ACE to use alphabetic generators: a ...\n    if ForAll(fgens, function(g)\n                       local gstring;\n                       gstring := String(g);\n                       return Length(gstring) = 1 and\n                              LowercaseString(gstring) = gstring;\n                     end) \n    then\n      # if all generators are represented by single lowercase letters\n      # ... use the user's set of generators for ACE\n      acegens := List(fgens, g -> String(g));\n    else\n      acegens := List([1..n], i -> WordAlp(CHARS_LALPHA, i));\n    fi;\n    return rec(acegens := acegens, toace := Flat(acegens));\n  else\n    # if #generators > 26 tell ACE to use numerical generators: 1 ...\n    return rec(acegens := List([1..n], i -> String(i)), toace := n);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_WORDS . . . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . .  returns the translation of words in generators fgens\n##  . . . . . . . . . . .  to words in ACEgens (the generators ACE will use),\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  as one string.\n##\nInstallGlobalFunction(ACE_WORDS, function(words, fgens, ACEgens)\n  words := ACE_WORDS_ARG_CHK(fgens, words, \"\");\n  return JoinStringsWithSeparator(\n             List(words, w -> String( MappedWord( w,\n                                                  fgens,\n                                                  GeneratorsOfGroup(\n                                                      FreeGroup(ACEgens)\n                                                      ) ) ) ) );\nend);\n\n#############################################################################\n####\n##\n#F  ACE_RELS  . . . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . returns the translation of  the  relators  rels  in\n##  . . . . . . . . . . . generators  fgens  to   words   in   ACEgens   (the\n##  . . . . . . . . . . . generators ACE will use), as  one  string,  but  if\n##  . . . . . . . . . . . enforceAsis is true  ensure  the  relator  for  the\n##  . . . . . . . . . . . first generator (which we'll  represent  as  x)  is\n##  . . . . . . . . . . . . . . . . .  translated as \"x*x\" rather than \"x^2\".\n##\nInstallGlobalFunction(ACE_RELS, function(rels, fgens, ACEgens, enforceAsis)\n  if enforceAsis then\n    return Concatenation( ACEgens[1], ACEgens[1], \", \",\n                          ACE_WORDS(Filtered(rels, rel -> rel <> fgens[1]^2),\n                                    fgens, ACEgens) );\n  else\n    return ACE_WORDS(rels, fgens, ACEgens);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ToACEGroupGenerators  . . . . . Given the GAP free group generators fgens\n##  . . . . . . . . . . . . . . . . returns the ACE directive  string  needed\n##  . . . . . . . . . . . . . . . . for the `group' option so that  ACE  uses\n##  . . . . . . . . . . . . . . . . an   appropriate   equivalent   set    of\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . generators.\n##\nInstallGlobalFunction(ToACEGroupGenerators, function(fgens)\n\n  fgens := ACE_FGENS_ARG_CHK(fgens);\n  return TO_ACE_GENS(fgens).toace;\nend);\n\n#############################################################################\n####\n##\n#F  ToACEWords  . . . .  Returns the translation of words in generators fgens\n##  . . . . . . . . . .  to equivalent ACE words, as one string, suitable for\n##  . . . . . . . . . . . . . . . .  the `relators' and `generators' options.\n##\nInstallGlobalFunction(ToACEWords, function(fgens, words)\n\n  fgens := ACE_FGENS_ARG_CHK(fgens);\n  return ACE_WORDS(words, fgens, TO_ACE_GENS(fgens).acegens);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_FGENS_ARG_CHK( <fgens> )\n##\n##  Checks that <fgens> is a list of free group generators for the same  free\n##  group, gives the user a chance to fix them if necessary, and then returns\n##  the (repaired) <fgens>.\n##\nInstallGlobalFunction(ACE_FGENS_ARG_CHK, function(fgens)\nlocal errmsg, onbreakmsg, error, fam;\n\n  onbreakmsg := \n      [\"Type: 'quit;' to quit to outer loop, or\",\n       \"type: 'fgens := <val>; return;' to assign <val> to fgens to continue.\"];\n  error := true;\n  repeat\n    if not IsList(fgens) then\n        errmsg := [\"fgens must be a *list* of free group gen'rs\"];\n    elif not ForAll(fgens, g -> IsAssocWordWithInverse(g) and\n                                (NumberSyllables(g) = 1) and\n                                (ExponentSyllable(g, 1) = 1)) then\n      if ForAll(fgens, IsElementOfFpGroup) then\n        errmsg := [\"fgens must be a list of free group gen'rs,\",\n                   \"not fp group elements e.g. use 'FreeGeneratorsOfFpGroup'\",\n                   \"rather than 'GeneratorsOfGroup'\"];\n      else\n        errmsg := [\"fgens must be a list of free group gen'rs\"];\n      fi;\n    else\n      fam := FamilyObj(fgens[1]);\n      if not ForAll(fgens{[2..Length(fgens)]}, g -> fam = FamilyObj(g)) then\n        errmsg := [\"fgens must all belong to the same free group\"];\n      else\n        error := false;\n      fi;\n    fi;\n    if error then\n      Error(ACE_ERROR(errmsg, onbreakmsg), \"\\n\");\n    fi;\n  until not error;\n  return fgens;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_WORDS_ARG_CHK( <fgens>, <words>, <whicharg> )\n##\n##  Checks that <words> is a valid list of words in the free group generators\n##  <fgens>. If not, an error message for  the  <whicharg>  (which  indicates\n##  what type of words they are,  e.g.  \"relators\",  \"subgp  gen'rs\"  or  \"\")\n##  argument is generated, telling the user how  to  fix  the  problem.  Once\n##  everything is ok, <words> after being filtered of any  identity  elements\n##  is returned.\n##\nInstallGlobalFunction(ACE_WORDS_ARG_CHK, function(fgens, words, whicharg)\nlocal fam, errmsg, onbreakmsg;\n\n  onbreakmsg := \n      [\"Type: 'quit;' to quit to outer loop, or\",\n       \"type: 'words := <val>; return;' to assign <val> to words to continue.\",\n       \"Note: fgens is the list of free group generators.\"];\n  \n  fam := FamilyObj(fgens[1]);\n  errmsg := \"words \";\n  if whicharg <> \"\" then\n    errmsg := Concatenation(errmsg, \"(\", whicharg, \") \");\n  fi;\n  while not IsList(words) or not ForAll(words, w -> FamilyObj(w) = fam) do\n    if IsList(words) and ForAll(words, IsElementOfFreeGroup) then\n      errmsg := \n        [Concatenation(\n             errmsg, \"is a list of words in the *wrong* free grp gen'rs\")];\n    elif IsList(words) and ForAll(words, IsElementOfFpGroup) then\n      errmsg := \n        [Concatenation(\n             errmsg, \"must be a list of words in the free group gen'rs,\"),\n         \"not fp group elements. Perhaps, you should use 'UnderlyingElement'\",\n         \"to convert each fp group element to a word in the free group gen'rs\"];\n    else\n      errmsg := \n        [Concatenation(\n             errmsg, \"must be a list of words in the free group gen'rs\")];\n    fi;\n    Error(ACE_ERROR(errmsg, onbreakmsg), \"\\n\");\n  od;\n  return Filtered(words, word -> not IsOne(word));\nend);\n\n#############################################################################\n####\n##\n#F  PROCESS_ACE_OPTIONS . . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . for the ACE function with name ACEfname process options\n##  . . . . . . . . . (on the top of OptionsStack)  with  names  newoptnames,\n##  . . . . . . . . . other than those  that  are  fields  of  disallowed  or\n##  . . . . . . . . . listed in ignored, by sending them to ACE via the write\n##  . . . . . . . . . function ToACE,  after  appropriate  translation  where\n##  . . . . . . . . . necessary, mostly in the order specified by  the  user.\n##  . . . . . . . . . The list optnames contains the names of  all  currently\n##  . . . . . . . . . active options i.e. the fields of all options on top of\n##  . . . . . . . . . the OptionsStack. If  echo  is  set  then  all  options\n##  . . . . . . . . . processed are echoed along with an  indication  of  how\n##  . . . . . . . . . they were handled by the interface. If the InfoLevel of\n##  . . . . . . . . . InfoACE or InfoWarning is at least 1 and the  user  has\n##  . . . . . . . . . not passed the  acenowarnings  option  then  a  warning\n##  . . . . . . . . . message is issued for each optname that is a  field  of\n##  . . . . . . . . . disallowed or is in ignored or for some other reason is\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  ignored.\n##\nInstallGlobalFunction(PROCESS_ACE_OPTIONS, \nfunction(ACEfname, optnames, newoptnames, echo, datarec, disallowed, ignored)\nlocal ToACE, IsValidOptionValue, CheckValidOption, ProcessOption, \n      AddIgnoreOptionsToIgnored, IsMyLine, nowarnings, ignoreunknown, \n      paramoptnames, strategy, opt, optname, line, invokesEnumeration;\n\n  ToACE := function(list) \n    WRITE_LIST_TO_ACE_STREAM(datarec.stream, list);\n  end;\n\n  IsValidOptionValue := function(val)\n    # Check that val is a valid value of opt.fullname.\n    # This function will only be called when opt.known = true,\n    # in which case, opt.fullname will be a field of KnownACEOptions\n    if IsFunction(KnownACEOptions.(opt.fullname)[2]) then\n      return KnownACEOptions.(opt.fullname)[2](val);\n    elif IsBool(val) then\n      return KnownACEOptions.(opt.fullname)[2] in [\"\", [\"\",0,1], [0,1]];\n    else\n      return val in KnownACEOptions.(opt.fullname)[2];\n    fi;\n  end;\n\n  CheckValidOption := function(val)\n    # If opt.fullname is a known allowed optname and val is a valid value,\n    # warn the user of a possible error, if s/he wants to know and its\n    # not an ignored option.\n    if not(nowarnings or opt.ignore) then\n      if opt.fullname in RecNames(disallowed) then\n        Info(InfoACE + InfoWarning, 1,\n             \"ACE Warning: \", opt.name, \": \", disallowed.(opt.fullname));\n      elif opt.known then\n        if not IsValidOptionValue(val) then\n          Info(InfoACE + InfoWarning, 1,\n               \"ACE Warning: \", val, \": \",\n               \"possibly not an allowed value of \", opt.name);\n        fi;\n      else\n        Info(InfoACE + InfoWarning, 1,\n             \"ACE Warning: \", opt.name, \": unknown (maybe new) or bad option\");\n      fi;\n    fi;\n  end;\n\n  ProcessOption := function(val)\n    # Echo what we are about to do first, if the user has set the echo\n    # option.\n    if echo > 0 then\n      if opt.ignore then\n        Print(\" \", opt.name, \" := \", opt.value, \" (ignored)\\n\");\n      elif opt.fullname in RecNames(ACE_OPT_ACTIONS) then\n        Print(\" \", opt.name);\n        if val = \"\" then\n          Print(\" (no value, \");\n        else\n          Print(\" := \", opt.value, \" (\");\n        fi;\n        Print( ACE_OPT_ACTIONS.(opt.fullname), \")\\n\" );\n      elif opt.fullname in NonACEbinOptions then\n        Print(\" \", opt.name, \" := \", opt.value, \" (not passed to ACE)\\n\");\n      elif opt.list then\n        Print(\" \", opt.name, \" := \", opt.value, \n              \" (brackets are not passed to ACE)\\n\");\n      elif val = \"\" then\n        Print(\" \", opt.name, \" (no value)\\n\");\n      else\n        Print(\" \", opt.name, \" := \", val, \"\\n\");\n      fi;\n    fi;\n    # Warn user if opt.name is an unknown optname or has an unexpected value\n    # if they want to know.\n    CheckValidOption(val);\n    # Now do it ... pass opt.ace (which is opt.name except when the ACE and\n    # GAP optnames differ) to ACE with value val,  except if opt.name is to\n    # be ignored or is a NonACEbinOption without a translation.\n    if not opt.donotpass and not opt.ignore then\n      if opt.fullname in RecNames(ACE_OPT_TRANSLATIONS) then\n        # The ACE optname differs from the GAP optname\n        opt.ace := ACE_OPT_TRANSLATIONS.(opt.fullname);\n      else\n        # The ACE optname is the same as the GAP optname\n        opt.ace := opt.name;\n      fi;\n      if opt.list then\n        ToACE([ opt.ace,\":\", \n                JoinStringsWithSeparator( List(val, String) ), \";\" ]);\n      elif val = \"\" then\n        ToACE([ opt.ace, \";\" ]);\n      elif opt.fullname = \"aceincomment\" then\n        ToACE([ opt.ace, val, \";\" ]);\n      else\n        ToACE([ opt.ace, \":\", val, \";\" ]);\n      fi;\n\n      # Eventually we may include more general support for interpretation\n      # of ACE output here ... for the moment we ensure the enumeration\n      # result is set (for ACEStats) and the coset table is set (for\n      # ACECosetTable[FromGensAndRels]) if there is an enumeration result\n      if IsBound(datarec.procId) then\n        if not IsBound( ACE_OPT_SENTINELS.(opt.synonyms[1]) ) then\n          # Flush any available output ... it may contain errors\n          line := ReadAllLine(datarec.stream);\n          while line <> fail do\n            Info(InfoACE + InfoWarning, 1, Chomp(line));\n            line := ReadAllLine(datarec.stream);\n          od;\n        elif opt.fullname = \"print\" and IsBound(datarec.stats) and\n             val in [ \"\", datarec.stats.activecosets ] and\n             (datarec.stats.index <> 0 or \n              VALUE_ACE_OPTION(optnames, false, \"incomplete\") ) then\n          datarec.cosettable := ACE_COSET_TABLE(datarec.stats.activecosets,\n                                                datarec.acegens, \n                                                datarec.stream, \n                                                ACE_READ_NEXT_LINE);\n        else\n          if ACE_OPT_SENTINELS.(opt.synonyms[1]) = fail then\n            ToACE([ \"text:***\" ]);\n            IsMyLine := line -> IsMatchingSublist(line, \"***\");\n          else\n            IsMyLine := ACE_OPT_SENTINELS.(opt.synonyms[1]);\n          fi;\n          invokesEnumeration := opt.synonyms[1] in\n                                [\"start\", \"continu\", \"redo\", \"aep\", \"rep\"];\n          repeat\n            line := ACE_READ_NEXT_LINE(datarec.stream);\n            if invokesEnumeration and\n               not IsMatchingSublist(line, \"** ERROR\") and\n               Length(line) > 1 and line[ Length(line) - 1 ] = ')' then\n              datarec.enumResult := Chomp(line);\n              datarec.stats := ACE_STATS(datarec.enumResult);\n            fi;\n            Info(InfoACE + InfoWarning, 1, Chomp(line));\n          until IsMyLine(line);\n        fi;\n      fi;\n\n    fi;\n  end;\n\n  AddIgnoreOptionsToIgnored := function()\n  local ignore, optname, opt;\n    ignore := VALUE_ACE_OPTION(optnames, [], \"aceignore\");\n    for optname in ignore do\n      opt := rec(name := optname);\n      FULL_ACE_OPT_NAME(opt); # sets opt.known and opt.fullname\n      Add(ignored, opt.fullname);\n    od;\n  end;\n\n  if echo > 0 then\n    Print(ACEfname, \" called with the following options:\\n\");\n    if echo = 2 then\n      paramoptnames := RecNames(ACEParameterOptions);\n      strategy := \"default\";\n    fi;\n  fi;\n\n  nowarnings := VALUE_ACE_OPTION(optnames, false, \"acenowarnings\");\n  ignoreunknown := VALUE_ACE_OPTION(optnames, ACEIgnoreUnknownDefault,\n                                    \"aceignoreunknown\");\n  AddIgnoreOptionsToIgnored();\n\n  for optname in newoptnames do\n    opt := ACEOptionData(optname); # sets opt.name, opt.known, opt.fullname\n                                   # and opt.synonyms\n    opt.value := ValueOption(opt.name);\n    if echo = 2 then\n      paramoptnames := Difference(paramoptnames, opt.synonyms);\n      if opt.fullname in ACEStrategyOptions then\n        strategy := opt.fullname;\n        if IsInt(opt.value) then\n          strategy := Concatenation(strategy, String(opt.value));\n        elif opt.value and (opt.fullname = \"felsch\") then\n          strategy := \"felsch0\";     # Hmm! I'd like to do this differently!!\n        fi;\n      fi;\n    fi;\n    # We don't pass the NonACEbinOptions options to ACE unless they\n    # have a translation (i.e. are fields of ACE_OPT_TRANSLATIONS)\n    opt.donotpass := (opt.fullname in NonACEbinOptions) and\n                     not (opt.fullname in RecNames(ACE_OPT_TRANSLATIONS));\n    opt.ignore := opt.fullname in RecNames(disallowed) or\n                  opt.fullname in ignored or\n                  (ignoreunknown and not opt.known);\n    opt.list := false;\n    if opt.value = true then\n      # An option detected by GAP as boolean may in fact be a no-value\n      # option of ACE ... unknown ACE options detected as being true are\n      # assumed to be no-value options (since the user can still over-ride\n      # this behaviour by entering values of 0 or 1 explicitly e.g. \n      # ACEStats(... : `opt' := 1) )\n      if not opt.known or IsValidOptionValue(\"\") then\n        ProcessOption(\"\");\n      else\n        ProcessOption(1);\n      fi; \n    elif opt.value = false then\n      ProcessOption(0);\n    elif not IsString(opt.value) and IsList(opt.value) then\n      opt.list := true;\n      ProcessOption(opt.value);\n    else\n      ProcessOption(opt.value);\n    fi;\n  od;\n\n  if echo = 2 then\n    Print(\"Other options set via ACE defaults:\\n\");\n    for optname in paramoptnames do\n      Print(\" \", optname, \" := \"); \n      if IsRecord(ACEParameterOptions.(optname)) then\n        if IsBound(ACEParameterOptions.(optname).(strategy)) then\n          Print(ACEParameterOptions.(optname).(strategy), \"\\n\");\n        else\n          Print(ACEParameterOptions.(optname).default, \"\\n\");\n        fi;\n      else\n        Print(ACEParameterOptions.(optname), \"\\n\");\n      fi;\n    od;\n  fi;\n\nend);\n\n#############################################################################\n####\n##\n#F  PROCESS_ACE_OPTION  . . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . . . . . . . . . process  a  single  ACE  option\n##  . . . . . . . . . . . . . . . . . . . . . that  hasn't  been  passed  via\n##  . . . . . . . . . . . . . . . . . . . . . . . . .  GAP's option mechanism\n##\n##  Checks optval is a valid value of optname (which must  be  lowercase  and\n##  unabbreviated) and pass it ACE by writing to stream.\n##\nInstallGlobalFunction(PROCESS_ACE_OPTION, function(stream, optname, optval)\nlocal aceoptname, error;\n\n  # Check that optval is a valid value of optname.\n  if IsFunction(KnownACEOptions.(optname)[2]) then\n    error := not KnownACEOptions.(optname)[2](optval);\n  else\n    error := not (optval in KnownACEOptions.(optname)[2]);\n  fi;\n  \n  if error then\n    Info(InfoACE + InfoWarning, 1, \n         \"ACE Warning: \", optval, \": \",\n         \"possibly not an allowed value of \", optname);\n  fi;\n\n  if optname in RecNames(ACE_OPT_TRANSLATIONS) then\n    # The ACE optname differs from the GAP optname\n    aceoptname := ACE_OPT_TRANSLATIONS.(optname);\n  else\n    # The ACE optname is the same as the GAP optname\n    aceoptname := optname;\n  fi;\n\n  if optval = \"\" then\n    WRITE_LIST_TO_ACE_STREAM(stream, [ aceoptname, \";\" ]);\n  elif not IsString(optval) and IsList(optval) then\n    WRITE_LIST_TO_ACE_STREAM(\n        stream, [ aceoptname,\":\", \n                  JoinStringsWithSeparator( List(optval, String) ), \";\" ]\n        );\n  else\n    WRITE_LIST_TO_ACE_STREAM(stream, [ aceoptname, \":\", optval, \";\" ]);\n  fi;\n\n  return error;\nend);\n\n#############################################################################\n####\n##\n#F  ACEOptionData . . .  returns a record of the known data of an option name\n##\n##  For argument optname the fields of the returned record are:\n##    name  . . . .  optname (unchanged);\n##    known . . . .  true iff optname is a valid mixed case abbreviation of a \n##                   KnownACEOption field;\n##    fullname  . .  the lower case unabbreviated  form  of  optname  if  the\n##                   `known' field is set `true',  or optname in  lower case, \n##                   otherwise;\n##    synonyms  . .  a list of KnownACEOptions fields that are  option  names\n##                   synonymous with optname, if the  `known'  field  is  set\n##                   set `true', or list with just fullname otherwise;\n##    abbrev  . . .  the shortest lowercase abbreviation of  optname  if  the \n##                   `known' field is set `true', or fullname otherwise.\n##\nInstallGlobalFunction(ACEOptionData, function(optname)\nlocal opt;\n  opt := rec(name := optname);\n  FULL_ACE_OPT_NAME(opt); # Sets the `known' and `fullname' fields\n  if opt.known then\n    opt.synonyms := ACE_OPTION_SYNONYMS(opt.fullname);\n    opt.abbrev := opt.fullname{[1 ..  KnownACEOptions.(opt.fullname)[1]]};\n  else\n    opt.synonyms := [ opt.fullname ];\n    opt.abbrev := opt.fullname;\n  fi;\n  return opt;\nend);\n\n#############################################################################\n####\n##\n#F  SANITISE_ACE_OPTIONS  . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . . . . . . . . . . . .  Called by SetACEOptions,\n##  . . . . . . . . . . . . . . . . . or by CALL_ACE when CALL_ACE is invoked\n##  . . . . . . . . . . . . . . . . . by   ACEExample   with   user   options\n##\n##  Scrubs any option  names  in  optsrec  that match  those  in  newoptsrec,\n##  to ensure that *all* new options are at the end of  optsrec  when  it  is \n##  updated with options from newoptsrec.\n##\nInstallGlobalFunction(SANITISE_ACE_OPTIONS, function(optsrec, newoptsrec)\nlocal newoptnames, optname, opt;\n    newoptnames := Concatenation(\n                       List(RecNames(newoptsrec),\n                            optname -> ACEOptionData(optname).synonyms)\n                       );\n    for optname in RecNames(optsrec) do\n      opt := rec(name := optname);\n      FULL_ACE_OPT_NAME(opt); # Sets opt.fullname\n      if opt.fullname in newoptnames then\n        Unbind(optsrec.(optname));\n      fi;\n    od;\nend);\n\n#############################################################################\n####\n##\n#F  NEW_ACE_OPTIONS()\n##\n##  Looks at OptionsStack and returns the new options.\n##\nInstallGlobalFunction(NEW_ACE_OPTIONS, function()\nlocal newoptions, oldoptions, oldnames, optname;\n    if IsEmpty(OptionsStack) then\n      return rec();\n    elif Length(OptionsStack) = 1 then\n      return OptionsStack[ Length(OptionsStack) ];\n    else\n      newoptions := ShallowCopy( OptionsStack[ Length(OptionsStack) ] );\n      oldoptions := OptionsStack[ Length(OptionsStack) - 1 ];\n      oldnames := RecNames(oldoptions);\n      for optname in RecNames(newoptions) do\n        if optname in oldnames and \n           oldoptions.(optname) = newoptions.(optname) then\n          Unbind( newoptions.(optname) );\n        fi;\n      od;\n      return newoptions;\n    fi;\nend);\n\n#E  options.gi  . . . . . . . . . . . . . . . . . . . . . . . . . . ends here \n", "meta": {"hexsha": "021e280fd2f122b148cd500b05967e0a890142f2", "size": 52756, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/options.gi", "max_stars_repo_name": "isuruf/ace", "max_stars_repo_head_hexsha": "7d285d9e82178ef36d9923611425b2c629a8bb77", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/options.gi", "max_issues_repo_name": "isuruf/ace", "max_issues_repo_head_hexsha": "7d285d9e82178ef36d9923611425b2c629a8bb77", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/options.gi", "max_forks_repo_name": "isuruf/ace", "max_forks_repo_head_hexsha": "7d285d9e82178ef36d9923611425b2c629a8bb77", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.179741051, "max_line_length": 80, "alphanum_fraction": 0.5246607021, "num_tokens": 14645, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.39606816627404173, "lm_q2_score": 0.06560483517543499, "lm_q1q2_score": 0.025983986766645286}}
{"text": "#\n#\n#\n\nRead(\"~/Workspace/Chevalley.gap/init.gi\");\n\nRead(Filename(home_dir,\"lib/rsys.gd\"));\nRead(Filename(home_dir,\"lib/rsys.gi\"));\n\nRead(Filename(home_dir,\"lib/chvadj.gd\"));\nRead(Filename(home_dir,\"lib/chvadj.gi\"));\n\nRead(Filename(home_dir,\"lib/nilchv.gd\"));\nRead(Filename(home_dir,\"lib/nilchv.gi\"));\n", "meta": {"hexsha": "6c1b4e625d1539888e19f0a846cdb47f5b768e1d", "size": 301, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "test/nilchv.test.init.gi", "max_stars_repo_name": "iuliansimion/Chevalley.gap", "max_stars_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/nilchv.test.init.gi", "max_issues_repo_name": "iuliansimion/Chevalley.gap", "max_issues_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/nilchv.test.init.gi", "max_forks_repo_name": "iuliansimion/Chevalley.gap", "max_forks_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.0666666667, "max_line_length": 42, "alphanum_fraction": 0.707641196, "num_tokens": 94, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.49609382947091946, "lm_q2_score": 0.05108273135916328, "lm_q1q2_score": 0.02534182781980154}}
{"text": "############################################################################\n##\n##  access.gd                     IRREDSOL                  Burkhard H\u00f6fling\n##\n##  Copyright \u00a9 2003\u20132016 Burkhard H\u00f6fling\n##\n\n\n############################################################################\n##\n#F  IndicesAbsolutelyIrreducibleSolubleMatrixGroups(<n>, <q>)\n##\n##  see the IRREDSOL manual\n##  \nInstallGlobalFunction(IndicesAbsolutelyIrreducibleSolubleMatrixGroups,\n    function(n, q)\n        Info(InfoWarning, 1, \"Obsolete function. See ?IndicesAbsolutelyIrreducibleSolubleMatrixGroups.\");\n        return IndicesIrreducibleSolubleMatrixGroups(n, q, 1);\n    end);\n\n\n############################################################################\n##\n#F  AbsolutelyIrreducibleSolubleMatrixGroup(<n>, <q>, <k>)\n##\n##  see the IRREDSOL manual\n##  \nInstallGlobalFunction(AbsolutelyIrreducibleSolubleMatrixGroup,\n    function(n, q, k)\n        Info(InfoWarning, 1, \"Obsolete function. See ? AbsolutelyIrreducibleSolubleMatrixGroup.\");\n        return IrreducibleSolubleMatrixGroup(n, q, 1, k);\n    end);\n\n\n############################################################################\n##\n#F  RecognitionAbsolutelyIrreducibleSolubleMatrixGroup(G, wantmat, wantgroup)\n##\n##  see the IRREDSOL manual\n##\nInstallGlobalFunction(RecognitionAbsolutelyIrreducibleSolubleMatrixGroup,\n    function(G, wantmat, wantgroup)\n        local r;\n        Info(InfoWarning, 1, \"Obsolete function. See ? RecognitionAbsolutelyIrreducibleSolubleMatrixGroup.\");\n        r := RecognitionIrreducibleSolubleMatrixGroup(G, wantmat, wantgroup);\n        if r.id[3] <> 1 then\n            Error(\"G is not absolutely irreducible\");\n        fi;\n        r.id := r.id{[1,2,4]};\n        return r;\n    end);\n\n\n############################################################################\n##\n#F  RecognitionAbsolutelyIrreducibleSolubleMatrixGroupNC(G, wantmat, wantgroup)\n##\n##  see the IRREDSOL manual\n##\nInstallGlobalFunction(RecognitionAbsolutelyIrreducibleSolubleMatrixGroupNC,\n    function(G, wantmat, wantgroup)\n        local r;\n        Info(InfoWarning, 1, \"Obsolete function. See ? RecognitionAbsolutelyIrreducibleSolubleMatrixGroupNC.\");\n        r := RecognitionIrreducibleSolubleMatrixGroupNC(G, wantmat, wantgroup);\n        if r <> fail then\n            if r.id[3] <> 1 then\n                Error(\"G is not absolutely irreducible\");\n            fi;\n            r.id := r.id{[1,2,4]};\n        fi;\n        return r;\n    end);\n\n\n############################################################################\n##\n#A  IdAbsolutelyIrreducibleSolubleMatrixGroup(<G>)\n##\n##  see the IRREDSOL manual\n##  \nInstallGlobalFunction(\"IdAbsolutelyIrreducibleSolubleMatrixGroup\",\n    function(G)\n        local r;\n        Info(InfoWarning, 1, \"Obsolete function. See ? IdAbsolutelyIrreducibleSolubleMatrixGroup.\");\n        r := IdIrreducibleSolubleMatrixGroup(G, false, false);\n        if r[3] <> 1 then\n            Error(\"G is not absolutely irreducible\");\n        fi;\n        return r{[1,2,4]};\n    end);\n    \n\n############################################################################\n##\n#E\n##\n", "meta": {"hexsha": "ff87da7092d9d56965b5daa12250ff7f1dd7331f", "size": 3126, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/obsolete.gi", "max_stars_repo_name": "fingolfin/irredsol", "max_stars_repo_head_hexsha": "c7ab06f5123650049142a5ae3a1c1e05a38d2151", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2017-09-01T16:53:11.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-01T16:53:11.000Z", "max_issues_repo_path": "lib/obsolete.gi", "max_issues_repo_name": "fingolfin/irredsol", "max_issues_repo_head_hexsha": "c7ab06f5123650049142a5ae3a1c1e05a38d2151", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2017-08-02T16:19:58.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T08:57:23.000Z", "max_forks_repo_path": "lib/obsolete.gi", "max_forks_repo_name": "fingolfin/irredsol", "max_forks_repo_head_hexsha": "c7ab06f5123650049142a5ae3a1c1e05a38d2151", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2016-02-17T18:26:09.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-02T10:40:35.000Z", "avg_line_length": 32.2268041237, "max_line_length": 111, "alphanum_fraction": 0.5511836212, "num_tokens": 702, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.47657965106367595, "lm_q2_score": 0.05261895873320146, "lm_q1q2_score": 0.025077124992403114}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n\n#\n#######################\n#\n# local helper functions\n#\n#######################\n\n#\n## _fProto\n#\n# create a TFunc(...) object from an array of variables\n#\n# eg: _fProto([\n#        var.fresh_t(\"i\", TPtr(TInt)), \n#        var.fresh_t(\"b\", TReal)\n#     ])\n#     ----> TFunc( TPtr(TInt), TReal )\n#\n# NOTE: useful for converting lists of fully typed variables into a function proto\n\n_fProto := (a) -> ApplyFunc(TFunc, List(a, e -> e.t));\n\n#\n## _fCall\n#\n# create a function call in 'spiral-code' reprentation given an array and a fully typed variable list\n#\n# eg: _fCall(\"foo\", [\n#        var.fresh_t(\"i\", TPtr(TInt)), \n#        var.fresh_t(\"b\", TReal)\n#     ])\n#     ----> call(\"foo\", TFunc(TPtr(TInt), TReal), i, b)\n#\n# NOTE: this is generally unparsed to\n#\n#     foo(i, b)\n#\n_fCall := (name, var_array) -> ApplyFunc(call, Concat([var(name, _fProto(var_array))], var_array));\n\n#\n## _wrapInPtr\n#\n# copy a list of vars, creating new vars that are pointers\n#\n# eg: _wrapInPtr([\n#        var.fresh_t(\"i\", TPtr(TInt))\n#        var.fresh_t(\"b\", TReal)\n#     ])\n#     ---> [ var.fresh_t(\"i\", TPtr(TPtr(TInt))), var.fresh_t(\"b\", TPtr(TReal)) ]\n#\n# this is useful if you want to pass by reference, as in the case of allocation functions.\n#\n# NOTE: this function does not modify the input array\n\n_wrapInPtr := (var_array) -> List(var_array, e -> CopyFields(e, rec(t := TPtr(e.t))));\n\n\n#\n## _arraysToPtrs\n#\n# turns arrays into pointers so that the arrays are not statically defined.\n#\n_arraysToPtrs := (var_array) -> List(var_array, \n    e -> When(ObjId(e.t) = TArray, \n        CopyFields(e, rec(t := TPtr(e.t.t))),\n        CopyFields(e)\n    )\n);\n    \n#\n## _getXY\n#\n# get input and output arrays. returns a nested array, \n#   IsArray(X) and IsArray(Y) = true\n#\n# NOTE: var.fresh cannot be used here, as this function needs to ALWAYS \n# return the same data, as it may be called >1 \n#\n_getXY := function(sums, opts)\n    local X, Y, precision;\n\n    precision := 64;\n\n    if IsBound(opts.precision) then\n        if opts.precision = \"single\" then\n            precision := 32;\n        elif opts.precision = \"double\" then\n            precision := 64;\n        else\n            Error(\"Unknown precision\");\n        fi;\n    fi;\n    \n    if IsBound(opts.doSumsUnification) and opts.doSumsUnification then\n        X := List([1..Length(sums.dmn())],\n           (i) -> var(Concatenation(\"X\", String(i)), sums.dmn()[i], sums.dmn()[i].size));\n        Y := List([1..Length(sums.rng())],\n           (i) -> var(Concatenation(\"Y\", String(i)), sums.rng()[i], sums.rng()[i].size));\n\n        return [X, Y];\n    fi;\n\n    if IsList(sums.dims()[2])  then\n        X := List([ 1 .. Length(sums.dims()[2]) ], \n            (x) -> var(Concatenation(\"X\", String(x)), TPtr(T_Real(precision)), sums.dims()[2]));\n    else\n        X := Cond(IsBound(opts.X), opts.X, [var(\"X\", TArray(T_Real(precision), sums.dims()[2]), sums.dims()[2])]);\n    fi;\n\n    if IsList(sums.dims()[1])  then\n        Y := List([ 1 .. Length(sums.dims()[1]) ], \n            (x) -> var(Concatenation(\"Y\", String(x)), TPtr(T_Real(precision)), sums.dims()[1]));\n    else\n        Y := Cond(\n            opts.inplace, X, \n            IsBound(opts.Y), opts.Y, \n            [var(\"Y\", TArray(T_Real(precision), sums.dims()[1]), sums.dims()[1])]\n        );\n    fi;\n    \n    return [X, Y];\nend;\n\n######################\n#\n## default wrappers: init/compute, alloc, timer, verify, data\n#\n# these defaults generate the above functions and our output has the following\n# characteristics:\n#\n# temp variables on the stack\n# statically declared data (twiddles in case of DFT)\n# calloc'ed (default allocate func) input/output pointers\n#\n######################\n\n#\n## _DefaultWrapInitCompute\n#\n#\n# wraps passed in code in compute() function, generates init() function.\n#\nClass(_DefaultWrapInitCompute, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, io, params, datas, sub, initsub, init, compute;\n\n        # extract data from 'sums'\n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, x, Concat(y, x));\n        params := Set(Collect(sums, param));\n        datas := Collect(sums, FDataOfs);\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # generate the 'init' code\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            init := func(TVoid, initsub, params, chain(\n                List(datas, e -> SReduce(e.var.init, opts))\n            ));\n        else\n            init := func(TVoid, initsub, When(params = [], [TVoid], params), code);\n        fi;\n\n        # wrap the 'compute'\n        compute := func(TVoid, sub, Concatenation(io, params), code);\n\n        return program(chain(\n            init,\n            compute\n        ));\n    end\n));\n\n#\n## _DefaultWrapAlloc\n#\n# sets up allocation functions.\n#\n# NOTE: only functions in 'code' are preserved, everything else is trashed.\n\nClass(_DefaultWrapAlloc, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, io, iop, sub, initsub, funcs, alloc, free;\n\n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, x, Concat(y, x));\n        iop := _wrapInPtr(io);\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # extract functions.\n        funcs := Collect(code, func);\n\n        # ensure ordering, code must already be wrapped by init/compute\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = sub or e.id = initsub)));\n\n        # we expect a program wrapper\n        Constraint(ObjId(code) = program);\n\n        alloc := func(TVoid, \"alloc\", iop, chain(\n            List(iop, e -> allocate(\n                deref(e), \n                e.t.t\n#                When(IsBound(e.range) and ObjId(e.t) = TPtr,\n#                    TArray(e.t.t, e.range),\n#                    e.t\n#                )\n            ))\n        ));\n\n        free := func(TVoid, \"dealloc\", io, chain(\n            List(io, e -> deallocate(\n                e, \n                e.t\n#                When(IsBound(e.range) and ObjId(e.t) = TPtr,\n#                    TArray(e.t.t, e.range),\n#                    e.t\n#                )\n            ))\n        ));\n\n#        alloc.countedArithCost := (self, countrec) >> countrec.arithcost(0);\n#        free.countedArithCost := (self, countrec) >> countrec.arithcost(0);\n\n        Add(code.cmds, alloc);\n        Add(code.cmds, free);\n\n        return code;\n    end\n));\n\n#\n## _DefaultWrapTimer\n#\n# adds a timer function. \n#\n# relies on existing init, compute, alloc, and dealloc.\n\nClass(_DefaultWrapTimer, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, io, params, sub, initsub, funcs, i, numruns, t, timer;\n\n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, x, Concat(y, x));\n        params := Set(Collect(sums, param));\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # extract functions.\n        funcs := Collect(code, func);\n\n        # ensure ordering, make sure we have an init and compute\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = sub or e.id = initsub)));\n\n        # ensure ordering, make sure we have the alloc/dealloc functions too!\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = \"alloc\" or e.id = \"dealloc\")));\n\n        # we expect a program wrapper\n        Constraint(ObjId(code) = program);\n\n        # these two are used interchangably, MUST be same type.\n        i := var.fresh_t(\"i\", TInt);\n        numruns := var.fresh_t(\"numruns\", TInt);\n\n        t := var(\"t\", TPtr(TVoid));\n\n        timer := func(TVoid, \"timer\", [t, numruns],\n            decl(Concat(_arraysToPtrs(io), params), chain(\n                _fCall(\"alloc\", List(io, addrof)),\n                _fCall(initsub, params),\n\n                # this is used by simics to switch from a fast functional\n                # to a slow timed execute mode\n                When(IsBound(opts.extraTimerCall) and opts.extraTimerCall,\n                    _fCall(\"timer_start\", [t]),\n                    skip()\n                ),\n                When(IsBound(opts.coldcache) and opts.coldcache, \n                    skip(),\n                    _fCall(sub, Concat(io, params)) # warm up the cache by default\n                ), \n                _fCall(\"timer_start\", [t]),\n                loop(i, numruns, \n                    _fCall(sub, Concat(io, params))\n                ),\n                _fCall(\"timer_end\", [t]),\n                _fCall(\"dealloc\", io)\n            ))\n        );\n    \n#        timer.countedArithCost := (self, countrec) >> countrec.arithcost(0);\n\n        Add(code.cmds, timer);\n\n        return code;\n    end,\n));\n\n#\n## _DefaultWrapVerify\n#\n#\nClass(_DefaultWrapVerify, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, io, params, sub, initsub, funcs, i, j, basis, printY, verify;\n        \n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, x, Concat(y, x));\n        params := Set(Collect(sums, param));\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # extract functions.\n        funcs := Collect(code, func);\n\n        # ensure ordering, make sure we have an init and compute\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = sub or e.id = initsub)));\n\n        # ensure ordering, make sure we have the alloc/dealloc functions too!\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = \"alloc\" or e.id = \"dealloc\")));\n        \n        # we expect a program wrapper\n        Constraint(ObjId(code) = program);\n\n        i := var.fresh_t(\"i\", TInt);\n        j := var.fresh_t(\"j\", TInt);\n\n        basis := func(TVoid, \"basis\", Concat(x, [j]),\n            chain(\n                loop(i, x[1].range,\n                    assign(nth(x[1], i), V(0))\n                ),\n                assign(nth(x[1], j), V(1))\n            )\n        );\n\n        # outputs only entries in y[1].\n        printY := func(TVoid, \"printY\", y, chain(\n            PRINT(\"[\"),\n            PRINT(\"%lf\", nth(y[1], 0)),\n            loop(i, (y[1].range-1), \n                PRINT(\", %lf\", nth(y[1], add(i,1)))\n            ),\n            PRINT(\"]\")\n\n        ));\n\n        verify := func(TVoid, \"verify\", [], \n            decl(_arraysToPtrs(io), chain(\n\n                _fCall(\"alloc\", List(io, addrof)),\n\n                _fCall(initsub, params),\n\n                PRINT(\"[\\\\n\"),\n                loop(i, x[1].range, chain(\n                    _fCall(\"basis\", Concat(x, [i])),\n                    _fCall(sub, Concat(io, params)),\n                    _fCall(\"printY\", y),\n\n\n                    IF(neq(i, x[1].range-1), PRINT(\",\\\\n\"), skip())\n                )),\n                PRINT(\"\\\\n];\\\\n\"),\n                _fCall(\"dealloc\", io)\n            ))\n        );\n\n#        basis.countedArithCost := (self, countrec) >> countrec.arithcost(0);\n#        printY.countedArithCost := (self, countrec) >> countrec.arithcost(0);\n#        verify.countedArithCost := (self, countrec) >> countrec.arithcost(0);\n\n        Append(code.cmds, [basis, printY, verify]);\n        \n        return code;\n    end\n));\n\n#\n## _DefaultWrapData\n#\n# must be done after all function wraps\n#\n# allocates data arrays (for things like twiddles) globally in the file.\n#\nClass(_DefaultWrapData, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local datas, data;\n\n        datas := Collect(sums, FDataOfs);\n\n        # for static data declared in file.\n        data := List(datas, e -> e.var);\n\n        # we expect a program wrapper\n        Constraint(ObjId(code) = program);\n\n        # put data chunk at start of program\n\n        code.cmds := Concat([decl(data, skip())], code.cmds);\n\n        return code;\n    end\n));\n\n#\n## _DefaultWrapAll\n#\n# same structure as the new legacy wrap except uses the new timer paradigm.\n#\n# by structure, we have \n# data (like twiddles) in the data segment, not allocated\n# input/output arrays allocated\n# temporary arrays on the stack\n#\nClass(_DefaultWrap, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local \n            x, y, io, iop, params, datas,                # sums related data\n            sub, initsub,                                # strings\n            t, j, i,                                   # var names\n            data,                                        # twiddle/other data\n            init, compute, alloc, free, timer, verify,   # functions\n            basis, printY,                               # \n            prog;                                        # full program\n\n        #\n        # data from sums\n        #\n\n        # in/out and sizes\n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, x, Concat(y, x));\n        iop := _wrapInPtr(io);\n        params := Set(Collect(sums, param));\n        datas := Collect(sums, FDataOfs);\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        #\n        # code sections start here:\n        #\n\n        # generate the 'init' code\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            init := func(TVoid, initsub, params, chain(\n                List(datas, e -> SReduce(e.var.init, opts))\n            ));\n        else\n            init := func(TVoid, initsub, params, code);\n        fi;\n\n        # wrap the 'compute'\n        compute := func(TVoid, sub, Concatenation(io, params), code);\n\n        # create the allocs/free\n        #\n        # NOTE: extra level of derefs because we modify incoming pointers\n        alloc := func(TVoid, \"alloc\", iop, chain(\n            List(iop, e -> allocate(\n                deref(e), \n                When(IsBound(e.range) and ObjId(e.t.t) = TPtr,\n                    TArray(e.t.t.t, e.range),\n                    e.t.t\n                )\n            ))\n        ));\n\n        free := func(TVoid, \"dealloc\", io, chain(\n            List(io, e -> deallocate(\n                e, \n                When(IsBound(e.range) and ObjId(e.t) = TPtr,\n                    TArray(e.t.t, e.range),\n                    e.t\n                )\n            ))\n        ));\n\n        #\n        # setup timer\n        # \n\n        # these two are used interchangably, MUST be same type.\n        j := var.fresh_t(\"j\", TInt);\n        i := var.fresh_t(\"i\", TInt);\n\n        t := var(\"t\", TPtr(TVoid));\n\n        timer := func(TVoid, \"timer\", [t, j],\n            decl(Concat(io, params), chain(\n                _fCall(\"alloc\", List(io, addrof)),\n                _fCall(initsub, params),\n                _fCall(\"timer_start\", [t]),\n                loop(i, j, \n                    _fCall(sub, Concat(io, params))\n                ),\n                _fCall(\"timer_end\", [t]),\n                _fCall(\"dealloc\", io)\n            ))\n        );\n    \n        #\n        # verifier\n        #\n\n        # verifier helpers\n        #\n        # \n\n        basis := func(TVoid, \"basis\", Concat(x, [j]),\n            chain(\n                loop(i, x[1].range,\n                    assign(nth(x[1], i), V(0))\n                ),\n                assign(nth(x[1], j), V(1))\n            )\n        );\n\n        printY := func(TVoid, \"printY\", y, skip());\n\n        verify := func(TVoid, \"verify\", [], \n            decl(io, chain(\n\n                _fCall(\"alloc\", List(io, addrof)),\n\n                _fCall(initsub, params),\n\n                loop(i, x[1].range, chain(\n                    _fCall(\"basis\", Concat(x, [i])),\n                    _fCall(sub, Concat(io, params)),\n                    _fCall(\"printY\", y)\n                )),\n\n                _fCall(\"dealloc\", io)\n            ))\n        );\n\n        # for static data declared in file.\n        data := List(datas, e -> e.var);\n\n        #\n        # put pieces together\n        #\n\n        prog := program(\n            decl(data, chain(\n                init,\n                compute,\n                comment(\"\"),\n                comment(\"****************************************\"),\n                comment(\"* timer/verifier code below this point *\"),\n                comment(\"****************************************\"),\n                alloc,\n                free,\n                timer,\n                basis,\n                printY,\n                verify\n            ))\n        );\n\n        return prog;\n    end,\n));\n", "meta": {"hexsha": "cba1c62c44785e8c5d36dfd1c38e4de2442b0b1d", "size": 16767, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/cgwrap.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/cgwrap.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/cgwrap.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.8588640275, "max_line_length": 114, "alphanum_fraction": 0.4999701795, "num_tokens": 4295, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.35936415888237616, "lm_q2_score": 0.06954173823859386, "lm_q1q2_score": 0.024990808269330658}}
{"text": "~% gap\n\n            #########           ######         ###########           ###\n         #############          ######         ############         ####\n        ##############         ########        #############       #####\n       ###############         ########        #####   ######      #####\n      ######         #         #########       #####    #####     ######\n     ######                   ##########       #####    #####    #######\n     #####                    ##### ####       #####   ######   ########\n     ####                    #####  #####      #############   ###  ####\n     #####     #######       ####    ####      ###########    ####  ####\n     #####     #######      #####    #####     ######        ####   ####\n     #####     #######      #####    #####     #####         #############\n      #####      #####     ################    #####         #############\n      ######     #####     ################    #####         #############\n      ################    ##################   #####                ####\n       ###############    #####        #####   #####                ####\n         #############    #####        #####   #####                ####\n          #########      #####          #####  #####                ####\n\n     Information at:  http://www.gap-system.org\n     Try '?help' for help. See also  '?copyright' and  '?authors'\n\n   Loading the library. Please be patient, this may take a while.\nGAP4, Version: 4.4.12 of 17-Dec-2008, x86_64-unknown-linux-gnu-gcc\nComponents:  small 2.1, small2 2.0, small3 2.0, small4 1.0, small5 1.0, small6 1.0, small7 1.0, small8 1.0,\n             small9 1.0, small10 0.2, id2 3.0, id3 2.1, id4 1.0, id5 1.0, id6 1.0, id9 1.0, id10 0.1, trans 1.0,\n             prim 2.1  loaded.\nPackages:    AClib 1.1, Polycyclic 2.6, Alnuth 2.2.5, AutPGrp 1.4, CrystCat 1.1.3, Cryst 4.1.6, CRISP 1.3.2,\n             CTblLib 1.1.3, TomLib 1.1.4, FactInt 1.5.2, GAPDoc 1.2, FGA 1.1.0.1, IRREDSOL 1.1.2, LAGUNA 3.5.0,\n             Sophus 1.23, Polenta 1.2.7, ResClasses 2.5.3  loaded.\ngap> join := function(a, b, sep)\n>   return Concatenation(a, sep, sep, b);\n> end;\nfunction( a, b, sep ) ... end\ngap>\ngap> join(\"Rosetta\", \"Code\", \":\");\n\"Rosetta::Code\"\ngap>\n", "meta": {"hexsha": "86ef10710c77d16f31c9a74cff7a609fd3a5307f", "size": 2217, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Interactive-programming/GAP/interactive-programming.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Interactive-programming/GAP/interactive-programming.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Interactive-programming/GAP/interactive-programming.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 55.425, "max_line_length": 112, "alphanum_fraction": 0.2679296346, "num_tokens": 660, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46490157137338844, "lm_q2_score": 0.05261895371912669, "lm_q1q2_score": 0.0244626342680456}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#\n# Typ ::\n#\n# Value ::\n#    t = <type>\n#    v = <.>\n#\n# Types:\n#   TReal \n#   TComplex\n#   TInt\n#   TArray(<type>, <size>)\n#   TVect(<type>, <vlen>)\n#\n# Value(<type>, <.>)\n# V(<.>)   infers type automatically\n#\n\nDeclare(Value, IsExp, IsValue, TArray, TVect, BitVector, T_UInt);\n\n_evInt := v -> Cond(IsInt(v), v, IsList(v), List(v, i->_evInt(i)), v.ev());\n\n#----------------------------------------------------------------------------------------------\n# Typ : data types\n#----------------------------------------------------------------------------------------------\nClass(TypOps, rec(\n    Print := x-> When(IsBound(x.print), x.print(), Print(x.__name__)),\n    \\= := RewritableObjectOps.\\=,\n    \\< := RewritableObjectOps.\\<\n));\nClass(TypOpsNoPrint, ClassOps, rec(\n    \\= := RewritableObjectOps.\\=,\n    \\< := RewritableObjectOps.\\<\n));\n\n\nDeclare(RangeT);\n\nClass(RangeTOps, PrintOps, rec(\n    \\= := (v1,v2) -> When( ObjId(v1)<>RangeT or ObjId(v2)<>RangeT, false,\n        v1.max=v2.max and v1.min=v2.min and v1.eps=v2.eps),\n    \\< := (v1,v2) -> Error(\"Operation '<' is undefined for RangeT.\"),\n    \\+ := (v1,v2) -> When( ObjId(v1)<>RangeT or ObjId(v2)<>RangeT, Error(\"'+' is defined for RangeT only\"),\n        RangeT(Min2(v1.min, v2.min), Max2(v1.max, v2.max), Max2(v1.eps, v2.eps))),\n    \\* := (v1,v2) -> When( ObjId(v1)<>RangeT or ObjId(v2)<>RangeT, Error(\"'*' is defined for RangeT only\"),\n        RangeT(Max2(v1.min, v2.min), Min2(v1.max, v2.max), Max2(v1.eps, v2.eps))),\n));\n\n#F RangeT(<min>, <max>, <eps>): data type range\n#F  <min> smallest value, <max> largest value, <eps> unit roundoff\nClass(RangeT, rec(\n    __call__ := (self, min, max, eps) >> \n        WithBases(self, rec( min := min, max := max, eps := eps, operations := RangeTOps)),\n    print    := self >> Print(self.__name__, \"(\", self.min, \", \", self.max, \", \", self.eps, \")\"),\n));\n\nClass(Typ, rec(\n    operations := TypOps,\n    isType := true,\n    isSigned := self >> true,\n    doHashValues := false,\n    check := v -> v,\n    #normalize := (self, v) >> Value(self,v),\n    eval := self >> self,\n\n    vbase := rec(),\n\n    value := meth(self, v)\n        local ev;\n        if IsExp(v) then\n            ev := v.eval();\n            if IsSymbolic(ev) and not IsValue(ev) then\n                v.t := self;\n                return v;\n            fi;\n        fi;\n\n        if IsValue(v) then return Value.new(self, self.check(v.v));\n        else return Value.new(self,self.check(v));\n        fi;\n    end,\n\n    realType := self >> self,\n\n    product  := (v1, v2) -> v1 * v2,\n    sum      := (v1, v2) -> v1 + v2,\n    base_t   := self >> self, # composite types should return base data type (without recursion).\n    saturate := abstract(), # (self, v) >> ...\n    # range should return RangeT\n    range    := abstract(), # (self) >> ...\n));\n\nClass(CompositeTyp, Typ, rec(operations := TypOpsNoPrint));\n\nClass(AtomicTyp, Typ, rec(\n    doHashValues := true,\n    isAtomic := true,\n    rChildren := self >> [],\n    from_rChildren := (self, rch) >> Checked(rch=[], self),\n    free := self >> Union(List(self.rChildren(), FreeVars)),\n    vtype := (self,v) >> TVect(self, v),\n    csize := self >> sizeof(self)\n));\n\nIsType := x -> IsRec(x) and IsBound(x.isType) and x.isType;\n\nClass(TFunc, RewritableObject, Typ, rec(\n    check := v -> v, #Checked(IsFunction(v), v),\n    product := (v1, v2) -> Error(\"Can not multiply functions\"),\n    sum  := (v1, v2) -> Error(\"Can not add functions\"),\n    zero := (v1, v2) -> Error(\"TFunc.zero() is not supported\"),\n    one  := (v1, v2) -> Error(\"TFunc.one() is not supported\"),\n    free := self >> Union(List(self.params, FreeVars)),\n    updateParams := self >> Checked(ForAll(self.params, e->IsType(e) or IsValue(e) or IsInt(e) or IsSymbolic(e)), true),\n    csize := self >> sizeof(self)\n));\n\nIsFuncT := x -> IsType(x) and ObjId(x)=TFunc;\n\nClass(ValueOps, PrintOps, rec(\n    \\= := (v1,v2) -> Cond(\n        not IsValue(v2), v1.v=v2,\n        not IsValue(v1), v1=v2.v,\n        IsBound(v1.t.vequals), v1.t.vequals(v1.v, v2.v),\n        IsBound(v2.t.vequals), v2.t.vequals(v1.v, v2.v),\n        v1.v = v2.v),\n    \\< := (v1,v2) -> Cond(\n        not IsValue(v2), When(IsRec(v2), ObjId(v1) < ObjId(v2), v1.v < v2),\n        not IsValue(v1), When(IsRec(v1), ObjId(v1) < ObjId(v2), v1   < v2.v),\n        v1.v < v2.v)\n ));\n\n#----------------------------------------------------------------------------------------------\n# Value : values or constants\n# NB: All values are automatically hashed in GlobalConstantHash\n#     This can reduce memory footprint, since lots of values are repetitive,\n#     like 1s and 0s, and also float values that are too close to each other will\n#     hash to same value (by virtue of ValueOps.\\=), which will prevent compiler\n#     from putting them in separate registers, and thus degrading performance.\n#\n#     This has negligible effect on accuracy, as long as <type>.vequals is valid.\n#     \n#----------------------------------------------------------------------------------------------\nClass(Value, rec(\n    isValue := true,\n    __call__ := (self, t, v) >> t.value(v),\n\n    new := (self,t,v) >> # HashedValue(GlobalConstantHash,  <-- this hashes the Value upon construction, disabled now\n                         # due to slowness with large data() blocks, which aren't hashed, unless this option is used\n\tCond(t.vbase=rec(),\n            WithBases(self, rec(t:=t, v:=v, operations := ValueOps)),\n            WithBases(self, Inherit(t.vbase, rec(t:=t, v:=v, operations:=ValueOps)))\n\t),\n    #),\n\n    ev := self >> self.v,\n    eval := self >> self,\n    free := self >> Set([]),\n\n    from_rChildren := (self, rch) >> self,\n#   print := self >> Print(self.__name__, \"(\", self.t, \",\", self.v, \")\"),\n#   print := self >> Print(self.v),\n    print := self >> Cond(IsString(self.v), Print(\"V(\\\"\",self.v, \"\\\")\"), Print(\"V(\", self.v, \")\")),\n\n    dims := self >> Cond(\n\tIsArrayT(self.t), self.t.dims(),\n\tError(\"<self>.dims() is only valid when self.t is a TArray\"))\n));\n\nIsValue := x -> IsRec(x) and IsBound(x.isValue) and x.isValue; \n\n#----------------------------------------------------------------------------------------------\n#----------------------------------------------------------------------------------------------\n\nDeclare(TComplex);\n\nClass(TUnknown, AtomicTyp, rec( one := self >> 1, zero := self >> 0));\nClass(TVoid,    AtomicTyp);\nClass(TDummy,   AtomicTyp); # used in autolib for Lambda parameters that are ignored\n\nClass(TReal, AtomicTyp, rec(\n    cutoff := 1e-15,\n    hash := (val, size) -> 1 + (DoubleRep64(Double(val)) mod size), #(IntDouble(1.0*val*size) mod size),\n\n    check := (self,v) >> Cond(\n        IsExp(v),     ReComplex(Complex(code.EvalScalar(v))),\n        IsInt(v),     Double(v),\n        IsRat(v),     v,\n        IsDouble(v),  When(AbsFloat(v) < self.cutoff, 0.0, v),\n        IsCyc(v),     ReComplex(Complex(v)),\n        IsComplex(v), ReComplex(v),\n        Error(\"<v> must be a double or an expression\")),\n\n    vequals := (self, v1,v2) >> When(\n        (IsDouble(v1) or IsInt(v1) or IsRat(v1)) and (IsDouble(v2) or IsInt(v2) or IsRat(v2)),\n        AbsFloat(Double(v1)-Double(v2)) < self.cutoff,\n        false),\n\n    zero := self >> self.value(0.0),\n    one := self >> self.value(1.0),\n    strId := self >> \"f\",\n    \n    complexType := self >> TComplex,\n));\n\n\nTDouble:=TReal;\n\n#\n# format:  | sign | integer bits | frac bits |\n# # make sure we have space at least for the sign bit\n#\n_fpdouble := (val,b,fb) -> let(res := IntDouble(val * 2.0^fb),\n    Cond(\n\tval = 1 and (fb = b-1), # we can represent 1 as 0.999999, if we use frac bits only\n\t    2^fb - 1,\n\tval = -1 and (fb = b-1), # we can represent 1 as 0.999999, if we use frac bits only\n\t    -(2^fb - 1),\n\tLog2Int(res)+2 > b, Error(\"Overflow, value=\", val, \", signed width=\",\n                                   Log2Int(res)+2, \", max width=\", b),\n         res));\n\n# format:  | integer bits | frac bits |\n#\n_ufpdouble := (val,b,fb) -> let(res := IntDouble(val * 2.0^fb),\n    When(Log2Int(res)+1 > b, Error(\"Overflow, value=\", val, \", unsigned width=\",\n                                   Log2Int(res)+1, \", max width=\", b),\n         res));\n\n#F TFixedPt(<bits>, <fracbits>)   -- fixed point data type\n#F\n#F   <bits> -- total # of bits (including sign bit)\n#F   <fracbits> -- number of fractional bits\n#F\n#F   Number of integer bits is assumed to be bits-1-fracbits (1 = sign bit)\n#F\nClass(TFixedPt, TReal, rec(\n    operations := TypOpsNoPrint, # NOTE: do not inherit from TReal, and then this line won't be needed\n\n    __call__ := (self, bits, fracbits) >> WithBases(self, rec(\n            bits := bits,\n            fracbits := fracbits,\n            operations := TypOps)),\n\n    rChildren := self >> [self.bits, self.fracbits],\n    rSetChild := rSetChildFields(\"bits\", \"fracbits\"),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n\n    print := self >> Print(self.__name__, \"(\", self.bits, \", \", self.fracbits, \")\"),\n\n    check := (self, v) >> _fpdouble(v, self.bits, self.fracbits)\n));\n\n# TUFixedPt(<bits>, <fracbit>)  -- unsigned fixed point data type\n#\nClass(TUFixedPt, TFixedPt);\n\nClass(TComplex, AtomicTyp, rec(\n    hash := (val, size) -> let(\n        cplx := Complex(val), \n        #h := IntDouble(size * (ReComplex(cplx)+ImComplex(cplx))),\n        h := DoubleRep64(ReComplex(cplx)) + DoubleRep64(ImComplex(cplx)),\n        1 + (h mod size)),\n\n    check := v -> Cond(\n        BagType(v) in [T_CYC, T_RAT, T_INT], v, # exact representation\n        IsDouble(v),  When(AbsFloat(v) < TReal.cutoff, 0, v),\n        IsComplex(v), Complex(TReal.check(ReComplex(v)), TReal.check(ImComplex(v))),\n        IsExp(v),     Complex(v.ev())),\n\n    realType    := self >> TReal,\n    complexType := self >> self,\n\n    zero := self >> self.value(0.0),\n    one := self >> self.value(1.0),\n));\n\nClass(TBool, AtomicTyp, rec(\n    hash := (val, size) -> 1 + (InternalHash(val) mod size),\n    check := v -> Cond(IsBool(v), v, Error(\"<v> must be a boolean\")),\n    one := self >> self.value(true),\n    zero := self >> self.value(false),\n));\n\nClass(TInt_Base, AtomicTyp, rec(\n    hash    := (val, size) -> 1 + (10047871*val mod size),\n    bits    := 32,\n    check   := v -> Cond(IsExp(v), Int(v.ev()),\n                         IsInt(v), v,\n                         IsDouble(v) and IsInt(IntDouble(v)), IntDouble(v),\n                         Error(\"<v> must be an integer or an expression\")),\n    one  := self >> self.value(1),\n    zero := self >> self.value(0),\n\n    complexType := self >> TComplex,\n));\n\nClass(TInt, TInt_Base, rec(strId := self >> \"i\"));\nClass(TUInt, TInt_Base, rec(isSigned := False, strId := self >> \"ui\"));\nClass(TULongLong, TInt_Base);\n\nIsChar := (x)->When(BagType(x)=T_CHAR, true, false);\n\nClass(TChar, TInt_Base, rec(\n    hash := (val, size) -> When(IsChar(val), 1 + (InternalHash(val) mod size), TInt_Base.hash(val, size)),\n    bits := 8,\n    check := v -> Cond(IsExp(v), Int(v.ev()),\n                       IsInt(v), v, \n                       IsChar(v), v,  \n                       Error(\"<v> must be an integer or an expression\")),\n));\n\nClass(TUChar, TInt_Base, rec(\n    bits := 8,\n    isSigned := self >> false,\n    check := v -> Cond(IsExp(v), Int(v.ev()),\n                       IsInt(v), v,\n                       Error(\"<v> must be an integer or an expression\")),\n));\n\nClass(TString, AtomicTyp, rec(\n    doHashValues := true,\n    hash := (val, size) -> 1 + (InternalHash(val) mod size),\n    check := v -> Cond(IsString(v), v, Error(\"<v> must be a string\")),\n    one := self >> Error(\"TString.one() is not allowed\"),\n    zero := self >> Error(\"TString.zero() is not allowed\"),\n));\n\nClass(TList, CompositeTyp, rec(\n    isListT := true,\n    hash := (val, size) -> Error(\"Not implemented\"),\n    __call__ := (self, t) >>\n        WithBases(self, rec(\n        t    := Checked(IsType(t), t),\n        operations := PrintOps)),\n    print := self >> Print(self.__name__, \"(\", self.t, \")\"),\n    check := v -> Cond(IsList(v), v, Error(\"<v> must be a list\")),\n\n    one  := self >> Error(\"TList.one() is not allowed\"),\n    zero := self >> Error(\"TList.zero() is not allowed\"),\n\n    rChildren := self >> [self.t],\n    rSetChild := rSetChildFields(\"t\"),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n\n));\n\nClass(TSym, CompositeTyp, rec(\n    hash := (val, size) -> Error(\"Not implemented\"),\n    check := v -> v,\n    __call__ := (self, id) >>\n        WithBases(self, rec(\n        id    := Checked(IsString(id), id),\n        operations := TypOps)),\n\n    rChildren := self >> [self.id],\n    rSetChild := rSetChildFields(\"id\"),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n\n    print := self >> Print(self.__name__, \"(\\\"\", self.id, \"\\\")\"),\n    csize := self >> sizeof(self)\n));\n\n#F TArrayBase -- base class for array-like element collection types\n#F\n#F Subclasses: TPtr, TArray, TVect, BitVector\n#F\n#F Default constructor:\n#F\n#F  __call__(<element-type>, <size>) - array type of <size> elements of <element-type>\n#F\nClass(TArrayBase, CompositeTyp, rec(\n     __call__ := (self, t, size) >>\n        WithBases(self, rec(\n        t    := Checked(IsType(t), t),\n        size := Checked(IsPosInt0Sym(size), size),\n        operations := TypOps)),\n\n    hash := (self, val, size) >> (Sum(val, x -> x.t.hash(x.v, size)) mod size) + 1,\n\n    rChildren := self >> [self.t, self.size],\n    rSetChild := rSetChildFields(\"t\", \"size\"),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n\n    isSigned := self >> self.t.isSigned(),\n\n    print := self >> Print(self.__name__, \"(\", self.t, \", \", self.size, \")\"),\n\n    check := (self, v) >> Checked(IsList(v), Length(v) = self.size,\n    ForAll(v, el -> el.t = self.t), v),\n\n    # these fields go into values\n    vbase := rec(\n        free := self >> Union(List(self.v, e -> e.free())),\n        rChildren := self >> self.v,\n        rSetChild := meth(self, n, newC) self.v[n] := newC; end\n    ),\n\n    zero := self >> self.value(Replicate(_unwrap(self.size), self.t.zero())),\n    one  := self >> self.value(Replicate(_unwrap(self.size), self.t.one())),\n\n    value := (self, v) >> let(vv := When(IsValue(v), v.v, v),\n        Cond(IsExp(vv), vv,\n             Checked(IsList(vv),\n                     Value.new(self, List(vv, e->self.t.value(e)))))),\n\n    # array type can have free variables in .size field\n    free := self >> Union(FreeVars(self.size), FreeVars(self.t)),\n\n    csize := self >> self.t.csize() * self.size,\n\n    realType := self >> ObjId(self)(self.t.realType(), self.size),\n\n    base_t := self >> self.t,\n    range  := self >> self.t.range(),\n));\n\nDeclare(TPtr, TArray);\n\n#F TArray(<element-type>, <size>) - array type of <size> elements of <element-type>\n#F\nClass(TArray, TArrayBase, rec(\n    isArrayT := true,\n    vtype := (self, v) >> TArray(self.t.vtype(v), self.size/v),\n    toPtrType := self >> TPtr(self.t),\n    doHashValues := true,\n\n    dims := self >> Cond(\n        ObjId(self.t)=TArray, [self.size] :: self.t.dims(),\n        [self.size])\n));\n\n# [ptrAligned, ptrUnaligned] are TPtr.alignment values\nptrUnaligned := [1,0];\nptrAligned4  := [4,0];\nptrAligned8  := [8,0];\nptrAligned16 := [16,0];\nptrAligned := ptrAligned16;\n\n# NOTE: this is a hack, esp because 16 byte boundary is hardcoded in ptrAligned\n#        It should be in SpiralDefaults somehow\nTArray.alignment := ptrAligned; \nTArray.qualifiers := [];\n\nTypeDomain := (dom, els) ->\n    Cond(Same(dom, Rationals) or Same(dom, Scalars) or Same(dom, Doubles), TReal,\n     Same(dom, Complexes), TComplex,\n     Same(dom, Cyclotomics), When(ForAll(els, x->Im(x)=0), TReal, TComplex),\n     Same(dom, Integers), TInt,\n     Error(\"Unrecognized domain <dom>\"));\n\n# IsArrayT(<t>) - checks whether <t> is an array type object\nIsArrayT := x -> IsType(x) and IsBound(x.isArrayT) and x.isArrayT;\n\n# IsListT(<t>) - checks whether <t> is a list type object\nIsListT := x -> IsType(x) and IsBound(x.isListT) and x.isListT;\n\n# IsVecT(<t>) - checks whether <t> is an vector type object\nIsVecT := x -> IsType(x) and IsBound(x.isVecT) and x.isVecT;\n\n# IsPtrT(<t>) - checks whether <t> is a pointer type object\nIsPtrT := x-> IsType(x) and IsBound(x.isPtrT) and x.isPtrT;\n\n# IsUnalignedPtrT(<t>) - checks whether <t> is a unaligned pointer type object,\n#       unaligned means aligned with smaller granularity than child type (t.t)\n#       size.\nIsUnalignedPtrT := x -> IsPtrT(x) and x.alignment<>ptrAligned;\n\n\n# obsolete, use IsArrayT\nIsArray := IsArrayT;\n\nClass(TPtr, TArrayBase, rec(\n     isPtrT := true,\n     __call__ := arg >> let(self := arg[1],\n         t          := arg[2],\n         qualifiers := When(IsBound(arg[3]), arg[3], []),\n         alignment  := When(IsBound(arg[4]), arg[4], ptrAligned16),\n         WithBases(self, rec(\n            t    := Checked(IsType(t), t),\n            size := 0,\n            qualifiers := qualifiers,\n            _restrict  := false,\n            alignment  := alignment,\n            operations := TypOps)).normalizeAlignment()),\n\n     # value := (self, v) >> Error(\"Values of TPtr type are not allowed\"),\n     value := Typ.value,\n\n     check := (self, v) >> Cond(\n        IsList(v), Checked(\n           Length(v) = self.size,\n           ForAll(v, el -> el.t = self.t), \n           v\n        ),\n        IsInt(v), v,\n        Error(\"TPtr needs to either point to an array or some value\")\n     ),\n\n     # this looks crazy, but sometimes this happens (in LRB backend actually) : X - X\n     # where X is a pointer. Internally this can become X + (-X), and then becomes 0\n     isSigned := self >> true,\n\n     rChildren := self >> [self.t, self.qualifiers, self.alignment],\n     rSetChild := rSetChildFields(\"t\", \"qualifiers\", \"alignment\"),\n\n     zero := self >> TInt.zero(),\n     one := self >> TInt.one(),\n\n     print := self >> Print(self.__name__, \"(\", self.t,\n         When(self.qualifiers<>[], Print(\", \", self.qualifiers)), \")\",\n         When(self._restrict, \".restrict()\", \"\"),\n         \".aligned(\", self.alignment, \")\"\n         ),\n\n     restrict := (self) >> CopyFields(self, rec(_restrict := true)),\n     unRestricted := (self) >> CopyFields(self, rec(_restrict := false)),\n\n     csize := self >> sizeof(self),\n\n     realType := self >> Cond(self._restrict,\n         ObjId(self)(self.t.realType(), self.qualifiers).restrict(),\n         ObjId(self)(self.t.realType(), self.qualifiers)\n     ),\n\n     aligned   := (self, a) >> CopyFields(self, rec( alignment := Checked(IsList(a) and Length(a)=2, a)  )).normalizeAlignment(),\n     unaligned := (self) >> CopyFields(self, rec( alignment := [1,0] )),\n\n     normalizeAlignment := meth(self)\n         if IsValue(self.alignment[2]) then self.alignment[2] := self.alignment[2].v;\n         elif IsSymbolic(self.alignment[2]) then self.alignment := ptrUnaligned; # NOTE: Conservative assumption\n         fi;\n         Constraint(IsInt(self.alignment[2]));\n         self.alignment[2] := self.alignment[2] mod self.alignment[1];\n         return self;\n     end,\n\n     withAlignment := (self, value) >> CopyFields(self, rec( \n         alignment := When(IsPtrT(value), value.alignment, value))),\n\n     # things get a little strange here because we allow pointers\n     # to be set to some int based offset \n     # \n     vbase := rec(\n         free := self >> Cond(\n             IsList(self.v), Union(List(self.v, e -> e.free())),\n             IsInt(self.v), [],\n             Error(\"hmm.\")\n         ),\n         rChildren := self >> Cond(\n             IsList(self.v), self.v,\n             IsInt(self.v), [], \n             Error(\"hmm.\")\n         ),\n\n         rSetChild := meth(arg)\n             local _self;\n             _self := arg[1];\n\n             if Length(arg) = 3 then\n                _self.v[arg[2]] := arg[3];\n             elif Length(arg) = 2 then\n                _self.v := arg[2];\n             else\n                Error(\"choke\");\n             fi;    \n         end,\n     ),\n));\n\n\n# -- TVect ----------------------------------------------------------------------\n\nClass(TVect, TArrayBase, rec(\n    isVecT := true,\n    doHashValues := true,\n    __call__ := (self, t, size) >> Cond(t=T_UInt(1), BitVector(size), Inherited(t, size)),\n\n    product := (v1, v2) -> Checked(IsList(v1) or IsList(v2), let(\n        vv1 := When(not IsList(v1), Replicate(Length(v2), v1), v1),\n        vv2 := When(not IsList(v2), Replicate(Length(v1), v2), v2),\n        l := Length(vv1),\n        Checked(l = Length(vv2),\n            List([1..l], i -> vv1[i]*vv2[i])))),\n\n    sum := (v1, v2) -> Checked(IsList(v1) or IsList(v2), let(\n        vv1 := When(not IsList(v1), Replicate(Length(v2), v1), v1),\n        vv2 := When(not IsList(v2), Replicate(Length(v1), v2), v2),\n        l := Length(vv1),\n        Checked(l = Length(vv2),\n            List([1..l], i -> vv1[i]+vv2[i])))),\n\n    value := (self, v) >> Cond( IsValue(v) and self=v.t, v, let(\n        vv := When(IsValue(v), v.v, v),\n        Cond(IsExp(vv), vv,\n             IsList(vv), Value.new(self, List(vv,                       e -> self.t.value(e))),\n             <#else#>    \n                         Value.new(self, List(Replicate(self.size, vv), e -> self.t.value(e)))))),\n\n    saturate := (self, v) >> let( vv := _unwrap(v), Cond(not IsList(vv) or Length(vv)<>self.size, v,\n        Value.new(self, List(vv, e -> self.t.saturate(e)))) ),\n  \n    toUnsigned := self >> TVect(self.t.toUnsigned(), self.size),\n    toSigned   := self >> TVect(self.t.toSigned(),   self.size),\n    double     := self >> TVect(self.t.double(),     self.size/2),\n\n));\n\nIsTVectDouble := x -> IsVecT(x) and x.t = TReal;\n\nTVectDouble := vlen -> TVect(TReal, vlen);\n\n#Class(T_Type, Typ, rec(\n#     __call__ := (self, bits) >>\n#        WithBases(self, rec(\n#        bits := Checked(IsPosInt(bits), bits),\n#        operations := TypOps)),\n#\n#     hash := (self, val, size) >>  1 + (10047871*val mod size),\n#\n#     rChildren := self >> [],\n#     rSetChild := self >> Error(\"This function should not be called\"),\n#     print := self >> Print(self.__name__, \"(\", self.bits, \")\"),\n#     free := self >> Union(List(self.rChildren(), FreeVars)),\n#     vtype := (self,v) >> TVect(self, v)\n#));\n\nClass(T_Type, RewritableObject, rec(\n    isType := true,\n\n    isSigned := self >> true,\n    realType := self >> self,\n\n    doHashValues := false, \n    check := v -> v,\n    vbase := rec(),\n\n    value := meth(self, v)\n        local ev;\n        if IsExp(v) then\n            ev := v.eval();\n            if IsSymbolic(ev) and not IsValue(ev) then\n                v.t := self;\n                return v;\n            fi;\n        fi;\n        if IsValue(v) then\n            return Value.new(self, self.check(v.v));\n        else\n            return Value.new(self, self.check(v));\n        fi;\n    end,\n\n    eval     := self >> self,\n    product  := (v1, v2) -> v1 * v2,\n    sum      := (v1, v2) -> v1 + v2,\n    zero     := self >> self.value(0),\n    one      := self >> self.value(1),\n    csize    := self >> sizeof(self),\n    base_t   := self >> self, # composite types should return base type (without recursion).\n    saturate := abstract(), # (self, v) >> ...\n    range    := abstract(), # (self) >> ...\n));                           \n\nDeclare(T_Int, T_UInt, T_Complex);\n\nClass(T_Ord, T_Type, rec(\n    hash := (val, size) -> 1 + (10047871*val mod size),\n    saturate := (self, v) >> let( b := self.range(),\n        Cond( IsExp(v), v, self.value(Max2(b.min, Min2(b.max, _unwrap(v)))))),\n));\n\nClass(T_Int, T_Ord, rec(\n    check := (self, v) >> let(\n        i := Cond(IsDouble(v), IntDouble(v),\n                  IsRat(v), Int(v),\n                  Error(\"Can't convert <v> to an integer\")),\n        b := self.params[1],\n        ((i + 2^(b-1)) mod 2^b) - 2^(b-1)),\n\n    strId    := self >> \"i\"::StringInt(self.params[1]),\n    range    := self >> RangeT(-2^(self.params[1]-1),  2^(self.params[1]-1)-1,  1),\n    \n    isSigned   := True,\n    toUnsigned := self >> T_UInt(self.params[1]),\n    toSigned   := self >> self,\n    double     := self >> T_Int(2*self.params[1]),\n));\n\nClass(T_UInt, T_Ord, rec(\n    check := (self, v) >> let(\n        i := Cond(IsDouble(v), IntDouble(v),\n                  IsRat(v), Int(v),\n                  Error(\"Can't convert <v> to an integer\")),\n        b := self.params[1],\n        i mod 2^b),\n\n    strId    := self >> \"ui\"::StringInt(self.params[1]),\n    range    := self >> RangeT(0, 2^self.params[1]-1, 1),\n\n    isSigned   := False,\n    toUnsigned := self >> self,\n    toSigned   := self >> T_Int(self.params[1]),\n    double     := self >> T_UInt(2*self.params[1]),\n));\n\nClass(BitVector, TArrayBase, rec(\n    isVecT := true,\n    __call__ := (self, size) >> Inherited(T_UInt(1), size),\n\n    print := self >> Print(self.__name__, \"(\", self.size, \")\"),\n    vbase := rec(\n        print := self >> let(n:=Length(self.v), Print(\"h'\", HexStringInt(Sum([1..n], i->self.v[i] * 2^(n-i))))), \n    ),\n    \n    isSigned := self >> false,\n\n    rChildren := self >> [self.size],\n    rSetChild := rSetChildFields(\"size\"),\n\n    one := self >> self.value(Replicate(self.size, 1)),\n    zero := self >> self.value(Replicate(self.size, 0)),\n\n    hash := (self, val, size) >> let(n:=Length(val),\n        1 + (Sum([1..n], i -> val[i] * 2^(n-i)) mod size)),\n \n    product := TVect.product,\n    sum := TVect.sum,\n\n    _uint1 := T_UInt(1),\n\n    value := (self, v) >> When( IsValue(v) and v.t = self, v,\n        let(vv := When(IsValue(v), v.v, v),\n            Cond(IsExp(vv), vv,\n                 Checked(IsList(vv),\n                     Value.new(self, List(vv, e->self._uint1.check(e))))))),\n));\n\nClass(T_Real, T_Type, rec(\n   #correct cutoffs are floor(log10(2^(mantissa bits + 1)))\n   cutoff := self>>Cond(\n       self.params[1] = 128, 1e-34,\n       self.params[1] = 80, 1e-19,\n       self.params[1] = 64, 1e-15,\n       self.params[1] = 32, 1e-7,\n       Error(\"cutoff not supported\")\n   ),\n\n   hash := TReal.hash, \n   \n   check := (self,v) >> let( r := Cond(\n            IsExp(v),     ReComplex(Complex(code.EvalScalar(v))),\n            IsInt(v),     Double(v),\n            IsRat(v),     v,\n            IsDouble(v),  v,\n            IsCyc(v),     ReComplex(Complex(v)),\n            IsComplex(v), ReComplex(v),\n            # else\n                Error(\"<v> must be a double or an expression\")),\n        When(AbsFloat(r) < self.cutoff(), 0.0, r)),\n\n   vequals := (self, v1,v2) >> When(\n        (IsDouble(v1) or IsInt(v1)) and (IsDouble(v2) or IsInt(v2)),\n        AbsFloat(Double(v1)-Double(v2)) < self.cutoff(),\n        false),\n\n   zero := self >> self.value(0.0),\n   one := self >> self.value(1.0),\n   isSigned := (self) >> true,\n   strId := self >> \"f\"::StringInt(self.params[1]),\n   range := self >> Cond( \n       self.params[1] = 128, RangeT(\n           -1.7976931348623157e+308 - 10e291, #INF\n           1.7976931348623157e+308 + 10e291, #INF\n           1e-34\n       ),\n       self.params[1] = 80, RangeT(\n           -1.7976931348623157e+308 - 10e291, #INF\n           1.7976931348623157e+308 + 10e291, #INF\n           1e-19\n       ),\n       self.params[1] = 64, RangeT(\n           -1.7976931348623157e+308,\n            1.7976931348623157e+308,\n            1.1102230246251565e-016\n       ),\n       self.params[1] = 32, RangeT(\n           -3.4028234e+038,\n            3.4028234e+038,\n            5.96046448e-008\n       )),\n   \n   complexType := self >> T_Complex(self),\n));\n\nClass(T_Complex, T_Type, rec(\n    hash := TComplex.hash,\n    realType    := self >> self.params[1],\n    complexType := self >> self,\n    \n    isSigned := self >> self.params[1].isSigned(),\n    strId    := self >> \"c\"::self.params[1].strId(),\n\n    check := (self, v) >> let(\n\trealt := self.params[1],\n\tcpx := Complex(v),\n\tComplex(realt.check(ReComplex(cpx)),\n\t        realt.check(ImComplex(cpx))))\n));\n\n# # complex type is made up of TWO T_Real, T_Uint, or T_Int types.\n\n# Class(T_Complex, TArrayBase, rec(\n#     isComplex := true,\n#     __call__ := (arg) >> let(\n#         self := arg[1],\n#         t := arg[2],\n#         Checked(\n#             ObjId(t) in [T_Real, T_UInt, T_Int],\n#             WithBases(self, rec(\n#                 t := t,\n#                 qualifiers := When(Length(arg) > 2, arg[3], []),\n#                 operations := TypOps,\n#                 size := 0\n#             ))\n#         )\n#     ),\n\n#     rChildren := self >> [self.t, self.qualifiers],\n#     rSetChild := rSetChildFields(\"t\", \"qualifiers\"),\n\n#     print := self >> Print(self.__name__, \"(\", self.t,\n#         When(self.qualifiers <> [],\n#             Print(\", \", self.qualifiers)\n#         ),\n#         \")\"\n#     )\n# ));\n\n_IsVar := (e) -> code.IsVar(e);\n\n#F T_Struct: structure type.\n#F\n#F T_Struct(\"structname\", [<var1>, <var2>, ... , <varN>])\n#F\nClass(T_Struct, T_Type, rec(\n    updateParams := meth(self)\n        Constraint(IsString(self.params[1]));\n        Constraint(IsList(self.params[2]));\n        Constraint(ForAll(self.params[2], e -> _IsVar(e)));\n    end,\n\n    getName := self >> self.params[1],\n    getVars := self >> self.params[2]\n));\n\nIsIntT := (t) -> IsType(t) and t in [TChar, TInt] or ObjId(t) = T_Int;\nIsUIntT := (t) -> IsType(t) and t in [TUChar, TUInt] or ObjId(t) = T_UInt;\nIsOrdT := (t) -> IsIntT(t) or IsUIntT(t);\n\nIsFixedPtT := (t) -> IsType(t) and ObjId(t)=TFixedPt; \n\nIsRealT := (t) -> IsType(t) and t=TReal or ObjId(t)=T_Real;\n\nIsComplexT := (t) -> IsType(t) and t=TComplex or ObjId(t)=T_Complex;\n\nIsOddInt :=  n -> When(IsValue(n), n.v mod 2 = 1, IsInt(n) and n mod 2 = 1);\n\nIsEvenInt := n -> When(IsValue(n), n.v mod 2 =0, IsInt(n) and n mod 2 = 0);\n", "meta": {"hexsha": "7f3a901f62ec0be325228e49b99451725e4966a3", "size": 29402, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/types.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/types.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/types.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.6022857143, "max_line_length": 129, "alphanum_fraction": 0.5354737773, "num_tokens": 8602, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3998116407397951, "lm_q2_score": 0.06097518214476315, "lm_q1q2_score": 0.024378587617705613}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nprep_hex_perm_spu := function(p)\n    local retval;\n    retval :=  ConcatenationString(\n                \"0x\", p{[  1 ..  8]}, \", \",\n                \"0x\", p{[  9 .. 16]}, \", \",\n                \"0x\", p{[ 17 .. 24]}, \", \",\n                \"0x\", p{[ 25 .. 32]});\n    return(retval);\nend;\n\n\nprep_perm_string_spu := function(p)\n    local base_string, final_string, i_counter, zeroOutString, v;\n    # This handles both 4x32f and 2x64f perm strings\n    v := Length(p);\n    base_string := [0..((16/v)-1)];\n    zeroOutString := List([1..(16/v)], i->128);\n    final_string := [];\n    # A value of '128' in the permutation param list causes the spu_shuffle to zero out the corresponding bytes.\n    for i_counter in (p-1) do # changed Reversed(p-1) to (p-1)\n       if i_counter = 127 then\n          Append(final_string, zeroOutString);\n        else\n           Append(final_string, (base_string + i_counter * (16/v)));\n        fi;\n    od;\n    return final_string;\nend;\n\n# NOTE: The first section is Intel SSE/2/3 specific, and has to be ported\n# over to SPU\n\nunpacklo := (l1,l2,n,k) -> Flat(List([1..n/(2*k)], i-> [\n        List([1..k], j->l1[(i-1)*k+j]),\n        List([1..k], j->l2[(i-1)*k+j])\n]));\n\nunpackhi := (l1,l2,n,k) -> Flat(List([1..n/(2*k)], i -> [\n        List([1..k], j->l1[n/2+(i-1)*k+j]),\n        List([1..k], j->l2[n/2+(i-1)*k+j])\n]));\n\nsparams := (l,n) -> List([1..l], i->[1..n]);\n\nshuffle := (in1, in2, p, n, k) -> Flat([\n    List([1..n/(2*k)],     i->List([1..k], j->in1[(p[i]-1)*k+j])),\n    List([n/(2*k)+1..n/k], i->List([1..k], j->in2[(p[i]-1)*k+j]))\n]);\n\niperm4 := self >> Filtered(Cartesian(self.params()), i->i[1]<>i[2] and i[3] <> i[4]);\n\n\n# Generic instructions\n#\nClass(vop_new_mixin, rec(\n    params := self >> [],\n    permparams := self >> Cartesian(self.params()),\n    isBinop := self >> self.numargs = 2,\n    isUnop := self >> self.numargs = 1,\n    isLoadop := False,\n    isStoreop := False,\n));\n\nClass(vop_new, vop_new_mixin, Exp, rec(\n    __call__ := arg >> let(self:=arg[1], \n    _computeExpType(WithBases(self, rec(\n        p          := When(Length(arg) >= self.numargs+2, arg[self.numargs+2], []),\n        args       := Concat(List(Sublist(arg, [2..self.numargs+1]), toExpArg),\n                        When(Length(arg) >= self.numargs+2 and arg[self.numargs+2] <> [],\n                        [vparam(arg[self.numargs+2])], [])),\n        operations := ExpOps\n    )))\n    ),\n));\n\nClass(vbinop_new, vop_new, rec(numargs:=2));\nClass(vunop_new, vop_new, rec(numargs:=1));\n\nClass(vunbinop_new, vop_new, rec(\n    numargs := 1,\n    params := self >> self.binop.params(),\n    v := self >> self.binop.v,\n    semantic := (self, in1, p) >> self.binop.semantic(in1, in1, p)\n));\n\nClass(vloadop_new, vop_new, rec(\n    numargs := 0,\n    isLoadop := True,\n    # in case of explicit type cast (YSV modification), we don't need getNoScalar,\n    # and below returns [], compiler understands not to mess with typecasts\n    getNoScalar := self >> When(IsBound(self.noscalar) and IsBound(self.args[self.noScalar].loc),\n\tself.args[self.noScalar].loc, [])\n));\n\nClass(vstoreop_new, assign, vop_new_mixin, rec(\n    isStoreop := True,\n    # in case of explicit type cast (YSV modification), we don't need getNoScalar,\n    # and below returns [], compiler understands not to mess with typecasts\n    getNoScalar := self >> let(s := self.loc,\n    When(IsBound(s.loc), s.loc, []))\n));\n\nClass(vstoremsk, assign, vop_new_mixin, rec(\n    isStoreop := True,\n   __call__ := (self, loc, exp, p) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       exp := toExpArg(exp),\n       p := p)),\n\n    print := (self,i,is) >> Print(Blanks(i), self.name, \"(\",\n    self.loc.print(), \", \", self.exp.print(), \", \", self.p, \");\\n\"),\n\n    # in case of explicit type cast (YSV modification), we don't need getNoScalar,\n    # and below returns [], compiler understands not to mess with typecasts\n    getNoScalar := self >> When(IsBound(self.noscalar) and IsBound(self.args[self.noScalar].loc),\n\tself.args[self.noScalar].loc, [])\n));\n", "meta": {"hexsha": "eafe501fd626402a8d8354ae55def11d125c3260", "size": 4122, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/cellSPU/misc.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/cellSPU/misc.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/cellSPU/misc.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.2419354839, "max_line_length": 112, "alphanum_fraction": 0.5727802038, "num_tokens": 1281, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4455295350395727, "lm_q2_score": 0.05419873402437071, "lm_q1q2_score": 0.024147136769611353}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#\n# NEON 64-bit and 128-bit SIMD ISA Definitions\n#\n# legend: v = ok, ! = missing, u = added, untested\n    # Required:\n    #  v active\n    #  v bin_shl1  bin_shl2  bin_shr1  bin_shr2  bin_shrev\n    #  v bits, ctype, t, v\n    #  v countrec\n    #  v includes\n    #  v info\n    #  v instr\n    #  v isFixedPoint, isFloat\n    #  v loadCont (uses sv loads, ARM does not have masked loads)\n    #  v mul_cx, mul_cx_conj\n    #  u reverse\n    #  v splopts\n    #  v storeCont (uses sv stores, ARM does not have masked stores)\n    #  v svload\n    #  v svstore\n    #  v RCVIxJ2\n    #  v dupload, duploadn\n    #  ! hadd\n    #  v swap_cx\n    #  v vzero\n\n    # Fixed point:\n    #  fracbits\n    #  saturatedArithmetic\n\n    # Viterbi:\n    #  ! interleavedmask, hmin, average (?), isSigned\n\nClass(SIMD_NEON, SIMD_ISA, rec(   \n    file := \"neon\",\n    commonIncludes := self >> [],\n    active       := true,\n    isFixedPoint := false,\n    isFloat      := true,\n    ctype        := \"float32_t\",\n    stype        := \"__attribute__ ((aligned(16))) float32_t\",\n    bits         := 32,\n    useDeref     := false,\n    splopts      := rec(precision := \"single\"),\n    arrayDataModifier := \"__attribute__ ((aligned(16)))\",\n    arrayBufModifier  := \"static __attribute__ ((aligned(16)))\",\n    declareConstants := true,\n    threeOps         := false,\n    fma\t\t     := true,\n    vzero := self >> self.t.zero(),\n    unparser := NEONUnparser,\n    compileStrategy := self >> BaseIndicesCS\n      :: When(self.fma, [DoFMA], [])\n      :: [ MarkDefUse, #\n           (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n           MarkDefUse, #\n           (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))) ]\n      :: When(self.threeOps, [DoThreeOp], [])\n      :: [ Compile.declareVars,\n           (c, opts) -> opts.vector.isa.fixProblems(c, opts),\n           HashConsts ],\n\n    loadCont := (self, n, y, yofs, x, xofs, xofs_align, opts) >> let(\n\tnn := _unwrap(n), \n\tyy := vtref(self.t, y, yofs),\n\tassign(yy, deref(nth(x, xofs).toPtr(self.t)))),\n\n    storeCont := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\tnn := _unwrap(n),\n\txx := vtref(self.t, x, xofs),\n\tassign(deref(nth(y, yofs).toPtr(self.t)), xx)),\n\n    storeContAcc := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\ta  := _unwrap(yofs_align),\n\tnn := _unwrap(n),\n\txx := vtref(self.t, x, xofs),\n\tt  := TempVec(TArray(xx.t.t, xx.t.size)),\n\tdecl([t], chain(\n\t    self.loadCont(nn, t, 0, y, yofs, yofs_align, opts), \n\t    assign(vtref(self.t, t, 0), vtref(self.t, t, 0) + xx), \n\t    self.storeCont(nn, y, yofs, yofs_align, t, 0, opts)))),\n));\n\nDeclare(NEON_HALF);\n\nClass(NEON_HALF, SIMD_NEON, rec(\n    info := \"NEON 2 x floating point\",\n    v     := 2,\n    t     := TVect(T_Real(32), 2),\n    freshU  := self >> var.fresh_t(\"u\", TVect(self.t, 2)),\n    freshT  := self >> var.fresh_t(\"t\", self.t),\n    instr   := [vunpacklo_half,  vunpackhi_half, vrev_half ],\n\n    includes := self >> self.commonIncludes() :: \n        [\"<arm_neon.h>\", \"<include/omega32_neon.h>\", \"<include/mm_malloc.h>\"], \n\n    dupload := (y, x) -> assign(y, vdup(x, 2)),\n    duploadn := (y, x, n) -> assign(y, vdup_lane_half(x, n)),\n\n    reverse := (y,x) -> assign(vref(y,0,2), vrev_half(vref(x,0,2))),\n    RCVIxJ2 := (y,x,opts) -> assign(y, vrev_half(x)),\n   \n    # this is shift \"right\" in Spiral notation (and ARM too)\n    # [a b] -> [0 a]\n    bin_shl1 := (self, y,x,opts) >> assign(y, vext_half(self.t.zero(), x, 1)),\n    # this is shift \"left\" in Spiral notation (and ARM too)\n    # [a b] -> [b 0]\n    bin_shr1 := (self, y,x,opts) >> assign(y, vext_half(x, self.t.zero(), 1)),\n\n    # this is shift \"right\" in Spiral notation (and ARM too)\n    # [a b], [c,d] -> [b c]\n    bin_shl2 := (self, y,x,opts) >> assign(y, vext_half(x[1], x[2], 1)),\n    # this is shift \"left\" in Spiral notation (and ARM too)\n    # [a b], [c,d] -> [b c]\n    bin_shr2 := (self, y,x,opts) >> assign(y, vext_half(x[1], x[2], 1)),\n\n    # [a b], [c,d] -> [b c]\n    bin_shrev := (self, y,x,opts) >> assign(y, vext_half(x[1], x[2], 1)),\n\n    countrec := rec(\n        ops := [\n           [ add, sub ],\n\t   [ mul, vmulcx_half ],\n           [ fma, fms, nfma ],\n           [ vunpacklo_half, vunpackhi_half, vrev_half, vswapcx_half, vtrnq_half, vextract_half,\n\t     vdup_lane_half ],\n           [ vload1_half ],\n           [ deref, nth, ],\n           Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\",\"[mults]\",\"[fmas]\",\"[vperms]\",\"[svldst]\",\"[vldst]\",\"[vval]\"],\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n   loadCont := (self, n, y, yofs, x, xofs, xofs_align, opts) >> let(\n\tnn := _unwrap(n), \n\tyy := vtref(self.t, y, yofs),\n\tp0 := nth(x, xofs).toPtr(self.t.t),\n\tCond(\n\t    nn=1, assign(yy, vload1_half(p0, self.vzero(), 1)), \n\t    nn=2, assign(yy, deref(nth(x, xofs).toPtr(self.t)))\n\t)\n    ),\n\n    storeCont := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\tnn := _unwrap(n),\n\txx := vtref(self.t, x, xofs),\n\tp0 := nth(y, yofs).toPtr(self.t.t),\n\tCond(\n\t    nn=1, vstore1_half(p0, xx, 1),\n\t    nn=2, assign(deref(nth(y, yofs).toPtr(self.t)), xx)\n\t)\n    ),\n\n    svload := [\n        # load using subvectors of length 1\n\t[   (y,x,opts) -> assign(y, vload1_half(x[1].toPtr(NEON_HALF.t.t),\n\t\t                                NEON_HALF.vzero(), 1)),\n\n            (y,x,opts) -> let(u := var.fresh_t(\"T\", NEON_HALF.t),\n                decl([u], chain(\n                        assign(u, vload1_half(x[1].toPtr(NEON_HALF.t.t), \n\t\t\t\t              NEON_HALF.vzero(), 1)),\n                        assign(y, vload1_half(x[2].toPtr(NEON_HALF.t.t), u, 2))\n                )))\n\t],\n        # load using subvectors of length 2\n        [(y,x,opts) -> assign(y, nth(x[1].toPtr(TVect(TReal, 2)), 0)) ]\n    ],\n\n    svstore := [\n        [  (y,x,opts) -> vstore1_half(y[1].toPtr(NEON_HALF.t.t), x, 1),\n           (y,x,opts) -> chain(\n               vstore1_half(y[1].toPtr(NEON_HALF.t.t), x, 1),\n               vstore1_half(y[2].toPtr(NEON_HALF.t.t), x, 2)\n           )\n        ],\n        [  (y,x,opts) -> assign(nth(y[1].toPtr(NEON_HALF.t), 0), x) ]\n    ],\n\n    mul_cx := (self, opts) >> ((y,x,c) -> let(\n\tu := self.freshU(),  v1 := self.freshT(), v2 := self.freshT(), r1 := self.freshT(), \n\tdecl([u, v1, v2, r1], chain(\n\t\tassign(r1, self.t.value([-1.0,1.0])),\n         \tassign(u, vtrnq_half(c, c)),\n\t\tassign(v1, x * vextract_half(u, [0])),\n\t\tassign(v2, vswapcx_half(x) * vextract_half(u, [1])),\n\t\tassign(y, fma(v1, v2, r1))))\n    )),\n\n    mul_cx_conj := (self, opts) >> ((y,x,c) -> let(\n\tu := self.freshU(),  v1 := self.freshT(), v2 := self.freshT(), r1 := self.freshT(), \n\tdecl([u, v1, v2, r1], chain(\n\t\tassign(r1, self.t.value([1.0, -1.0])),\n         \tassign(u, vtrnq_half(c, c)),\n\t\tassign(v1, x * vextract_half(u, [0])),\n\t\tassign(v2, vswapcx_half(x) * vextract_half(u, [1])),\n\t\tassign(y, fma(v1, v2, r1))))\n    )),\n\n    swap_cx := (y, x, opts) -> assign(y, vswapcx_half(x)),\n));\n\nClass(NEON, SIMD_NEON, rec(\n    info := \"NEON 4 x floating point\",\n\n    countrec := rec(\n        ops := [\n            [ add, sub ],\n\t    [ mul, vmulcx_neon ],\n            [ fma, fms, nfma ],\n            [ vpacklo_neon,      vpackhi_neon,       vunpacklo_neon,    vunpackhi_neon,\n              vunpacklolo2_neon, vunpacklohi2_neon,  vunpackhilo2_neon, vunpackhihi2_neon,\n              vtransposelo_neon, vtransposehi_neon,  vrev_neon,         vswapcx_neon, \n              vuzpq_32f,         vzipq_32f,          vtrnq_32f,         vextract_neon_4x32f,\n\t      vdup_lane_neon ],\n            [ vload1_neon, vload_half_neon, vcombine_neon ],\n            [ deref, nth, ],\n            Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\",\"[mults]\",\"[fmas]\",\"[vperms]\",\"[svldst]\",\"[vldst]\",\"[vval]\"],\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n    v     := 4,\n    t     := TVect(T_Real(32), 4),\n    freshU := self >> var.fresh_t(\"u\", TVect(self.t, 2)),\n    freshT := self >> var.fresh_t(\"t\", self.t),\n\n    instr := [vpacklo_neon,    vpackhi_neon, \n              vunpacklo_neon,  vunpackhi_neon, \n              vunpacklolo2_neon,   vunpacklohi2_neon,\n              vunpackhilo2_neon,   vunpackhihi2_neon,\n              vtransposelo_neon, vtransposehi_neon,\n\t      vrev_neon ],\n\n    includes := self >> self.commonIncludes() :: \n        [\"<arm_neon.h>\", \"<include/omega32_neon.h>\", \"<include/mm_malloc.h>\"], \n\n    dupload  := (y, x) -> assign(y, vdup(x, 4)),\n    duploadn := (y, x, n) -> assign(y, vdup_lane_neon(x, n)),\n\n    reverse := (y,x) -> assign(vref(y,0,4), vrev_neon(vext_neon(vref(x,0,4), vref(x,0,4), 2))),\n    RCVIxJ2 := (y,x,opts) -> assign(y, vext_neon(x, x, 2)),\n\n    # this is shift \"right\" in Spiral notation (and ARM too)\n    # [a b c d] -> [0 a b c]\n    bin_shl1 := (self, y,x,opts) >> assign(y, vext_neon(self.t.zero(), x, 1)),\n    # this is shift \"left\" in Spiral notation (and ARM too)\n    # [a b c d] -> [b c d 0]\n    bin_shr1 := (self, y,x,opts) >> assign(y, vext_neon(x, self.t.zero(), 3)),\n\n    # this is shift \"right\" in Spiral notation (and ARM too)\n    # [a b c d], [e f g h] -> [d e f g]\n    bin_shl2 := (self, y,x,opts) >> assign(y, vext_neon(x[1], x[2], 1)),\n    # this is shift \"left\" in Spiral notation (and ARM too)\n    # [a b c d], [e f g h] -> [b c d e]\n    bin_shr2 := (self, y,x,opts) >> assign(y, vext_neon(x[1], x[2], 3)),\n\n    # [a b c d] [e f g h] -> [e d c b]\n    # support for VO1dsJ(n, v)\n    bin_shrev := (self, y, x, opts) >> let(\n\tu := var.fresh_t(\"T\", self.t), \n\tdecl([u], chain(\n\t\tassign(u, vext_neon(x[1], x[2], 3)), # [ b c d e]\n\t\tassign(u, vext_neon(u, u, 2)),       # [ d e b c]\n\t\tassign(y, vrev_neon(u))))            # [ e d c b]\n    ),\n\n    loadCont := (self, n, y, yofs, x, xofs, xofs_align, opts) >> let(\n\tnn := _unwrap(n), \n\tyy := vtref(self.t, y, yofs),\n\tp0 := nth(x, xofs).toPtr(self.t.t),\n\tp2 := nth(x, xofs+2).toPtr(self.t.t),\n\tCond(\n\t    nn=1, \n\t        assign(yy, vload1_neon(p0, self.vzero(), 1)), \n\t    nn=2,\n                assign(yy, vcombine_neon(\n\t\t\t       vload_half_neon(p0), \n\t\t\t       NEON_HALF.vzero())),\n\t    nn=3,\n                assign(yy, vcombine_neon(\n\t\t\t       vload_half_neon(p0), \n\t\t\t       vload1_half(p2, NEON_HALF.vzero(), 1))),\n\t    nn=4,\n\t        assign(yy, deref(nth(x, xofs).toPtr(self.t)))\n\t)\n    ),\n\n    storeCont := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\tnn := _unwrap(n),\n\txx := vtref(self.t, x, xofs),\n\tp0 := nth(y, yofs).toPtr(self.t.t),\n\tp2 := nth(y, yofs+2).toPtr(self.t.t),\n\tCond(\n\t    nn=1, \n\t\tvstore1_neon(p0, xx, 1),\n\t    nn=2,\n\t\tvstore2lo_neon(p0, xx),\n\t    nn=3, chain(\n\t\tvstore2lo_neon(p0, xx),\n\t\tvstore1_neon(p2, xx, 3)),\n\t    nn=4,\n\t        assign(deref(nth(y, yofs).toPtr(self.t)), xx)\n\t)\n    ),\n\n    svload := [\n        # load using subvectors of length 1\n\t[\n            (y,x,opts) -> assign(y, vload1_neon(x[1].toPtr(NEON.t.t), NEON.vzero(), 1)),\n\n            (y,x,opts) -> let(u := NEON.freshT(), \n                    decl([u], chain(\n                            assign(u, vload1_neon(x[1].toPtr(NEON.t.t), NEON.vzero(), 1)),\n                            assign(y, vload1_neon(x[2].toPtr(NEON.t.t), u,            2))))),\n            (y,x,opts) -> let(u := NEON.freshT(), \n                    decl([u], chain(\n                            assign(u, vload1_neon(x[1].toPtr(NEON.t.t), NEON.vzero(), 1)),\n                            assign(u, vload1_neon(x[2].toPtr(NEON.t.t), u,            2)),\n                            assign(y, vload1_neon(x[3].toPtr(NEON.t.t), u,            3))))),\n            (y,x,opts) -> let(u := NEON.freshT(), \n                    decl([u], chain(\n                            assign(u, vload1_neon(x[1].toPtr(NEON.t.t), NEON.vzero(), 1)),\n                            assign(u, vload1_neon(x[2].toPtr(NEON.t.t), u,            2)),\n                            assign(u, vload1_neon(x[3].toPtr(NEON.t.t), u,            3)),\n                            assign(y, vload1_neon(x[4].toPtr(NEON.t.t), u,            4)))))\n\t],\n        # load using subvectors of length 2\n        [\n            (y,x,opts) -> let(\n\t\tu := var.fresh_t(\"T\", NEON_HALF.t),\n                decl([u], chain(\n                        assign(u, vload_half_neon(x[1].toPtr(NEON_HALF.t.t))),\n                        assign(y, vcombine_neon(u, NEON_HALF.vzero()))))),\n            (y,x,opts) -> let(\n\t\tu1 := var.fresh_t(\"T\", NEON_HALF.t),\n\t\tu2 := var.fresh_t(\"T\", NEON_HALF.t),\n                decl([u1, u2] , chain(\n                        assign(u1, vload_half_neon(x[1].toPtr(NEON_HALF.t.t))),\n                        assign(u2, vload_half_neon(x[2].toPtr(NEON_HALF.t.t))),\n\t\t\tassign(y, vcombine_neon(u1, u2)))))\n        ]],\n\n\n    svstore := [ \n        # store using subvectors of length 1\n        [  (y,x,opts) -> vstore1_neon(y[1].toPtr(NEON.t.t), x, 1),\n           (y,x,opts) -> chain(\n               vstore1_neon(y[1].toPtr(NEON.t.t), x, 1),\n               vstore1_neon(y[2].toPtr(NEON.t.t), x, 2)),\n           (y,x,opts) -> chain(\n               vstore1_neon(y[1].toPtr(NEON.t.t), x, 1),\n               vstore1_neon(y[2].toPtr(NEON.t.t), x, 2),\n               vstore1_neon(y[3].toPtr(NEON.t.t), x, 3)),\n           (y,x,opts) -> chain(\n               vstore1_neon(y[1].toPtr(NEON.t.t), x, 1),\n               vstore1_neon(y[2].toPtr(NEON.t.t), x, 2),\n               vstore1_neon(y[3].toPtr(NEON.t.t), x, 3),\n               vstore1_neon(y[4].toPtr(NEON.t.t), x, 4))\n        ],\n        # store using subvectors of length 2\n        [  (y,x,opts) -> vstore2lo_neon(y[1].toPtr(NEON.t.t), x),\n           (y,x,opts) -> chain(vstore2lo_neon(y[1].toPtr(NEON.t.t), x),\n                               vstore2hi_neon(y[2].toPtr(NEON.t.t), x))\n        ]\n    ],\n\n    mul_cx := (self, opts) >> ((y,x,c) -> let(\n\t    u := self.freshU(),  v1 := self.freshT(), v2 := self.freshT(), r1 := self.freshT(), \n\t    decl([u, v1, v2, r1], chain(\n\t\t    assign(r1, self.t.value([-1.0,1.0,-1.0,1.0])),\n         \t    assign(u, vtrnq_32f(c, c)),\n\t\t    assign(v1, x * vextract_neon_4x32f(u, [0])),\n\t\t    assign(v2, vswapcx_neon(x) * vextract_neon_4x32f(u, [1])),\n\t\t    assign(y, fma(v1, v2, r1))))\n    )),\n\n    mul_cx_conj := (self, opts) >> ((y,x,c) -> let(\n\t    u := self.freshU(),  v1 := self.freshT(), v2 := self.freshT(), r1 := self.freshT(), \n\t    decl([u, v1, v2, r1], chain(\n\t\t    assign(r1, self.t.value([1.0, -1.0, 1.0, -1.0])),\n         \t    assign(u, vtrnq_32f(c, c)),\n\t\t    assign(v1, x * vextract_neon_4x32f(u, [0])),\n\t\t    assign(v2, vswapcx_neon(x) * vextract_neon_4x32f(u, [1])),\n\t\t    assign(y, fma(v1, v2, r1))))\n    )),\n\n    swap_cx := (y, x, opts) -> assign(y, vswapcx_neon(x)),\n));\n\nSIMD_ISA_DB.addISA(NEON);\nSIMD_ISA_DB.addISA(NEON_HALF);\n\n", "meta": {"hexsha": "4b6d6bc14a017351e2fa8b3848d0b304dad59974", "size": 14752, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/neon/isa.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/neon/isa.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/neon/isa.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 36.7880299252, "max_line_length": 96, "alphanum_fraction": 0.5130151844, "num_tokens": 5263, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4225046348141882, "lm_q2_score": 0.056652422122527184, "lm_q1q2_score": 0.023935910920217584}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Non-Terminals (Transforms)\n# ==========================\n# MP, from 03/24/01, GAPv3.4.4\n\n#F Non-Terminaltable (Transform Table)\n#F -----------------------------------\n#F\n\n#F The non-terminal table represents all symbols that can be used\n#F to define an spl of type \"nonTerminal\". The table is meant to be\n#F extended. In contrast to spls of type \"symbol\", an spl of type\n#F \"nonTerminal\" has no equivalent in the SPL language. The non-terminals\n#F usually represent discrete signal transforms and are used by the\n#F formula generator to represent non-terminal expressions in SPL objects.\n#F These are meant to be further expanded. Thus, an SPL object can be exported\n#F to a valid SPL program iff it contains no non-terminals.\n#F Every non-terminal is represented by a record contained in the \n#F following list NonTerminalTableSPL.\n#F The record has the form:\n#F rec(\n#F   isNonTerminal,   true, identifying a non-terminal\n#F   NonTerminalOps,  operations record\n#F   symbol,          a string for the symbol\n#F   CheckParams,     a function for checking and canonifying\n#F                    of the parameters\n#F   Dim,             a function to return the dimension from\n#F                    the parameters in canonical form\n#F   Params,          a function that returns a shorter representation\n#F                    of parameters used for printing in gap\n#F   Terminate SPL,   a function to convert into an spl without non-terminals\n#F   Transposed,      a function for transposing\n#F   isRealTransform, = true if the transform is considered as real transform,\n#F                    i.e., the matrix is real for all choices of parameters\n#F )\n#F\n#F the following fields are optional:\n#F for verification:\n#F SmallRandom        a function that returns a parameter choice for a small\n#F                    instantiation of the transform, i.e., one that can be verified\n#F                    against the definition\n#F LargeRandom        correspondingly, a function that returns a parameter choice\n#F                    for a large instantiation of the transform, used for verifying\n#F                    on a random vector\n#F\n#F HashIndexSPL       a function that returns index used for hashing. It is stored\n#F                    in .hashIndex field. Overrides the standard\n#F                    HashIndex function used in the search.\n#F\n#F hashIndex          overrides HashIndex function used in \n#F                    search. Precomputed by optional HashIndexSPL\n#F                    function and should not be specified manually.\n#F\n#F\n#F Nonterminals are created in the directory formgen/transforms\n#F\n#F The Non-Terminal table can easily be extended by adding new non-terminals\n#F (transforms).\n#F\n\n#F Non-Terminal Table\n#F ------------------\n#F\n\n#F NonTerminalTableSPL\n#F   is the set of all known non-terminals (transforms)\n#F\nNonTerminalTableSPL := Set ( [ ] );\n\n#F NonTerminalListSPL\n#F   is a set containing all known non-terminals.\n#F   Note that NonTerminalListSPl is ordered exactly as NonTerminalTableSPL.\n#F\nNonTerminalListSPL := Set( [ ] );\n\n\n#F Adding new Non-Terminals (Transforms)\n#F -------------------------------------\n#F\n\n#F AddNonTerminal ( <non-terminal> )\n#F   adds <non-terminal> to the non-terminal table. This function is \n#F   meant to import new non-terminals into NonTerminalTableSPL,\n#F   and NonTerminalListSPL, and update .index field.\n#F\n#F Note: Currently, this function is invoked automatically, when one\n#F       for example, defines new breakdown rules for a non-terminal,\n#F       \nAddNonTerminal := function ( S )\n  local i;\n  Constraint(IsNonTerminal(S));\n  if not IsBound(S.__bases__) then \n      Error(\"Old-style non-terminals are not supported anymore\");\n  fi;\n\n  if S in NonTerminalTableSPL then RemoveSet(NonTerminalTableSPL, S); fi;\n  AddSet(NonTerminalTableSPL, S);\n  AddSet(NonTerminalListSPL, S.name);\n  for i in [1..Length(NonTerminalTableSPL)] do \n      NonTerminalTableSPL[i].index := i;\n  od;\n  #UpdateApplicableTable();\nend;\n\n", "meta": {"hexsha": "dd4e072329d7b45e0b2d3d6c6d9f9f6ff13986e1", "size": 4072, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/nonterm.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/nonterm.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/nonterm.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 37.3577981651, "max_line_length": 84, "alphanum_fraction": 0.6787819253, "num_tokens": 1009, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4301473485858429, "lm_q2_score": 0.05500529410263933, "lm_q1q2_score": 0.02366038141643481}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nClass(CudaUnparser, CUnparser, rec(\n\n    simt_loop := meth(self, o, i, is) \n        local v, lo, hi, l_cond, r_cond, simt_idx, simt_rng, body;\n        \n        v := o.var; lo := o.range[1]; hi := Last(o.range); \n        simt_idx := o.simt_idx;\n        simt_rng := o.simt_idx.get_rng();\n        body := Copy(o.cmd);\n        l_cond := simt_rng[1]>0; r_cond := simt_rng[2] < simt_idx.size()-1;\n\n        if (hi-lo) < simt_rng[2]-simt_rng[1] then\n            body := SubstVars(body, rec((v.id) := simt_idx + lo - simt_rng[1]));\n            Print(Blanks(i), \"if( \");\n            if l_cond then\n                Print(self(simt_idx, 0, 0), \" >= \", self(simt_rng[1], 0, 0), \" && \");\n            fi;\n            Print(self(simt_idx, 0, 0), \" <= \", self(simt_rng[1]+hi-lo, 0, 0), \" ) {\\n\",\n                self(body, i+is, is),\n                Blanks(i), \"}\\n\");            \n        elif (hi-lo) = simt_rng[2]-simt_rng[1] then\n            body := SubstVars(body, rec((v.id) := simt_idx + lo - simt_rng[1]));\n            if l_cond or r_cond then\n                Print(Blanks(i), \"if( \");\n                if l_cond then\n                    Print(self(simt_idx, 0, 0), \" >= \", self(simt_rng[1], 0, 0));\n                fi;\n                if l_cond and r_cond then\n                    Print(\" && \");\n                fi;\n                if r_cond then\n                    Print(self(simt_idx, 0, 0), \" <= \", self(simt_rng[2], 0, 0));\n                fi;\n                Print(\" ) {\\n\");\n            fi;\n            self(body, When(l_cond or r_cond, i+is, i), is);\n            if l_cond or r_cond then\n                Print(Blanks(i), \"}\\n\");\n            fi;\n        else\n            body := SubstVars(body, rec((v.id) := simt_idx + v - simt_rng[1]));\n            Print(When(IsBound(self.opts.looppragma), self.opts.looppragma(o,i,is)),\n                Blanks(i), \"for(int \", v, \" = \", lo, \"; \");\n            if l_cond then\n                Print(self(simt_idx + v-simt_rng[1], 0, 0), \" >= \", lo, \" && \");\n            fi;\n            Print(self(simt_idx + v-simt_rng[1], 0, 0), \" <= \", hi, \"; \", \n                v, \"+=\", self(simt_rng[2]-simt_rng[1]+1, 0, 0), \") {\\n\",\n                self(body, i+is, is),\n                Blanks(i), \"}\\n\");\n        fi;\n\n    end,\n\n    Dim3 := meth(self,t,vars,i,is)\n        local v, var_list;\n        Print(\"dim3 \");\n        var_list := List(vars, v-> v.id::\"(\"::StringJoin(\", \", List([v.x.value, v.y.value, v.z.value], v -> When(IsValue(v), v.v, v) ) )::\")\");\n        self.infix(var_list, \", \");\n    end,\n\n    TArray := meth(self,t,vars,i,is)\n        local dims, elt, v, ptype, vsize, var_specs;\n        if Length(vars) > 1 then DoForAll(vars, v->Print(self.TArray(t, [v], i, is), \"; \"));\n        elif Length(vars) = 0 then\n            Print(self.declare(t.t, [], i, is), \" *\");\n        else\n            # at this point Length(vars)=1\n            v := When(IsList(vars), vars[1], vars);\n            var_specs := When(IsBound(v.decl_specs), v.decl_specs, []);\n            dims := []; elt := t;\n            while IsArray(elt) do Add(dims, elt.size); elt := elt.t; od;\n\n            #FIXME/HACK: Ignoring twiddles by looking for \"D\" in .id\n            # Better way: look for func.name=\"init\" in parent/context\n            if IsBound(self.opts.useMemoryArena) and self.opts.useMemoryArena and v.id[1] <> 'D' then\n                #FIXME: Arena currently doesn't handle multiple dims.\n                #FIXME: Slightly ugly hack to get this to be a pointer\n\n                # To handle vectors. Arena is declared only for scalars. For\n                # vectors, we must manually scale the allocation by vector length.\n                vsize := 1; if ObjId(elt)=TVect then vsize := elt.size; fi;\n                ptype := Concatenation(elt.name, \"Pointer\");\n                self.(ptype)(elt, [v], i, is);\n                Print(\" =  &(ARENA[ (arenalevel-=\",self(dims[1]*vsize,i,is),\") ])\");\n            else\n                if var_specs <> [] then\n                    Print(self.infix(var_specs, \" \"), \" \");\n                fi;\n                if IsBound(v.decl_as_ptr) and v.decl_as_ptr then\n                    Print(self.declare(t.t, [], i, is), \"*\", v.id);\n                else\n                    self.(elt.name)(elt, [v], i, is);\n                    DoForAll(dims, d->Print(\"[\",self(d,i,is),\"]\"));\n                fi;\n            fi;\n\n        fi;\n    end,\n\n    T_CudaEvent := (self, t, vars, i, is) >> \n        Print(\"cudaEvent_t \", self.infix(vars, \", \", i + is)),\n\n    cu_event_create := (self, o, i, is) >> Print(Blanks(i), \"cudaEventCreate(\", self(o.args[1], 0, 0), \n                            When(Length(o.args)>1 and not o.args[2].v, \")\", \");\\n\")),\n\n    cu_event_record := (self, o, i, is) >> Print(Blanks(i), \"cudaEventRecord(\", self(o.args[1], 0, 0), \n                            When(Length(o.args)>1 and not o.args[2].v, \")\", \");\\n\")),\n\n    cu_event_destroy := (self, o, i, is) >> Print(Blanks(i), \"cudaEventDestroy(\", self(o.args[1], 0, 0), \n                            When(Length(o.args)>1 and not o.args[2].v, \")\", \");\\n\")),\n\n    cu_event_elapsed_time := (self, o, i, is) >> Print(Blanks(i), \"cudaEventElapsedTime\", \n                                self.pinfix(o.args{[1..3]}, \", \"), \n                                When(Length(o.args)>3 and not o.args[4].v, \"\", \";\\n\")),\n    \n    cu_event_synchronize := (self, o, i, is) >> Print(Blanks(i), \"cudaEventSynchronize(\", self(o.args[1], 0, 0), \n                            When(Length(o.args)>1 and not o.args[2].v, \")\", \");\\n\")),\n\n    cu_device_synchronize := (self, o, i, is) >> Print(Blanks(i), \"cudaDeviceSynchronize(\",\n                            When(Length(o.args)>0 and not o.args[1].v, \")\", \");\\n\")),\n\n    cprintf := (self, o, i, is) >> Print(Blanks(i), \"printf(\\\"\", o.args[1].v, \"\\\", \", \n                                            self.infix(o.args{[2..Length(o.args)]}, \", \"), \");\\n\"),\n\n    func := (self, o, i, is) >> let(\n        parameters:=Flat(o.params),\n        id := Cond(o.id=\"transform\" and IsBound(self.opts.subName),\n                     self.opts.subName,\n                   o.id=\"init\"      and IsBound(self.opts.subName),\n                     Concat(\"init_\",self.opts.subName),\n                   o.id=\"destroy\"      and IsBound(self.opts.subName),\n                     Concat(\"destroy_\",self.opts.subName),\n                   o.id),\n\t\tWhen ((IsBound(self.opts.wrapCFuncs) and self.opts.wrapCFuncs), Print(\"\\nextern \\\"C\\\" {\")),\n        Print(\"\\n\", Blanks(i),\n            self.opts.funcModifier, self.declare(o.ret, var(id, o.ret), i, is), \"(\",\n            DoForAllButLast(parameters, p->Print(self.declare(p.t, p,i,is), \", \")),\n            When(Length(parameters)>0, self.declare(Last(parameters).t, Last(parameters),i,is), \"\"), \") \",\n            \"{\\n\",\n            When(IsBound(self.opts.postalign), DoForAll(parameters, p->self.opts.postalign(p,i+is,is))),\n            self(o.cmd, i+is, is),\n            Blanks(i),\n            \"}\\n\"),\n\t\tWhen ((IsBound(self.opts.wrapCFuncs) and self.opts.wrapCFuncs), Print(\"}\\n\"))),\n\n    specifiers_func := (self, o, i, is) >> let(\n        parameters:=Flat(o.params),\n        id := o.id,\n        Print(\"\\n\", Blanks(i),\n            self.opts.funcModifier, self.infix(o.decl_specs, \" \"), \" \", self.declare(o.ret, var(id, o.ret), i, is), \"(\",\n            DoForAllButLast(parameters, p->Print(self.declare(p.t, p,i,is), \", \")),\n            When(Length(parameters)>0, self.declare(Last(parameters).t, Last(parameters),i,is), \"\"), \") \",\n            \"{\\n\",\n            When(IsBound(self.opts.postalign), DoForAll(parameters, p->self.opts.postalign(p,i+is,is))),\n            self(o.cmd, i+is, is),\n            Blanks(i),\n            \"}\\n\")),\n\n    cu_call := (self, o, i, is) >>\n        Print(Blanks(i), o.func, \n                \"<<<\",\n                self.infix([o.dim_grid, o.dim_block], \", \"),\n                \">>>\",\n                self.pinfix(o.args, \", \"), \";\\n\"),\n\n    cu_allocate := (self, o, i, is) >> Print(Blanks(i),\n        \"cudaMalloc(&\",\n        self(o.loc, 0, 0), \", \", self(o.size, 0, 0), \"*sizeof(\", self.declare(o.type,[], 0, 0), \"));\\n\"),\n\n    cu_allocate_managed := (self, o, i, is) >> Print(Blanks(i),\n        \"cudaMallocManaged(&\",\n        self(o.loc, 0, 0), \", \", self(o.exp.size, 0, 0), \"*sizeof(\", self.declare(o.exp.t,[], 0, 0), \"));\\n\"),\n\n    cu_memcpy := (self, o, i, is) >> Print(Blanks(i),\n        \"cudaMemcpy(\", self(o.loc, 0, 0), \", \", self(o.exp, 0, 0), \", \", self(o.size, 0, 0), \"*sizeof(\", self.declare(o.loc.t.t,[], 0, 0), \n            \"), \", o.kind, \");\\n\"),\n\n    cu_memcpy_to_sym := (self, o, i, is) >> Print(Blanks(i),\n        \"cudaMemcpyToSymbol(\", self(o.loc, 0, 0), \", \", self(o.exp, 0, 0), \", \", self(o.size, 0, 0), \"*sizeof(\", self.declare(o.loc.t.t,[],0,0), \") );\\n\"),\n\n    cu_check_errors := (self, o, i, is) >> Print(Blanks(i), \"checkCudaErrors( \", self(o.args[1], 0, 0), \" );\\n\"), \n\n    cu_free := (self, o, i, is) >> Print(Blanks(i), \"cudaFree(\", self(o.args[1], 0, 0), \");\\n\"),\n\n#    cospi := (self,o,i,is) >> Print(\"_\"::o.name, self.pinfix(o.args, \", \")),\n#    sinpi := (self,o,i,is) >> Print(\"_\"::o.name, self.pinfix(o.args, \", \")),\n\n    simtThreadIdxX := (self, o, i, is) >> Print(\"threadIdx.x\"),\n    simtThreadIdxY := (self, o, i, is) >> Print(\"threadIdx.y\"),\n    simtThreadIdxZ := (self, o, i, is) >> Print(\"threadIdx.z\"),\n\n    simtBlockIdxX := (self, o, i, is) >> Print(\"blockIdx.x\"),\n    simtBlockIdxY := (self, o, i, is) >> Print(\"blockIdx.y\"),\n    simtBlockIdxZ := (self, o, i, is) >> Print(\"blockIdx.z\"),\n\n    simt_syncgrid := (self, o, i, is) >> Error(\"Grid-level sync not supported.\"),\n    simt_syncblock := (self, o, i, is) >> Print(Blanks(i), \"__syncthreads();\\n\"),\n    simt_synccluster := (self, o, i, is) >> Print(Blanks(i), \"__syncwarp();\\n\")\n\n    ));\n\n\nCudaDefaults := CopyFields(SpiralDefaults, \n                                rec(\n                                    globalUnrolling := 10,\n                                    useDeref := false,\n                                    generateInitFunc := false,\n                                    includes := [],\n                                    arrayBufModifier := \"\",\n                                    arrayDataModifier := \"\",\n\n                                    mempool := true,\n                                    use_shmem := true,\n                                    gpu_timing := true,\n                                    sumsgen := SIMTSumsGen,\n                                    codegen :=  CudaCodegen,\n                                    unparser := CudaUnparser,\n                                    cuda_version := \"10.1\",\n                                )\n                    );\n\nTitanVDefaults := CopyFields(CudaDefaults, \n                                rec(\n                                    codename := \"GV100-400-A1\",\n                                    max_l1_size := 128*1024,\n                                    max_shmem_size := 96*1024,\n                                    l2_size := 4.5*2^20,\n                                    devmem_size := 12*2^30\n                                )\n                    );\n", "meta": {"hexsha": "beca74285037aacc64843649cf9f819c7b7a71a6", "size": 11175, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "cuda_unparser.gi", "max_stars_repo_name": "mikefranusich/spiral-package-simt", "max_stars_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cuda_unparser.gi", "max_issues_repo_name": "mikefranusich/spiral-package-simt", "max_issues_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-03-30T14:16:00.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-30T14:16:00.000Z", "max_forks_repo_path": "cuda_unparser.gi", "max_forks_repo_name": "mikefranusich/spiral-package-simt", "max_forks_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:26:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-05T12:02:48.000Z", "avg_line_length": 47.3516949153, "max_line_length": 155, "alphanum_fraction": 0.4562863535, "num_tokens": 3137, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4687906266262437, "lm_q2_score": 0.05033063188523922, "lm_q1q2_score": 0.0235945284599761}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n## The hoister is a compiler pass that separates looped code in three \n## parts:\n##  - the hoisted code a.k.a before the loop\n##  - the body of the loop, a.k.a the loop itself\n##  - the epilogue of the loop, a.k.a what is run after the loop\n##\n## Essentially, it is done by separating statements that depend on the loop\n## index, that have to be in the body from statements that do not which can \n## be hoisted.\n##\n## On top of this, the following code performs two optimizations:\n##  - if code is being stored to a memory location that is loop independent, \n##    then this memory location is scalarized, i.e. the store is performed in \n##    register and the memory write is delayed (put inside the epilogue)\n##  - The code performs loop variable induction. This replaces statements that\n##    depend of param*i, by accumulators that add plus param at each pass of\n##    the loop. The code also attempts to discover the minimal accumulation\n##    value to have a few number of window pointers\n\nHoister := function(c)\n    local loop_idx, loop_range, idxpool, hoist, body, epilogue, lvlist, lvfifo, asns, asn, lv, freevars, \n    candidate_memory_acc, confirmed_memory_acc, stmt, stmts, lv, freevars, equal_second_member, d, step, \n    lvfamilies, fams, fam, s, cc, pointer, j, var_usage, members, member_usage, rootexpr, m, newloop_idx, newloop_range, newloop_start, newloop_inc ;\n    #Hoister only applies to loopn(decl(chain(...)))\n    if ((ObjId(c)=loopn) and (ObjId(c.cmd)=decl) and (ObjId(c.cmd.cmd)=chain)) then\n\n         c := Compile.pullDataDeclsRefs(c);\n         loop_idx := c.var;\n         loop_range := c.range;\n         c := c.cmd;\n         MarkDefUse(c);\n         #idxpool will contain the set of all variables that change with the loop index\n         #(and therefore should not be hoisted)\n         idxpool := Set([loop_idx]);\n\n         #Loop variable induction\n         #This gathers all expressions that are linear in the index variable\n         #and stores them as (v, start, inc) in the loop-variable list (lvlist)\n         lvlist := [];\n         lvfifo := [];\n\n         Add(lvfifo, rec(v := loop_idx,\n                     start := loop_idx.t.zero(),\n                     inc := V(1)));\n\n         while(Length(lvfifo)>0) do\n\n             lv := lvfifo[1];\n             lvfifo := ListWithout(lvfifo, 1);\n             Add(lvlist, lv);\n\n             #If lv.start is a variable, add this variable to the lvfifo\n             if IsVar(lv.start) then\n                  #If lv.start is used twice, it cannot be used as an induction variable.\n                  if (Length(Collect(c, [assign, lv.start, @(0)]))=1\n                      and Length(Collect(c, lv.start))=1) then \n                      SubstBottomUp(c, lv.v, e->lv.start);\n                      SubstBottomUp(lvfifo, lv.v, e->lv.start);\n                      SubstBottomUp(lvlist, lv.v, e->lv.start);\n\n                      [asns, c] := Pull(c, [assign, lv.start, @(0)],e->skip(), e->e);\n\n                      Add(lvfifo, rec(v := lv.start, \n                              start := asns[1].exp, \n                              inc := lv.inc));\n                      AddSet(idxpool, lv.start);                  \n\n                 fi;\n             fi;\n\n             #Gather all mults and adds that depend on lv and add them too\n             [asns, c] := Pull(c, [assign, @(0), [add, @(1).cond(e->ObjId(e)<>Value), lv.v]], \n                 e->skip(), e->e);\n             for asn in asns do\n                 Add(lvfifo, rec(v := asn.loc, \n                         start := add(asn.exp.args[1], lv.start), \n                         inc := lv.inc));\n                 AddSet(idxpool, asn.loc);\n                 od;\n\n             [asns, c] := Pull(c, [assign, @(0), [add, lv.v, @(2).cond(e->ObjId(e)<>Value)]], \n                 e->skip(), e->e);\n             for asn in asns do\n                 Add(lvfifo, rec(v := asn.loc, \n                         start := add(asn.exp.args[2], lv.start), \n                         inc := lv.inc));\n                 AddSet(idxpool, asn.loc);\n                 od;                \n\n             [asns, c] := Pull(c, [assign, @(0), [mul, @(1), lv.v]], \n                 e->skip(), e->e);\n             for asn in asns do\n                 Add(lvfifo, rec(v := asn.loc, \n                     start := mul(asn.exp.args[1], lv.start), \n                     inc := mul(asn.exp.args[1],  lv.inc)));\n                 AddSet(idxpool, asn.loc);\n                 od;\n\n             [asns, c] := Pull(c, [assign, @(0), [mul, lv.v, @(2)]], \n                 e->skip(), e->e);\n             for asn in asns do\n                 Add(lvfifo, rec(v := asn.loc, \n                     start := mul(asn.exp.args[2], lv.start), \n                     inc := mul(asn.exp.args[2],  lv.inc)));\n                 AddSet(idxpool, asn.loc);\n                 od;\n\n         od;\n\n         #Some of the lvs were only used by other lvs, let's kick\n         #them out\n         freevars := Set(c.free());\n         lvlist := Filtered(lvlist, lv -> lv.v in freevars);\n\n         #Now we partition the lvs into bins that have the same increment\n         #We call it an lvfamily\n         lvfamilies:=[];\n         for lv in lvlist do\n             fams := Filtered(lvfamilies, fam->fam.inc=lv.inc);\n             if (Length(fams)>0) then\n                 Add(fams[1].list, lv);\n             else\n                 Add(lvfamilies, rec(inc:=lv.inc, list:=[lv]));\n             fi;\n         od;\n\n         #If the increment is an operation, hoist this operation\n         for lv in lvfamilies do\n             if (ObjId(lv.inc) in [add, mul]) then\n                d := var.fresh_t(\"d\", lv.inc.t);\n                Add(c.cmds, assign(d, lv.inc));\n                lv.inc := d;\n             fi;\n         od;\n\n         #OK, so this is the tricky part.\n         #we want to fuse lvfamilies together if it is possible.\n         #it is only possible if members of the family are used sequentially in the \n         #loop AND if we know the pattern\n\n         var_usage := [];\n         DoForAll(c.rChildren(), function(x) if IsAssign(x) then Append(var_usage, x.op_in()); fi; end);\n\n         for j in [1..Length(lvfamilies)] do\n           fam:=lvfamilies[j];\n           members:=List(fam.list, x->x.v);\n           member_usage := RemoveAdjacentDuplicates(Filtered(var_usage, x -> x in members));\n\t   \n           if (Length(Set(member_usage))=Length(member_usage) and Length(members)>1) then\n               #ok so this is a good candidate, but can we match it?\n               #our target is that they all are add( add(param, i*param), param)\n               rootexpr := fam.list[1].start;\n\n               if (ObjId(rootexpr)=add) then \n                   d := rootexpr.args[2];\n                   equal_second_member:=true;\n                   for m in fam.list do\n                   if ((ObjId(m.start)<>add) or (m.start.args[2]<>d)) then\n                       equal_second_member:=false;\n                   fi;\n                   od;\n                   \n                   if ((equal_second_member) and (rootexpr.args[1] in fam.list[2].start.args[1].pred)) then\n                           step := Difference(fam.list[2].start.args[1].pred, Set([rootexpr.args[1]]));\n                           if (Length(step)=1) then \n                               pointer := 2;\n                               cc := [];\n                               for d in c.rChildren() do\n                               if ((Length(fam.list)>=pointer) and (members[pointer] in d.op_in())) then\n                                   pointer:=pointer+1;\n                              Add(cc, assign(members[1], add(members[1], step[1])));\n                               fi;\n                               Add(cc, d);                               \n                               od;\n                               c := chain(cc);\n                               \n                               d := sub(fam.inc, mul(V(Length(members)-1), step[1]));\n                               s := var.fresh_t(\"inc\", d.t);\n                               Add(cc, assign(s, d));\n                               \n                               c := chain(cc);\n                               lvfamilies[j] := rec(inc := s,\n                                   list:=[rec(v:=members[1], \n                                           start:=rootexpr, \n                                           inc:=lvfamilies[j].inc)]);\n                               for d in [2..Length(members)] do\n                               SubstBottomUp(c, members[d], e->members[1]);\n                               od;\n                           fi;\n                   fi;\n               fi;\n           fi;\n        od;\n\n\n         #This is the hoister logic\n         candidate_memory_acc := Set([]);\n         confirmed_memory_acc := Set([]);\n         hoist := [];\n         body := [];\n         epilogue := [];\n\n\n         for asn in c.cmds do\n             if IsAssign(asn) then\n                 s := asn.op_in();\n                 IntersectSet(s, idxpool);\n                 if (Length(s)=0) then                     \n                     if (ObjId(asn.exp)=deref) then\n                         #cannot assume SSA on derefs\n                         #so we mark it and leave it\n                         #we'll fix that later\n                         AddSet(candidate_memory_acc, asn.exp);\n                     fi;\n                     Add(hoist, asn);\n                 else\n                     if ((ObjId(asn.loc)=deref) and (asn.loc in candidate_memory_acc)) then\n                         AddSet(confirmed_memory_acc, asn.loc);\n                     fi;\n                     Add(body, asn);\n                     UniteSet(idxpool, asn.op_out());\n                 fi;\n             else\n                 if (ObjId(asn)<> skip) then\n                     Error(\"Non assigns cannot be handled\");\n                 fi;\n             fi;\n         od;\n\n         #Plug back the induced vars\n         newloop_idx := [];\n         for lv in lvfamilies do\n            if ((newloop_idx=[])and(Length(lv.list)=1)) then\n                newloop_idx := lv.list[1].v;\n                d := lv.list[1].start;\n                s := var.fresh_t(\"init\", d.t);\n                Add(hoist, assign(s, d));\n                lv.list[1].start := s;\n                d := add(lv.list[1].start, mul(loop_range, lv.list[1].inc));\n                s := var.fresh_t(\"ubound\", d.t);\n                Add(hoist, assign(s, d));\n                newloop_range := s;\n                newloop_start := lv.list[1].start;\n                newloop_inc := lv.inc;                \n            else\n                for d in lv.list do\n                   Add(hoist, assign(d.v, d.start));\n                   Add(body, assign(d.v, add(d.v, lv.inc)));\n                od;\n            fi;\n         od;\n         if (newloop_idx=[]) then\n             newloop_idx := loop_idx;\n             newloop_range := loop_range;\n             newloop_start := V(0);\n             newloop_inc := V(1);\n         fi;\n         Add(hoist, assign(newloop_idx, newloop_start));\n         Add(body, assign(newloop_idx, add(newloop_idx, newloop_inc)));\n\n\n         #This is the memory accumulator logic\n         for d in confirmed_memory_acc do\n             asns := Collect(hoist, [assign, @(1), [deref, d.loc]]);\n             if Length(asns)<>1 then\n                 Error(\"Multi assign in hoist????\");\n             else\n                 SubstBottomUp(body, [deref, d.loc], e->asns[1].loc);\n                 Add(epilogue, assign(d, asns[1].loc));\n             fi;\n         od;\n\n         c := Compile.declareVars(chain(\n                 chain(hoist), \n                 doloop(newloop_idx, newloop_range, chain(body)), \n                 chain(epilogue)));\n    fi;\n    return c;\nend;\n", "meta": {"hexsha": "edae9719f7bcf70876429f7255a49d6199c6f2a1", "size": 11823, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/hoister.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/hoister.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/hoister.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.4842105263, "max_line_length": 149, "alphanum_fraction": 0.458259325, "num_tokens": 2750, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.5, "lm_q2_score": 0.0467249556393363, "lm_q1q2_score": 0.02336247781966815}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# dummy to restart doc string\n_dummy := 0;\n\n\n\n\n\n#F ExhaustiveSearch(spl, opts)\n#F\n\nExhaustiveSearch := function(spl, opts)\n\tlocal idxList, resList, bestRec;\n\t\n\tif not IsSPL(spl) then\n\t\tError(\"invalid SPL\");\n\tfi;\n\t\n\tidxList := [1 .. NofRuleTrees(spl, opts)];\n\t\n\tresList := TimeRuleTrees(spl, opts, idxList);\n\n\tbestRec := BestTimedRuleTree(resList);\n\tbestRec.ruletree := RuleTreeN(spl, bestRec.index, opts);\n\t\n\treturn bestRec;\nend;\n", "meta": {"hexsha": "a0b9afbbcb9832c7d14c6aa8af919751e164d391", "size": 513, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/search/exhaust.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/search/exhaust.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/search/exhaust.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 16.03125, "max_line_length": 57, "alphanum_fraction": 0.6998050682, "num_tokens": 155, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.5, "lm_q2_score": 0.0467249543118892, "lm_q1q2_score": 0.0233624771559446}}
{"text": "f := function(n)\n  return f(n+1);\nend;\n\n# Now loop until an error occurs\nf(0);\n\n# Error message :\n#   Entering break read-eval-print loop ...\n#   you can 'quit;' to quit to outer loop, or\n#   you may 'return;' to continue\n\nn;\n# 4998\n\n# quit \"brk mode\" and return to GAP\nquit;\n", "meta": {"hexsha": "bde98fa5f59284d5e73c4a71b0822886f25a3338", "size": 276, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Find-limit-of-recursion/GAP/find-limit-of-recursion-1.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Find-limit-of-recursion/GAP/find-limit-of-recursion-1.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Find-limit-of-recursion/GAP/find-limit-of-recursion-1.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 15.3333333333, "max_line_length": 45, "alphanum_fraction": 0.6376811594, "num_tokens": 87, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.42250463481418826, "lm_q2_score": 0.055005290229849145, "lm_q1q2_score": 0.02323999006141085}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Cell Unparser\n# Author: schellap\n\n@TInt := @.cond(x->x.t=TInt);\n@TRealOrInt := @.cond(x->x.t=TInt or x.t=TReal);\n@TReal := @.cond(x->x.t=TReal);\n@TVect := @.cond(x->ObjId(x.t)=TVect);\n\nClass(CellUnparser, CMacroUnparserProg, rec(\n\n    func_ppe := (self,o,i,is) >> \"\",\n\n    # str = format string with $n for arguments ($1 = first argument)\n    # list of arguments , arguments are printed using this unparser\n    printf := (self, str, args) >> ApplyFunc(PrintEvalF, Concatenation([str],\n        List(args, a->(When(IsFunc(a), a, ()->self(a,0,0)))))),\n\n    # -----------------------------\n    # ISA independent constructs\n    # -----------------------------\n    nth :=  (self, o, i, is) >> self.printf(\"$1[$2]\", [o.loc, o.idx]),\n    fdiv := (self, o, i, is) >> self.printf(\"((($3)$1) / $2)\", Concatenation(o.args, [self.opts.vector.isa.ctype])),\n    fdiv := (self, o, i, is) >> self.printf(\"($1 / $2)\", o.args),\n    idiv := (self, o, i, is) >> self.printf(\"($1 / $2)\", o.args),\n    imod := (self, o, i, is) >> self.printf(\"($1 % $2)\", o.args),\n\n    # This is the type used for declarations of vector variables\n    ctype := (t, isa) -> Cond(\n        #t in [TDouble, TVect(TDouble, 1)], \"float\",\n        t = TReal,              isa.ctype, #evals to \"float\" or \"double\"\n        t = TVect(TReal, 2),    isa.vtype, #evals to \"vector double\"\n        t = TVect(TReal, 4),    isa.vtype,\n        t = TVect(TReal, 8),    isa.vtype,\n        Error(\"Unparser doesn't know how to declare type: \", t)\n    ),\n\n    Value := (self, o, i, is) >> Cond(\n        o.t = TReal,\n           let(v := When(IsCyc(o.v), ReComplex(Complex(o.v)), Double(o.v)), When(v<0, Print(\"(\", v, \")\"), Print(v))),\n        o.t = TInt,         \n           When(o.v < 0, Print(\"(\", o.v, \")\"), Print(o.v)),\n        ObjId(o.t)=TVect,\n           Print(\"((\", self.ctype(o.t, self.opts.vector.isa), \"){\", self.infix(o.v, \", \"), \"})\"),\n        #NOTE: Adding this for parallel cell, but this shouldn't be needed, right?\n       IsArray(o.t),\n           Print(\"{\", self.infix(o.v, \", \"), \"}\"),\n       o.t = TString,\n           #Print(\"\\\"\", o.v, \"\\\"\")\n           Print(o.v),\n       o.t = TBool, Print(When(o.v, \"1\", \"0\"))\n\n    ),\n\n    vdup         := (self, o, i, is) >> Print(\"spu_splats((\", self.opts.vector.isa.ctype, \")\", self(o.args[1], i, is), \")\"),\n    vsplat_8x16i := (self, o, i, is) >> Print(\"spu_splats((\", self.opts.vector.isa.ctype, \")\", self(o.args[1], i, is), \")\"),\n    vsplat_4x32f := (self, o, i, is) >> Print(\"spu_splats((\", self.opts.vector.isa.ctype, \")\", self(o.args[1], i, is), \")\"),\n    vsplat_2x64f := (self, o, i, is) >> Print(\"spu_splats((\", self.opts.vector.isa.ctype, \")\", self(o.args[1], i, is), \")\"),\n\n    # Declarations\n    TVect := (self, t, vars, i, is) >> let(ctype := self.ctype(t, self.opts.vector.isa), \n              Print(ctype, \" \",\n              self.infix(vars, \", \"))),\n\n    TVectPointer := (self, t, vars, i, is) >> let(ctype := self.ctype(t, self.opts.vector.isa), \n              Print(ctype,\n              When(IsBound(self.opts.useMemoryArena) and self.opts.useMemoryArena, \"* \", \" \"),\n              self.infix(vars, \", \"))),\n\n    TReal := ~.TVect, \n    TRealPointer := ~.TVectPointer,\n\n    TInt := (self, t, vars, i, is) >> Print(\"int \", self.infix(vars, \", \")),\n\n    # Arithmetic\n    # --------------------------------\n    # -- mul -- \n    mul := (self, o, i, is) >> CondPat(o, \n    [mul, @TReal, @TVect], \n        Cond(self.opts.vector.isa.v = 2,\n            self.printf(\"spu_mul(((vector $1){$2,$2}), $3)\",       [self.ctype(o.args[1].t, self.opts.vector.isa), o.args[1], o.args[2]]),\n        self.opts.vector.isa.v = 4,\n            self.printf(\"spu_mul(((vector $1){$2,$2,$2,$2}), $3)\", [self.ctype(o.args[1].t, self.opts.vector.isa), o.args[1], o.args[2]]),\n        Error(\"Don't know how to unparse vector arch of length: \", self.opts.vector.isa.v)\n        ),\n    [mul, @TVect,   @TVect], \n        self.printf(\"spu_mul($1, $2)\",              [o.args[1], o.args[2]]),\n    [mul, @TRealOrInt, @TRealOrInt],  \n        self.printf(\"($1 * $2)\", o.args),\n    [mul, @TRealOrInt, @TRealOrInt, @TRealOrInt], \n        self.printf(\"($1 * $2 * $3)\", o.args),\n    Error(\"Don't know how to unparse <o>. Unrecognized type combination: \", o)),\n\n    # -- add -- \n    add := (self, o, i, is) >> When(Length(o.args) > 2, \n       self(_computeExpType(add(o.args[1], _computeExpType(ApplyFunc(add, Drop(o.args, 1))))), i, is), \n       CondPat(o, \n           [add, @TVect,   @TVect], \n              self.printf(\"spu_add($1, $2)\", [o.args[1], o.args[2]]),\n           #[add, @TRealOrInt, @TRealOrInt],  \n           [add, @TVect,   @], \n              self.printf(\"spu_add($1, $2)\", [o.args[1], o.args[2]]),\n           [add, @, @],  \n              self.printf(\"($1 + $2)\", o.args),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n       )\n    ),\n\n    # -- sub -- \n    sub := (self, o, i, is) >> When(Length(o.args) > 2, \n       self(_computeExpType(sub(o.args[1], _computeExpType(ApplyFunc(sub, Drop(o.args, 1))))), i, is), \n       CondPat(o, \n           [sub, @TVect,   @TVect], \n              self.printf(\"spu_sub($1, $2)\", [o.args[1], o.args[2]]),\n           [sub, @TVect,   @], \n              self.printf(\"spu_sub($1, $2)\", [o.args[1], o.args[2]]),\n           [sub, @TRealOrInt, @TRealOrInt],  \n              self.printf(\"($1 - $2)\", o.args),\n           [sub, @, @],  \n              self.printf(\"($1 - $2)\", o.args),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n       )\n    ),\n\n    # -- neg -- \n    neg := (self, o, i, is) >> CondPat(o,\n       #[neg, @TVect],\n       #    self(o.t.value(Replicate(o.t.size,0)) - o.args[1], i, is),\n       #self.printf(\"(-$1)\", o.args)\n       [neg, @TVect], Cond( self.opts.vector.isa.v = 2, self.printf(\"_negated2($1)\", o.args),\n                            self.opts.vector.isa.v = 4, self.printf(\"_negatef4($1)\", o.args),\n                            Error(\"What kind of vector length are you trying to pull on me?\")\n                ),\n        self.printf(\"(-$1)\", o.args)\n    ),\n\n    v_neg01 := (self, o, i, is) >> self.printf(\"_negated2($1)\", o.args),\n\n\n    vpack := (self, o, i, is) >> Print(self.opts.vector.isa.vconstv, \"{\", self.infix(o.args, \", \"), \"}\"),\n\n    # Spiral: fma(rt, x, y, z)    -> rt = x + (y*z)\n    # SPU:    FMA(rt, ra, rb, rc) -> rt = (ra*rb) + rc\n    # -- fma --\n    fma  := (self, o, i, is) >> CondPat(o,\n       [fma, @TVect, @TVect, @TVect],\n          self.printf(\"spu_madd($2, $3, $1)\",  [o.args[1], o.args[2], o.args[3]]),\n       [fma, @TVect, @TReal, @TVect],\n          self.printf(\"spu_madd(((vector $4){$2,$2,$2,$2}), $3, $1)\",  [o.args[1], o.args[2], o.args[3], self.ctype(o.args[2].t, self.opts.vector.isa)]),\n       [fma, @TReal, @TReal, @TReal],\n          self.printf(\"$1 + ($2 * $3)\", [o.args[1], o.args[2], o.args[3]]),\n        Error(\"Don't know how to unparse fma instruction <o>. Unrecognized type combination:\", o.args[1].t, o.args[2].t, o.args[3].t)\n    ),\n\n    # Spiral: fms(rt, x, y, z)    -> rt = x - (y*z)\n    # SPU:    FNMS(rt, ra, rb, rc) -> rt = rc - (ra*rb)\n    fms  := (self, o, i, is) >> CondPat(o,\n       [fms, @TVect, @TVect, @TVect],\n          self.printf(\"spu_nmsub($2, $3, $1)\",  [o.args[1], o.args[2], o.args[3]]),\n       [fms, @TVect, @TReal, @TVect],\n          self.printf(\"spu_nmsub(((vector $4){$2,$2,$2,$2}), $3, $1)\",  [o.args[1], o.args[2], o.args[3], self.ctype(o.args[2].t, self.opts.vector.isa)]),\n       [fms, @TInt, @TVect, @TVect], #HACK\n          self.printf(\"spu_nmsub($2, $3, (($4){$1,$1,$1,$1}))\",  [o.args[1].v, o.args[2], o.args[3], self.ctype(o.args[2].t, self.opts.vector.isa)]),\n       [fms, @TInt, @TReal, @TVect], #HACK\n          self.printf(\"spu_nmsub(((vector $4){$2,$2,$2,$2}), $3, ((vector $4){$1,$1,$1,$1}))\",  [o.args[1].v, o.args[2], o.args[3], self.ctype(o.args[2].t, self.opts.vector.isa)]),\n       [fms, @TReal, @TReal, @TReal],\n          self.printf(\"$1 + ($2 - $3)\", [o.args[1], o.args[2], o.args[3]]),\n        Error(\"Don't know how to unparse fms instruction <o>. Unrecognized type combination\")\n    ),\n\n    # Spiral: nfma(rt, x, y, z)   -> rt = (y*z) - x\n    # SPU:    FMS(rt, ra, rb, rc) -> rt = (ra*rb) - rc\n    #NOTE: Change above and below vector constants to spu_splats so the v=2 or v=4 cases are both implicitly taken care of\n    nfma := (self, o, i, is) >> CondPat(o,\n       [nfma, @TVect, @TVect, @TVect],\n          self.printf(\"spu_msub($2, $3, $1)\",  [o.args[1], o.args[2], o.args[3]]),\n       [nfma, @TVect, @TReal, @TVect],\n          self.printf(\"spu_msub(((vector $4){$2,$2,$2,$2}), $3, $1)\",  [o.args[1], o.args[2], o.args[3], self.ctype(o.args[2].t, self.opts.vector.isa)]),\n        Error(\"Don't know how to unparse nfma instruction <o>. Unrecognized type combination\")\n    ),\n\n    # logic\n    # --------------------------------\n    bin_and := (self, o, i, is) >> self.prefix(\"spu_and\", o.args),\n\n    bin_or := (self, o, i, is) >> self.prefix(\"spu_or\", o.args),\n\n    # comparison\n    # --------------------------------\n    eq := (self, o, i, is) >> CondPat(o,\n        [eq, @TVect, @], self.printf(\"spu_cmpeq($1, spu_splat($2))\", o.args),\n        [eq, @, @TVect], self.printf(\"spu_cmpeq(spu_splat($1), $2)\", o.args),\n        [eq, @, @], self.printf(\"(($1) == ($2))\", o.args)\n        ),\n    cmpg := (self, o, i, is) >> CondPat(o,\n        [eq, @TVect, @], self.printf(\"spu_cmpgt($1, spu_splat($2))\", o.args),\n        [eq, @, @TVect], self.printf(\"spu_cmpgt(spu_splat($1), $2)\", o.args),\n        [eq, @, @], self.printf(\"(($1) > ($2))\", o.args)\n        ),\n    cmpl := (self, o, i, is) >> CondPat(o,\n        [eq, @TVect, @], self.printf(\"spu_LT_IS_EXPENSIVE($1, spu_splat($2))\", o.args),\n        [eq, @, @TVect], self.printf(\"spu_LT_IS_EXPENSIVE(spu_splat($1), $2)\", o.args),\n        [eq, @, @], self.printf(\"(($1) < ($2))\", o.args)\n        ),\n\n    promote_spu8x16i := (self, o, i, is) >> self.prefix(\"spu_promote\", o.args),\n    promote_spu4x32f := (self, o, i, is) >> self.prefix(\"spu_promote\", o.args),\n    promote_spu2x64f := (self, o, i, is) >> self.prefix(\"spu_promote\", o.args),\n\n    extract_spu8x16i := (self, o, i, is) >> self.prefix(\"spu_extract\", o.args),\n    extract_spu4x32f := (self, o, i, is) >> self.prefix(\"spu_extract\", o.args),\n    extract_spu2x64f := (self, o, i, is) >> self.prefix(\"spu_extract\", o.args),\n\n    insert_spu8x16i  := (self, o, i, is) >> self.prefix(\"spu_insert\",  o.args),\n    insert_spu4x32f  := (self, o, i, is) >> self.prefix(\"spu_insert\",  o.args),\n    insert_spu2x64f  := (self, o, i, is) >> self.prefix(\"spu_insert\",  o.args),\n\n    vparam_spu := (self, o, i, is) >>\n      Print(\"((vector unsigned char){\", PrintCS(prep_perm_string_spu(o.p)), \"})\"),\n\n   vzero_8x16i := (self, o, i, is) >> Print(\"((\", self.opts.vector.isa.vtype ,\"){\", PrintCS(List([1..self.opts.vector.isa.v], i->0)), \"})\"),\n   vzero_4x32f := (self, o, i, is) >> Print(\"((\", self.opts.vector.isa.vtype ,\"){\", PrintCS(List([1..self.opts.vector.isa.v], i->0)), \"})\"),\n   vzero_2x64f := (self, o, i, is) >> Print(\"((\", self.opts.vector.isa.vtype ,\"){\", PrintCS(List([1..self.opts.vector.isa.v], i->0)), \"})\"),\n\n   # ----------------------------------------------------------------------------------\n   # ISA specific : spu_8x16i\n   # ----------------------------------------------------------------------------------\n   vperm_8x16i_spu := (self, o, i, is) >>\n     self.printf(\"spu_shuffle($1, $2, $3)\", o.args),\n\n   vuperm_8x16i_spu := (self, o, i, is) >>\n     self.printf(\"spu_shuffle($1, $1, $2)\", o.args),\n\n   vloadu8_spu8x16i := (self, o, i, is) >> \n   Print(\"spu_or(spu_slqwbyte(*((vector signed short*) (&(\",self(o.args[1],i,is),\"))), (unsigned) ((vector signed short*) (&(\",self(o.args[1],i,is),\"))) & 15), spu_rlmaskqwbyte(*(((vector signed short*) (&(\",self(o.args[1],i,is),\")))+1), ((unsigned) ((vector signed short*) (&(\",self(o.args[1],i,is),\"))) & 15)-16))\"),\n\n   # ----------------------------------------------------------------------------------\n   # ISA specific : spu_4x32f\n   # ----------------------------------------------------------------------------------\n   vperm_4x32f_spu := (self, o, i, is) >>\n     self.printf(\"spu_shuffle($1, $2, $3)\", o.args),\n\n   vuperm_4x32f_spu := (self, o, i, is) >>\n     self.printf(\"spu_shuffle($1, $1, $2)\", o.args),\n\n   #vloadu1,2,4 should produce:\n   #spu_shuffle(spu_slqwbyte((*((vector float *)(&X[element]))), (unsigned int)(&X[element]) & 15), ((vector float){0,0,0,0}), ((vector unsigned char){0, 1, 2, 3, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}));\n   #spu_shuffle(spu_promote(X[element], 0), spu_promote(X[element+1], 0), ((vector unsigned char){0, 1, 2, 3, 16, 17, 18, 19, 128, 128, 128, 128, 128, 128, 128, 128}));\n   #spu_or(spu_slqwbyte(*ptr,            (unsigned) ptr & 15), spu_rlmaskqwbyte(*(ptr+1), ((unsigned) ptr & 15)-16));\n\n   #NOTE: Both these are HACKs!\n   slqwbyte_spu4x32f := (self, o, i, is) >>\n       self.printf(\"spu_slqwbyte(*$1, (unsigned) ($1) & 15)\", o.args),\n\n   rlmaskqwbyte_spu4x32f := (self, o, i, is) >>\n       self.printf(\"spu_rlmaskqwbyte(*$1, ((unsigned) $1 & 15)-16)\", o.args),\n\n   vloadu_spu4x32f := (self, o, i, is) >> \n       Print(\"spu_or(spu_slqwbyte(*\",self(o.args[1],i,is),\", (unsigned) \",self(o.args[1],i,is),\" & 15), spu_rlmaskqwbyte(*(\",self(o.args[1],i,is),\"+1), ((unsigned) \",self(o.args[1],i,is),\" & 15)-16))\"),\n\n   vloadu4_spu4x32f := (self, o, i, is) >> \n   Print(\"spu_or(spu_slqwbyte(*((vector float*) (&(\",self(o.args[1],i,is),\"))), (unsigned) ((vector float*) (&(\",self(o.args[1],i,is),\"))) & 15), spu_rlmaskqwbyte(*(((vector float*) (&(\",self(o.args[1],i,is),\")))+1), ((unsigned) ((vector float*) (&(\",self(o.args[1],i,is),\"))) & 15)-16))\"),\n\n# spu_or(\n#       spu_slqwbyte(*((vector float*) (&(\",ptr,\"))), (unsigned) ((vector float*) (&(\",ptr,\"))) & 15),\n#       spu_rlmaskqwbyte(*(((vector float*) (&(\",ptr,\")))+1), ((unsigned) ((vector float*) (&(\",ptr,\"))) & 15)-16))\n\n   #spu_or(spu_slqwbyte(*ptr,            (unsigned) ptr & 15), spu_rlmaskqwbyte(*(ptr+1), ((unsigned) ptr & 15)-16));\n\n   # ----------------------------------------------------------------------------------\n   # ISA specific : spu_2x64f\n   # ----------------------------------------------------------------------------------\n\n   vperm_2x64f_spu := (self, o, i, is) >>\n     self.printf(\"spu_shuffle($1, $2, $3)\", o.args),\n\n   vuperm_2x64f_spu := (self, o, i, is) >>\n     self.printf(\"spu_shuffle($1, $1, $2)\", o.args),\n\n   # ----------------------------------------------------------------------------------\n   # Cell Parallel unparser\n   # ----------------------------------------------------------------------------------\n   extraHeader := \"TODO\",\n#Concat(\"#include <spu_mfcio.h>\\n\\\n#extern spe_infostruct spe_info;\\n\\\n#//extern DATATYPE_NO_QUOTES* Xalt;\\\n#//extern DATATYPE_NO_QUOTES* Yalt;\\\n#extern DATATYPE_NO_QUOTES* XYalt;\\\n#extern mfc_list_element_t gathlist[2048], scatlist[2048];\\\n##define Xalt XYalt\\\n##define Yalt XYalt\\\n#/* extern volatile int writeSignal[4];\\n\\\n#extern int check;\\n\\\n#extern void sig_barrier();\\n\\\n#n*/\\n\\\n##include \\\"spumacros.h\\\"\\n\\\n#// Declare memory arena\\\n##ifdef ARENA_SIZE\\\n#  __attribute__((aligned(16))) DATATYPE_NO_QUOTES ARENA[ARENA_SIZE];\\\n#  int arenalevel = ARENA_SIZE;\\\n##endif\\\n#\\n\\\n#\\n\\n\\n\"),\n\n\n\n   dist_loop := meth(self, o, i, is)\n       Print(Blanks(i),    \"{\\n\");\n       #Print(Blanks(i+is), \"unsigned int \", o.var, \" = spe_info.spuid;\\n\"); # Not needed since spuid is now a param\n       self(o.cmd,i+is,is);\n       Print(Blanks(i),    \"}\\n\");\n       #Print(Blanks(i),    \"//ALL_TO_ALL_BARRIER;\\n\");\n       #Print(Blanks(i),    \"BLOCK_ON_READ();\\n\");\n    end,\n\n    #NOTE: this should really be just a berrier (shouldn't have\n    #BLOCK_ON_CPUDMA). But leaving this in there for legacy compatibility.\n    #Should'nt affect performance significantly.\n\n    dist_barrier := (self,o,i,is) >> Print(Blanks(i), \"BLOCK_ON_CPUDMA; ALL_TO_ALL_BARRIER;\\n\"),\n\n    dma_barrier := (self,o,i,is) >> Print(Blanks(i), \"BLOCK_ON_CPUDMA;\\n\"),\n\n    #NOTE: might be hacks. Need to possibly fix inside parent unparser's methods.\n    call := (self, o, i, is) >> Print(Blanks(i), o.args[1].id, self.pinfix(Drop(o.args, 1), \", \"), \";\\n\"),\n\n    fcall := (self, o, i, is) >> Print(self(o.args[1],0,0), \"(\", self.infix(Drop(o.args, 1), \", \"), \")\"),\n\n    #fcall_addr := (self, o, i, is) >> Print(self(o.args[1],0,0), \"(\", self.infix(Drop(o.args, 1), \", \"), \")\"),\n\n   # ----------------------------------------------------------------------------------\n   # Cell Multibuffering unparser\n   # ----------------------------------------------------------------------------------\n    multibuffer_loop := meth(self, o, i, is) \n       local v, lo, hi, measSteadyState, swapx, swapy, swapxy, block_on_diag, swap_twiddles, n;\n\n       n  := Length(o.range);\n       v  := o.var;\n       lo := o.range[1] + 1;\n       hi := Last(o.range) - 1;\n       measSteadyState := When(\n            IsBound(self.opts.measSteadyState) and self.opts.measSteadyState = true,\n            true,\n            false);\n\n       #swapx := Concat(\"SWAP(\", o.x.id, \", \", o.x.id, \"alt);\\n\");\n       #swapy := Concat(\"SWAP(\", o.y.id, \", \", o.y.id, \"alt);\\n\");\n\n       swapx  := Concat(\"SWAP(\", o.x.id, \", XYalt);\\n\");\n       swapy  := Concat(\"SWAP(\", o.y.id, \", XYalt);\\n\");\n       swapxy := Concat(\"SWAP(\", o.y.id, \", \", o.x.id, \");\\n\");\n\n\n       swap_twiddles := When(o.twiddles=[], \"\\n\",\n            Concat(\"SWAP(\", o.bufs[1].id, \", \", o.bufs[2].id, \");\\n\")\n       );\n\n       block_on_diag := When(o.twiddles=[], \"\\n\", \"BLOCK_ON_DIAG;\\n\");\n\n       Print(\n\n       Blanks(i), When(measSteadyState, \"/*\", \"\"),\n       Blanks(i), \"\\n{// ------------- Multibuffer header begin -----------\\n\",\n       Blanks(i+is), \"int \", v, \" = \", lo-1, \";\\n\",\n       # Begin skewiter:\n       Blanks(i+is), v, \"= (\", v, \"+(spuid/  ( SPUS>\",n,\" ? (SPUS/\",n,\") : 1  )  ))%\", n, \";\\n\",\n\n\n       Blanks(i+is), \"{\\n\",\n       self(o.gathmem, i+is, is),\n       When(o.twiddles=[], \"\", self(o.twiddles, i+is, is)),\n       Blanks(i+is), \"}\\n\",\n\n\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n       Blanks(i+is), block_on_diag,\n       Blanks(i+is), swapx,\n       Blanks(i+is), swap_twiddles,\n\n\n       Blanks(i+is), \"{\\n\",\n       # skewiter increment\n       Blanks(i+is), v, \"= (\", v, \"+1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"++;\\n\",\n       self(o.gathmem, i+is, is),\n       When(o.twiddles=[], \"\", self(o.twiddles, i+is, is)),\n       # skewiter decrement\n       Blanks(i+is), v, \"= (\", v, \"+\", n, \"-1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"--;\\n\",\n       Blanks(i+is), \"}\\n\",\n\n\n       Blanks(i+is), \"{ // Loopbody begin\\n\",\n       When(IsBound(self.opts.mbuf_nobody) and self.opts.mbuf_nobody = true, \"\", self(o.cmd,i+is,is)),\n       Blanks(i+is), \"} // Loopbody end\\n\",\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n       Blanks(i+is), block_on_diag,\n       Blanks(i), \"}// ------------- Multibuffer header end -----------\\n\\n\",\n       Blanks(i), When(measSteadyState, \"*/\", \"\"),\n\n       Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"++) {\\n\",\n       # Begin skewiter:\n       Blanks(i+is), v, \"= (\", v, \"+(spuid/  ( SPUS>\",n,\" ? (SPUS/\",n,\") : 1  )  ))%\", n, \";\\n\",\n       Blanks(i+is), swapy,\n       Blanks(i+is), swapxy,\n       # skewiter decrement\n       Blanks(i+is), v, \"= (\", v, \"+\", n, \"-1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"--;\\n\",\n       self(o.scatmem, i+is, is),\n       # skewiter increment\n       Blanks(i+is), v, \"= (\", v, \"+1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"++;\\n\",\n       #Blanks(i+is), swapx,\n       Blanks(i+is), swap_twiddles,\n       # skewiter increment\n       Blanks(i+is), v, \"= (\", v, \"+1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"++;\\n\",\n       self(o.gathmem, i+is, is),\n       When(o.twiddles=[], \"\", self(o.twiddles, i+is, is)),\n       # skewiter decrement\n       Blanks(i+is), v, \"= (\", v, \"+\", n, \"-1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"--;\\n\",\n       Blanks(i+is), \"{ // Loopbody begin\\n\",\n       When(IsBound(self.opts.mbuf_nobody) and self.opts.mbuf_nobody = true, \"\", self(o.cmd,i+is,is)),\n       Blanks(i+is), \"} // Loopbody end\\n\",\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n       Blanks(i+is), block_on_diag,\n       # End skewiter:\n       Blanks(i+is), v, \"= (\", v, \"+\", n, \"-(spuid/  ( SPUS>\",n,\" ? (SPUS/\",n,\") : 1  )  ))%\", n, \";\\n\",\n       Blanks(i), \"}\\n\",\n\n       Blanks(i), When(measSteadyState, \"/*\", \"\"),\n       Blanks(i), \"\\n{// ------------- Multibuffer footer begin -----------\\n\",\n       Blanks(i+is), \"int \", v, \"=\", hi, \"+1;\\n\",\n       # Begin skewiter:\n       Blanks(i+is), v, \"= (\", v, \"+(spuid/  ( SPUS>\",n,\" ? (SPUS/\",n,\") : 1  )  ))%\", n, \";\\n\",\n       Blanks(i+is), swapy,\n       Blanks(i+is), swapxy,\n       # skewiter decrement\n       Blanks(i+is), v, \"= (\", v, \"+\", n, \"-1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"--;\\n\",\n\n\n       Blanks(i+is), \"{\\n\",\n       self(o.scatmem, i+is, is),\n       Blanks(i+is), \"}\\n\",\n\n\n       # skewiter increment\n       Blanks(i+is), v, \"= (\", v, \"+1) % \", n, \";\\n\",\n       #Blanks(i+is), v, \"++;\\n\",\n       #Blanks(i+is), swapx,\n       Blanks(i+is), swap_twiddles,\n       Blanks(i+is), \"{ // Loopbody begin\\n\",\n       When(IsBound(self.opts.mbuf_nobody) and self.opts.mbuf_nobody = true, \"\", self(o.cmd,i+is,is)),\n       Blanks(i+is), \"} // Loopbody end\\n\",\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n       Blanks(i+is), swapy,\n       #Blanks(i+is), v, \"++;\\n\",\n\n       Blanks(i+is), \"{\\n\",\n       self(o.scatmem, i+is, is),\n       Blanks(i+is), \"}\\n\",\n\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n       Blanks(i), \"}// ------------- Multibuffer footer end -----------\\n\\n\",\n       Blanks(i), When(measSteadyState, \"*/\", \"\")\n       );\n\n       #NOTE: Last wait can be avoided by DMA_putting Y directly (same for X?)\n\n    end,\n\n\n#F For debugging:\n#F Multibuffer_loop that doesn't do multibuffering. Easier for humans to parse when looking at C code\n    mem_loop := meth(self, o, i, is) \n       local v, lo, hi, swapx, swapy, block_on_diag, swap_twiddles;\n\n       swapx := Concat(\"SWAP(\", o.x.id, \", \", o.x.id, \"alt);\\n\");\n       swapy := Concat(\"SWAP(\", o.y.id, \", \", o.y.id, \"alt);\\n\");\n       swap_twiddles := When(o.twiddles=[], \"\\n\",\n            Concat(\"SWAP(\", o.bufs[1].id, \", \", o.bufs[2].id, \");\\n\")\n       );\n\n       v  := o.var;\n       lo := o.range[1];\n       hi := Last(o.range);\n\n\n       block_on_diag := When(o.twiddles=[], \"\\n\", \"BLOCK_ON_DIAG;\\n\");\n\n       Print(\n\n\n       Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"++) {\\n\",\n\n       self(o.gathmem, i+is, is),\n       When(o.twiddles=[], \"\", self(o.twiddles, i+is, is)),\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n       Blanks(i+is), block_on_diag,\n       Blanks(i+is), swapx,\n       Blanks(i+is), swap_twiddles,\n\n       Blanks(i+is), \"{ // Loopbody begin\\n\",\n       When(IsBound(self.opts.mbuf_nobody) and self.opts.mbuf_nobody = true, \"\", self(o.cmd,i+is,is)),\n       Blanks(i+is), \"} // Loopbody end\\n\",\n\n       Blanks(i+is), swapy,\n       self(o.scatmem, i+is, is),\n       Blanks(i+is), \"BLOCK_ON_MEMDMA;\\n\",\n\n       Blanks(i), \"}\\n\"\n\n\n       );\n\n    end,\n\n\n\n    kern := (self, o, i, is) >> self(o.cmd, i, is)\n\n));\n\nClass(CellUnparser_parallel, CellUnparser);\n\n", "meta": {"hexsha": "5f39cbab37a7800425a637e6023d9899690f6c21", "size": 23225, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/cellSPU/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/cellSPU/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/cellSPU/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 43.6560150376, "max_line_length": 318, "alphanum_fraction": 0.4907642626, "num_tokens": 7884, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4111108548019597, "lm_q2_score": 0.05582314231270587, "lm_q1q2_score": 0.022949499753907955}}
{"text": "#\n#\n#\n\nRead(\"~/Workspace/Chevalley.gap/init.gi\");\n\nRead(Filename(home_dir,\"lib/rsys.gd\"));\nRead(Filename(home_dir,\"lib/rsys.gi\"));\n\nRead(Filename(home_dir,\"lib/chvadj.gd\"));\nRead(Filename(home_dir,\"lib/chvadj.gi\"));\n", "meta": {"hexsha": "f52f9b0df4308cf6f21d0652345a1eb4be96002d", "size": 216, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "test/chvadj.test.init.gi", "max_stars_repo_name": "iuliansimion/Chevalley.gap", "max_stars_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/chvadj.test.init.gi", "max_issues_repo_name": "iuliansimion/Chevalley.gap", "max_issues_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/chvadj.test.init.gi", "max_forks_repo_name": "iuliansimion/Chevalley.gap", "max_forks_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.0, "max_line_length": 42, "alphanum_fraction": 0.6990740741, "num_tokens": 66, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3849121444839335, "lm_q2_score": 0.05921025696673772, "lm_q1q2_score": 0.022790746984511782}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(SKLR_Vx1i, SIMD_ISA, rec(\n\n    includes     := () -> [\"<stdlib.h>\"] :: _MM_MALLOC(), \n    active       := true,\n    ctype        := \"char\",\n    instr        := [],\n    bits         := 1,\n    isFloat      := false,\n    isFixedPoint := false,\n    splopts      := rec(),\n    alignment    := 8,\n    \n    autolib := rec(\n        includes := () -> [\"<include/sp_bits.h>\"],\n        includesTimer := () -> [],\n    ),\n\n    _op_load_u  := abstract(),\n    _op_bcast   := abstract(),\n    _op_store_u := abstract(),\n    \n    dupload  := (self, y, x) >> Checked(ObjId(x)=nth, # NOTE: is there a better way?\n\tlet(base := x.loc,\n\t    ofs  := x.idx,\n\t    v    := self.v,\n\t    xvec := Cond(IsUnalignedPtrT(base.t), self._op_load_u(base, idiv(ofs,v)*v, v),\n\t\t         vtref(self.t, base, idiv(ofs, v))),\n\t    assign(y, self._op_bcast(xvec, imod(ofs, v))))),\n\t        \n    svload := [ [ ], # load using subvecs of len 1\n                [ ], # load using subvecs of len 2\n                [ ], # load using subvecs of len 4\n    ],\n\n    svstore := [ [ ], # store using subvecs of len 1\n                 [ ], # store using subvecs of len 2\n                 [ ], # store using subvecs of len 4\n    ],\n\n    # keep the n lower scalars and zero the other ones\n    mask_l := (self, c, n) >> Cond( n = self.v, c,\n        bin_and(c, self.val(Replicate(n, 1) :: Replicate(self.v - n, 0)))),\n    mask_h := (self, c, n) >> Cond( n = self.v, c,\n        bin_and(c, self.val(Replicate(n, 0) :: Replicate(self.v - n, 1)))),\n\n\n    loadCont := (self, n, y, yofs, x, xofs, xofs_align, opts) >> let(\n\ta  := _unwrap(xofs_align),\n\tnn := _unwrap(n), \n\tyy := vtref(self.t, y, yofs),\n\tm  := x -> self.mask_l(x, nn),\n\tCond(a = 0 and not IsUnalignedPtrT(x.t), \n\t         assign(yy, m(vtref(self.t, x, xofs/self.v))),\n\n\t     # known alignment, sv is small, so that we only need 1 aligned load + 1 shift + mask\n\t     ((IsInt(a) and (nn <= self.v - a)) or nn=1) and not IsUnalignedPtrT(x.t), \n\t\t let(v1 := vtref(self.t, x, idiv(xofs, self.v)), \n\t\t     assign(yy, m(bin_shr(v1, a)))),\n\n\t     # known alignment, sv covers 2 vectors, 2 aligned loads + 2 shifts + mask\n\t     # NB: no masking is needed because shifts will do the job\n\t     IsInt(a) and not IsUnalignedPtrT(x.t),\n\t\t let(v1 := vtref(self.t, x, (xofs - a)/self.v), \n\t\t     v2 := vtref(self.t, x, (xofs - a)/self.v + 1),\n\t\t     assign(yy, m(bin_or(bin_shr(v1, a), bin_shl(v2, self.v - a))))),\n             # else, unknown alignment, use unaligned load\n             assign(yy, self._op_load_u(x, xofs, nn))\n        )\n    ),\n\n    storeCont := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\ta  := _unwrap(yofs_align),\n\tnn := _unwrap(n), \n\txx := vtref(self.t, x, xofs),\n\tyy := vtref(self.t, y, yofs/self.v),\n\tCond(nn = self.v and a = 0 and not IsUnalignedPtrT(y.t), \n\t        assign(yy, xx),\n\t     #else \n\t        self._op_store_u(y, yofs, xx, nn))),\n\n    rotate_left := (self, shift) >> ((y, x) -> assign(vtref(self.t, y, 0), rCyclicShift(vtref(self.t, x, 0), shift, self.v))),\n    \n    kswap := (self, y, x, k, mask) >> let( u := var.fresh_t(\"U\", self.t),\n                                         chain(assign( u, bin_and(bin_xor(x, bin_shr(x, 2^(k-1))), self.t.value(mask))),\n                                               assign( y, bin_xor(bin_xor(x, u), bin_shl(u, 2^(k-1)))))),\n\n    kexch := (self, y1, y2, x1, x2, mask) >> let( u := var.fresh_t(\"U\", self.t),\n                                         chain(assign(  u, bin_and(bin_xor(x1, x2), self.t.value(mask))),\n                                               assign( y1, bin_xor(x1, u)),\n                                               assign( y2, bin_xor(x2, u)))),\n));\n\nClass(SKLR_16x1i, SKLR_Vx1i, rec(\n    # countrec below is invalid\n    countrec := rec( \n        ops := [\n            [add, sub], \n\t    [mul],\n            [sklr_bcast_16x1i], # shuffles \n            [sklr_loadu_16x1i, sklr_storeu_16x1i],\n            [deref],\n            Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\"],\n        type := \"TVect\",\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n    info     := \"Scalar 16 x 1-bit\",\n    v        := 16,\n    t        := BitVector(16),\n\n    v_ones   := BitVector(16).one(), \n    v_zeros  := BitVector(16).zero(),\n    val      := bits -> BitVector(16).value(bits),\n\n    _op_load_u  := (self, ptr, offs, elts)      >> sklr_loadu_16x1i(ptr, offs, elts),\n    _op_bcast   := (self, loc, elt_num)         >> sklr_bcast_16x1i(loc, elt_num),\n    _op_store_u := (self, ptr, offs, src, elts) >> sklr_storeu_16x1i(ptr, offs, src, elts),\n));\n\nClass(SKLR_32x1i, SKLR_Vx1i, rec(\n    # countrec below is invalid\n    countrec := rec( \n        ops := [\n            [add, sub], \n\t    [mul],\n            [sklr_bcast_32x1i], # shuffles \n            [sklr_loadu_32x1i, sklr_storeu_32x1i],\n            [deref],\n            Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\"],\n        type := \"TVect\",\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n    info     := \"Scalar 32 x 1-bit\",\n    v        := 32,\n    t        := BitVector(32),\n\n    v_ones   := BitVector(32).one(), \n    v_zeros  := BitVector(32).zero(),\n    val      := bits -> BitVector(32).value(bits),\n\n    _op_load_u  := (self, ptr, offs, elts)      >> sklr_loadu_32x1i(ptr, offs, elts),\n    _op_bcast   := (self, loc, elt_num)         >> sklr_bcast_32x1i(loc, elt_num),\n    _op_store_u := (self, ptr, offs, src, elts) >> sklr_storeu_32x1i(ptr, offs, src, elts),\n    \n));\n\n\nClass(SKLR_64x1i, SKLR_Vx1i, rec(\n    # countrec below is invalid\n    countrec := rec( \n        ops := [\n            [add, sub], \n\t    [mul],\n            [sklr_bcast_64x1i], # shuffles \n            [sklr_loadu_64x1i, sklr_storeu_64x1i],\n            [deref],\n            Value      # Value without [] is a keyword in countOps !!\n        ],\n        printstrings := [\"[adds]\", \"[mults]\", \"[vperms]\", \"[svldst]\", \"[vldst]\", \"[vval]\"],\n        type := \"TVect\",\n        arithcost := (self, opcount) >> opcount[1]+opcount[2]\n    ),\n\n    info     := \"Scalar 64 x 1-bit\",\n    v        := 64,\n    t        := BitVector(64),\n\n    v_ones   := BitVector(64).one(), \n    v_zeros  := BitVector(64).zero(),\n    val      := bits -> BitVector(64).value(bits),\n\n    _op_load_u  := (self, ptr, offs, elts)      >> sklr_loadu_64x1i(ptr, offs, elts),\n    _op_bcast   := (self, loc, elt_num)         >> sklr_bcast_64x1i(loc, elt_num),\n    _op_store_u := (self, ptr, offs, src, elts) >> sklr_storeu_64x1i(ptr, offs, src, elts),\n));\n\n\n\nRewriteRules(RulesStrengthReduce, rec(\n    aligned_loadu_32x1 := Rule( @(1, sklr_loadu_32x1i, x -> IsInt(_unwrap(x.args[2] mod 32)) and not IsUnalignedPtrT(x.args[1])),\n                             e -> let(\n                                     offs := imod(e.args[2], 32),\n                                     xx0  := vtref(e.t, e.args[1], idiv(e.args[2], 32)),\n                                     xx1  := vtref(e.t, e.args[1], idiv(e.args[2], 32)+1),\n                                     nn   := _unwrap(e.args[3]),\n                                     bin_and( When(offs + nn <= 32,\n                                             bin_shr(xx0, offs),\n                                             bin_or(bin_shr(xx0, offs), bin_shl(xx1, 32 - offs))),\n                                         e.t.value(Replicate(nn, 1) :: Replicate(32 - nn, 0)))\n                                     )),\n    aligned_loadu_64x1 := Rule( @(1, sklr_loadu_64x1i, x -> IsInt(_unwrap(x.args[2] mod 64)) and not IsUnalignedPtrT(x.args[1])),\n                             e -> let(\n                                     offs := imod(e.args[2], 64),\n                                     xx0  := vtref(e.t, e.args[1], idiv(e.args[2], 64)),\n                                     xx1  := vtref(e.t, e.args[1], idiv(e.args[2], 64)+1),\n                                     nn   := _unwrap(e.args[3]),\n                                     bin_and( When(offs + nn <= 64,\n                                             bin_shr(xx0, offs),\n                                             bin_or(bin_shr(xx0, offs), bin_shl(xx1, 64 - offs))),\n                                         e.t.value(Replicate(nn, 1) :: Replicate(64 - nn, 0)))\n                                     )),\n\n));\n\nClass(SKLR_32x1i_to_SSE_16x8i, ISA_Bridge, rec(\n    isa_from    := SKLR_32x1i,\n    isa_to      := SSE_16x8i(T_Int(8)),\n\n    code        := (self, y, x, opts) >> let(\n                    xx := (offs) -> vtref(self.isa_from.t, x, offs),\n                    yy := (offs) -> vtref(self.isa_to.t,   y, offs),\n                    a  := var.fresh_t(\"U\", T_UInt(32)),\n                    b0 := var.fresh_t(\"U\", T_UInt(32)),\n                    b1 := var.fresh_t(\"U\", T_UInt(32)),\n                    b2 := var.fresh_t(\"U\", T_UInt(32)),\n                    b3 := var.fresh_t(\"U\", T_UInt(32)),\n                    mask := T_UInt(32).value(1 + 256 + 65536 + 16777216),\n                    decl([a,b0,b1,b2,b3], chain(\n                        assign( a, tcast(a.t, xx(0)) ),\n                        assign( b0, bin_and(            a, mask)),\n                        assign( b1, bin_and(bin_shr(a, 1), mask)),\n                        assign( b2, bin_and(bin_shr(a, 2), mask)),\n                        assign( b3, bin_and(bin_shr(a, 3), mask)),\n                        assign( yy(0), tcast(self.isa_to.t, vpack(b0, b1, b2, b3))),\n                        assign( b0, bin_and(bin_shr(a, 4), mask)),\n                        assign( b1, bin_and(bin_shr(a, 5), mask)),\n                        assign( b2, bin_and(bin_shr(a, 6), mask)),\n                        assign( b3, bin_and(bin_shr(a, 7), mask)),\n                        assign( yy(1), tcast(self.isa_to.t, vpack(b0, b1, b2, b3)))\n                    ))),\n\n    toAMat := self >> L(self.isa_from.v, 8).toAMat(),\n    toSpl  := self >> Cvt(self)*TL(self.isa_from.v, div(self.isa_from.v, 8)).withTags([AVecReg(self.isa_from)])\n));\n\nClass(SKLR_64x1i_to_SSE_16x8i, SKLR_32x1i_to_SSE_16x8i, rec(\n    isa_from := SKLR_64x1i,\n    isa_to   := SSE_16x8i(T_Int(8)),\n\n    code     := (self, y, x, opts) >> let(\n                    xx := (offs) -> vtref(self.isa_from.t, x, offs),\n                    yy := (offs) -> vtref(self.isa_to.t,   y, offs),\n                    a  := var.fresh_t(\"U\", T_UInt(64)),\n                    b0 := var.fresh_t(\"U\", T_UInt(64)),\n                    b1 := var.fresh_t(\"U\", T_UInt(64)),\n                    mask := T_UInt(64).value(1 + 2^8 + 2^16 + 2^24 + 2^32 + 2^40 + 2^48 + 2^56),\n                    decl([a,b0,b1], chain(\n                        assign( a, tcast(a.t, xx(0)) ),\n                        assign( b0, bin_and(            a, mask)),\n                        assign( b1, bin_and(bin_shr(a, 1), mask)),\n                        assign( yy(0), tcast(self.isa_to.t, vpack(b0, b1))),\n                        assign( b0, bin_and(bin_shr(a, 2), mask)),\n                        assign( b1, bin_and(bin_shr(a, 3), mask)),\n                        assign( yy(1), tcast(self.isa_to.t, vpack(b0, b1))),\n                        assign( b0, bin_and(bin_shr(a, 4), mask)),\n                        assign( b1, bin_and(bin_shr(a, 5), mask)),\n                        assign( yy(2), tcast(self.isa_to.t, vpack(b0, b1))),\n                        assign( b0, bin_and(bin_shr(a, 6), mask)),\n                        assign( b1, bin_and(bin_shr(a, 7), mask)),\n                        assign( yy(3), tcast(self.isa_to.t, vpack(b0, b1)))\n                    )))\n));\n\nClass(SKLR_32x1i_to_SSE_4x32f_f32, SKLR_32x1i_to_SSE_16x8i, rec(\n    isa_from := SKLR_32x1i,\n    isa_to   := SSE_4x32f(T_Real(32)),\n\n    code     := (self, y, x, opts) >> let(\n                    xx := (offs) -> vtref(self.isa_from.t, x, offs),\n                    yy := (offs) -> vtref(self.isa_to.t,   y, offs),\n                    ti := TVect(T_Int(32), 4),\n                    tf := TVect(T_Real(32), 4),\n                    a  := var.fresh_t(\"U\", T_UInt(32)),\n                    b  := var.fresh_t(\"U\", ti),\n                    decl( [a, b], chain( \n                        assign( a, tcast(a.t, xx(0)) ),\n                        assign( b, vpack(a, bin_shr(a, 8), bin_shr(a, 16), bin_shr(a, 24)) ),\n                        assign(yy(0), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 31), 31) ))),\n                        assign(yy(1), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 30), 31) ))),\n                        assign(yy(2), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 29), 31) ))),\n                        assign(yy(3), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 28), 31) ))),\n                        assign(yy(4), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 27), 31) ))),\n                        assign(yy(5), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 26), 31) ))),\n                        assign(yy(6), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 25), 31) ))),\n                        assign(yy(7), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b, 24), 31) )))\n                    ))\n                )\n));\n\nClass(SKLR_64x1i_to_SSE_4x32f_f32, SKLR_32x1i_to_SSE_16x8i, rec(\n    isa_from := SKLR_64x1i,\n    isa_to   := SSE_4x32f(T_Real(32)),\n\n    code     := (self, y, x, opts) >> let(\n                    xx := (offs) -> vtref(self.isa_from.t, x, offs),\n                    yy := (offs) -> vtref(self.isa_to.t,   y, offs),\n                    ti := TVect(T_Int(32), 4),\n                    tf := TVect(T_Real(32), 4),\n                    a  := var.fresh_t(\"U\", T_UInt(64)),\n                    b0 := var.fresh_t(\"U\", ti),\n                    b1 := var.fresh_t(\"U\", ti),\n                    shift := (t, n) -> tcast(T_Int(32), bin_shr(t, n)),\n                    decl( [a, b0, b1], chain( \n                        assign( a, tcast(a.t, xx(0)) ),\n                        assign( b0, vpack(shift(a,  0), shift(a,  8), shift(a, 16), shift(a, 24)) ),\n                        assign( b1, vpack(shift(a, 32), shift(a, 40), shift(a, 48), shift(a, 56)) ),\n                        assign(yy( 0), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 31), 31) ))),\n                        assign(yy( 1), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 31), 31) ))),\n                        assign(yy( 2), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 30), 31) ))),\n                        assign(yy( 3), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 30), 31) ))),\n                        assign(yy( 4), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 29), 31) ))),\n                        assign(yy( 5), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 29), 31) ))),\n                        assign(yy( 6), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 28), 31) ))),\n                        assign(yy( 7), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 28), 31) ))),\n                        assign(yy( 8), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 27), 31) ))),\n                        assign(yy( 9), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 27), 31) ))),\n                        assign(yy(10), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 26), 31) ))),\n                        assign(yy(11), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 26), 31) ))),\n                        assign(yy(12), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 25), 31) ))),\n                        assign(yy(13), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 25), 31) ))),\n                        assign(yy(14), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b0, 24), 31) ))),\n                        assign(yy(15), tcast(tf, bin_and( tf.one(), arith_shr(bin_shl(b1, 24), 31) )))\n                    ))\n                )\n));\n\n# NOTE: assumption that most significant bit is set for non zero numbers:\n#\n# SSE_16x8i_i8_to_SKLR_32x1i can be implemented as \n#    neg(vmovemask_16x8i(eq(self.isa_from.t.zero(), xx(2*i))))\n# and later simplified if xx(2*i) comes from comparision, yet we cannot match this situation\n# because it's unlikely that we will have comparision propagated into this expression.\n# Another way is to make T_Bool and simplify expression above by looking at data type.\n\nISA_Bridge.add(Class(CVT_SKLR_16x1i_SSE_16x8i, ISA_Bridge_I, rec(\n    isa_from    := SSE_16x8i(T_Int(8)),\n    isa_to      := SKLR_16x1i,\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> assign(self._y(y,0), vmovemask_16x8i(self._x(x,0))),\n)));\n\nISA_Bridge.add(Class(CVT_SKLR_16x1i_SSE_16x8ui, CVT_SKLR_16x1i_SSE_16x8i, rec(\n    isa_from := SSE_16x8i(T_UInt(8)),\n)));\n\nClass(SKLR_32f_to_SKLR_32x1i, ISA_Bridge_I, rec(\n    isa_from    := SKLR(T_Real(32)),\n    isa_to      := SKLR_32x1i,\n    granularity := self >> self.isa_to.v,\n\n    code := (self, y, x, opts) >> let(\n                j  := Ind(self.isa_to.v),\n                xt := self.isa_from.t,\n                yt := T_UInt(self.isa_to.v),\n                yy := (offs) -> vtref(self.isa_to.t, y, offs),\n                a  := var.fresh_t(\"U\", yt),\n                decl([a], chain(\n                    assign(a, a.t.zero()),\n                    loop(j, j.range, \n                        assign(a, bin_or(a, cond(eq(nth(x, j), xt.zero()), yt.zero(), bin_shl(yt.one(), j))))),\n                    assign(yy(0), a)\n                ))\n            ),\n));\n\nClass(SKLR_32f_to_SKLR_64x1i, SKLR_32f_to_SKLR_32x1i, rec(\n    isa_from := SKLR(T_Real(32)),\n    isa_to   := SKLR_64x1i\n));\n\n\nClass(SKLR_64x1i_to_SKLR_32f, ISA_Bridge_I, rec(\n    isa_from    := SKLR_64x1i,\n    isa_to      := SKLR(T_Real(32)),\n    granularity := self >> self.isa_from.v,\n\n    code := (self, y, x, opts) >> let(\n                j  := Ind(self.isa_from.v),\n                xx := (offs) -> vtref(self.isa_from.t, x, offs),\n                ti := T_UInt(self.isa_from.v),\n                tf := self.isa_to.t,\n                a  := var.fresh_t(\"U\", ti),\n                decl( [a], chain( \n                    assign( a, tcast(a.t, xx(0)) ),\n                    loop(j, j.range, \n                        assign( nth(y, j), tcvt( tf, bin_and(bin_shr(a, j), a.t.one())))\n                    ).unroll()\n                ))\n            ),\n));\n\n\nClass(SKLR_32x1i_to_SKLR_32f, SKLR_64x1i_to_SKLR_32f, rec(\n    isa_from := SKLR_32x1i,\n    isa_to   := SKLR(T_Real(32))\n));\n\nClass(SKLR_64x1i_to_SKLR_8i, SKLR_64x1i_to_SKLR_32f, rec(\n    isa_from := SKLR_64x1i,\n    isa_to   := SKLR(T_Int(8))\n));\n\nClass(SKLR_32x1i_to_SKLR_8i, SKLR_64x1i_to_SKLR_32f, rec(\n    isa_from := SKLR_32x1i,\n    isa_to   := SKLR(T_Int(8))\n));\n\n\n\n\nISA_Bridge.add(Class(CVT_SKLR_32x1i_SKLR_16x1i, ISA_Bridge_I, rec(\n    isa_from    := SKLR_16x1i,\n    isa_to      := SKLR_32x1i,\n    code := (self, y, x, opts) >> \n        assign(self._y(y,0), bin_or(tcvt(T_UInt(32), self._x(x,0)), bin_shl(tcvt(T_UInt(32), self._x(x,1)), 16)) ),\n)));\n\nISA_Bridge.add(Class(CVT_SKLR_64x1i_SKLR_16x1i, ISA_Bridge_I, rec(\n    isa_from    := SKLR_16x1i,\n    isa_to      := SKLR_64x1i,\n    code := (self, y, x, opts) >> \n        assign(self._y(y,0), bin_or(\n                     tcvt(T_UInt(64), self._x(x,0)),\n             bin_shl(tcvt(T_UInt(64), self._x(x,1)), 16),\n             bin_shl(tcvt(T_UInt(64), self._x(x,2)), 32),\n             bin_shl(tcvt(T_UInt(64), self._x(x,3)), 48)\n        )),\n)));\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "meta": {"hexsha": "846821ee7c6c00646b3b3c49e996c9214008078d", "size": 19483, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/scalar/bitisa/isa.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/scalar/bitisa/isa.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/scalar/bitisa/isa.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 42.262472885, "max_line_length": 129, "alphanum_fraction": 0.4771852384, "num_tokens": 6188, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3849121585956185, "lm_q2_score": 0.05921024866613546, "lm_q1q2_score": 0.02279074462506554}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(CellCodegen, VectorCodegen, rec(\n    Formula := meth(self, o, y, x, opts)\n        local icode, datas, prog, params, sub, initsub, io;\n        if IsBound(opts.XType) and not IsList(x) then\n            x.t := TPtr(opts.XType);\n            if IsBound(opts.useRestrict) and opts.useRestrict then\n                x.t := x.t.restrict();\n            fi;\n        fi;\n        if IsBound(opts.YType) and not IsList(y) then\n            y.t := TPtr(opts.YType);\n            if IsBound(opts.useRestrict) and opts.useRestrict then\n                y.t := y.t.restrict();\n            fi;\n        fi;\n\n        o := o.child(1);\n        params := Set(Collect(o, param));\n\n        datas := Collect(o, FDataOfs);\n        o := BlockSums(opts.globalUnrolling, o);\n        icode := ESReduce(self(o, y, x, opts),opts);\n        icode := RemoveAssignAcc(icode);\n        #Error(\"BP\");\n        icode := BlockUnroll(icode, opts);\n        # icode := PowerOpt(icode);\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        # Insert sw pipelining here\n        icode := MarkPreds(icode);\n        icode := MarkDefUse(icode);\n        #SubstTopDown(icode, loop, e->MarkSWPLoops(e));\n        #SubstTopDown(icode, loop_sw, e->SoftwarePipeline(e));\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        icode := func(TVoid, sub, Concatenation(io, params), icode);\n\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            prog := program(\n                decl(List(datas, x->x.var),\n                    chain(\n                        func(TVoid, initsub, params, chain(List(datas, x -> SReduce(x.var.init, opts)))),\n                        icode\n                    )));\n        else\n            prog := program( func(TVoid, initsub, params, chain()), icode);\n        fi;\n        prog.dimensions := o.dims();\n        return prog;\n    end,\n\n));\n\n", "meta": {"hexsha": "17893bb5c4e3037ad256b689c65b9d4b802ef7d4", "size": 2213, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/cellSPU/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/cellSPU/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/cellSPU/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.578125, "max_line_length": 105, "alphanum_fraction": 0.5431540895, "num_tokens": 574, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46490157137338844, "lm_q2_score": 0.04885777948775908, "lm_q1q2_score": 0.022714058457673703}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(TestBench);\n\n#F TestBench(\"name\", <transforms> <opts>, <searchopts>)\n#F\n#F d := TestBench(\"default\", [DFT(2), DFT(4)], SpiralDefaults, rec())\n#F\n#F TestBench Interface:\n#F\n#F     .build(transforms, opts, bopts, name, searchopts),\n#F\n#F     .generateCfiles := [true, false],  default = true\n#F     .matrixVerify   := [true, false],  default = false\n#F     .fftwVerify     := [true, false],  default = false\n#F\n#F     .fileTransform(t, opts),    .c filenames:   override in a subclass\n#F     .funcTransform(t, opts),    function names: override in a subclass\n#F     .txtFileName(runMethod),    timing file name\n#F\n#F     .run()              run DP\n#F     .runExhaustive()    run exhaustive search\n#F     .runRandom()        run 1 random tree, do not generate hash\n#F     .runRandomSave()    run 1 random tree, generate and save hash\n#F     .runRandom10()      run 10 random trees, do not generate hash\n#F     .runRandomSave10()  run 10 random trees, generate and save hash\n#F     .pickRandom()       generate random trees and save hash, do not run\n#F\n#F     .generateCode()\n#F     .generateProductionCode()   same as .generateCode() but will use opts.production()\n#F\n#F     .entries()\n#F     .times()\n#F     .mflops()\n#F\nClass(TestBench, rec(\n    ##\n    ## Configuration\n    ##\n    generateCfiles    := true,\n    matrixVerify      := false,\n    fftwVerify        := false,\n    outputExhaustive  := false,\n    outputDir         := \".\",\n    fileTransform     := (self, t, opts) >> self.outputDir :: Conf(\"path_sep\") :: self.name :: \"_\" \n                                                   :: Drop(CodeletName(CodeletShape(t)), 1) :: \".c\",\n    funcTransform     := (self, t, opts) >> \"sub1\",\n    prodFileTransform := (self, t, opts) >> self.fileTransform(t, opts), # used in generateProductionCode\n    prodFuncTransform := (self, t, opts) >> self.funcTransform(t, opts),\n    txtFileName       := (self, runMethod) >> self.outputDir :: Conf(\"path_sep\") :: self.name :: \".\" \n                                                  :: SubString(runMethod, 5) :: \".txt\",\n    ##\n    ## Public methods\n    ##\n\n    # TestBench(<name>, <transforms>, <opts>, <search_opts>)\n    __call__ := meth(self, name, transforms, opts, searchopts)\n        local o;\n\to := CopyFields(opts); \n\tif not IsBound(o.hashTable) then o.hashTable := HashTableDP(); fi;\n\tif not IsBound(o.hashFile)  then o.hashFile := Concat(self.outputDir, Conf(\"path_sep\"), name, \".hash\"); fi;\n        return WithBases(self,\n            rec(searchopts:=searchopts, opts:=o, transforms:=transforms, name:=name, verbosity:=1, callbacks:=[]));\n    end,\n\n    # TestBench.build(<transforms>, [<opts>], [<bench_opts>], [<bench_name>], [<search_opts>])\n    #    Alternative constructor that supports default argument values if not provided\n    #   \n    build := function(arg)\n        local transforms, opts, bopts, name, dpr;\n\n        transforms := When(IsList(arg[1]), arg[1], [arg[1]]);\n        opts := When(Length(arg) >= 2, arg[2], SpiralDefaults);\n        bopts := When(Length(arg) >= 3, arg[3], rec());\n        name := When(Length(arg) >= 4, arg[4], \"spiral\");\n        dpr := When(Length(arg) >= 5, arg[5], rec(verbosity := 0, timeBaseCases:=true));\n\n        return CopyFields(TestBench(name, transforms, opts, dpr), bopts);\n    end,\n\n    generateCode           := self >> self._generateCode(self.transforms, self.opts),\n\n    generateProductionCode := self >> self._generateCode(self.transforms, self.opts.production()),\n\n    entries := self >> List(self.transforms, t -> self.entry(t)), \n\n    entry := (self, t) >> let(l := self._rawentry(t), \n\tWhen(l=false, false, CopyFields(l, rec(ruletree := ApplyRuleTreeSPL(l.ruletree, t, self.opts))))),\n\n    times   := self >> List(self.entries(), e -> e.measured),\n\n    mflops  := self >> List(self.entries(), e -> self.acost(e) * LocalConfig.cpuinfo.freq / e.measured),\n\n    # Use NonTerminal.normalizedArithCost() if it is there, otherwise return 0\n    acost := (self, entry) >> self._rtflops(entry.ruletree),\n\n    run            := arg >> arg[1]._run([],Drop(arg, 1), \"_runDP\",         true),\n    runDP          := ~.run,\n    runExhaustive  := arg >> arg[1]._run([], Drop(arg, 1), \"_runExhaustive\", true),\n    runRandom      := arg >> arg[1]._run([arg[2]], Drop(arg, 2), \"_runRandom\",     false),\n    runRandomSave  := arg >> arg[1]._run([arg[2]], Drop(arg, 2), \"_runRandomSave\", true),\n    pickRandomSave := arg >> arg[1]._run([], Drop(arg, 1), \"_pickRandomSave\",true), \n\n    ##\n    ## Private methods\n    ##\n\n    _rtflops := rtree -> let(t:=rtree.node, When(IsBound(t.normalizedArithCost), EvalScalar(t.normalizedArithCost()), 0)),\n\n    _verify := (self, opts, ruletree) >> VerifyMatrixRuleTree(ruletree, opts),\n\n    # NOTE: Slightly hacked in. Check for opts.profile being bound etc. Look at VerifyMatrixRuleTree.\n    _verifyfftw := (self, opts, code) >> opts.profile.verifyfftw(code, opts),\n\n    _startHashFile := (self, hfile, d) >> PrintTo(hfile,\n        \"<# DPBench experiment '\", self.name, \"'\\n\",\n        \" # Started \", d[2], \" \", d[3], \" \", d[1], \"  \", d[4], \":\", d[5], \"\\n\",\n        \" # Transforms: \", self.transforms, \"#> \\n\\n\",\n        \"ImportAll(spiral); Import(paradigms.common, paradigms.smp, platforms.sse, paradigms.vector); \\n\",\n        \"ImportAll(paradigms.vector); \\n\\n\",\n        \"hash := HashTableDP(); \\n\"\n    ),\n\n    _loadHash := meth(self, hfile)\n        local ns, result;\n        ns := tab();\n        result := READ(hfile, ns);\n        if result = false or not IsBound(ns.hash) then return false;\n        else return ns.hash;\n        fi;\n    end,\n\n    _saveHash := meth(self, hfile, date, hash)\n        local bucket, e;\n        var.print := var.printFull;\n        self._startHashFile(hfile, date);\n        for bucket in hash.entries do\n            for e in bucket do\n                if e.data<>[] then\n                    AppendTo(hfile, \"HashAdd(hash, \", e.key, \", [\", e.data[1], \"]);\\n\");\n                fi;\n            od;\n        od;\n        var.print := var.printShort;\n    end,\n\n    reloadHash := meth(self)\n       local hash, e;\n       hash := self._loadHash(self.opts.hashFile);\n       if (self.verbosity>0) then\n\t   PrintLine(When(hash=false, \"Could not load \", \"Loaded \"), self.name, \" (\", self.opts.hashFile, \")\");\n       fi;\n       if hash <> false then\n\t   self.opts.hashTable := hash;\n       fi;\n    end,\n\n    _generateCode := meth(self, transforms, opts)\n         local entries, e, c, t;\n         for t in transforms do\n             e := self.entry(t); \n             if e = false then Error(\"Transform \", t, \" not found in hashTable\"); fi;\n             c := CodeRuleTree(e.ruletree, opts);\n             PrintLine(t, \" -> \", self.prodFileTransform(t, opts));\n             PrintTo(self.prodFileTransform(t, opts), PrintCode(self.prodFuncTransform(t, opts), c, opts));\n         od;\n    end,\n\n    _showStats := meth(self, runMethod, t, ruletree, c, cycles, searchTime)\n        local acc;\n        # NOTE: slightly hacked in. Clean up to get both matrix and fftw verification to use already generated c.\n\tif self.matrixVerify or self.fftwVerify then\n\t    if self.matrixVerify then acc := self._verify(self.opts, ruletree);\n\t    else                      acc := self._verifyfftw(self.opts, c); fi;\n\t    _seqPerfStatsGflopsAcc(self.txtFileName(runMethod), t, self._rtflops(ruletree), cycles, searchTime, acc);\n\telse\n\t    When(self.opts.verbosity>-1, \n\t\t _seqPerfStatsGflops(self.txtFileName(runMethod), t, LocalConfig.cpuinfo.freq, self._rtflops(ruletree), cycles, searchTime));\n\tfi;\n    end,\n\n    _rawentry := (self, t) >> let(\n\tlookup := MultiHashLookup(Concatenation([self.opts.hashTable], self.opts.baseHashes), HashAsSPL(t)),\n\tWhen(lookup=false or lookup=[], false, lookup[1])),\n\n    #\n    # Run methods\n    #\n\n    _runDP         := (self, t, opts) >> TimedAction(DP(t, self.searchopts, opts)),\n\n \n    # Find best using an exhaustive search\n    _runExhaustive := meth(self, t, opts)\n       local r, searchTime, mincycles, mintree, rt, c, compiletime, cm, measuretime;\n\n       r := AllRuleTrees(t, opts);\n       searchTime := 0;\n       mincycles := 10^100;\n\n       for rt in r do\n          [c,  compiletime] := TimedAction(CodeRuleTreeOpts(rt, opts));\n          [cm, measuretime] := TimedAction(CMeasure(c, opts));\n          if self.outputExhaustive then _seqPerfStatsGflops(\n\t\t  self.txtFileName(\"_runExhaustive-all\"), t, LocalConfig.cpuinfo.freq, self._rtflops(rt), cm, compiletime+measuretime); fi;\n          if (cm < mincycles) then\n              mincycles := cm; mintree := Copy(rt);\n          fi;\n          searchTime:=searchTime+compiletime+measuretime;\n       od;\n       HashDelete(opts.hashTable,t);\n       HashAdd(opts.hashTable, t, [rec(ruletree:=mintree, measured:=mincycles)]);\n\n       return([mintree, searchTime]);\n    end,\n\n    # Run a <num> random ruletrees. Useful for quick, dirty, non-comprehensive tests.\n    _runRandomNum := meth(self, num, t, opts)\n       local r, c, start, cycles, i, res;\n       start := TimeInSecs();\n       res := [];\n       for i in [1..num] do\n           r := RandomRuleTree(t, opts); \n           c := CodeRuleTree(r, opts); \n           cycles := CMeasure(c, opts); \n           Add(res, [r, cycles]);\n       od;\n       Sort(res, (a, b) -> a[2] < b[2]);\n       return [res[1][1], res[1][2], TimeInSecs()-start];\n     end,\n\n    # Run random search and save result in hash.\n    _runRandomSave := meth(self, num, t, opts)\n       local r, srchTime, cycles;\n       [r, cycles, srchTime] := self._runRandomNum(num, t, opts);\n       HashDelete(opts.hashTable, t);\n       HashAdd(opts.hashTable, t, [rec(ruletree:=r, measured:=cycles)]);\n       return [r, srchTime];\n    end,\n\n    _runRandom := (self, num, t, opts) >> self._runRandomNum(num, t, opts){[1,3]},\n\n    # Pick random and save result in hash (NOT measured).\n    _pickRandomSave := meth(self, e, t, opts)\n       local r, searchtime;\n       [r, searchtime] := TimedAction(RandomRuleTree(t, opts));\n       HashDelete(opts.hashTable,t);\n       HashAdd(opts.hashTable,t,[rec(ruletree:=r)]);\n       return [r, searchtime];\n    end,\n\n    _resume := self >> When(ForAny(self.entries(), e->e=false), self.reloadHash()),\n\n    _run := meth(self, runArgs, transforms, runMethod, useHash)\n        local t, outf, res, nopts, opts, c, cycles, hentry,  date, i, searchTime, acc, f, ruletree;\n        MakeDir(self.outputDir);\n        transforms := Flat(transforms);\n        if transforms=[] then transforms := self.transforms; fi; # equivalent of runAll() in DPBench\n        Constraint(ForAll(transforms, IsSPL));\n        self._resume();\n        for f in self.callbacks do f(self); od;\n\topts := self.opts;\n\tdate := Date();\n\n\tfor t in transforms do\n            # For run methods that use hash tables\n\t    if useHash then\n\t\thentry := self._rawentry(t); \n\t\tif hentry = false then\n\t\t    res := ApplyFunc(self.(runMethod), runArgs :: [t, opts]);\n\t\t    if res[1] = [] then Error(runMethod, \" did not find any ruletrees for <t> (\", t, \")\"); fi;\n\t\t    self._saveHash(opts.hashFile, date, opts.hashTable);\n\t\t    hentry := self._rawentry(t); \n\t\t    hentry.searchTime := res[2];\n\t\t    searchTime := res[2];\n\t\telse\n\t\t    searchTime := -1;\n\t\tfi;\n\t\thentry.spectree := ApplyRuleTreeSPL(hentry.ruletree, t, opts);\n                #NOTE: exhaustive search will not update cycles\n\t\tcycles := When(IsBound(hentry.measured), hentry.measured, 0);\n\t\truletree := hentry.spectree;\n            # For run methods that don't use hash tables\n\t    else\n\t\t[ruletree, searchTime] := ApplyFunc(self.(runMethod), runArgs :: [t, opts]);\n\t\tcycles := 0;\n\t    fi;\n\n            # HACK: It's a pain to do this in a cleaner way\n\t    if runMethod = \"_pickRandomSave\" then return; fi;\n\n\t    if self.generateCfiles then\n                #NOTE: Shouldn't have to generate code or run this whole thing again.\n\t\tc := CodeRuleTree(ruletree, opts);\n\t\tcycles := CMeasure(c, opts);\n\t\tif useHash then hentry.measured := cycles; fi;\n\n\t\tnopts := CopyFields(opts, rec(fileinfo := rec(\n\t\t\t    cycles  := cycles,\n\t\t\t    flops   := self._rtflops(ruletree),\n\t\t\t    file    := self.fileTransform(t,opts),\n\t\t\t    algorithm := ruletree)));\n\t\tPrintTo(self.fileTransform(t,opts), PrintCode(self.funcTransform(t,opts), c, nopts));\n            else\n                c := skip();\n\t    fi;\n\t    \n\t    self._showStats(runMethod, t, ruletree, c, cycles, searchTime); \n        od;\n    end,\n));\n", "meta": {"hexsha": "c527cd2a6826dc4e86757ed1e2b209ee02a3d165", "size": 12418, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/libgen/testbench.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/libgen/testbench.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/libgen/testbench.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 39.4222222222, "max_line_length": 127, "alphanum_fraction": 0.5942985988, "num_tokens": 3461, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.38861802670584894, "lm_q2_score": 0.05834583610886592, "lm_q1q2_score": 0.022674243695130342}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F AllocBuffersSMP(pfx, code, map, opts)\n#F\n#F Returns [newbuffers, allocation_code, code]\n#F and fills the <map> with the remapping from original array-typed variables\n#F to the new dynamically allocated pointer-typed variables.\n#F\n#F if opts.zeroallocate is true, the buffers are zeroed out\n#F if opts.buffPrefixExtra is set, it's appended to pfx\nAllocBuffersSMP := function(pfx, code, map, opts)\n    local nameprefix, newbuffers, buffers, b, bufmap, v, nthreads, tid, newv, alloc_code;\n    ## Pull out the buffer declarations\n    [buffers, code] := PullBuffersSMP(code, IsArrayT);\n    alloc_code := [];\n    newbuffers := [];\n\tif IsBound(opts.buffPrefixExtra) then\n\t\tnameprefix := Concat(pfx, String(opts.buffPrefixExtra));\n\telse\n\t\tnameprefix := pfx;\n\tfi;\n    for b in buffers do\n        [v, nthreads, tid] := b;\n        if nthreads = 1 then\n            newv := var.fresh_t(nameprefix, TPtr(v.t.t));\n        else\n            newv := var.fresh_t(Concat(\"thr\", nameprefix), TPtr(v.t.t));\n        fi;\n        if IsBound(v.value) then\n            newv.value := v.value;\n        fi;\n        Add(newbuffers, newv);\n        if IsBound(opts.zeroallocate) and opts.zeroallocate then\n            Add(alloc_code, zallocate(newv, TArray(v.t.t, v.t.size*nthreads)));\n        else\n            Add(alloc_code, allocate(newv, TArray(v.t.t, v.t.size*nthreads)));\n        fi;\n        map.(v.id) := When(nthreads=1, newv, newv + tid*v.t.size);\n    od;\n    return [newbuffers, alloc_code, code];\nend;\n\n#F UnifyBuffersSMP(pfx, code, map, ubuf)\n#F\n#F Returns [ubuf_size, ptr_init_code, code]\n#F and fills the <map> with the remapping from original array-typed variables\n#F to the new dynamically allocated pointer-typed variables.\n#F\n#F ptr_init_code initializes the pointer-typed variables as pointers to\n#F sections of <ubuf>\n#F\nUnifyBuffersSMP := function(pfx, code, map, ubuf, opts)\n    local map, vars, alloc, ofs, usize, ptr_init_code;\n    [vars, alloc, code] := AllocBuffersSMP(pfx, code, map,opts);\n    ofs   := ScanL(alloc, (prev, c) -> prev + c.exp.size * sizeof(c.exp.t), 0);\n    usize := Sum(alloc, a -> a.exp.size * sizeof(a.exp.t));\n\n    ptr_init_code := List([1..Length(vars)], i -> assign(vars[i], tcast(vars[i].t, (ubuf + ofs[i]))));\n    return [ usize, ptr_init_code, code ];\nend;\n\nClass(RecCodegen, RecCodegenMixin, SMPCodegenMixin, DefaultCodegen, rec(\n    Formula := meth(self, o, y, x, opts)\n        local code, datas, prog, params, init_code, destroy_code, codelet_codes, codelet_recs,\n          datvars, dalloc, bufvars, bufalloc, map, ignore, num_threads, smp, io, _data, v;\n\n        [x, y] := self.initXY(x, y, opts);\n    o := o.child(1);\n    params := Set(Collect(o, param));\n    datas := Collect(o, @(1, var, e->IsBound(e.init)));\n    smp := Collect(o, SMPSum);\n    num_threads := When(smp=[], 1, smp[1].nthreads);\n#    if not ForAll(smp, x->x.nthreads=num_threads) then Error(\"Non-uniform num_threads in SMPSum's\"); fi;\n    io := When(x=y, [x], [y, x]);\n\n    ## Generating code : codelets\n    codelet_recs := CompileCodelets(o, opts);\n    codelet_codes := List(codelet_recs, clrec ->\n        func(TVoid, clrec.name, Concatenation([Y, X], clrec.params), clrec.code));\n\n    map := tab();\n    ## Generating code : main body\n    code := SReduce(self(o, y, x, opts), opts);\n    code := BlockUnroll(code, opts);\n    code := DeclareHidden(code); # NOTE: do I need this?\n    code := func(TVoid, \"transform\", Concatenation(\n        When(IsBound(opts.subParams), opts.subParams, []), params, io),\n                When(num_threads=1, code,\n                                    smp_fork(num_threads, code)));\n\n    [bufvars, bufalloc, code] := AllocBuffersSMP(\"buf\", code, map, opts);\n\n    ## Generating code : initialization\n    [datvars, dalloc, ignore] := AllocBuffersSMP(\"dat\", decl(datas, skip()), map, opts);\n    init_code := func(TVoid, \"init\", [],\n        chain(bufalloc, dalloc, List(datas, x -> SReduce(x.init, opts))));\n\tdestroy_code := func(TVoid, \"destroy\", [], skip());\n\n    for v in bufvars do Add(v.t.qualifiers, \"static\"); od;\n    for v in datvars do Add(v.t.qualifiers, \"static\"); od;\n    _data := When(not IsBound(opts.smp) or (IsBound(opts.smp) and IsBound(opts.smp.OmpMode) and opts.smp.OmpMode = \"for\"), (i,j,k)->k, (i,j,k)->data(i, j, k));\n\n    prog := program(\n        codelet_codes,\n        decl(Concatenation(datvars, bufvars),\n        _data(var(\"NUM_THREADS\", TInt), V(num_threads),\n            SubstVars(chain(init_code, code, destroy_code), map))));\n    prog.dimensions := o.dimensions;\n    return prog;\n    end,\n));\n", "meta": {"hexsha": "e6ab0f9fc63aeb41039663f49c93233dc349778d", "size": 4624, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/libgen/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/libgen/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/libgen/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 40.2086956522, "max_line_length": 159, "alphanum_fraction": 0.634083045, "num_tokens": 1336, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.399811640739795, "lm_q2_score": 0.056652426104335525, "lm_q1q2_score": 0.02265029943266438}}
{"text": "#############################################################################\n##\n##                             equivalent mappings\n##  stack.gi\n##                                                          Sergio Siccha\n##\n##  Copyright 2017 by the authors.\n##  This file is free software, see license file.\n##\n##  Implementation of MyStack\n##\n#############################################################################\n\n###############################\n# Operation StackCreate\n# Input:\n#   length -\n# Filters:\n#   IsInt\n#\n# Output:\n#   stack;\n###############################\nInstallMethod( StackCreate, \"Initialize empty stack of given length.\",\n[ IsInt ],\nfunction( length )\n  local stack;\n  stack := rec( elements := [], last := 0 );\n  stack.elements[ length+1 ] := fail; ## force allocation of storage\n  Objectify( StackType, stack );\n  return stack;\nend );\n\n###############################\n# Operation StackPush\n# Input:\n#   obj -\n# Filters:\n#   IsObject\n#\n# Output:\n#   none\n###############################\nInstallMethod( StackPush, \"Push obj to stack.\",\n[ IsMyStack, IsObject ],\nfunction( stack, obj )\n  stack!.last := stack!.last + 1;\n  stack!.elements[ stack!.last ] := obj;\nend );\n\n###############################\n# Operation StackPop\n# Input:\n#   stack -\n# Filters:\n#   IsMyStack\n#\n# Output:\n#   last element of stack\n###############################\nInstallMethod( StackPop, \"Pop the last object that was added to stack\",\n[ IsMyStack ],\nfunction( stack )\n  stack!.last := stack!.last - 1;\n  return stack!.elements[ stack!.last + 1 ];\nend );\n\n###############################\n# Operation StackPopAll\n# Input:\n#   stack -\n# Filters:\n#   IsMyStack\n#\n# Output:\n#   all elements of stack\n###############################\nInstallMethod( StackPopAll, \"Pop all objects of stack.\",\n[ IsMyStack ],\nfunction( stack )\n  local last;\n  stack!.last := 0;\n  return stack!.elements{ [ 1 .. last ] };\nend );\n\n\n###############################\n# Operation StackPeek\n# Input:\n#   stack -\n# Filters:\n#   IsMyStack\n#\n# Output:\n#   last element of stack\n###############################\nInstallMethod( StackPeek, \"Peek the last object that was added to stack\",\n[ IsMyStack ],\nfunction( stack )\n  return stack!.elements[ stack!.last ];\nend );\n\n###############################\n# Operation StackIsEmpty\n# Input:\n#   stack -\n# Filters:\n#   IsMyStack\n#\n# Output:\n#   stack!.last = 0;\n###############################\nInstallMethod( StackIsEmpty, \"Checks whether stack is empty.\",\n[ IsMyStack ],\nfunction( stack )\n  return stack!.last = 0;\nend );\n", "meta": {"hexsha": "6ba99d60b6947ff2e3a8f78904e4d63c1ebefaeb", "size": 2524, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/data-structures/stack.gi", "max_stars_repo_name": "ssiccha/equivalent-mappings", "max_stars_repo_head_hexsha": "0fd2dd4946980604e9378c29f16244521d6bbf76", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/data-structures/stack.gi", "max_issues_repo_name": "ssiccha/equivalent-mappings", "max_issues_repo_head_hexsha": "0fd2dd4946980604e9378c29f16244521d6bbf76", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/data-structures/stack.gi", "max_forks_repo_name": "ssiccha/equivalent-mappings", "max_forks_repo_head_hexsha": "0fd2dd4946980604e9378c29f16244521d6bbf76", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.3898305085, "max_line_length": 77, "alphanum_fraction": 0.4932646593, "num_tokens": 565, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.33458944125318596, "lm_q2_score": 0.06754669442450782, "lm_q1q2_score": 0.022600410745995763}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# NOTE: find a better place for these! What about a single standard drop tag rule?\nNewRulesFor(TRC, rec(\n    TRC_tag := rec(\n        forTransposition := false,\n        applicable := (self, nt) >>\n            (nt.isTag(1, spiral.paradigms.smp.AParSMP) or not nt.hasTags())\n            # AVecReg is taken from a namespace that is NOT YET LOADED\n\t    # hence the fully qualified name\n            and not nt.hasTag(spiral.paradigms.vector.AVecReg)\n            and not nt.hasTag(spiral.paradigms.vector.AVecRegCx),\n\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> RC(c[1])\n    )\n));\n\nNewRulesFor(TDiag, rec(\n    TDiag_tag := rec(\n        forTransposition := false,\n\n\t# YSV: Below limits applicability to the cases where diag size is divisible by vlen\n\t#      which is a safe thing to do. Because VectorCodegen, can't  generated code\n\t#      for VDiags of size non-divisible by vlen. HOWEVER, if VDiag is propagate\n\t#      past any kind of VGath, this problem goes away. So having no restriction,\n\t#      will work MOST of the time, but not all the time.\n        #\n\t# applicable := (self, nt) >> let(\n\t#     vtags := [spiral.paradigms.vector.AVecReg, spiral.paradigms.vector.AVecRegCx],\n\t#     dom   := nt.params[1].domain(),\n\t#     not nt.hasAnyTag(vtags) or (dom mod nt.getAnyTag(vtags).v) = 0\n\t# ),\n\n        apply := (t, C, Nonterms) -> let(\n\t    vtags := [spiral.paradigms.vector.AVecReg, spiral.paradigms.vector.AVecRegCx],\n\t    Cond(t.hasAnyTag(vtags),\n\t\t spiral.paradigms.vector.sigmaspl.VDiag(t.params[1], t.getAnyTag(vtags).v),\n\t\t Diag(t.params[1])\n\t    )\n\t)\n    )\n));\n\nRulesFor(TRCDiag, rec(\n    TRCDiag_tag := rec(\n        forTransposition := false,\n        applicable := (self, nt) >> not nt.transposed,\n        rule := (P, C) -> RC(Diag(P[1])))\n));\n\nRulesFor(TId, rec(\n    TId_tag := rec(\n        forTransposition := false,\n        switch := false,\n        rule := (P, C) -> P[1])\n));\n\nNewRulesFor(TRaderMid, rec(\n    TRaderMid_tag := rec(\n        forTransposition := false,\n        apply := (t, C, Nonterms) -> t.raderMid(t.params[1], t.params[2], t.params[3])\n    )\n));\n\nNewRulesFor(TRDiag, rec(\n    TRDiag_RT_Diag := rec(\n        forTransposition := true,\n        apply := (t, C, Nonterms) -> t.terminate()\n    )\n));\n\nNewRulesFor(TCompose, rec(\n    TCompose_tag := rec(\n        forTransposition := false,\n        applicable := (self, nt) >> true,\n        children := nt -> [ List(nt.params[1], e -> e.withTags(nt.getTags())) ],\n        apply := (nt, c, nt) -> Grp(Compose(c))\n    )\n));\n\nNewRulesFor(TCond, rec(\n    TCond_tag := rec(\n        forTransposition := false,\n        applicable := (self, nt) >> true,\n        children := nt -> [[\n\t    nt.params[2].withTags(nt.getTags()), nt.params[3].withTags(nt.getTags()) ]],\n        apply := (t, C, Nonterms) -> COND(t.params[1], C[1], C[2])\n    )\n));\n\nNewRulesFor(TGrp, rec(\n    TGrp_tag := rec(\n        forTransposition := false,\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> Grp(c[1])\n    )\n));\n\nNewRulesFor(TInplace, rec(\n    TInplace_tag := rec(\n        forTransposition := false,\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> Inplace(c[1])\n    )\n));\n\nNewRulesFor(TICompose, rec(\n    TICompose_tag := rec(\n        forTransposition := false,\n        children := nt -> [[ nt.params[3].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> ICompose(nt.params[1], nt.params[2], c[1])\n    )\n));\n\n\n\n########################################################################\n#   (A + B) rules\nNewRulesFor(TDirectSum, rec(\n#   (A + B) terminate\n    A_dirsum_B := rec(\n        forTransposition := false,\n        children := (self, t) >> let( tags := t.getTags(),\n            [[ t.params[1].withTags(tags), t.params[2].setTags(tags) ]]\n        ),\n        apply := (t, C, Nonterms) -> DirectSum(C)\n\n#D        children := (self, t) >> let (tags:=GetTags(t),\n#D            [[ AddTag(t.params[1], tags), SetTag(t.params[2], tags) ]]),\n    )\n));\n\n\n\n\n########################################################################\n#   (A x B) rules\nNewRulesFor(TTensor, rec(\n#   (A x B) -> (A x I)(I x B)\n    AxI_IxB := rec(\n        info := \"(A x B) -> (A x I)(I x B)\",\n        forTransposition := false,\n        applicable := nt -> true,\n        inplace := false,\n        children := (self, nt) >> let(inp := When(self.inplace, TInplace, x->x),\n            [[ TCompose([\n                inp(TTensorI(nt.params[1], nt.params[2].dims()[1], AVec, AVec)),\n                TTensorI(nt.params[2], nt.params[1].dims()[2], APar, APar)\n            ]).withTags(nt.getTags()) ]]),\n        apply := (nt, c, cnt) -> c[1],\n#D        isApplicable := P -> true,\n#D        allChildren := P -> [[TCompose([TTensorI(P[1], P[2].dims()[1], AVec, AVec), TTensorI(P[2], P[1].dims()[2], APar, APar)], P[3])]],\n#D        rule := (P, C) -> C[1]\n    ),\n#   (A x B) -> (I x B)(A x I)\n    IxB_AxI := rec(\n        info := \"(A x B) -> (I x B)(A x I)\",\n        forTransposition := false,\n        applicable := nt -> true,\n        inplace := false,\n        children := (self, nt) >> let(inp := When(self.inplace, TInplace, x->x),\n            [[ TCompose([\n                inp(TTensorI(nt.params[2], nt.params[1].dims()[1], APar, APar)),\n                TTensorI(nt.params[1], nt.params[2].dims()[2], AVec, AVec)\n            ]).withTags(nt.getTags()) ]]),\n        apply := (nt, c, cnt) -> c[1]\n\n#D        isApplicable := P -> true,\n#D        allChildren := P -> [[TCompose([TTensorI(P[2], P[1].dims()[1], APar, APar), TTensorI(P[1], P[2].dims()[2], AVec, AVec)], P[3])]],\n#D        rule := (P, C) -> C[1]\n    ),\n#   (A x B) -> (L(B x I))(L(A x I))\n    L_BxI__L_AxI := rec(\n        info := \"(A x B) -> (L(B x I))(L(A x I))\",\n        forTransposition := false,\n        applicable := nt -> true,\n        children := nt -> [[ TCompose([\n            TTensorI(nt.params[2], nt.params[1].dims()[1], APar, AVec),\n            TTensorI(nt.params[1], nt.params[2].dims()[2], APar, AVec)\n        ]).withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> c[1]\n\n#D        isApplicable := P -> true,\n#D        allChildren := P -> [[TCompose([TTensorI(P[2], P[1].dims()[1], APar, AVec), TTensorI(P[1], P[2].dims()[2], APar, AVec)], P[3])]],\n#D        rule := (P, C) -> C[1]\n    ),\n#   (A x B) -> ((A x I)L)((B x I)L)\n    AxI_L__BxI_L := rec(\n        info := \"(A x B) -> ((A x I)L)((B x I)L)\",\n        forTransposition := false,\n        applicable := nt -> true,\n        children := nt -> [[ TCompose([\n            TTensorI(nt.params[1], nt.params[2].dims()[1], AVec, APar),\n            TTensorI(nt.params[2], nt.params[1].dims()[2], AVec, APar)\n        ]).withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> c[1],\n\n#D        isApplicable := P -> true,\n#D        allChildren := P -> [[TCompose([TTensorI(P[1], P[2].dims()[1], AVec, APar), TTensorI(P[2], P[1].dims()[2], AVec, APar)], P[3])]],\n#D        rule := (P, C) -> C[1]\n    ),\n));\n\n########################################################################\n#   rules for A x I, I x A, (A x I)L, (I x A)L\nNewRulesFor(TTensorI, rec(\n    TTensorI_toGT := rec(\n        applicable := t -> true,\n        freedoms := t -> [], # no degrees of freedom\n        child := (t, fr) -> [ GT_TTensorI(t) ], # fr will be an empty list\n        apply := (t, C, Nonterms) -> C[1]\n    )\n));\n\n\nNewRulesFor(TTensorI, rec(\n#   base cases\n#   I x A\n    IxA_base := rec(\n        info := \"IxA base\",\n        forTransposition := false,\n        applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsParPar(nt.params),\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> When(nt.params[2] > 1,\n            Tensor(I(nt.params[2]), c[1]),\n            c[1]\n        )\n#D        isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsParPar(P),\n#D        allChildren := P -> [[P[1]]],\n#D        rule := (P, C) -> When(P[2]>1,Tensor(I(P[2]),C[1]),C[1])\n    ),\n#   A x I\n    AxI_base := rec(\n        info := \"AxI base\",\n        forTransposition := false,\n        applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsVecVec(nt.params),\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> When( nt.params[2] > 1,\n            Tensor(c[1], I(nt.params[2])),\n            c[1]\n        ),\n#D        isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsVecVec(P),\n#D        allChildren := P -> [[P[1]]],\n#D        rule := (P, C) -> When(P[2]>1,Tensor(C[1], I(P[2])),C[1])\n    ),\n#   (I x A)L\n    IxA_L_base := rec(\n        info := \"(IxA)L base\",\n        forTransposition := false,\n        applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsParVec(nt.params),\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> Tensor(I(nt.params[2]), c[1]) * L(c[1].dims()[2] * nt.params[2], nt.params[2]),\n\n#D        isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsParVec(P),\n#D        allChildren := P -> [[P[1]]],\n#D        rule := (P, C) -> Tensor(I(P[2]), C[1])*L(C[1].dims()[2]*P[2], P[2])\n    ),\n#   L(I x A)\n    L_IxA_base := rec(\n        info := \"L(IxA) base\",\n        forTransposition := false,\n        applicable := nt -> (not nt.hasTags() or nt.firstTag() = ANoTag) and IsVecPar(nt.params),\n        children := nt -> [[ nt.params[1].withTags(nt.getTags()) ]],\n        apply := (nt, c, cnt) -> L(c[1].dims()[1] * nt.params[2], c[1].dims()[1]) * Tensor(I(nt.params[2]), c[1])\n\n#D        isApplicable := (self, P) >> PUntagged(self.nonTerminal, P) and IsVecPar(P),\n#D        allChildren := P -> [[P[1]]],\n#D        rule := (P, C) -> L(C[1].dims()[1]*P[2], C[1].dims()[1]) * Tensor(I(P[2]), C[1])\n    ),\n#   splitting rules ##############################################################\n#   (A _m x I_n)L_mn_m\n    AxI_L_split := rec(\n        info := \"split (A_m x I_n) L^mn_m --> (L_mn/u_m x I_u) * (I_n/u x (A_m x I_u) * L_mu_m )\",\n        forTransposition := false,\n        applicable := nt -> (nt.firstTag().kind() = AGenericTag) and IsVecPar(nt.params),\n        children := nt -> let(t := nt.getTags(), p := nt.params, d  := p[1].dims(), mu := t[1].params[1], [\n            TTensorI(TL(d[1] * p[2]/mu, d[1],1,1), mu, AVec, AVec).withTags(t),\n            TTensorI(p[1], mu, AVec, APar).withTags(t)\n        ]),\n        apply := (nt, c, cnt) -> let(t := nt.getTags(), n := nt.params[2], mu := t[1].params[1],\n            c[1] * Tensor(I(n/mu), c[2])\n        ),\n\n        # Example\n        # =======\n        # t:=TTensorI(DFT(4, 1), 4, AVec, APar).withTags([ AGenericTag(2) ]);\n        # c:=AxI_L_split.children(t);\n        # res := AxI_L_split.apply(t,c,false);\n\n        switch:=false\n    ),\n\n#   (I_n x A_rxs) L^ns_n\n    IxA_L_split := rec(\n        info := \"split (I_n x A_rxs) L^ns_n\",\n        forTransposition := false,\n        applicable := nt -> IsParVec(nt.params),\n        children := nt -> let(t := nt.getTags(), p := nt.params, d := p[1].dims(), [[\n            TTensorI(p[1], p[2], APar, APar).withTags(t),\n            TL(d[2]*p[2], p[2], 1, 1).withTags(t)\n        ]]),\n        apply := (nt, c, cnt) -> c[1] * c[2],\n\n#D        isApplicable := P -> P[3].isPar and P[4].isVec,\n#D        allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[TTensorI(P[1], P[2], APar, APar, pv), TL(d[2]*P[2], P[2], 1, 1, pv)]]),\n#D        rule := (P, C) -> C[1] * C[2],\n        switch := false\n    ),\n#   L^nr_n (A_rxs x I_n)\n    L_AxI_split := rec(\n        info := \"split L^nr_n (A_rxs x I_n) \",\n        forTransposition := false,\n        applicable := nt -> IsParVec(nt.params),\n        children := nt -> let( t := nt.getTags(), p := nt.params, d := p[1].dims(), [[\n            TL(d[1] * p[2], p[2], 1, 1).withTags(t),\n            TTensorI(p[1], p[2], AVec, AVec).withTags(t)\n        ]]),\n        apply := (nt, c, cnt) -> c[1] * c[2],\n        switch := false\n#D        isApplicable := P -> P[3].isPar and P[4].isVec,\n#D        allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[ TL(d[1]*P[2], P[2], 1, 1, pv), TTensorI(P[1], P[2], AVec, AVec, pv) ]]),\n#D        rule := (P, C) -> C[1] * C[2],\n    ),\n#   L^nr_r (I_n x A_rxs)\n    L_IxA_split := rec(\n        info := \"split L^nr_r (I_n x A_rxs)\",\n        forTransposition := false,\n        applicable := nt -> IsVecPar(nt.params),\n        children := nt -> let( t := nt.getTags(), p := nt.params, d := p[1].dims(), [[\n            TL(d[1]*p[2], d[1], 1, 1).withTags(t),\n            TTensorI(p[1], p[2], APar, APar).withTags(t)\n        ]]),\n        apply := (nt, c, cnt) -> c[1] * c[2],\n\n#D        isApplicable := P -> P[3].isVec and P[4].isPar,\n#D        allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[TL(d[1]*P[2], d[1], 1, 1, pv), TTensorI(P[1], P[2], APar, APar, pv)]]),\n#D        rule := (P, C) -> C[1] * C[2],\n        switch := false\n    ),\n#   (A_rxs x I_n) L^nr_s\n    AxI_L_split := rec(\n        info := \"split (A_rxs x I_n) L^nr_s \",\n        forTransposition := false,\n        applicable := nt -> IsVecPar(nt.params),\n        children := nt -> let( t := nt.getTags(), p := nt.params, d := p[1].dims(), [[\n            TTensorI(p[1], p[2], APar, APar).withTags(t),\n            TL(d[2]*p[2], d[2], 1, 1).withTags(t)\n        ]]),\n        apply := (nt, c, cnt) -> c[1] * c[2],\n#D        isApplicable := P -> P[3].isVec and P[4].isPar,\n#D        allChildren := P -> let(pv:=P[5], d:=P[1].dims(), [[ TTensorI(P[1], P[2], APar, APar, pv), TL(d[2]*P[2], d[2], 1, 1, pv)]]),\n#D        rule := (P, C) -> C[1] * C[2],\n        switch := false\n    ),\n##   vector recursion #############################################################\n#   (I x (I x A)L)L\n    IxA_L_vecrec := rec(\n        info := \"(I x (I x A)L)L vector recursion\",\n        forTransposition := false,\n        applicable := nt -> ObjId(nt.params[1]) = TTensorI and IsParVec(nt.params) and IsParVec(nt.params[1].params),\n        children := nt -> let(k := nt.params[2], m := nt.params[1].params[2], n := nt.params[1].params[1].dims(), [[\n            TL(k*m, k, 1, n[1]).withTags(nt.getTags()),\n            TTensorI(nt.params[1].params[1], nt.params[2], APar, AVec).withTags(nt.getTags()),\n            TL(m*n[2], m, 1, k).withTags(nt.getTags())\n        ]]),\n        apply := (nt, c, cnt) -> let(m := nt.params[1].params[2],\n            c[1] * Tensor(I(m), c[2]) * c[3]\n        ),\n#D        isApplicable := P -> P[1].name = \"TTensorI\" and P[3].isPar and P[4].isVec and P[1].params[3].isPar and P[1].params[4].isVec,\n#D        allChildren := P -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),\n#D                [[ TL(k*m, k, 1, n[1], P[5]), TTensorI(P[1].params[1], P[2], APar, AVec, P[5]),  TL(m*n[2], m, 1, k, P[5])]]),\n#D        rule := (P, C) -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),\n#D                C[1] * Tensor(I(m), C[2]) * C[3]\n#D            ),\n        switch := false\n    ),\n#   L(I x L(I x A))\n    L_IxA_vecrec := rec(\n        info := \"L(I x L(I x A)) vector recursion\",\n        forTransposition := false,\n        applicable := nt -> ObjId(nt.params[1]) = TTensorI and IsVecPar(nt.params) and IsVecPar(nt.params[1].params),\n        children := nt -> let( k := nt.params[2], m := nt.params[1].params[2], n := nt.params[1].params[1].dims(), [[\n            TL(m*n[1], n[1], 1, k).withTags(nt.getTags()),\n            TTensorI(nt.params[1].params[1], nt.params[2], AVec, APar).withTags(nt.getTags()),\n            TL(k*m, m, 1, n[2]).withTags(nt.getTags())\n        ]]),\n        apply := (nt, c, cnt) -> let(m := nt.params[1].params[2],\n            c[1] * Tensor(I(m), c[2]) * c[3]\n        ),\n#D        isApplicable := P -> P[1].name = \"TTensorI\" and P[3].isVec and P[4].isPar and P[1].params[3].isVec and P[1].params[4].isPar,\n#D        allChildren := P -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),\n#D                [[ TL(m*n[1], n[1], 1, k, P[5]), TTensorI(P[1].params[1], P[2], AVec, APar, P[5]),  TL(k*m, m, 1, n[2], P[5])]]),\n#D        rule := (P, C) -> let(k:=P[2], m:=P[1].params[2], n:=P[1].params[1].dims(),\n#D                C[1] * Tensor(I(m), C[2]) * C[3]\n#D            ),\n        switch := false\n    )\n));\n\n\n########################################################################\n#   rules for L\n\n#D isVec := P->Length(P[5]) > 0 and P[5][1].isVec;\n\nNewRulesFor(TL, rec(\n#   TL(N,n,l,r,[]) -> I_l x L(N,n) x I_r\n    L_base := rec(\n        forTransposition := false,\n        applicable := nt -> nt.isTag(1, spiral.paradigms.smp.AParSMP) or not nt.hasTags(),\n        apply := (nt, c, cnt) -> let(\n            c1 := When(nt.params[3]=1, [], [I(nt.params[3])]),\n            c2 := When(nt.params[4]=1, [], [I(nt.params[4])]),\n            Tensor(Concat(c1, [ L(nt.params[1], nt.params[2]) ], c2))\n        )\n    ),\n#   TL(N,n,l,r,[]) -> I_l x L(N,n) x I_r\n    L_func := rec(\n        forTransposition := false,\n        applicable := nt -> nt.isTag(1, spiral.paradigms.smp.AParSMP) or not nt.hasTags(),\n        apply := (nt, c, cnt) -> let(\n            c1 := When(nt.params[3]=1, [], [fId(nt.params[3])]),\n            c2 := When(nt.params[4]=1, [], [fId(nt.params[4])]),\n            Prm(fTensor(Concat(c1, [ L(nt.params[1], nt.params[2]) ], c2)))\n        )\n    ),\n#   recursion rules\n    IxLxI_kmn_n := rec (\n        info             := \"I(l) x L(kmn, n) x I(r) -> (I_l x L(kn,n) x I(mr))(I(kl) x L(mn, n) x I(r))\",\n        forTransposition := false,\n        applicable := nt -> Length(DivisorsIntDrop(nt.params[1]/nt.params[2])) > 0,\n        children := nt -> let(\n            N := nt.params[1], n := nt.params[2],\n            km := N/n, ml := DivisorsIntDrop(km),\n            l := nt.params[3], r := nt.params[4],\n            List(ml, m -> let( k := km/m, [\n                TL(k*n, n, l, r*m).withTags(nt.getTags()),\n                TL(m*n, n, k*l, r).withTags(nt.getTags())\n            ]))\n        ),\n        apply := (nt, c, cnt) -> let(\n            spl := c[1] * c[2],\n            When(nt.params[1] = nt.params[2]^2,\n                SymSPL(spl),\n                spl\n            )\n        ),\n\n#D        isApplicable     := P -> #isVec(P) and let(v:=P[5][1].v, (P[1]*P[2] >= v or P[1]*P[3] >= v) and\n#D                                Length(DivisorsIntDrop(P[1]/P[2])) > 0,\n#D        allChildren := P -> let(N:=P[1], n:=P[2], km:=N/n, ml:=DivisorsIntDrop(km), l:=P[3], r:=P[4], vp:=P[5],\n#D            List(ml, m->let(k:=km/m, [TL(k*n, n, l, r*m, vp), TL(m*n,n, k*l, r, vp)])) ),\n#D        rule := (P, C) -> let(spl := C[1]*C[2], When(P[1]=P[2]^2, SymSPL(spl), spl)),\n        switch := false\n    ),\n    IxLxI_kmn_km := rec (\n        info             := \"I(l) x L(kmn, km) x I(r) -> (I(kl) x L(mn,m) x I(r))(I(l) x L(kn, k) x I(r))\",\n        forTransposition := false,\n        applicable := nt -> Length(DivisorsIntDrop(nt.params[2])) > 0,\n        children := nt -> let(\n            N := nt.params[1], km := nt.params[2],\n            n := N/km, ml := DivisorsIntDrop(km),\n            l := nt.params[3], r := nt.params[4],\n            List(ml, m->let(\n                k := km/m,\n                [\n                    TL(m*n, m, k*l, r).withTags(nt.getTags()),\n                    TL(k*n,k, l, m*r).withTags(nt.getTags())\n                ]\n            ))\n        ),\n        apply := (nt, C, cnt) -> let(P := nt.params, spl := C[1]*C[2], When(P[1]=P[2]^2, SymSPL(spl), spl)),\n#D        isApplicable     := P -> #isVec(P) and let(v:=P[5][1].v, (P[1]*P[2] >= v or P[1]*P[3] >= v) and\n#D                                Length(DivisorsIntDrop(P[2])) > 0,\n#D        allChildren := P -> let(N:=P[1], km:=P[2], n:=N/km, ml:=DivisorsIntDrop(km), l:=P[3], r:=P[4], vp:=P[5],\n#D            List(ml, m->let(k:=km/m, [TL(m*n, m, k*l, r, vp), TL(k*n,k, l, m*r, vp)])) ),\n#D        rule := (P, C) -> let(spl := C[1]*C[2], When(P[1]=P[2]^2, SymSPL(spl), spl)),\n        switch := false\n    ),\n    IxLxI_IxLxI_up := rec (\n        info             := \"I(l) x L(kmn, km) x I(r) -> (I(l) x L(kmn, k) x I(r))(I(l) x L(kmn, m) x I(r))\",\n        forTransposition := false,\n        applicable       := nt -> Length(DivisorPairs(nt.params[2])) > 0,\n        children := nt -> let(\n            N := nt.params[1], km := DivisorPairs(nt.params[2]),\n            l := nt.params[3], r := nt.params[4], t := nt.getTags(),\n            List(km, i->[TL(N, i[1], l, r).withTags(t), TL(N, i[2], l, r).withTags(t)])\n        ),\n        apply := (nt, c, nt) -> c[1] * c[2],\n\n#D        isApplicable     := P -> Length(DivisorPairs(P[2])) > 0,\n#D        allChildren := P -> let(N:=P[1], km:=DivisorPairs(P[2]), l:=P[3], r:=P[4], vp:=P[5],\n#D            List(km, i->[TL(N, i[1], l, r, vp), TL(N, i[2], l, r, vp)])),\n#D        rule := (P, C) -> C[1]*C[2],\n        switch := false\n    ),\n    IxLxI_IxLxI_down := rec (\n        info             := \"I(l) x L(kmn, k) x I(r) -> (I(l) x L(kmn, km) x I(r))(I(l) x L(kmn, kn) x I(r))\",\n        forTransposition := false,\n        applicable       := nt -> Length(DivisorPairs(nt.params[1]/nt.params[2])) > 0,\n        children         := nt -> let(\n            N := nt.params[1], km := DivisorPairs(nt.params[1]/nt.params[2]),\n            l := nt.params[3], r := nt.params[4], t := nt.getTags(),\n            List(km, i->[TL(N, N/i[1], l, r).withTags(t), TL(N, N/i[2], l, r).withTags(t)])\n        ),\n        apply := (nt, c, cnt) -> c[1] * c[2],\n\n#D        isApplicable     := P -> Length(DivisorPairs(P[1]/P[2])) > 0,\n#D        allChildren := P -> let(N:=P[1], km:=DivisorPairs(P[1]/P[2]), l:=P[3], r:=P[4], vp:=P[5],\n#D            List(km, i->[TL(N, N/i[1], l, r, vp), TL(N, N/i[2], l, r, vp)])),\n#D        rule := (P, C) -> C[1]*C[2],\n        switch := false\n    ),\n    IxLxI_loop1 := rec(\n        info := \"I x L x I loop1\",\n        forTransposition := false,\n        applicable := nt -> not nt.hasTags(),\n        apply := (nt, c, cnt) -> let(\n            m := nt.params[2], n := nt.params[1]/nt.params[2], j:=Ind(m), fid := fId(n), fbase := fBase(m,j),\n            gath := Gath(fTensor(fid, fbase)), scat := Scat(fTensor(fbase, fid)),\n            c0 := [ISum(j, m, scat*gath)],\n            c1 := When(nt.params[3]=1, [], [I(nt.params[3])]),\n            c2 := When(nt.params[4]=1, [], [I(nt.params[4])]),\n            Tensor(Concat(c1,c0,c2))\n        ),\n\n#D        isApplicable := P -> Length(P[5]) = 0,\n#D        rule := (P, C) -> let(m:=P[2], n:=P[1]/P[2], j:=Ind(m), fid := fId(n), fbase := fBase(m,j),\n#D                gath := Gath(fTensor(fid, fbase)), scat := Scat(fTensor(fbase, fid)),\n#D                C0 := [ISum(j, m, scat*gath)], C1:=When(P[3]=1, [], [I(P[3])]), C2:=When(P[4]=1, [], [I(P[4])]), Tensor(Concat(C1, C0, C2))),\n        switch := false\n    ),\n    IxLxI_loop2 := rec(\n        info := \"I x L x I loop2\",\n        forTransposition := false,\n        applicable := nt -> not nt.hasTags(),\n        apply := (nt, c, cnt) -> let(\n            m := nt.params[2], n := nt.params[1]/nt.params[2], j:=Ind(m), fid := fId(n), fbase := fBase(m,j),\n            gath := Gath(fTensor(fbase, fid)), scat := Scat(fTensor(fid, fbase)),\n            c0 := [ISum(j, m, scat*gath)],\n            c1 := When(nt.params[3]=1, [], [I(nt.params[3])]),\n            c2 := When(nt.params[4]=1, [], [I(nt.params[4])]),\n            Tensor(Concat(c1,c0,c2))\n        ),\n\n#D        isApplicable := P -> Length(P[5]) = 0,\n#D        rule := (P, C) -> let(m:=P[2], n:=P[1]/P[2], j:=Ind(n), fid := fId(m), fbase := fBase(n,j),\n#D                gath := Gath(fTensor(fbase, fid)), scat := Scat(fTensor(fid, fbase)),\n#D                C0 := [ISum(j, n, scat*gath)], C1:=When(P[3]=1, [], [I(P[3])]), C2:=When(P[4]=1, [], [I(P[4])]), Tensor(Concat(C1, C0, C2))),\n        switch := false\n    )\n));\n\n###################################################################\nNewRulesFor(TICompose, rec(\n    TICompose_unroll := rec(\n        forTransposition := false,\n        applicable := nt -> true,\n        children := nt -> [[\n            TCompose(\n                List([0..nt.params[2]-1], i -> RulesStrengthReduce(SubstBottomUp(Copy(nt.params[3]), nt.params[1], e -> V(i))))\n            ).withTags(nt.getTags())\n        ]],\n        apply := (nt, c, cnt) -> c[1]\n    )\n));\n\n\nNewRulesFor(TDR, rec(\n    TDR_base := rec(\n        forTransposition := false,\n        applicable := nt -> true,\n        apply := (nt, c, cnt) -> DR(nt.params[1], nt.params[2])\n#D        isApplicable := True,\n#D        rule := (P, C) -> DR(P[1], P[2])\n    )\n));\n\nNewRulesFor(TGath, rec(\n    TGath_base := rec(\n        applicable := True,\n        apply := (t, C, nt) -> t.terminate()\n    )\n));\n\nNewRulesFor(TScat, rec(\n    TScat_base := rec(\n        applicable := True,\n        apply := (t, C, nt) -> t.terminate()\n    )\n));\n\n\nNewRulesFor(TConj, rec(\n    TConj_tag := rec(\n        applicable := True,\n        children := t -> [[ t.params[1].withTags(t.getTags()) ]],\n        apply := (t, C, nt) -> ConjLR(C[1], t.params[2], t.params[3])\n    ),\n\n    TConj_perm := rec(\n        applicable := True,\n\n\t_cvtPerm := (t,p, use_tl) -> Cond(\n\t    ObjId(p) = fId,\n\t        I(p.params[1]),\n\t    ObjId(p) = L and use_tl,\n\t        TL(p.params[1], p.params[2], 1, 1).withTags(t.getTags()),\n\t    # else\n\t\tFormatPrm(p)\n\t),\n\n\t# one degree of freedom -- use TL (true) or use FormatPrm(L) (false)\n\tfreedoms := (self, t) >> [[ true, false ]],\n\n        child := (self, t, fr) >> [\n\t    self._cvtPerm(t, t.params[2], fr[1]),\n\t    t.params[1].withTags(t.getTags()),\n\t    self._cvtPerm(t, t.params[3], fr[1])\n\t],\n\n\tapply := (self, t, C, Nonterms) >> C[1]*C[2]*C[3]\n    ),\n\n    TConj_cplx := rec(\n        applicable := t -> t.params[1] _is TRC,\n\n\t_cvtPerm := (t, p) -> Cond(\n\t    ObjId(p) = fId,\n\t        I(p.params[1]),\n\t    ObjId(p) = L,\n\t        TL(p.params[1], p.params[2], 1, 1).withTags(t.getTags()),\n\t    # else\n\t\tFormatPrm(p)\n\t),\n\n\tfreedoms := (self, t) >> [],\n\n        child := (self, t, fr) >> [\n\t    self._cvtPerm(t, t.params[2]),\n\t    t.params[1].withTags(List(t.getTags(), t->Cond(t.kind()=spiral.paradigms.vector.AVecReg, spiral.paradigms.vector.AVecRegCx(t.isa.cplx()), t))),\n\t    self._cvtPerm(t, t.params[3])\n\t],\n\n\tapply := (self, t, C, Nonterms) >> C[1]*C[2]*C[3]\n    ),\n\n));\n\n#########################################################################\n\nNewRulesFor(TTensorInd, rec(\n#   base cases\n#   I x A\n    dsA_base := rec(\n        info := \"IxA base\",\n        forTransposition := false,\n        applicable := nt -> not nt.hasTags() and IsParPar(nt.params),\n        children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],\n        apply := (nt, c, cnt) -> IDirSum(cnt[2].params[1], c[1])\n    ),\n#   A x I\n    L_dsA_L_base := rec(\n        info := \"AxI base\",\n        forTransposition := false,\n        applicable := nt -> not nt.hasTags() and IsVecVec(nt.params),\n        children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],\n        apply := (nt, c, cnt) ->\n            L(c[1].dims()[1] * nt.params[2].range, c[1].dims()[1]) *\n            IDirSum(cnt[2].params[1], c[1]) *\n            L(c[1].dims()[2] * nt.params[2].range, nt.params[2].range)\n    ),\n#   (I x A)L\n    dsA_L_base := rec(\n        info := \"(IxA)L base\",\n        forTransposition := false,\n        applicable := nt -> not nt.hasTags() and IsParVec(nt.params),\n        children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],\n        apply := (nt, c, cnt) ->\n            IDirSum(cnt[2].params[1], c[1]) *\n            L(c[1].dims()[2] * nt.params[2].range, nt.params[2].range),\n    ),\n#   L(I x A)\n    L_dsA_base := rec(\n        info := \"L(IxA) base\",\n        forTransposition := false,\n        applicable := nt -> not nt.hasTags() and IsVecPar(nt.params),\n        children := nt -> [[ nt.params[1], InfoNt(nt.params[2]) ]],\n        apply := (nt, c, cnt) ->\n            L(c[1].dims()[1] * nt.params[2].range, c[1].dims()[1]) *\n            IDirSum(cnt[2].params[1], c[1])\n    )\n));\n", "meta": {"hexsha": "20e24a2f81e453a71b64748efb22b375358c6375", "size": 27849, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/common/breakdown.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/common/breakdown.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/common/breakdown.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 39.8982808023, "max_line_length": 148, "alphanum_fraction": 0.4731588208, "num_tokens": 9452, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4726834766204328, "lm_q2_score": 0.046033899945310756, "lm_q1q2_score": 0.02175946386854664}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Option Records\n# ==============\n# MP, BS, from 01/25/01, GAPv3.4.4\n\n\n# general default search options\nSEARCH_DEFAULTS :=\n    rec(\n\t\ttimeLimit          := false,\n\t\tglobalUnrolling    := false,\n\t\tglobalUnrollingMin := 8,\n\t\tglobalUnrollingMax := 64,\n\t\ttimeBaseCases      := true\n    );\n\n# default DP search options\nDP_DEFAULTS :=\n    rec(\n        nBest     := 1,\n        optimize  := \"minimize\",\n        verbosity := 3,\n\t    DPVec     := false,\n\t    DPVecVlen := 4\n    );\n\n\n#F Search Options Record\n#F ---------------------\n\n#F Search options records keep search options that are not specific to any\n#F particular search algorithm.  These are options that cause the search\n#F algorithms to search over different implementations instead of just how\n#F the search algorithm progresses.\n#F \n#F These options get incorporated into a search algorithm's options record.\n#F \n\n\n#F PrintSpecSearchOptionsRecord()\n#F   prints the specification for the general search options\n#F   only to be called by specific search algorithm's PrintSpec\n#F \n\nPrintSpecSearchOptionsRecord := function()\n   Print(\"  timeLimit := false | <minutes>,\\n\");\n   Print(\"  globalUnrolling := true | false,\\n\");\n   Print(\"  globalUnrollingMin := <positive int>,\\n\"); \n   Print(\"  globalUnrollingMax := <positive int>,\\n\");\nend;\n\n\n#F CheckSearchOptionsRecord( <search-options-record> )\n#F   checks whether <search-options-record> is a valid search options record\n#F\n\nCheckSearchOptionsRecord := function( R )\n   local r;\n\n   if not IsRec(R) then\n    Error(\"<R> must be an search options record\");\n  fi;\n\n  # check fields\n  for r in RecFields(R) do\n     if r = \"timeLimit\" then\n        if not ( R.(r) = false or ( IsInt(R.(r)) and R.(r) > 0 ) ) then\n       Error( \"timeLimit must be either false or a positive integer\" );\n    fi;\n\n     elif r = \"globalUnrolling\" then\n        if not IsBool(R.(r)) then\n       Error( \"Search option globalUnrolling must be true or false\" );\n    fi;\n     elif r = \"globalUnrollingMin\" then\n        if not IsInt(R.(r)) then\n       Error( \"globalUnrollingMin is not an integer\" );\n    fi;\n     elif r = \"globalUnrollingMax\" then\n        if not IsInt(R.(r)) then\n       Error( \"globalUnrollingMax is not an integer\" );\n    fi;\n     elif r = \"timeBaseCases\" then\n        if not IsBool(R.(r)) then\n       Error( \"Search option timeBaseCases must be true or false\" );\n    fi;\n     fi;\n  od;\n\n  return true;\nend;\n\n\n#F MergeSearchOptionsRecord( <search-options-record> )\n#F   merges <search-options-record> with the default values\n#F\n\nMergeSearchOptionsRecord := function( R )\n   local OR, r;\n\n   CheckSearchOptionsRecord(R);\n\n   OR := ShallowCopy(R);\n   for r in RecFields(SEARCH_DEFAULTS) do\n      if not IsBound( OR.(r) ) then\n         OR.(r) := SEARCH_DEFAULTS.(r);\n      fi;\n   od;\n\n   if OR.globalUnrolling = true and\n      OR.globalUnrollingMin > OR.globalUnrollingMax then\n      Error( \"globalUnrollingMin > globalUnrollingMax\" );\n   fi;\n\n   return OR;\nend;\n\n\n\n#F DP Options Record\n#F -----------------\n\n#F The DP Options Records maintain options for the Dynamic Programming search\n#F algorithm.  This is a combination of both search options specific to DP\n#F as well as general search options.\n\n#F PrintSpecDPOptionsRecord()\n#F   prints the specification for the DP search options\n#F \n\nPrintSpecDPOptionsRecord := function()\n   Print(\"rec(\\n\");\n   PrintSpecSearchOptionsRecord();\n   Print(\"  nBest := <positive integer>,\\n\");\n   Print(\"  optimize := \\\"minimize\\\" | \\\"maximize\\\",\\n\");\n   Print(\"  hashTable := <hashTable>,\\n\");\n   Print(\"  verbosity := <non-negative integer>\\n\");\n   Print(\");\\n\");\nend;\n\n\n#F CheckDPOptionsRecord( <DP-options-record> )\n#F   checks to see if DP-options-record is valid\n#F\n\nCheckDPOptionsRecord := function( R )\n   local r;\n\n   CheckSearchOptionsRecord(R);\n   for r in RecFields(R) do\n      if r = \"nBest\" then\n         if not ( IsInt(R.(r)) and R.(r) > 0 ) then\n        Error( \"nBest must be a positive integer\" );\n     fi;\n      elif r = \"verbosity\" then\n         if not ( IsInt(R.(r)) and R.(r) >= 0 ) then\n        Error( \"verbosity must be a non-negative integer\" );\n     fi;\n      elif r = \"optimize\" then\n         if not R.(r) in [\"minimize\",\"maximize\"] then\n        Error( \"optimize must be to minimize or maximize\" );\n     fi;\n      elif r = \"hashTable\" then\n         if not IsHashTable( R.(r) ) then\n        Error( \"hashTable must be a valid hashTable\" );\n         fi;\n      elif r = \"hashTableBases\" then\n         if not IsHashTable( R.(r) ) then\n        Error( \"hashTableBases must be a valid hashTable\" );\n         fi;\n      elif r = \"breakdownRules\" then\n         if not IsRec( R.(r) ) then\n        Error( \"breakdownRules must be a record\" );\n         fi;\n      elif not r in RecFields(SEARCH_DEFAULTS) and  r <> \"DPVec\" and r <> \"measureFunction\" and r <> \"wrap\" \n      and not IsSystemRecField(r) then\n         Error( \"Unknown DPOptionsRecord field <r>\" );\n      fi;\n   od;\nend;\n\n\n#F MergeDPOptionsRecord( <DP-options-record> )\n#F   merges <DP-options-record> with the defaults\n#F\n\nMergeDPOptionsRecord := function( R )\n   local OR, r;\n\n   CheckDPOptionsRecord(R);\n   OR := MergeSearchOptionsRecord(R);\n   for r in RecFields(DP_DEFAULTS) do\n      if not IsBound( OR.(r) ) then\n         OR.(r) := DP_DEFAULTS.(r);\n      fi;\n   od;\n\n   return OR;\nend;\n\n\n\n# Implement Options Record\n# ------------------------\n\n#F The Implement Options Records maintain options for timed search.\n#F\n\n# Utility for Search algorithms to check dataType in SPLOpts\n# ----------------------------------------------------------\n\n#F SearchCheckDataType( <spl>, <SPL-options-record> )\n#F   Checks to see that the dataType is set properly for the given spl.\n#F   Sets it if no default was given.\n#F\n\nSearchCheckDataType := function( spl, SPLOpts )\n   if not IsBound( SPLOpts.dataType ) then\n      Error( \"SPLOpts.dataType not bound\" );\n   fi;\n\n   if SPLOpts.dataType = \"no default\" then\n      if IsRealSPL(spl) then\n         SPLOpts.dataType := \"real\";\n      else\n         SPLOpts.dataType := \"complex\";\n      fi;\n   elif SPLOpts.dataType in [\"real\",\"complex\"] then\n       ;\n      # YEVGEN: This should not be too ambitious with error checking\n      # we currently use real datatype for complex transforms (RC operator is applied\n      # to get a real formula).\n\n      #if (not IsRealSPL(spl)) and SPLOpts.dataType = \"real\" then\n      #   Error(\"Real data type specified but spl is complex\");\n      #fi;\n   else\n      Error(\"SPLOpts.dataType is not \\\"real\\\" or \\\"complex\\\"\");\n   fi;\nend;\n", "meta": {"hexsha": "2e564660a5d4795a304303ddf6001cdf90a64aab", "size": 6581, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/search/optrec.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/search/optrec.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/search/optrec.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 26.8612244898, "max_line_length": 108, "alphanum_fraction": 0.6280200577, "num_tokens": 1786, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.411110869232168, "lm_q2_score": 0.052618950190703985, "lm_q1q2_score": 0.021632222350984467}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(SMP_UnparseMixin, rec(\n    includes := [\"<include/threads.h>\", \"<include/smp2.h>\"],\n\n    # nothing to do here, threads must be started outside\n    smp_fork := (self, o, i, is) >> Print(\n        Blanks(i), \"/* region must be executed concurrently by \", o.nthreads, \" threads */ \\n\",\n        Blanks(i), \"{\\n\",\n        self(o.cmd, i+is, is),\n        Blanks(i), \"}\\n\"\n    ),\n\n    smp_loop := meth(self, o, i, is)\n        local v, lo, hi;\n        v := o.var;\n        lo := 0;\n        hi := o.range-1;\n        Print(Blanks(i), \"{ /* begin parallel loop */\\n\");\n        Print(Blanks(i+is), self.printf(\"int $1 = $2; \\n\", [o.tidvar, o.tidexp]));\n        Print(Blanks(i+is), self.printf(\"for(int $1 = $2; $1 <= $3; $1 += $4) {\\n\", [v, o.tidvar + lo, hi, o.nthreads]));\n        self(o.cmd,i+is+is,is);\n        Print(Blanks(i+is), \"}\\n\");\n        Print(Blanks(i), \"} /* end parallel loop */\\n\");\n    end,\n\n    threadId := (self, o, i, is) >> Print(\"tid\")   # Error ??\n));\n\nClass(OpenMP_UnparseMixin, SMP_UnparseMixin, rec(\n    includes := [\"<omp.h>\"],\n\n    # start threads using 'omp parallel' pragma\n    smp_fork := (self, o, i, is) >> Print(\n        Blanks(i), \"#pragma omp parallel num_threads(\", o.nthreads, \")\\n\",\n        Blanks(i), \"{\\n\",\n        self(o.cmd, i+is, is),\n        Blanks(i), \"}\\n\"\n    ),\n\n    threadId := (self,o,i,is) >> Print(\"omp_get_thread_num()\"),\n    barrier := (self,o,i, is) >> Print(\"#pragma omp barrier\\n\")\n));\n\nClass(OpenMP_UnparseMixin_ParFor, SMP_UnparseMixin, rec(\n    includes := [\"<omp.h>\"],\n\n    # start threads using 'omp parallel' pragma\n    smp_fork := (self, o, i, is) >>\n        Print(Blanks(i), \"/* SMP fork */\\n\",\n        Blanks(i), \"{\\n\",\n#   NOTE: why do I need to do that??\n        self.opts.unparser(o.cmd,i+is,is),\n#        self(o.cmd, i+is, is),\n        Blanks(i), \"}\\n\"\n    ),\n\n    threadId := (self,o,i,is) >> Print(\"omp_get_thread_num()\"),\n    barrier := (self,o,i, is) >> Print(Blanks(i), \"/* SMP barrier */\\n\"),\n\n    smp_loop := (self,o,i,is) >> let(v := o.var, lo := 0, hi := o.range,\n            Print(Blanks(i), \"#pragma omp parallel for schedule(static, \", Int((hi+1)/2), \")\\n\",\n            Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" < \", hi, \"; \", v, \"++) {\\n\",\n                Blanks(i + is), \"int \", o.tidvar, \" = \", v, \";\\n\",\n#   NOTE: why do I need to do that??\n                self.opts.unparser(o.cmd,i+is,is),\n#                self(o.cmd,i+is,is),\n                Blanks(i), \"}\\n\")),\n));\n", "meta": {"hexsha": "639ff83c759ef720ba1afedb93139e95a562ed14", "size": 2538, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/smp/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/smp/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/smp/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.7671232877, "max_line_length": 121, "alphanum_fraction": 0.5059101655, "num_tokens": 815, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.36296919173767833, "lm_q2_score": 0.059210255721647315, "lm_q1q2_score": 0.02149149866186757}}
{"text": "if <condition> then\n    <statements>\nelif <condition> then\n    <statements>\nelse\n    <statements>\nfi;\n", "meta": {"hexsha": "162f42120997f32162c84c9227950f5fb4276748", "size": 102, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Conditional-structures/GAP/conditional-structures.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Conditional-structures/GAP/conditional-structures.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Conditional-structures/GAP/conditional-structures.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 12.75, "max_line_length": 21, "alphanum_fraction": 0.6666666667, "num_tokens": 28, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.33807713748839185, "lm_q2_score": 0.06278921341991638, "lm_q1q2_score": 0.021227597538153047}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(assign_cmd, ExpCommand, rec(\n    op_in := self >> Set( List(Drop(self.args,1), ArgsExp)), \n    op_out := self >> Set([self.args[1]]),\n    op_inout := self >> Set([]),\n    unparse := \"assign_cmd\",\n));\n\nClass(neg_cmd, assign_cmd);\n\nClass(fma_cmd,  assign_cmd, rec(exp_op := fma));\nClass(fms_cmd,  assign_cmd, rec(exp_op := fms));\nClass(nfma_cmd, assign_cmd, rec(exp_op := nfma));\n\n# Examples: \n#   assign(t1, add(t1, t2)) == assign_add(t1, t2),\n#   assign(t1, add(t2, t3)) == chain(assign(t1, t2), assign_add(t2, t3)).\n#\n\n_threeop_bintab := WeakRef(tab());\n_threeop_binlist := [];\n\nThreeOpFromBinOp := function(arg)\n    local op;\n    for op in arg do\n        _threeop_bintab.(op.exp_op.__name__) := op;\n        Add(_threeop_binlist, op.exp_op);\n    od;\nend;\n\n\nThreeOpFromBinOp(\n   Class(add_cmd, assign_cmd, rec( exp_op := add )),\n   Class(mul_cmd, assign_cmd, rec( exp_op := mul )),\n   Class(sub_cmd, assign_cmd, rec( exp_op := sub ))\n);\n\n\nClass(ThreeOpRuleSet, RuleSet);\nRewriteRules(ThreeOpRuleSet, rec(\n    neg := Rule([assign, @(1), [neg, @(2)]], e -> neg_cmd(@(1).val, @(2).val)),\n\n    fma  := Rule([assign, @(1), [ fma, @(2), @(3), @(4)]], e ->  fma_cmd(@(1).val, @(2).val, @(3).val, @(4).val)), \n    fms  := Rule([assign, @(1), [ fms, @(2), @(3), @(4)]], e ->  fms_cmd(@(1).val, @(2).val, @(3).val, @(4).val)), \n    nfma := Rule([assign, @(1), [nfma, @(2), @(3), @(4)]], e -> nfma_cmd(@(1).val, @(2).val, @(3).val, @(4).val)), \n\n    binop := Rule([assign, @(1), [@(0,_threeop_binlist) , @(2), @(3)]], e -> _threeop_bintab.(@(0).val.__name__)(@(1).val, @(2).val, @(3).val)), \n));\n\nThreeOpMacroUnparser_Mixin := rec(\n\n    add_cmd := (self,o,i,is) >> Print(Blanks(i), self.prefixTTT(\"ADD\", o.args[1].t, o.args[2].t, o.args[3].t, o.args), \";\\n\"),\n    sub_cmd := (self,o,i,is) >> Print(Blanks(i), self.prefixTTT(\"SUB\", o.args[1].t, o.args[2].t, o.args[3].t, o.args), \";\\n\"),\n    mul_cmd := (self,o,i,is) >> Print(Blanks(i), self.prefixTTT(\"MUL\", o.args[1].t, o.args[2].t, o.args[3].t, o.args), \";\\n\"),\n    neg_cmd := (self,o,i,is) >> Print(Blanks(i), self.prefixTT( \"NEG\", o.args[1].t, o.args[2].t, o.args), \";\\n\"),\n\n    fma_cmd  := (self,o,i,is) >> Print(Blanks(i), self.prefixTTTT(\"FMA\", o.args[1].t, o.args[2].t, o.args[3].t, o.args[4].t, o.args), \";\\n\"),\n    fms_cmd  := (self,o,i,is) >> Print(Blanks(i), self.prefixTTTT(\"FMS\", o.args[1].t, o.args[2].t, o.args[3].t, o.args[4].t, o.args), \";\\n\"),\n    nfma_cmd := (self,o,i,is) >> Print(Blanks(i), self.prefixTTTT(\"NFMA\", o.args[1].t, o.args[2].t, o.args[3].t, o.args[4].t, o.args), \";\\n\"),\n\n);\n\nDoThreeOp := function(c, opts)\n    c := MarkDefUse(c);\n    c := BinSplit(c);\n    c := ThreeOpRuleSet(c);\n    return c;\nend;\n\nThreeOp_CS := Concatenation(BaseIndicesCS, [\n    MarkDefUse, #\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    MarkDefUse, #\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    DoThreeOp,\n    Compile.declareVars\n]);\n\nClass(ThreeOpUnparser, CMacroUnparserProg, rec(\n    add_cmd := (self,o,i,is) >> self.prefixTTT(\"ADD\", o.args[1].t, o.args[2].t, o.args[3], o.args),\n\n    sub_cmd := (self,o,i,is) >> self.prefixTTT(\"SUB\", o.args[1].t, o.args[2].t, o.args[3], o.args),\n\n    neg_cmd := (self,o,i,is) >> self.prefixT(\"NEG\", o.t, o.args),\n   \n    # first argument of mul_cmd is the result, 2nd and 3rd are operands\n    mul_cmd := (self,o,i,is) >> When(Length(o.args)=3,\n            let(\n            # check if constant ended up in slot #3\n            a := When(IsValue(o.args[3]), o.args[3], o.args[2]),\n            b := When(IsValue(o.args[3]), o.args[2], o.args[3]),\n            When(not (IsValue(a) or (IsVar(a) and IsBound(a.value))),\n                # <a> is not a constant\n                self.prefixTTT(\"MUL\", o.args[1], a, b, [o.args[1],a,b]),\n                #self.prefix(Concat(\"MUL_\", self._pfx(a.t), \"_\", self._pfx(b.t)), [o.args[1],a,b]),\n                # <a> is a constant\n                let(fmt := self._const( When(IsValue(a), a, a.value) ),\n                    self.prefix(Concat(\"MUL_\", o.args[1]._pfx(o.args[1].t), \"CNST\", \"_\", self._pfx(b.t)), [o.args[1], GetExponent(a.value), GetMantissa(a.value), b]))))),\n#                   self.prefix(Concat(\"MUL_\", o.args[1]._pfx(o.args[1].t), fmt[1], \"_\", self._pfx(b.t)), [o.args[1], a, b]))))),\n#                        # check if constant is special, and does not go into MUL args\n#                        # for example fmt[1]=\"I\" denotes sqrt(-1), one such constant\n#                        #When(fmt[2]=[], [b], [a, b])))))),\n\n#    add_cmd := (self, o, i, is) >> Print(Blanks(i), self.prefix(self, i, is), \";\\n\"),\n#    sub_cmd := ~.add_cmd\n\n    prefixT := (self, funcname, t, args) >>\n        self.prefix(Concat(funcname, \"_\", self._pfx(t)), args),\n\n    prefixTT := (self, funcname, t1, t2, args) >>\n        self.prefix(Concat(funcname, \"_\", self._pfx(t1), \"_\", self._pfx(t2)), args),\n\n    prefixTTT := (self, funcname, t1, t2, t3, args) >> \n        self.prefix(Concat(funcname, \"_\", self._pfx(t1), \"_\", self._pfx(t2), \"_\", self._pfx(t3)), args),\n    \n    _pfx := (self, t) >> Cond(\n        ObjId(t) = T_Complex, \"CPX\",\n        ObjId(t) = T_Real,    \"FLT\",\n        t = TComplex, \"CPX\",\n        t = TReal,    \"FLT\",\n        t = TInt or ObjId(t) in [TArray, TPtr], \"INT\",\n        t = TUnknown, \"UNK\",\n        ObjId(t) = TSym, \"SYM\",\n        IsVecT(t), Cond(\n            t.t = TReal, Concat(\"FV\",StringInt(t.size)),\n            t.t = TComplex, Concat(\"FC\",StringInt(t.size)),\n            t.t = TInt, Concat(\"IV\",StringInt(t.size)),\n            Error(\"Can't handle type \", t)\n        ),\n        Error(\"Can't handle type \", t)),\n\n    # returns a tuple [suffix, args], where suffix is used for MUL_XXX or C_XXX,\n    # and args are additional parameters into C_XXX\n    _const := (self,o) >> Cond(\n        o.t = TReal and IsCyc(o.v),        [\"FLT\", [ReComplex(Complex(o.v))]],\n        o.t = TReal,                       [\"FLT\", [o.v]],\n        o.t = TInt,                        [\"INT\", [o.v]],\n        o.t = TUnknown,                    [\"INT\", [o.v]], # NOTE: there is a bug that creates V(0) with TUnknown\n        o.t = TString,                     [\"STR\", [o.v]],\n        o.t = TBool,                       [\"INT\", [When(o.v in [true, 1], 1, 0)]],\n        Error(\"Don't know how to handle constant of type \", o.t)\n    ),\n));\n\n\nEncodeFloat := function(f)\n    local a, exp, mant, tmp, flag;\n\n    #shift by max exponent, which is +/- 127 in IEEE floating point\n    if (IntDouble(f)=0) then\n        exp := Log2Int(IntDouble(f*2^127))-127;\n    else\n        exp := Log2Int(IntDouble(f));\n    fi;\n\n    tmp := f/(2^exp);\n    mant := tmp - IntDouble(tmp);\n    mant := IntDouble(mant * 2^23);\n   \n        a:= rec(exp:= exp+127, mant:=mant);\n\n    return a;\nend;\n\nDecodeToFloat := function(exp, mant)\n    local f;  \n\n    if (mant<0) then\n        mant := -mant;\n        f := mant / (2^23);\n        f := f + 1;\n        f:= f * (2^(exp-127));\n        f:= -f;\n    else\n        f := mant / (2^23);\n        f := f + 1;\n        f:= f * (2^(exp-127));\n    fi;\n\n    return f;\nend;\n\nGetExponent := function(f)\n    local exp;\n\n    #shift by max exponent, which is +/- 127 in IEEE floating point\n    if (IntDouble(f)=0) then\n        exp := Log2Int(IntDouble(f*2^127))-127;\n    else\n        exp := Log2Int(IntDouble(f));\n    fi;\n\n    return exp + 127;\nend;\n\nGetMantissa := function(f)\n    local a, exp, mant, tmp, flag;\n\n    #shift by max exponent, which is +/- 127 in IEEE floating point\n    if (IntDouble(f)=0) then\n        exp := Log2Int(IntDouble(f*2^127))-127;\n    else\n        exp := Log2Int(IntDouble(f));\n    fi;\n\n    tmp := f/(2^exp);\n    mant := tmp - IntDouble(tmp);\n    mant := IntDouble(mant * 2^23);\n\n    return mant;\nend;\n", "meta": {"hexsha": "984711db3030ece35d48f725277e89b83eb0731e", "size": 7798, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/three_op.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/three_op.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/three_op.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 36.1018518519, "max_line_length": 170, "alphanum_fraction": 0.5291100282, "num_tokens": 2606, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4882833952958347, "lm_q2_score": 0.04336579922754008, "lm_q1q2_score": 0.021174799686540756}}
{"text": "ZapGremlins := function(s)\n  local upper, lower, c, i, n, t;\n  upper := \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n  lower := \"abcdefghijklmnopqrstuvwxyz\";\n  t := [ ];\n  i := 1;\n  for c in s do\n    n := Position(upper, c);\n    if n <> fail then\n      t[i] := lower[n];\n      i := i + 1;\n    else\n      n := Position(lower, c);\n      if n <> fail then\n        t[i] := c;\n        i := i + 1;\n      fi;\n    fi;\n  od;\n  return t;\nend;\n\nIsPalindrome := function(s)\n  local t;\n  t := ZapGremlins(s);\n  return t = Reversed(t);\nend;\n", "meta": {"hexsha": "90f9c34ef737e9876823f55d58277c7674bf7e04", "size": 512, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Palindrome-detection/GAP/palindrome-detection.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Palindrome-detection/GAP/palindrome-detection.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Palindrome-detection/GAP/palindrome-detection.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 18.2857142857, "max_line_length": 40, "alphanum_fraction": 0.509765625, "num_tokens": 162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.411110869232168, "lm_q2_score": 0.050330632063298644, "lm_q1q2_score": 0.020691469896547132}}
{"text": "\n# Copyright (c) 2018-2020, Carnegie Mellon University\n# See LICENSE for details\n\n\nObjLookup := arg -> ApplyFunc(ObjHash.objLookup, arg);\nObjAdd    := arg -> ApplyFunc(ObjHash.objAdd, arg);\nMemClass  := arg -> ApplyFunc(ObjHash.memClass, arg);\nMemClassFunc  := arg -> ApplyFunc(ObjHash.memClassFunc, arg);\nSingletonAdd  := arg -> ApplyFunc(ObjHash.singletonAdd, arg);\n\nobjs := x -> Filtered(Collect(x, @), IsRec);\nuids := x -> List(objs(x), o->o.uid);  \n### init\nSingletonAdd(TInt);\nSingletonAdd(TComplex);\nSingletonAdd(TUnknown);\nSingletonAdd(TReal);\n\n\nMemClass(TArray);\nMemClass(TArrayBase);\nMemClass(TVect);\n\n#ClassSPL.hash := ObjHash;\n#Function.hash := ObjHash;\n\n########\nMemClass(Exp);\nMemClass(ListableExp);\nMemClass(Lambda);\nMemClass(FList);\nMemClass(FData);\nMemClass(nth);\nMemClass(Value);\n\nMemClassFunc(Value, \"new\", \"new_no_memo\");\nMemClassFunc(Value, \"newbase\", \"newbase_no_memo\");\n", "meta": {"hexsha": "56580b646fd33c1d1b9ba482665b5008ab1887a3", "size": 893, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/objhash_init.gi", "max_stars_repo_name": "franzfranchetti/spiral-software", "max_stars_repo_head_hexsha": "5ad717954b8a14e82277c4bd82c7518d9e6c0a10", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "namespaces/spiral/spl/objhash_init.gi", "max_issues_repo_name": "franzfranchetti/spiral-software", "max_issues_repo_head_hexsha": "5ad717954b8a14e82277c4bd82c7518d9e6c0a10", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "namespaces/spiral/spl/objhash_init.gi", "max_forks_repo_name": "franzfranchetti/spiral-software", "max_forks_repo_head_hexsha": "5ad717954b8a14e82277c4bd82c7518d9e6c0a10", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.8974358974, "max_line_length": 61, "alphanum_fraction": 0.7110862262, "num_tokens": 256, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4073334000459302, "lm_q2_score": 0.050330631707179815, "lm_q1q2_score": 0.020501347339745055}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n## Hackity.\n#Class(fcall_addr, fcall, rec(\n#        computeType := self >> self.args[3].t\n#));\n\n# A dist_loop is a parallel loop with domain=#spus\n\nClass(dist_loop, loop_base, rec(\n   __call__ := meth(self, P, loopvar, range, cmd) \n       local result;\n       Constraint(IsVar(loopvar)); \n       Constraint(IsCommand(cmd)); \n       range := toRange(range);\n\n       loopvar.setRange(range);\n       #loopvar.isLoopIndex := true;\n       return WithBases(self, rec(\n           operations := CmdOps, \n           P := P, \n           var := loopvar,\n           cmd := cmd, \n           range := listRange(range)\n       ));\n   end,\n\n   rChildren := self >> [self.P, self.var, self.range, self.cmd],\n   rSetChild := rSetChildFields(\"P\", \"var\", \"range\", \"cmd\"),\n\n   #rChildren := self >> [self.P, self.var, self.cmd],\n   #rSetChild := rSetChildFields(\"P\", \"var\", \"cmd\", \"range\"),\n   #from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], self.range, rch[3]]),\n\n   print := (self, i, is) >> Print(self.name, \"(\", self.P, \", \", self.var, \", \",\n       Blanks(i+is),\n       self.cmd.print(i+is, is),\n       Print(\"\\n\", Blanks(i), \")\")),\n\n\n   #NOTE: This should go in loop_bases, which should free self.vars only if it's bound.\n   free := meth(self) local c;\n       c := self.cmd.free();\n       return c;\n   end\n\n));\n\nClass(DistCodegen, VectorCodegen, rec(\n    # Wed 16 Jul 2008 07:17:33 PM EDT\n    #NOTE: commenting this out! Check to see if this is now equivalent to DefaultCodegen.Formula.\n    # This had BlockSums() commented out. Why?\n  \n    #NOTE: Need to find a way (hack?) to callback DefaultCodegen's formula with one extra stage, etc.\n    #Formula := meth(self, o, y, x, opts)\n    #    local icode, datas, prog, params, sub, initsub, io;\n    #    if IsBound(opts.XType) then x.t := TPtr(opts.XType); fi;\n    #    if IsBound(opts.YType) then y.t := TPtr(opts.YType); fi;\n\n    #    o := o.child(1);\n    #    params := Set(Collect(o, param));\n\n    #    datas := Collect(o, FDataOfs);\n    #    #o := BlockSums(opts.globalUnrolling, o);\n    #    icode := self(o, y, x, opts);\n    #    icode := RemoveAssignAcc(icode);\n    #    icode := BlockUnroll(icode, opts);\n    #    # icode := PowerOpt(icode);\n    #    icode := DeclareHidden(icode);\n    #    # icode := InsertBarriers(icode);\n    #    if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n    #        icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n    #    fi;\n\n    #    io := When(X=Y, [X], [Y, X]);\n    #    #io := When(IsBound(opts.multibuffer_its) and opts.multibuffer_its > 1,\n    #    #                Concatenation(io, [Yprev, Xnext]),\n    #    #                io);\n    #    sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n    #    initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n    #    icode := func(TVoid, sub, Concatenation(io, params), icode);\n\n    #    if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n    #        prog := program(\n    #            decl(List(datas, x->x.var),\n    #                chain(\n    #                    func(TVoid, initsub, params, chain(List(datas, x -> SReduce(x.var.init, opts)))),\n    #                    icode\n    #                )));\n    #    else\n    #        prog := program( func(TVoid, initsub, params, chain()), icode);\n    #    fi;\n    #    prog.dimensions := o.dimensions;\n    #    return prog;\n    #end,\n\n\n    # ---------------\n    # Container\n    # ---------------\n\n#    DContainer := meth(self, o, y, x, opts)\n#         local spuid;\n#         spuid := var.fresh_t(\"spuid\", TInt);\n#         return( decl(\n#             spuid, \n#             self(o.child(1), y, x, opts)\n#             ));\n#      end,\n\n    DContainer := (self, o, y, x, opts) >> self(o.child(1), y, x, opts),\n\n    # ---------------\n    # Gather\n    # ---------------\n\n    #GathDist := (self, o, y, x, opts) >> self(Gath(fId( (o.N/o.P)*o.pkSize )), y, x, opts),\n    GathDist := (self, o, y, x, opts) >> call(var(\"// GathDist\"), y, x),\n\n    # Pass the base pointer of the data to be transferred as a param to the DMA_GET\n\n    GathRecv := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix;\n        i := Ind(); func := o.func.lambda();\n\n        # Standard Gather\n        #return loop(i, o.func.domain()/o.P, assign(nth(y, i), nth(x, func.at(i))));\n\n        # We shouldn't use func.at(i), since we've done ScatSend-side normalizing already\n        #return chain(\n        #    #dist_barrier(),\n        #    # Moving dist_barrier to scatsend for now\n        #    call(var(\"// BLOCK_ON_READ\")),\n        #    loop(i, o.pkSize*o.func.domain()/o.P, assign(nth(y, i), nth(x, i)))\n        #);\n\n        return call(var(\"// Gath_Recv\"), y, x);\n    end,\n\n    # ---------------\n    # Scatter\n    # ---------------\n\n\n\n    #ScatDist := (self, o, y, x, opts) >> self(Scat(fId( (o.N/o.P)*o.pkSize )), y, x, opts),\n    ScatDist := (self, o, y, x, opts) >> call(var(\"// ScatDist\"), y, x),\n\n    #NOTE: Assuming that Length(Y) is the full size of the transform.\n\n\n                   #idiv(func.at( (i*pkSize)+(chunkSize*o.i) ), chunkSize), # This is the SPU#\n    ScatSend := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix, pkSize, numPktsPerSPU;\n        func          := o.func.lambda();\n        pkSize        := o.pkSize;\n        numPktsPerSPU := o.func.domain()/o.P;\n        i             := Ind(numPktsPerSPU);\n\n        return chain(loop(i, numPktsPerSPU, chain(                            # Loop over number of packets\n           call(var(\"SCATSEND_PUT\"), \n               x,                                                       # Base address of X\n               i*pkSize,                                                # Offset of X in elements\n               fcall(var(\"ADDR\", TFunc(TInt, TInt, TULongLong)),\n                   idiv(func.at((numPktsPerSPU*o.i)+i), numPktsPerSPU), # This is the SPU#\n                   y                                                    # Base address of Y\n               ),\n               mul(\n                imod(func.at((numPktsPerSPU*o.i)+i), numPktsPerSPU),    # Offset of Y in elements\n                pkSize),\n               pkSize                                                   # Size of DMA transfer in elements\n           )\n        )),\n        dist_barrier());\n\n        # Standard Scatter\n\n        # return loop(i, numPktsPerSPU,                                    # Loop over number of packets * pkSize\n        #     assign(nth(y, func.at(i)), nth(x, i))\n        # );\n    end,\n\n    # ---------------\n    # Sum\n    # ---------------\n\n    # For now, assume loop range = # of spus\n\n    DistSum := (self, o, y, x, opts) >> let(\n        dist_loop(o.P, o.var, o.domain, self(o.child(1), y, x, opts))\n        ),\n\n    DistSumLoop := (self, o, y, x, opts) >> chain(\n        dist_loop(o.P, o.var, o.domain, self(o.child(1), y, x, opts)),\n        dist_barrier()\n        ),\n\n# Doesn't work for unrolled code.\n#   DistSum := (self, o, y, x, opts) >> let(\n#       Constraint(o.domain = opts.spus),\n#       # If we're GathRecv'ing inside, we must sync before getting into the loop.\n#       When(o._children[1]._children[Length(o._children[1]._children)].name = \"GathRecv\",\n#         chain(dist_barrier(), dist_loop(o.P, o.var, o.domain, self(o.child(1), y, x, opts))),\n#         dist_loop(o.P, o.var, o.domain, self(o.child(1), y, x, opts))\n#       )\n#    )\n\n\n\n    # PTensor and Comm_Cell are used by ParCellDMP only.\n    PTensor := (self, o, y, x, opts) >> self(o.L, y, x, opts),\n\n    # Looped version (NOTE: works, except since we'll never do more than 8 SPUs for now, we always want a fully unrolled version\n\n    Comm_Cell := meth(self, o, y, x, opts)\n        local i;\n        i := Ind(o.P);\n\n        return(chain(loop(i, o.P,             # Loop over P\n            call(var(\"SCATSEND_PUT\"),\n                x,                      # Base address of X\n                i*o.pkSize,             # Offset of X in elements\n                fcall(var(\"ADDR\"),      \n                    i,                  # This is the SPU#\n                    y                   # Base address of Y\n                ),\n                fcall(var(\"SPUID_TIMES\"), o.pkSize),             # Offset of Y in elements (MUST BE spuid*pkSize!)\n                o.pkSize                # Size of DMA transfer in elements\n                )\n        ),\n        dist_barrier()\n        ));\n    end\n\n));\n\n", "meta": {"hexsha": "f6594a27edf6fa04b45d8afb274864e0e4ce5310", "size": 8453, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/distributed/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/distributed/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/distributed/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 35.2208333333, "max_line_length": 128, "alphanum_fraction": 0.4969833195, "num_tokens": 2350, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.37022537869825406, "lm_q2_score": 0.055005285195222284, "lm_q1q2_score": 0.020364352541806637}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n#\n# keys.gi -- define string constants used as keys in scriptgen package\n#\n\n\n# transforms\n\nSGKEY_FFT\t\t:= \"FFT\";\nSGKEY_FFT_2D\t:= \"FFT2D\";\nSGKEY_FFT_3D\t:= \"FFT3D\";\nSGKEY_IFFT\t\t:= \"IFFT\";\nSGKEY_IFFT_2D\t:= \"IFFT2D\";\nSGKEY_IFFT_3D\t:= \"IFFT3D\";\nSGKEY_WHT\t\t:= \"WHT\";\n\n\n# data types\n\nSGKEY_DPCX\t\t:= \"DPCX\";\nSGKEY_SPCX\t\t:= \"SPCX\";\n\n\n# ScriptGen settings\n\nSGKEY_DATATYPE\t\t:= \"datatype\";\nSGKEY_FILENAME\t\t:= \"filename\";\nSGKEY_FUNCNAME\t\t:= \"funcname\";\nSGKEY_SIZE\t\t\t:= \"size\";\nSGKEY_TRANSFORM\t\t:= \"transform\";\n\n# ScriptGen settings details\n\nSGKEY_DISPLAYNAME\t\t:= \"displayname\";\nSGKEY_MULTIPLEVALUES\t:= \"multipleValues\";\nSGKEY_NAME\t\t\t\t:= \"name\";\nSGKEY_TYPE\t\t\t\t:= \"type\";\n\n\n# Special keys\n\nSGKEY_DEFAULT\t:= \"default\";\n\n\n# String constants\n\nSGSTR_STDOUT\t:= \"*stdout*\";\n\nSGSTR_ALL\t\t\t:= \"all\";\nSGSTR_CONSTRUCTOR\t:= \"constructor\";\nSGSTR_RUNRANDOMALL\t:= \"runRandomAll\";\nSGSTR_RUNALL\t\t:= \"runAll\";\n\n\n# Settings types\n\nSGTYPE_INT\t\t:= \"i\";\nSGTYPE_BOOL\t\t:= \"b\";\nSGTYPE_STRING\t:= \"s\";\n\n\n# display names associated with keys\n\n_SG_displayNames := rec(\n\t(SGKEY_FFT)\t\t\t:= \"Fast Fourier Transform\",\n\t(SGKEY_FFT_2D)\t\t:= \"2D Fast Fourier Transform\",\n\t(SGKEY_FFT_3D)\t\t:= \"3D Fast Fourier Transform\",\n\t(SGKEY_IFFT)\t\t:= \"Inverse Fast Fourier Transform\",\n\t(SGKEY_IFFT_2D)\t\t:= \"2D Inverse Fast Fourier Transform\",\n\t(SGKEY_IFFT_3D)\t\t:= \"2D Inverse Fast Fourier Transform\",\n\t(SGKEY_WHT)\t\t\t:= \"Walsh-Hadamard Transform\",\n\t\n\t(SGKEY_DPCX)\t\t:= \"Double-Precision Complex\",\n\t(SGKEY_SPCX)\t\t:= \"Single-Precision Complex\",\n\t\n\t(SGKEY_DATATYPE)\t:= \"Data Type\",\n\t(SGKEY_FILENAME)\t:= \"File Name\",\n\t(SGKEY_FUNCNAME)\t:= \"Function Name\",\n\t(SGKEY_SIZE)\t\t:= \"Size\",\n\t(SGKEY_TRANSFORM)\t:= \"Transform\",\n\t\n\t(SGSTR_RUNRANDOMALL) := \"Generate Code (quick search)\",\n\t(SGSTR_RUNALL)\t\t := \"Generate Code (in-depth search)\",\n);\n\n\nGetScriptGenDisplayName := function(key)\n\tif IsString(key) and IsBound(_SG_displayNames.(key)) then\n\t\treturn _SG_displayNames.(key);\n\telif (not IsString(key)) and IsList(key) and (Length(key) = 2) then\n\t\tif ForAll(key, IsInt) then\n\t\t\treturn StringPrint(key[1], \" x \", key[2]);\n\t\tfi;\n\tfi;\n\t\n\treturn StringPrint(key);\nend;\n\t\n\t\nSetScriptGenDisplayName := function(key, string)\n\tif not ( IsString(key) and IsString(string) ) then\n\t\tError(\"usage: SetScriptGenDisplayName(key, string)\\n  both <key> and <string> must be strings\");\n\tfi;\n\t\t\n\t_SG_displayNames.(key) := string;\nend;\n\n\n# documentation associated with keys\n\n_SG_docunmentationForKeys := rec(\n);\n\n\nGetScriptGenDocumentation := function(key)\n\tif IsString(key) and IsBound(_SG_docunmentationForKeys.(key)) then\n\t\treturn _SG_docunmentationForKeys.(key);\n\tfi;\n\t\n\treturn \"\";\nend;\n\t\n\t\nSetScriptGenDocumentation := function(key, string)\n\tif not ( IsString(key) and IsString(string) ) then\n\t\tError(\"usage: SetScriptGenDocumentation(key, string)\\n  both <key> and <string> must be strings\");\n\tfi;\n\t\t\n\t_SG_docunmentationForKeys.(key) := string;\nend;\n\n\n\n\n\n", "meta": {"hexsha": "2ff6728752861a004476c0f30200651f30df5652", "size": 2944, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/scriptgen/keys.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/scriptgen/keys.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/scriptgen/keys.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 21.1798561151, "max_line_length": 100, "alphanum_fraction": 0.6963315217, "num_tokens": 941, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4073334000459302, "lm_q2_score": 0.04958902157944975, "lm_q1q2_score": 0.02019926476490827}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(AStream, rec(\n#D Class(AStream, ATag, rec(\n#D    isStream := true,\n    __call__ := (self, bs) >> WithBases(self, rec(bs:=bs)),\n    print := (self) >> Print(self.name, \"(\", self.bs, \")\"),\n    operations := Inherit(PrintOps, rec(\\= := (self, other) >> ObjId(other) = ObjId(self) and self.bs = other.bs)),\n    #?? legal_kernel := (self,p) >> self.bs <= 2^p\n\n    # If we have a block size of 1, allow a radix 2 kernel so we can fold further.\n    legal_kernel := (self, p) >> Cond(self.bs=1, p=2, p <= self.bs),\n\n    # BWD: Somehow this becomes a tag, so we need .kind\n    kind := self >> ObjId(self)\n));\n", "meta": {"hexsha": "aeb334d7f105e743263e9ec7a8b0ffdcf2855709", "size": 689, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/stream/nonterms.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/stream/nonterms.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/stream/nonterms.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.45, "max_line_length": 115, "alphanum_fraction": 0.6052249637, "num_tokens": 216, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.5, "lm_q2_score": 0.04023793945855469, "lm_q1q2_score": 0.020118969729277344}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F ParStream(p, u)\n#F p=# of procs\n#F u = minimum packet size (specified)\nClass(ParStream, AGenericTag, rec(isParStream := true));\n\n\n#F MBufCell_spec(u1, u2, p)\n#F u1= PkSize for AxI.\n#F u2=PkSize for L(IxA) and (IxA)L\n#F  p=# of procs (Optional: default=1)\n#F  r=# of iters to leave for the children (experimental). Optional.\nClass(MBufCell_spec, AGenericTag, rec(isMBufCell_spec := true));\n\n#F MBufCell_its(b)\n#F Performs a multibuffer loop with exactly b multibuffered iterations\n#F Not to be called directly\nClass(MBufCell_its, AGenericTag, rec(isMBufCell_its := true));\n\n\n#F ==========================================================================\n#F MemCell(<its>) - Cell from main mem tag\nClass(MemCell, AGenericTag, rec(isMemCell := true));\n\n\n#F MBuf wrapper tags\nClass(MBuf_maxWrapper_WHT, AGenericTag, rec(isMaxWrapper_WHT := true));\nClass(MBuf_maxWrapper_DFT, AGenericTag, rec(isMaxWrapper_DFT := true));\nClass(MBuf_maxWrapper_DFT_vecrecur, AGenericTag, rec(isMaxWrapper_DFT_vecrecur := true));\n\n\n#-----------------------------------------------------------------------------\n# Deprecated\n#-----------------------------------------------------------------------------\n\n#F MBufCell(<its>) - Cell buffer tag\nClass(MBufCell, AGenericTag, rec(isMBufCell := true));\nClass(MBufCell_max, AGenericTag, rec(isMBufCell := true));\n#Class(MBufCell_mbuf, AGenericTag, rec(isMBufCell_mbuf := true));\n\n\n#F ==========================================================================\n#F 2DBufVecRecur(<its>) - Cell from main mem tag\nClass(2DBufVecRecur, AGenericTag, rec(is2DBufVecRecur := true));\n\n", "meta": {"hexsha": "aabb6536e072dbb050c563c8f2a42ee9372ce82f", "size": 1677, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/multibuffer/tags.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/multibuffer/tags.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/multibuffer/tags.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.54, "max_line_length": 89, "alphanum_fraction": 0.6070363745, "num_tokens": 450, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.48828339529583475, "lm_q2_score": 0.04084571415858562, "lm_q1q2_score": 0.019944283992637337}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F Printing of SPLs\n#F ----------------\n#F\n\n#F SPLOps.Print( <spl> [, <indent> , <indentStep> ] )\n#F   prints <spl> with <indent>. Further indenting is done\n#F   in steps of size <indentStep>. The default is\n#F   indent = 0, indentStep = 2.\n#F\nSPLOps.Print := function ( arg )\n    local S, indent, indentStep;\n    if Length(arg) = 1 then   S := arg[1]; indent := 0; indentStep := 2;\n    elif Length(arg) = 3 then S := arg[1]; indent := arg[2]; indentStep := arg[3];\n    else Error(\"usage: SPLOps.Print( <spl> [, <indent> , <indentStep> ] )\");\n    fi;\n    Constraint(IsInt(indent) and indent >= 0);\n    Constraint(IsInt(indentStep) and indentStep >= 0);\n    if IsInt(S) then\n\tPrint(S);\n    else\n\tS.print(indent, indentStep);\n    fi;\nend;\n\n_CompactPrintSPL := rec(\n    doPrintCutoff := true,\n\n    indentWithLines := function(indent, indentStep)\n        local x, beg;\n\tif indent < indentStep - 2 then\n\t    Print(Blanks(indent));\n\telse\n\t    beg := indent mod indentStep;\n\t    Print(Blanks(beg));\n\t    x := beg+1;\n\t    while x < indent - indentStep do\n\t        Print(\" |\", Blanks(indentStep-2));\n\t\tx := x + indentStep;\n\t    od;\n\t    Print(\" +\"); x := x + 2;\n\t    while x < indent do\n\t        Print(\"-\");\n\t\tx := x + 1;\n\t    od;\n\tfi;\n    end,\n\n    indentBlank := function(indent, indentStep) \n        Print(Blanks(indent)); \n    end,\n\n    print := meth(self, spl, maxDepth, indentFunc, indent, indentStep)\n        local c;\n\tif maxDepth > 0 then \n\t    indentFunc(indent, indentStep);\n\t    if IsBound(spl.symbol) then Print(spl.symbol, \" \", spl.params, \"\\n\"); \n\t    else Print(spl.name, \"\\n\"); \n\t    fi;\n\t    if IsBound(spl.children) then\n\t\tfor c in spl.children() do\n\t            self.print(c, maxDepth-1, indentFunc, indent+indentStep, indentStep);\n\t\tod;\n\t    fi;\n\telif self.doPrintCutoff then\n\t    indentFunc(indent, indentStep);\n\t    Print(\"...\\n\");\n\tfi;\n    end\n);\n\nCompactPrintSPL := function(spl, maxDepth)\n    Constraint(IsSPL(spl));\n    Constraint(IsInt(maxDepth) and maxDepth >= 0);\n    _CompactPrintSPL.print(spl,maxDepth, _CompactPrintSPL.indentBlank, 0,5);\nend;\n\nCompactPrintSPLTree := function(spl, maxDepth)\n    Constraint(IsSPL(spl));\n    Constraint(IsInt(maxDepth) and maxDepth >= 0);\n    _CompactPrintSPL.print(spl,maxDepth, _CompactPrintSPL.indentWithLines, 0,5);\nend;\n\nCompactPrintSPLNode := function(spl)\n    Constraint(IsSPL(spl));\n    if IsBound(spl.symbol) then Print(spl.symbol, \" \", spl.params); \n    else Print(spl.name); \n    fi;\nend;\n", "meta": {"hexsha": "9ad34725fb24b3efe89845c9ec584b82284189e6", "size": 2537, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/print.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/print.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/print.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 26.9893617021, "max_line_length": 82, "alphanum_fraction": 0.6204178163, "num_tokens": 756, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.44167302036300954, "lm_q2_score": 0.044680865502286934, "lm_q1q2_score": 0.019734332818828467}}
{"text": "#\n#\n#\n\nRead(\"~/Workspace/Chevalley.gap/init.gi\");\n\nRead(Filename(home_dir,\"lib/rsys.gd\"));\nRead(Filename(home_dir,\"lib/rsys.gi\"));\n\nRead(Filename(home_dir,\"lib/chvadj.gd\"));\nRead(Filename(home_dir,\"lib/chvadj.gi\"));\n\nRead(Filename(home_dir,\"lib/nilchv.gd\"));\nRead(Filename(home_dir,\"lib/nilchv.gi\"));\n\nRead(Filename(home_dir,\"lib/algU.gd\"));\nRead(Filename(home_dir,\"lib/algU.gi\"));\n\n#\n# UipotentChv needs SolveRelations\n#\nRead(Filename(home_dir,\"lib/poly.gd\"));\nRead(Filename(home_dir,\"lib/poly.gi\"));\n\n#\n# UipotentChv needs Descend for Unipotent\n# ... and Unipotent has to be declared before\n#\n# UniAlg needs Witt and UniMod\n#\nRead(Filename(home_dir,\"lib/unichv.gd\"));\nRead(Filename(home_dir,\"lib/witt.gd\"));\nRead(Filename(home_dir,\"lib/unimod.gd\"));\nRead(Filename(home_dir,\"lib/unialg.gd\"));\n\nRead(Filename(home_dir,\"lib/unichv.gi\"));\nRead(Filename(home_dir,\"lib/witt.gi\"));\nRead(Filename(home_dir,\"lib/unimod.gi\"));\nRead(Filename(home_dir,\"lib/unialg.gi\"));\n\n", "meta": {"hexsha": "20b5728d3e8eb51156a47b81dda6d762e57664c4", "size": 962, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "test/witt.test.init.gi", "max_stars_repo_name": "iuliansimion/Chevalley.gap", "max_stars_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/witt.test.init.gi", "max_issues_repo_name": "iuliansimion/Chevalley.gap", "max_issues_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/witt.test.init.gi", "max_forks_repo_name": "iuliansimion/Chevalley.gap", "max_forks_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.4634146341, "max_line_length": 45, "alphanum_fraction": 0.7224532225, "num_tokens": 296, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45326184801538616, "lm_q2_score": 0.04336579582756258, "lm_q1q2_score": 0.01965606075745894}}
{"text": "Bottles := function(n)\n\tlocal line, i, j, u;\n\tline := function(n)\n\t\ts := String(n);\n\t\tif n < 2 then\n\t\t\treturn Concatenation(String(n), \" bottle of beer\");\n\t\telse\n\t\t\treturn Concatenation(String(n), \" bottles of beer\");\n\t\tfi;\n\tend;\n\tfor i in [1 .. n] do\n\t\tj := n - i + 1;\n\t\tu := line(j);\n\t\tDisplay(Concatenation(u, \" on the wall\"));\n\t\tDisplay(u);\n\t\tDisplay(\"Take one down, pass it around\");\n\t\tDisplay(Concatenation(line(j - 1), \" on the wall\"));\n\t\tif i <> n then\n\t\t\tDisplay(\"\");\n\t\tfi;\n\tod;\nend;\n", "meta": {"hexsha": "b972885469cb0bb684fce93011ceb42397f473f4", "size": 493, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/99-Bottles-of-Beer/GAP/99-bottles-of-beer.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/99-Bottles-of-Beer/GAP/99-bottles-of-beer.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/99-Bottles-of-Beer/GAP/99-bottles-of-beer.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 21.4347826087, "max_line_length": 55, "alphanum_fraction": 0.584178499, "num_tokens": 163, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.334589441253186, "lm_q2_score": 0.05834583692755957, "lm_q1q2_score": 0.019521900977041665}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n#dummy var to keep copyright out of doc string\n_dummy := 0;\n\n\nTimeRec := (i,m) -> rec(index := i, measured := m);\n\nIsTimeRec := r -> IsRec(r) and IsBound(r.index) and IsBound(r.measured);\n\n\n#F TimeRuleTrees(spl, opts, treenums)\n#F\n#F    Times each rule tree indexed in list and returns a list of records\n#F    spl      - SPL object to build rule trees from\n#F    opts     - options\n#F    treenums - list of integer indexes to rule trees for SPL object\n#F               Must all be from 1 to NofRuleTrees(SPL, obj)\n#F\n#F\t  TimeRec records in returned list of form:\n#F    {\n#F      index    := <integer, index of tree>,\n#F      measured := <float, measured timing value, typically cycles>\n#F    }\n#F\n#F    if opts.timingResultsFile is set, prints results to file\n\nTimeRuleTrees := function(spl, opts, treenums)\n\tlocal retlist, idx, tree, meas, verbosity, maxidx, toFile, resultsFile, mem;\n\n\t# validate args\n\tif (not IsSPL(spl)) or (not IsRec(opts)) or (not IsList(treenums)) then\n\t\tError(\"usage: TimeRuleTrees(spl, opts, treenums)\");\n\tfi;\n\t\n\t# validate list of indexes\n\tmaxidx := NofRuleTrees(spl, opts);\n\tif not ForAll(treenums, x -> IsInt(x) and x > 0 and x <= maxidx) then\n\t\tError(\"List of tree indexes must be in range 1..<number of trees for spl>\");\n\tfi;\n\t\n\tverbosity := Cond(IsBound(opts.verbosity), opts.verbosity, 0);\n\t\n\tif verbosity > 0 then\n\t\tPrint(\"Timing \", Length(treenums), \" rule trees\\n\");\n\tfi;\n\t\n\ttoFile := IsBound(opts.timingResultsFile) and IsString(opts.timingResultsFile);\n\tif toFile then\n\t\tresultsFile := opts.timingResultsFile;\n\t\tPrintTo(resultsFile, \"# Timing results for \", spl, \"\\n\\n\");\n\tfi;\t\n\t\n\tretlist := [];\n\tfor idx in treenums do\n\t\ttree := RuleTreeN(spl, idx, opts);\n\t\tif tree <> false then\n\t\t\tmeas := CMeasureRuleTree(tree, opts);\n\t\t\tAdd(retlist, TimeRec(idx, meas));\n\t\t\tif verbosity > 1 then\n\t\t\t\tPrint(idx, \": \", meas, \"\\n\");\n\t\t\tfi;\n\t\t\tif toFile then\n\t\t\t\tAppendTo(resultsFile, idx, \", \", meas, \"\\n\");\n\t\t\tfi;\n\t\tfi;\n\t\t\n\t\tResetCodegen();\n\tod;\n\treturn retlist;\nend;\n\n\n#F BestTimedRuleTree(reclist)\n#F\n#F    Finds the TimeRec in reclist with the best time\n#F    reclist - list of timing records as returned by TimeRuleTrees\n#F\n#F\t  Returns a copy of the best TimeRec\n\nBestTimedRuleTree := function(reclist)\n\tlocal bestRec, tmRec;\n\t\n\t# validate list of timing records\n\tif not ForAll(reclist, r -> IsTimeRec(r)) then\n\t\tError(\"reclist is not a valid list of timing records\");\n\tfi;\n\t\n\tbestRec := reclist[1];\n\tfor tmRec in reclist do\n\t\tif tmRec.measured < bestRec.measured then\n\t\t\tbestRec := tmRec;\n\t\tfi;\n\tod;\n\t\n\treturn Copy(bestRec);\nend;\n\n\n#F TimeStridedRuleTrees(spl, opts, sample_count)\n#F\n#F    Time a strided list of indexed rule trees starting with index 1\n#F    Calculates stride from <rule tree count> / sample_count\n#F\n#F    Returns a list of timing records (TimeRec)\n\nTimeStridedRuleTrees := function(spl, opts, sample_count)\n\tlocal n_trees, stride, index_list;\n\t\n\tif sample_count < 1 then\n\t\tError(\"<sample_count> must be greater than 0\");\n\t\t\n\t\t\n\tfi;\n\n\tn_trees := NofRuleTrees(spl, opts);\n\t\n\tif sample_count > n_trees then\n\t\tError(\"<sample_count> (\", sample_count, \") is larger than number of rule trees (\",\n\t\t\tn_trees, \")\");\t\n\tfi;\n\t\n\tstride := n_trees / sample_count;\n\tindex_list := List([0..(sample_count-1)], x -> 1 + Int(x * stride));\n\n\treturn TimeRuleTrees(spl, opts, index_list);\nend;\n\n\n", "meta": {"hexsha": "386c43c146c3924365f52ed7d6e927a6ada7f920", "size": 3407, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/search/timetrees.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/search/timetrees.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/search/timetrees.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 25.8106060606, "max_line_length": 84, "alphanum_fraction": 0.677428823, "num_tokens": 994, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.35220178204788966, "lm_q2_score": 0.055005282871548496, "lm_q1q2_score": 0.01937295864940764}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImportAll(paradigms.vector);\n\nClass(LSKernel, SumsBase, BaseContainer, rec(\n    doNotMarkBB:= true,\n    abbrevs := [ ch -> [ch,0], (ch,ops) -> [ch,ops] ],\n    new := (self, ch, ops) >> SPL(WithBases(self, rec(\n        info := Cond(\n            IsInt(ops) or IsRat(ops) \n                or IsValue(ops) or IsExp(ops), rec(\n                    opcount := When(IsValue(ops),ops.v,ops),\n                    free := Set([]),\n                    loadFunc := fId(ch.dimensions[2]),\n                    storeFunc := fId(ch.dimensions[1])\n                ),\n\n            IsRec(ops), ops,\n\n            Error(\"unknown info\")\n        ),\n\n        _children := [ch],\n\n        dimensions := ch.dimensions\n    ))),\n\n    rChildren := self >> [self._children[1], self.info],\n\n    rSetChild := meth(self, n, what)\n        if n=2 then self.info := what;\n        elif n=1 then self._children[1] := what;\n        else Error(\"<n> must be in [1..2]\");\n        fi;\n    end,\n\n    mergeInfo := (self, r1, r2) >> rec(\n        opcount := r1.opcount + r2.opcount,\n        free := Concat(r1.free, r2.free),\n        loadFunc := r2.loadFunc,\n        storeFunc := r1.storeFunc\n    ),\n\n    print := meth(self, indent, indentStep)\n        local s,ch,first,newline;\n\n        ch := [self.child(1),self.info];\n        if self._short_print or ForAll(ch, x->IsSPLSym(x) or IsSPLMat(x)) then \n            newline := Ignore;\n        else \n            newline := self._newline;\n        fi;\n\n        first:=true;\n        Print(self.__name__, \"(\");\n        for s in ch do\n            if(first) then first:=false;\n            else Print(\", \"); fi;\n            newline(indent + indentStep);\n            When(IsSPL(s) or (IsRec(s) and IsBound(s.print) and NumGenArgs(s.print)=2),\n                s.print(indent + indentStep, indentStep), Print(s));\n        od;\n        newline(indent);\n        Print(\")\");\n        self.printA();\n    end,\n));\n\nClass(DMAGath, Gath, rec(doNotMarkBB:= true));\n\nClass(DMAScat, Scat, rec(doNotMarkBB:= true));\n\nClass(DMAFence, Buf, rec(doNotMarkBB:= true));\n\nClass(SWPSum, ISum, rec(doNotMarkBB := true));\n\nClass(DMAGathV, VGath, rec(doNotMarkBB := true));\nClass(DMAScatV, VScat, rec(doNotMarkBB := true));\n\n", "meta": {"hexsha": "14ba5414def3b12cd153e49e18263cc79b4cc37b", "size": 2270, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/sigmaspl.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/sigmaspl.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/sigmaspl.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.3493975904, "max_line_length": 87, "alphanum_fraction": 0.5303964758, "num_tokens": 629, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.48047867804790695, "lm_q2_score": 0.04023794233588316, "lm_q1q2_score": 0.01933347334091305}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Dynamic Programming Search for good trees\n# =========================================\n# BS, MP, from 08/17/00\n\n#F TimeLimitExpired( <startTime>, <timeLimit> )\n#F    calculates if the time limit has expired\n#F\n\nTimeLimitExpired := function( startTime, timeLimit )\n   return ( TimeInSecs()-startTime > 60*timeLimit );\nend;\n\n#F HashTableDP()\n#F   returns a hash table for use with dynamic programming\n#F\n\nDPMeasureRuleTree := CMeasureRuleTree;\n\nHashTableDP := function()\n   return HashTable( HashIndexSPL, IsHashIdenticalSPL, \"HashTableDP()\" );\nend;\n\n_dpMeasure := function(wrappedTree, fullTree, spl, opts, dpopts, indent, isBaseCase)\n    local mtree, time, bf;\n    # Time tree\n    When(dpopts.verbosity>=4, Print(Blanks(indent), \"Timing: \", PrettyPrintRuleTree(fullTree, indent+6), \"\\n\"));\n\n#    Print(\"** _dpMeasure: \\n* \", wrappedTree, \"\\n* \", fullTree, \"\\n* \", spl, \"\\n\");\n\n    ##################################################\n    #    tSPL hack: do not measure everything\n    if dpopts.verbosity>=5 then\n    Print(\"Now doing measurments:\\n\");\n    Print(\"spl: \", spl, \"\\n\");\n    if IsBound(dpopts.wraps) then Print(\"dpopts.wraps: \", dpopts.wraps, \"\\n\"); fi;\n    if IsBound(spl.wrap) then Print(\"spl.wrap\", spl.wrap, \"\\n\"); fi;\n    fi;\n\n    When(dpopts.verbosity>=5, Print(Blanks(indent), \"tSPL: Measuring: \", wrappedTree,\"\\n\"));\n\n    if (IsBound(spl.doNotMeasure) and (spl.doNotMeasure)) then\n        When(dpopts.verbosity>=5, Print(Blanks(indent), \"tSPL: Not measuring \", spl, \"\\n\"));\n        time := 0;\n    else\n        if not dpopts.timeBaseCases and isBaseCase then\n            time := 0; # do not measure\n        elif IsBound(dpopts.measureFunction) then\n            time := dpopts.measureFunction( wrappedTree, opts );\n        else\n            time := DPMeasureRuleTree( wrappedTree, opts );\n        fi;\n        When(dpopts.verbosity>=4, PrintLine(\"Measurment done: \", time));\n    fi;\n\n    ResetCodegen();\n\n    When(dpopts.verbosity>=4, Print(Blanks(indent), \"   ! \", time, \"\\n\" ));\n    return time;\nend;\n\n_dpReuseHash := function(W, spl, opts, dpopts, rvars)\n    local lkup, lkup2, i, wrappedspl;\n\n    wrappedspl := spl;\n    for i in Reversed(W) do\n        wrappedspl := i.twrap(spl,opts);\n    od;\n\n    # First lookup in readonly base cases hashtable, if not found, use the DP hashTable\n    lkup := MultiHashLookup(opts.baseHashes, spl); # NOTE: why not wrappedspl? because it does not work!\n    if lkup <> false then\n        # Save in DP hash table also\n        if HashLookup(rvars.hashTable, spl) = false then\n            HashAdd(rvars.hashTable, spl, lkup);\n        fi;\n    else\n        lkup := HashLookup( rvars.hashTable, wrappedspl);\n    fi;\n\n\n    # Found something -- just return it\n    if not lkup = false then\n    When(dpopts.verbosity>=5, Print(\"reuse lkup:\\nlkup: \", lkup, \"\\n\"));\n    lkup2 := Copy(lkup);\n    for i in lkup2 do\n            if IsBound(i.origtree) then\n                # special case in real A_x_I wrapped guys -- NOTE!!!\n        if W <> VWrapId then\n            When(dpopts.verbosity>=5, Print(\"VWrapId: using ruletree instead of origtree:\\n\"));\n            i.ruletree := i.origtree;\n        fi;\n        Unbind(i.origtree);\n        fi;\n    od;\n    return lkup2;\n    fi;\n    return lkup;\nend;\n\n\n_dpMax := (a,b) -> a.measured > b.measured;\n_dpMin := (a,b) -> a.measured < b.measured;\n\nDeclare(_DPSPLRec);\n\n# DPSPLRec( <spl>, <search-options-rec>, <SPL-options-rec>, <recVars> )\n#    does the actual dynamic programming recursivedly.\n#    do not call directly -- call DPSPL.\n#\n# HELP -- no checks for infinite loops (YSV: infinite loops in what?)\n#\nDPSPLRec := function( spl, dpopts, opts, rvars )\n    local hspl, res, i;\n    opts := TypeOpts(spl, opts);\n    hspl := HashAsSPL(spl);\n    res  := _DPSPLRec(hspl, dpopts, opts, rvars);\n    for i in res do\n        i.ruletree := ApplyRuleTreeSPL(i.ruletree, spl, opts);\n    od;\n    return res;\nend;\n\n_DPSPLRec := function( spl, dpopts, opts, rvars )\n   local hash, hash2, chash, i, bf, wrappedspl, tree, trees, mtree, W, w, children, childrenSets,\n         index, time, bestTrees, bestTrees2, numTimed, result, sorter, dpopts2, IsTopLevel,\n         fullTree, mopts;\n\n    ################################################\n    if dpopts.verbosity>=5 then\n        Print(\"Recursive call, spl: \", spl, \"\\n\");\n        if IsBound(dpopts.wraps) then Print(\"dpopts.wraps: \", dpopts.wraps, \"\\n\"); fi;\n        if IsBound(spl.wrap) then Print(\"spl.wrap\", spl.wrap, \"\\n\"); fi;\n    fi;\n\n    dpopts2 := Copy(dpopts);\n\n    if not IsBound(dpopts2.wraps) then\n        dpopts2.wraps := [VWrapId];\n        dpopts2.wrap_index := 1;\n    fi;\n\n    # replaceable wrapper\n    if ObjId(spl)=DPWrapper then \n        dpopts2.wraps := ListWithout(dpopts2.wraps, dpopts2.wrap_index) :: [spl.wrap]; \n        dpopts2.wrap_index := Length(dpopts2.wraps);\n    fi;\n    # stackable wrappers\n    if ObjId(spl)=DPSWrapper then \n        Add(dpopts2.wraps, spl.wrap); \n    fi;\n\n    W := dpopts2.wraps; \n\n    #################################################\n\n    ############################################################\n    ## Temporary Hack because spl.doNotMeasure is not checked ##\n    ############################################################\n    if (ObjId(spl)=InfoNt) then\n        W:=[VWrapId];\n    fi;\n\n    # Check Time Limit\n    if rvars.stopNow or (IsInt(dpopts.timeLimit) and TimeLimitExpired(rvars.startTime, dpopts.timeLimit)) then\n        rvars.stopNow := true;\n        When(dpopts.verbosity > 1, Print(\"\\nTime Limit Expired!\\n\\n\"));\n\n        return [];\n    fi;\n\n    # unify data types to have spl with correct data type attributes before searching in hash \n    spl := SumsUnification(spl, opts);\n\n    hash := _dpReuseHash(W, HashAsSPL(spl), opts, dpopts, rvars);\n    if hash <> false then\n        return hash;\n    fi;\n\n    # Set up some local variables and functions\n    sorter := When(dpopts.optimize = \"maximize\", _dpMax, _dpMin);\n    numTimed := 0;\n    bestTrees := [];\n    if dpopts.verbosity>=1 then \n        Print(Blanks(rvars.indent), \"DP called on \", spl.print(rvars.indent, 2), \"\\n\" );\n    fi;\n    trees := ExpandSPL(spl, opts);\n    When(dpopts.verbosity>=3, Print(Blanks(rvars.indent), Length(trees), \" tree(s) to fully expand\\n\"));\n    rvars.indent := rvars.indent + 2;\n\n    # For each possible new one level tree\n    for tree in trees do\n\n      # Check Time Limit\n      if IsInt(dpopts.timeLimit) and not rvars.stopNow and TimeLimitExpired(rvars.startTime, dpopts.timeLimit) then\n        rvars.stopNow := true;\n        When(dpopts.verbosity > 1, Print(\"\\nTime Limit Expired!\\n\\n\"));\n      else\n        # For each possible set of subtrees of <tree>'s children\n        childrenSets := Cartesian(List(tree.children, c -> List(DPSPLRec(c,dpopts2,opts,rvars), n->n.ruletree)));\n\n        for children in childrenSets do\n          if dpopts.verbosity>=5 then ################################################\n            PrintLine(\"Back again:\", \"\\nspl: \", spl, \"\\nchildren: \", children);\n            When(IsBound(dpopts.wraps), Print(\"dpopts.wraps: \", dpopts.wraps, \"\\n\"));\n            When(IsBound(spl.wrap),    Print(\"spl.wrap\", spl.wrap, \"\\n\"));\n          fi;   ######################################################################\n\n          # Construct full tree, wrap it, and measure\n          fullTree := CopyRuleTree(tree);\n          fullTree.children := ShallowCopy(children);\n          mopts := ShallowCopy(opts);\n          mtree := fullTree;\n          for w in Reversed(W) do\n            mtree := w.wrap(mtree, spl, mopts);\n            mopts := w.opts(spl, mopts);\n          od;\n          time := _dpMeasure(mtree, fullTree, spl, mopts, dpopts, rvars.indent,\n              Length(childrenSets)=1 and Length(trees)=1);\n\n          rvars.numTimed := rvars.numTimed + 1;\n          numTimed := numTimed + 1;\n\n              # See if one of the best times\n          Add(bestTrees, rec( ruletree := mtree, origtree:= fullTree, measured := time,\n                          globalUnrolling := opts.globalUnrolling ));\n          Sort(bestTrees, sorter);\n          When(IsBound(bestTrees[dpopts.nBest+1]), Unbind(bestTrees[dpopts.nBest+1]));\n\n          od;\n      fi;\n   od;\n   rvars.indent := rvars.indent - 2;\n\n   # Save final result\n   if not(IsBound(spl.doNotSaveInHashtable)) or\n       (IsBound(spl.doNotSaveInHashtable) and not spl.doNotSaveInHashtable) then\n       wrappedspl := HashAsSPL(spl);\n       for w in Reversed(W) do\n           wrappedspl := w.twrap(wrappedspl,opts);\n       od;\n       HashAdd(rvars.hashTable, wrappedspl, bestTrees);\n\n       if IsBound(opts.unsafeDpHashUnwrapped) and opts.unsafeDpHashUnwrapped then\n\t   if HashLookup(rvars.hashTable, HashAsSPL(spl))=false then\n\t       HashAdd(rvars.hashTable, HashAsSPL(spl), List(bestTrees, x->CopyFields(x, rec(ruletree:=x.origtree))));\n\t   fi;\n       fi;\n   fi;\n\n   if dpopts.verbosity>=2 then\n       When(dpopts.verbosity>=3, Print(Blanks(rvars.indent), numTimed, \" tree(s) timed at this level\\n\"));\n       Print(Blanks(rvars.indent), \"Best Trees:\\n\" );\n       for result in bestTrees do\n           Print(Blanks(rvars.indent+3), PrettyPrintRuleTree(result.ruletree, rvars.indent+3), \" ! \", result.measured, \"\\n\");\n       od;\n   fi;\n\n    # NOTE: Hack to avoid wrapped trees in bestfoundtable\n    bestTrees2 := Copy(bestTrees);\n    for i in bestTrees2 do\n        if IsBound(i.origtree) then\n            i.ruletree := i.origtree;\n            Unbind(i.origtree);\n        fi;\n    od;\n\n    return bestTrees2;\nend;\n\n\n# GlobalUnrollingDPSPL( <spl>, <search-options-rec>,\n#                       <SPL-options-rec>, <rvars> )\n#   performs search over global unrolling for DP\n#\n\nGlobalUnrollingDPSPL := function( spl, dpopts, opts, rvars )\n   local result, bestResult, bestUnrolling, bestHashTable;\n\n   bestResult := false;\n\n   # Initialize to first globalUnrolling setting\n   opts.globalUnrolling := dpopts.globalUnrollingMin;\n\n   repeat\n\n      if dpopts.verbosity > 0 then\n         Print( \"Global_Unrolling := \", opts.globalUnrolling, \"\\n\" );\n      fi;\n\n      # Set up hashTable\n      if IsBound( dpopts.hashTable ) then\n         rvars.hashTable := Copy(dpopts.hashTable);\n      else\n     rvars.hashTable := HashTableDP();\n      fi;\n\n      # Do DP\n      result := DPSPLRec( spl, dpopts, opts, rvars );\n\n      # Keep track of best result found over all unrollings\n      if bestResult = false or bestResult = [] then\n         bestResult := result;\n     bestUnrolling := opts.globalUnrolling;\n     bestHashTable := rvars.hashTable;\n      elif    (     bestResult[1].measured < result[1].measured\n                and dpopts.optimize = \"maximize\" )\n           or (     bestResult[1].measured > result[1].measured\n                and dpopts.optimize = \"minimize\" ) then\n         bestResult := result;\n     bestUnrolling := opts.globalUnrolling;\n     bestHashTable := rvars.hashTable;\n      fi;\n\n      # Increase globalUnrolling\n      opts.globalUnrolling := opts.globalUnrolling * 2;\n\n   until opts.globalUnrolling > dpopts.globalUnrollingMax or\n         rvars.stopNow;\n\n   if dpopts.verbosity > 0 then\n      Print( \"Optimal unrolling is \", bestUnrolling, \"\\n\" );\n   fi;\n\n   if IsBound( dpopts.hashTable ) then\n      RecCopy(dpopts.hashTable, bestHashTable);\n   fi;\n\n   return bestResult;\nend;\n\n\n#F DPSPL( <spl> [, <DP-options-record>, <SPL-options-record> ] )\n#F   runs dynamic programing on the given spl.\n#F   maintins the n best formulas for each spl.\n#F   returns a list of records of the best trees and their times.\n#F   also may pass a DPOptionsRecord and a SPLOptionsRecord.\n#F   to specify one set of options but not the other, pass just a \"rec()\"\n#F      in place of the options you do not wish to set\n#F   call PrintSpecDPOptionsRecord() and PrintSpecSPLOptionsRecord() to get\n#F      info on possible options\n#F   Verbosity levels:\n#F      0 = Print nothing\n#F      1 = Show recursive calls to DP\n#F      2 = Show best trees found found each recursive call to DP\n#F      3 = Show how many trees must be fully expanded and how many were timed\n#F      4 = Show formulas that are being timed.\n#F\n\nDPSPL := function( arg )\n   local spl,\n     dpopts, opts,\n     rvars,\n     result;\n\n   # process arg\n   if Length(arg) = 1 then\n      spl := arg[1];\n      dpopts := MergeDPOptionsRecord(rec());\n      opts := MergeSPLOptionsRecord(rec());\n   elif Length(arg) = 3 then\n      spl := arg[1];\n      dpopts := MergeDPOptionsRecord(arg[2]);\n#opts := MergeSPLOptionsRecord(arg[3]);\n      opts := (arg[3]);\n   else\n      Error( \"usage: DPSPL( <spl>\",\n             \" [, <DP-options-record>, <SPL-options-record> ] )\\n\" );\n   fi;\n\n   # check spl\n   if not IsSPL(spl) then\n      Error(\"<spl> must be provided and a valid spl\");\n   fi;\n   # check dataType\n   SearchCheckDataType( spl, opts );\n   # setup variables used during recursive calls\n\n   rvars := rec( indent := 0, numTimed := 0, stopNow := false);\n\n   # check timeLimit\n   if IsInt( dpopts.timeLimit ) then\n      rvars.startTime := TimeInSecs();\n   fi;\n\n   # check globalUnrolling because it requires extra work\n   if dpopts.globalUnrolling = true then\n      result := GlobalUnrollingDPSPL( spl, dpopts, opts, rvars );\n   else\n\n      # setup hashTable\n      if IsBound( dpopts.hashTable ) then\n         rvars.hashTable := dpopts.hashTable;\n      elif IsBound( opts.hashTable ) then\n         rvars.hashTable := opts.hashTable;\n      else\n         rvars.hashTable := HashTableDP();\n      fi;\n\n      result := DPSPLRec( spl, dpopts, opts, rvars );\n\n   fi;\n\n   if dpopts.verbosity >= 3 then\n      Print( rvars.numTimed, \" total trees timed\\n\" );\n   fi;\n\n   return result;\nend;\n\n\n#F DP(...) alias for DPSPL(...)\n#F\n\nDP := DPSPL;\n", "meta": {"hexsha": "37de72ea217a4d3905d913a5a006298c966af91d", "size": 13682, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/search/dp.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/search/dp.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/search/dp.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 32.5761904762, "max_line_length": 125, "alphanum_fraction": 0.6037859962, "num_tokens": 3733, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3208213138121609, "lm_q2_score": 0.06008665522337756, "lm_q1q2_score": 0.019277079671342328}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(DMACodegen, DefaultCodegen, rec(\n    Formula := meth(self, o, y, x, opts)\n        local icode, datas, prog, params, sub, initsub, io, t, initcode;\n        [x, y] := self.initXY(x, y, opts);\n\n        Add(x.t.qualifiers, opts.memModifier);\n        Add(y.t.qualifiers, opts.memModifier);\n\n        o := o.child(1);\n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n\n        datas := Collect(o, FDataOfs);\n        [o,t] := UTimedAction(BlockSumsOpts(o, opts)); #PrintLine(\"BlockSums \", t);\n        [icode,t] := UTimedAction(self(o, y, x, opts)); #PrintLine(\"codegen \", t);\n        [icode,t] := UTimedAction(ESReduce(icode, opts)); #PrintLine(\"ESReduce \", t);\n        icode := RemoveAssignAcc(icode);\n        Unbind(Compile.times);\n        [icode,t] := UTimedAction(BlockUnroll(icode, opts)); #PrintLine(\"BlockUnroll \", t);\n        #PrintLine(\"---compile--\");\n\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subNameDMA), opts.subNameDMA, \"sub_dma\");\n        icode := func(TVoid, sub, Concatenation(io, params), icode);\n\n        return icode;\n    end,\n    \n    LSKernel := meth(self, o, y, x, opts)\n        return chain(dma_signal(self.swp_var), cpu_wait(self.swp_var));\n    end,\n\n\n    DMAGath := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix, size;\n        Add(self.loadbuffers, y);\n        Add(self.membuffers, x);\n        i := Ind();\n\n        func := o.func;\n        size := 1;\n        if ObjId(func) = fTensor and ObjId(Last(func.children())) = fId then\n            size := Last(func.children()).domain();\n            func := fTensor(Concat(DropLast(func.children(), 1), [fBase(size, 0)]));\n        fi;\n\n        func := func.lambda();\n        return loop(i, func.domain(), dma_load(y+(i*size), x+func.at(i), size));\n    end,\n\n    DMAScat := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix, size;\n\n        Add(self.storebuffers, x);\n        Add(self.membuffers, y);\n        i := Ind();\n\n        func := o.func;\n        size := 1;\n        if ObjId(func) = fTensor and ObjId(Last(func.children())) = fId then\n            size := Last(func.children()).domain();\n            func := fTensor(Concat(DropLast(func.children(), 1), [fBase(size, 0)]));\n        fi;\n        \n        func := func.lambda();\n        return loop(i, func.domain(), dma_store(y+func.at(i), x+(i*size), size));\n    end,\n\n    DMAFence := (self,o,y,x,opts) >> chain(self(o.child(1), y, x, opts), dma_fence()),\n\n    swp_var := false,\n    SWPSum := meth(self, o, y, x, opts)\n        local old_swp, c;\n\n        old_swp := self.swp_var;\n        self.swp_var := o.var;\n        c := swp_loop(o.var, o.domain, self(o.child(1), y, x, opts));\n        self.swp_var := old_swp;\n        return c;\n    end\n\n));\n\n\nClass(CPUCodegen, DefaultCodegen, rec(\n    Formula := meth(self, o, y, x, opts)\n        local icode, datas, prog, params, sub, initsub, io, t, initcode;\n        [x, y] := self.initXY(x, y, opts);\n\n        o := o.child(1);\n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n\n        datas := Collect(o, FDataOfs);\n        [o,t] := UTimedAction(BlockSumsOpts(o, opts)); #PrintLine(\"BlockSums \", t);\n        [icode,t] := UTimedAction(self(o, y, x, opts)); #PrintLine(\"codegen \", t);\n        [icode,t] := UTimedAction(ESReduce(icode, opts)); #PrintLine(\"ESReduce \", t);\n        icode := RemoveAssignAcc(icode);\n        Unbind(Compile.times);\n        [icode,t] := UTimedAction(BlockUnroll(icode, opts)); #PrintLine(\"BlockUnroll \", t);\n        #PrintLine(\"---compile--\");\n\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        io := When(x=y, [x], [y, x]);\n        Add(params, Filtered(icode.free(), i->not IsBound(i.init)));\n        sub := Cond(IsBound(opts.subNameCompute), opts.subNameCompute, \"sub_cpu\");\n\n        icode := func(TVoid, sub, params, icode);\n\n        return icode;\n\n    end,\n\n    DMAGath := meth(self, o, y, x, opts)\n        local dma;\n        if not IsBound(x.t.qualifiers) then x.t.qualifiers := []; fi;\n        if not IsBound(y.t.qualifiers) then y.t.qualifiers := []; fi;\n        Add(x.t.qualifiers, opts.memModifier);\n        y.t.qualifiers := [ opts.scratchModifier ];\n        Add(self.loadbuffers, y);\n        return dma_wait(self.swp_var);\n    end,\n\n    DMAScat := meth(self, o, y, x, opts)\n        local dma;\n        if not IsBound(x.t.qualifiers) then x.t.qualifiers := []; fi;\n        if not IsBound(y.t.qualifiers) then y.t.qualifiers := []; fi;\n        x.t.qualifiers := [ opts.scratchModifier ];\n        Add(y.t.qualifiers, opts.memModifier);\n        Add(self.storebuffers, x);\n        return cpu_signal(self.swp_var);\n    end,\n\n    LSKernel := (self, o, y, x, opts) >> self(o.child(1), y, x, opts),\n\n    swp_var := false,\n    SWPSum := meth(self, o, y, x, opts)\n        local old_swp, c;\n\n        old_swp := self.swp_var;\n        self.swp_var := o.var;\n        c := swp_loop(o.var, o.domain, self(o.child(1), y, x, opts));\n        self.swp_var := old_swp;\n        return c;\n    end\n));\n\n_scratch_variables := function(vars, opts)\n   local new_vars, i, nv;\n   new_vars := [];\n    for i in vars do\n        nv := Copy(i);\n        nv.t := TArray(nv.t, 2);\n        nv.t.qualifiers := [opts.scratchModifier];\n        Add(new_vars, nv);\n    od;\n\n    return new_vars;\nend;\n\n_double_buffer := function(cpu, dma, vars, opts)\n    local new_cpu, new_dma, loops, new_loops, l, ld, st, s, w, c, i, s1, s2, ll, lst, new_vars, nv, svars, srec, v, vv, dvars, ass;\n\n    svars := [];\n    loops := Collect(dma, swp_loop);\n    new_loops := [];\n    new_dma := Copy(dma);\n    new_cpu := cpu;\n\n    for l in loops do\n        i := l.var;\n\n        ld := Collect(l, [loop, @(1), @(2), dma_load]);\n        if Length(ld) = 0 then ld := Collect(l, dma_load)[1]; else ld := ld[1]; fi;\n        st := Collect(l, [loop, @(1), @(2), dma_store]);\n        if Length(st) = 0 then st := Collect(l, dma_store)[1]; else st := st[1]; fi;\n        s := Collect(l, dma_signal)[1];\n        w := Collect(l, cpu_wait)[1];\n        s1 := Filtered(ld.free(), i->IsBound(i.t.qualifiers) and i.t.qualifiers=[opts.scratchModifier])[1];\n        s2 := Filtered(st.free(), i->IsBound(i.t.qualifiers) and i.t.qualifiers=[opts.scratchModifier])[1];\n        Add(svars, s1);\n        Add(svars, s2);\n\n        ll := Copy(l);\n        lst := SubstVars(Copy(st), rec((s2.id) := nth(s2, bin_and(i, V(2)))));\n        lst := SubstVars(lst, rec((i.id) := i-V(1)));\n        lst := Collect(lst, dma_store)[1];\n\n        ll.range := [Minimum(l.range)+1..Maximum(l.range)];\n        ll := SubstTopDown(ll, @(1, dma_load), e->dma_load(nth(@(1).val.loc, bin_and(i, V(2))), @(1).val.exp, @(1).val.size));\n        ll := SubstTopDown(ll, @(1, dma_store), e->lst);\n        ll := SubstTopDown(ll, @(1, cpu_wait), e->cpu_wait(@(1).val.args[1]-1));\n\n        c := chain([\n            SubstVars(chain([Copy(ld), Copy(s)]), rec((i.id) := V(0), (s1.id) := nth(s1, 0))),\n            ll,\n            SubstVars(chain([Copy(w), Copy(st)]), rec((i.id) := i.range-V(1), (s2.id) := nth(s2, 1))),\n        ]);\n        c := RulesStrengthReduce(c);\n        new_dma := SubstBottomUp(new_dma, @(1, swp_loop, e->e.var = i), e->c);\n    od;\n\n    svars := Set(svars);\n    loops := Collect(cpu, swp_loop);\n    new_cpu := Copy(cpu);\n    new_loops := [];\n    for l in loops do\n        i := l.var;\n        srec := rec();\n        dvars := [];\n        ass := [];\n        for v in svars do\n            vv := var.fresh_t(\"R\", TPtr(v.t.t));\n            Add(dvars, vv);\n            Add(ass, assign(vv, nth(v, bin_and(i, V(2)))));\n            srec.(v.id) := vv;\n        od;\n        c := SubstVars(l, srec);\n        c := swp_loop(c.var, c.range, decl(dvars, chain(Concat(ass, [c.cmd]))));\n        new_cpu := SubstBottomUp(new_cpu, @(1, swp_loop, e->e.var = i), e->c);\n    od;\n\n    new_vars := _scratch_variables(vars,opts);\n\n    return [new_cpu, new_dma, new_vars];\nend;\n\nClass(ScratchMainCodegen, rec(\n    genMain := (self, opts, sub, dmafunc, cpufunc, xy, params) >>\n        func(TVoid, sub, Concatenation(xy, params), par_exec(\n            ApplyFunc(call, Flat(Concatenation([dmafunc], xy))),\n            call(cpufunc)\n        ))\n));\n\nClass(ScratchCodegen, DefaultCodegen, rec(\n    CPUCodegen := CPUCodegen,\n    DMACodegen := DMACodegen,\n    MainCodegen := ScratchMainCodegen,\n\n    Formula := meth(self, o, y, x, opts)\n        local tag, main, initfunc, cpufunc, dmafunc, prog, params, sub, initsub, memvars, scratchvars, v, io, loadvar, storevar, v, substrec, svars, initcode, datas, dvars, dv;\n\n        datas := Collect(o, FDataOfs);\n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            initcode := chain(List(datas, x -> SReduce(x.var.init, opts)));\n            initfunc := func(TVoid, initsub, params :: Set(Collect(initcode, param)), initcode);\n        else\n            initfunc := func(TVoid, initsub, params, chain());\n        fi;\n\n        dvars := List(datas, x->x.var);\n        for dv in dvars do\n            dv.t.qualifiers := [opts.romModifier];\n        od;\n\n        self.DMACodegen.loadbuffers := Set([]);\n        self.DMACodegen.storebuffers := Set([]);\n        self.DMACodegen.membuffers := Set([]);\n        dmafunc := self.DMACodegen.Formula(o, y, x, opts);\n        self.DMACodegen.membuffers := Set(self.DMACodegen.membuffers);\n        SubtractSet(self.DMACodegen.membuffers, Set([x, y]));\n        for v in self.DMACodegen.membuffers do v.t.qualifiers := [opts.memModifier]; od;\n\n        self.CPUCodegen.loadbuffers := Set([]);\n        self.CPUCodegen.storebuffers := Set([]);\n        cpufunc := self.CPUCodegen.Formula(o, y, x, opts);\n\n        memvars := Set(Concat(\n            Filtered(Flat(List(Collect(cpufunc, decl), i->i.vars)), j->IsBound(j.t.qualifiers) and opts.memModifier in j.t.qualifiers),\n            self.DMACodegen.membuffers));\n        scratchvars := Set(Filtered(Flat(List(Collect(cpufunc, decl), i->i.vars)), j->IsBound(j.t.qualifiers) and opts.scratchModifier in j.t.qualifiers));\n        \n        tag := opts.tags[1];\n\n        loadvar := var.fresh_t(\"S\", TArray(opts.XType.t, Cond(tag.isRegCx, 2 * tag.size, tag.size)));\n        loadvar.t.qualifiers := [opts.scratchModifier];\n        storevar := var.fresh_t(\"S\", TArray(opts.XType.t, Cond(tag.isRegCx, 2 * tag.size, tag.size)));\n        storevar.t.qualifiers := [opts.scratchModifier];\n        \n        substrec := rec();\n        for v in self.CPUCodegen.loadbuffers do substrec.(v.id) := loadvar; od;\n        for v in self.CPUCodegen.storebuffers do substrec.(v.id) := storevar; od;\n        for v in self.DMACodegen.loadbuffers do substrec.(v.id) := loadvar; od;\n        for v in self.DMACodegen.storebuffers do substrec.(v.id) := storevar; od;\n        cpufunc :=  SubstVars(cpufunc, substrec);\n        dmafunc :=  SubstVars(dmafunc, substrec);\n\n        cpufunc := SubstTopDown(cpufunc, @(1, decl), e->decl(Filtered(@(1).val.vars, i->not i in Concat(memvars, scratchvars, [loadvar, storevar])), @(1).val.cmd));\n        dmafunc := SubstTopDown(dmafunc, @(1, decl), e->decl(Filtered(@(1).val.vars, i->not i in Concat(memvars, scratchvars, [loadvar, storevar])), @(1).val.cmd));\n        \n        [cpufunc, dmafunc, svars] := When(opts.swp,_double_buffer(cpufunc, dmafunc, [loadvar, storevar], opts),[cpufunc,dmafunc,[loadvar,storevar]]);\n\n        x.t.qualifiers := Set(x.t.qualifiers);\n        y.t.qualifiers := Set(y.t.qualifiers);\n\n        main := self.MainCodegen.genMain(opts, sub, dmafunc, cpufunc, [x,y], params);\n        prog := program(\n            decl(Concat(Set(memvars), svars, dvars), chain(\n                initfunc,\n                cpufunc,\n\t\t        dmafunc,\n                main\n        )));\n\n        prog.dimensions := o.dims();\n        return prog;\n    end\n));\n", "meta": {"hexsha": "6506b3ac1b26ba53710d312365f8d5eb474941de", "size": 12409, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 38.0644171779, "max_line_length": 176, "alphanum_fraction": 0.568216617, "num_tokens": 3610, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.5, "lm_q2_score": 0.03846619036489696, "lm_q1q2_score": 0.01923309518244848}}
{"text": "#############################################################################\n##\n##  io.gi\n##  Copyright (C) 2014-19                                James D. Mitchell\n##\n##  Licensing information can be found in the README file of this package.\n##\n#############################################################################\n##\n\n#############################################################################\n## This file contains methods for reading and writing digraphs from and to\n## files.\n##\n## It is organized as follows:\n##\n##   0. Internal functions\n##\n##   1. Picklers for IO\n##\n##   2. Read/WriteDigraphs (the main functions)\n##\n##   3. Decoders\n##\n##   4. Encoders\n##\n#############################################################################\n\n#############################################################################\n# 0. Internal functions\n#############################################################################\n\nBindGlobal(\"DIGRAPHS_SplitStringBySubstring\",\nfunction(string, substring)\n  local m, n, i, j, out, nr;\n\n  if Length(string) = 0 then\n    return [];\n  fi;\n  if Length(substring) = 1 then\n    return SplitString(string, substring);\n  fi;\n\n  m := Length(string);\n  n := Length(substring);\n  i := 1;\n  j := 1;\n  out := [];\n  nr := 0;\n\n  while m - i >= n do\n    if string{[i .. i + n - 1]} = substring then\n      if i <> 1 then\n        nr := nr + 1;\n        out[nr] := string{[j .. i - 1]};\n        j := i + n;\n        i := i + n;\n      fi;\n    else\n      i := i + 1;\n    fi;\n  od;\n  nr := nr + 1;\n  out[nr] := string{[j .. Length(string)]};\n  return out;\nend);\n\nBindGlobal(\"DIGRAPHS_Graph6Length\",\nfunction(n)\n  local list;\n  list := [];\n  if n < 0 then\n    return fail;\n  elif n < 63 then\n    Add(list, n);\n  elif n < 258248 then\n    Add(list, 63);\n    Add(list, Int(n / 64 ^ 2));\n    Add(list, Int(n / 64) mod 64);\n    Add(list, n mod 64);\n  elif n < 68719476736 then\n    Add(list, 63);\n    Add(list, 63);\n    Add(list, Int(n / 64 ^ 5));\n    Add(list, Int(n / 64 ^ 4) mod 64);\n    Add(list, Int(n / 64 ^ 3) mod 64);\n    Add(list, Int(n / 64 ^ 2) mod 64);\n    Add(list, Int(n / 64 ^ 1) mod 64);\n    Add(list, n mod 64);\n  else\n    return fail;\n  fi;\n  return list;\nend);\n\n################################################################################\n# 1. Picklers\n################################################################################\n\nInstallMethod(IO_Pickle, \"for a digraph with known digraph group\",\n[IsFile, IsDigraph and HasDigraphGroup],\nfunction(file, D)\n  local g, out;\n  g := DigraphGroup(D);\n  if IsTrivial(g) then\n    TryNextMethod();\n  fi;\n  if IO_Write(file, \"DIGG\") = fail then\n    return IO_Error;\n  fi;\n  out := [GeneratorsOfGroup(g),\n          RepresentativeOutNeighbours(D),\n          DigraphSchreierVector(D)];\n  return IO_Pickle(file, out);\nend);\n\nIO_Unpicklers.DIGG := function(file)\n  local list, gens, rep_out, sch, out, trace, word, D, i, w;\n\n  list := IO_Unpickle(file);\n  if list = IO_Error then\n    return IO_Error;\n  fi;\n\n  gens    := list[1];\n  rep_out := list[2];\n  sch     := list[3];\n\n  out  := [];\n  for i in [1 .. Length(sch)] do\n    if sch[i] < 0 then\n      out[i] := rep_out[-sch[i]];\n    fi;\n\n    trace := DIGRAPHS_TraceSchreierVector(gens, sch, i);\n    out[i] := rep_out[trace.representative];\n    word := trace.word;\n    for w in word do\n       out[i] := OnTuples(out[i], gens[w]);\n    od;\n  od;\n\n  D := ConvertToImmutableDigraphNC(out);\n  SetDigraphGroup(D, Group(gens));\n  SetDigraphSchreierVector(D, sch);\n  SetRepresentativeOutNeighbours(D, rep_out);\n  return D;\nend;\n\nInstallMethod(IO_Pickle, \"for a digraph\",\n[IsFile, IsDigraph],\nfunction(file, D)\n  if IO_Write(file, \"DIGT\") = fail then\n    return IO_Error;\n  fi;\n  return IO_Pickle(file, OutNeighbours(D));\nend);\n\nIO_Unpicklers.DIGT := function(file)\n  local out;\n  out := IO_Unpickle(file);\n  if out = IO_Error then\n    return IO_Error;\n  fi;\n  return ConvertToImmutableDigraphNC(out);\nend;\n\n################################################################################\n# 2. ReadDigraphs and WriteDigraphs\n################################################################################\n\nInstallGlobalFunction(IteratorFromDigraphFile,\nfunction(arg)\n  local filename, decoder, file, record;\n\n  if Length(arg) = 1 then\n    filename := arg[1];\n    decoder  := fail;\n  elif Length(arg) = 2 then\n    filename := arg[1];\n    decoder  := arg[2];\n  else\n    ErrorNoReturn(\"there must be 1 or 2 arguments,\");\n  fi;\n\n  if not IsString(filename) then\n    ErrorNoReturn(\"the 1st argument must be a string,\");\n  elif decoder <> fail and not IsFunction(decoder) then\n    ErrorNoReturn(\"the 2nd argument must be a function or fail,\");\n  fi;\n\n  file := DigraphFile(UserHomeExpand(filename), decoder, \"r\");\n\n  record := rec(file := file, current := file!.coder(file));\n\n  record.NextIterator := function(iter)\n    local next;\n    next := iter!.current;\n    iter!.current := iter!.file!.coder(iter!.file);\n    return next;\n  end;\n\n  record.IsDoneIterator := function(iter)\n    if iter!.current = IO_Nothing then\n      if not iter!.file!.closed then\n        IO_Close(iter!.file);\n      fi;\n      return true;\n    else\n      return false;\n    fi;\n  end;\n\n  record.ShallowCopy := function(iter)\n    local file;\n    file := DigraphFile(UserHomeExpand(filename), decoder, \"r\");\n    return rec(file := file, current := file!.coder(file));\n  end;\n\n  return IteratorByFunctions(record);\nend);\n\n# these functions wrap the various line encoders/decoders in this file so that\n# they behave like IO_Pickle.\n\nBindGlobal(\"DIGRAPHS_EncoderWrapper\",\nfunction(encoder)\n  if encoder = IO_Pickle then\n    return IO_Pickle;\n  fi;\n  return {file, D} -> IO_WriteLine(file, encoder(D));\nend);\n\nBindGlobal(\"DIGRAPHS_DecoderWrapper\",\nfunction(decoder)\n  if decoder = IO_Unpickle then\n    return IO_Unpickle;\n  fi;\n  return\n    function(file)\n      local line;\n      line := IO_ReadLine(file);\n      if line = \"\" then\n        return IO_Nothing;\n      fi;\n      return decoder(line);\n    end;\nend);\n\n# if we are choosing the decoder, then the file extension is used.\n\nBindGlobal(\"DIGRAPHS_ChooseFileDecoder\",\nfunction(filename)\n  local splitname, extension;\n\n  if not IsString(filename) then\n    ErrorNoReturn(\"the argument <filename> must be a string,\");\n  fi;\n\n  splitname := SplitString(filename, \".\");\n  extension := splitname[Length(splitname)];\n\n  if extension in [\"gz\", \"bz2\", \"xz\"] then\n    extension := splitname[Length(splitname) - 1];\n  fi;\n\n  if extension = \"txt\" then\n    return DigraphPlainTextLineDecoder(\"  \", \" \", 1);\n  elif extension = \"g6\" then\n    return DigraphFromGraph6String;\n  elif extension = \"s6\" then\n    return DigraphFromSparse6String;\n  elif extension = \"d6\" then\n    return DigraphFromDigraph6String;\n  elif extension = \"ds6\" then\n    return DigraphFromDiSparse6String;\n  elif extension = \"p\" or extension = \"pickle\" then\n    return IO_Unpickle;\n  fi;\n\n  return fail;\nend);\n\n# if we are choosing the decoder, then the file extension is used.\n\nBindGlobal(\"DIGRAPHS_ChooseFileEncoder\",\nfunction(filename)\n  local splitname, extension;\n\n  if not IsString(filename) then\n    ErrorNoReturn(\"the argument <filename> must be a string,\");\n  fi;\n\n  splitname := SplitString(filename, \".\");\n  extension := splitname[Length(splitname)];\n\n  if extension in [\"gz\", \"bz2\", \"xz\"] then\n    extension := splitname[Length(splitname) - 1];\n  fi;\n\n  if extension = \"txt\" then\n    return DigraphPlainTextLineEncoder(\"  \", \" \", -1);\n  elif extension = \"g6\" then\n    return Graph6String;\n  elif extension = \"s6\" then\n    return Sparse6String;\n  elif extension = \"d6\" then\n    return Digraph6String;\n  elif extension = \"ds6\" then\n    return DiSparse6String;\n  elif extension = \"p\" or extension = \"pickle\" then\n    return IO_Pickle;\n  fi;\n  return fail;\nend);\n\nInstallGlobalFunction(DigraphFile,\nfunction(arg)\n  local coder, mode, name, file;\n\n  # defaults\n  coder       := fail;\n  mode        := \"r\";\n  if Length(arg) = 1 then\n    name  := arg[1];\n  elif Length(arg) = 2 then\n    name  := arg[1];\n    if IsString(arg[2]) then\n      mode := arg[2];\n    else\n      coder := arg[2];\n    fi;\n  elif Length(arg) = 3 then\n    name  := arg[1];\n    coder := arg[2];\n    mode  := arg[3];\n  else\n    ErrorNoReturn(\"there must be 1, 2, or 3 arguments,\");\n  fi;\n\n  # TODO check that the mode and the coder are compatible\n\n  if not IsString(name) then\n    ErrorNoReturn(\"the 1st argument <name> must be a string,\");\n  elif not (IsFunction(coder) or coder = fail) then\n    ErrorNoReturn(\"the 2nd argument <coder> must be a function or fail,\");\n  elif not mode in [\"a\", \"w\", \"r\"] then\n    ErrorNoReturn(\"the 3rd argument <mode> must be one of \\\"a\\\", \",\n                  \"\\\"w\\\", or \\\"r\\\"\");\n  fi;\n\n  if coder = fail then  # <coder> not specified by the user\n    if mode = \"r\" then\n      coder := DIGRAPHS_ChooseFileDecoder(name);\n    else\n      coder := DIGRAPHS_ChooseFileEncoder(name);\n    fi;\n  fi;\n\n  if coder = fail then\n    ErrorNoReturn(\"cannot determine the file format,\");\n  elif mode = \"r\" then\n    coder := DIGRAPHS_DecoderWrapper(coder);\n  else\n    coder := DIGRAPHS_EncoderWrapper(coder);\n  fi;\n\n  file := IO_CompressedFile(UserHomeExpand(name), mode);\n\n  if file = fail then\n    ErrorNoReturn(\"cannot open the file given as the 1st argument <name>,\");\n  fi;\n  file!.coder := coder;\n  return file;\nend);\n\nInstallGlobalFunction(ReadDigraphs,\nfunction(arg)\n  local nr, decoder, name, file, i, next, out;\n\n  # defaults\n  nr      := infinity;\n  decoder := fail;\n\n  if Length(arg) = 1 then\n    name := arg[1];\n  elif Length(arg) = 2 then\n    name    := arg[1];\n    if IsInt(arg[2]) then\n      nr      := arg[2];\n    else\n      decoder := arg[2];\n    fi;\n  elif Length(arg) = 3 then\n    name    := arg[1];\n    decoder := arg[2];\n    nr      := arg[3];\n  else\n    ErrorNoReturn(\"there must be 1, 2, or 3 arguments,\");\n  fi;\n\n  if not (IsString(name) or IsFile(name)) then\n    ErrorNoReturn(\"the 1st argument <filenname> must be a string or IO \",\n                  \"file object,\");\n  elif not (IsFunction(decoder) or decoder = fail) then\n    ErrorNoReturn(\"the argument <decoder> must be a function or fail,\");\n  elif not (IsPosInt(nr) or IsInfinity(nr)) then\n    ErrorNoReturn(\"the argument <nr> must be a positive integer or \",\n                  \"infinity\");\n  fi;\n\n  if IsString(name) then\n    file := DigraphFile(name, decoder, \"r\");\n  else\n    file := name;\n    if file!.closed then\n      ErrorNoReturn(\"the 1st argument <filename> is a closed file,\");\n    elif file!.rbufsize = false then\n      ErrorNoReturn(\"the mode of the 1st argument <filename> must be \\\"r\\\",\");\n    fi;\n  fi;\n\n  decoder := file!.coder;\n\n  if nr < infinity then\n    i := 0;\n    next := fail;\n    while i < nr - 1 and next <> IO_Nothing do\n      i := i + 1;\n      next := IO_ReadLine(file);\n    od;\n    if next <> IO_Nothing then\n      out := decoder(file);\n    else\n      out := IO_Nothing;\n    fi;\n    if IsString(arg[1]) then\n      IO_Close(file);\n    fi;\n    return out;\n  fi;\n\n  out := [];\n  next := decoder(file);\n\n  while next <> IO_Nothing do\n    Add(out, next);\n    next := decoder(file);\n  od;\n\n  if IsString(arg[1]) then\n    IO_Close(file);\n  fi;\n\n  return out;\nend);\n\nInstallGlobalFunction(WriteDigraphs,\nfunction(arg)\n  local name, digraphs, encoder, mode, splitname, compext, g6sum, s6sum, v, e,\n        dg6sum, ds6sum, file, D, i;\n\n  # defaults\n  encoder := fail;\n  mode    := \"a\";\n  if Length(arg) = 2 then\n    name     := arg[1];\n    digraphs := arg[2];\n  elif IsFile(arg[1]) then\n    ErrorNoReturn(\"the 1st argument <filename> is a file, and so there must \",\n                  \"only be 2 arguments,\");\n  elif Length(arg) = 3 then\n    name     := arg[1];\n    digraphs := arg[2];\n    if IsString(arg[3]) then\n      mode := arg[3];\n    else\n      encoder := arg[3];\n    fi;\n  elif Length(arg) = 4 then\n    name     := arg[1];\n    digraphs := arg[2];\n    encoder  := arg[3];\n    mode     := arg[4];\n  else\n    ErrorNoReturn(\"there must be 2, 3, or 4 arguments,\");\n  fi;\n\n  if not IsList(digraphs) then\n    digraphs := [digraphs];\n  fi;\n\n  if not (IsString(name) or IsFile(name)) then\n    ErrorNoReturn(\"the 1st argument <filename> must be a string or a file,\");\n  elif not ForAll(digraphs, IsDigraph) then\n    ErrorNoReturn(\"the 2nd argument <digraphs> must be a digraph or list of \",\n                  \"digraphs,\");\n  elif not (IsFunction(encoder) or encoder = fail) then\n    ErrorNoReturn(\"the argument <encoder> must be a function or fail,\");\n  elif not mode in [\"a\", \"w\"] then\n    ErrorNoReturn(\"the argument <mode> must be \\\"a\\\" or \\\"w\\\",\");\n  fi;\n\n  if IsString(name) and not IsExistingFile(name) then\n    mode := \"w\";\n  fi;\n\n  if IsString(name) then\n    if encoder = fail and DIGRAPHS_ChooseFileEncoder(name) = fail then\n      # the file encoder was not specified and cannot be deduced from the\n      # filename, so we try to make a guess based on the digraphs themselves\n      splitname := SplitString(name, \".\");\n      if splitname[Length(splitname)] in [\"xz\", \"gz\", \"bz2\"] then\n        compext := splitname[Length(splitname)];\n        splitname := splitname{[1 .. Length(splitname) - 1]};\n      fi;\n\n      # Do we know all the graphs to be symmetric?\n      if ForAll(digraphs, g -> HasIsSymmetricDigraph(g)\n                               and IsSymmetricDigraph(g)) then\n        if ForAny(digraphs, IsMultiDigraph) then\n          encoder := DiSparse6String;\n          Add(splitname, \"ds6\");\n        else\n          # Find the sum of length estimates using Graph6 and Sparse6\n          g6sum := 0;\n          s6sum := 0;\n          for D in digraphs do\n            v := DigraphNrVertices(D);\n            e := DigraphNrEdges(D);\n            g6sum := g6sum + (v * (v - 1) / 2);\n            s6sum := s6sum + (e / 2 * (Log2Int(v - 1) + 2) * 3 / 2);\n          od;\n          if g6sum < s6sum and not ForAny(digraphs, DigraphHasLoops) then\n            encoder := Graph6String;\n            Add(splitname, \"g6\");\n          else\n            encoder := Sparse6String;\n            Add(splitname, \"s6\");\n          fi;\n        fi;\n      else\n        if ForAny(digraphs, IsMultiDigraph) then\n          encoder := DiSparse6String;\n          Add(splitname, \"ds6\");\n        else\n          # Find the sum of length estimates using Digraph6 and DiSparse6\n          dg6sum := 0;\n          ds6sum := 0;\n          for D in digraphs do\n            v := DigraphNrVertices(D);\n            e := DigraphNrEdges(D);\n            dg6sum := dg6sum + v ^ 2;\n            ds6sum := ds6sum + (e * (Log2Int(v) + 2) * 3 / 2);\n          od;\n          if dg6sum < ds6sum then\n            encoder := Digraph6String;\n            Add(splitname, \"d6\");\n          else\n            encoder := DiSparse6String;\n            Add(splitname, \"ds6\");\n          fi;\n        fi;\n      fi;\n      name := JoinStringsWithSeparator(splitname, \".\");\n      if IsBound(compext) then\n        Append(name, \".\");\n        Append(name, compext);\n      fi;\n      Info(InfoWarning, 1, \"Writing to \", name);\n    fi;\n    file := DigraphFile(name, encoder, mode);\n  else\n    file := name;\n    if file!.closed then\n      ErrorNoReturn(\"the 1st argument <filename> is closed,\");\n    elif file!.wbufsize = false then\n      ErrorNoReturn(\"the mode of the 1st argument <filename> must be \",\n                    \"\\\"w\\\" or \\\"a\\\",\");\n    fi;\n  fi;\n\n  encoder := file!.coder;\n\n  for i in [1 .. Length(digraphs)] do\n    encoder(file, digraphs[i]);\n  od;\n\n  if IsString(arg[1]) then\n    IO_Close(file);\n  fi;\n\n  return IO_OK;\nend);\n\n################################################################################\n# 3. Decoders\n################################################################################\n\nInstallMethod(DigraphFromGraph6StringCons, \"for IsMutableDigraph and a string\",\n[IsMutableDigraph, IsString],\nfunction(func, s)\n  local FindCoord, list, n, start, maxedges, out, pos, nredges, i, bpos, edge,\n  j;\n\n  s := Chomp(s);\n\n  # find a position in the adj matrix from the vector\n  # knowing a lower bound for pos_y\n  FindCoord := function(pos, bound)\n    local i, sum;\n      i := bound;\n      sum := i * (i + 1) / 2;\n      while sum < pos do\n        i := i + 1;\n        sum := sum + i;\n      od;\n    return [pos - sum + i, i + 1];\n  end;\n\n  if Length(s) = 0 then\n    ErrorNoReturn(\"the 2nd argument <s> must be a non-empty string,\");\n  fi;\n\n  # Convert ASCII chars to integers\n  list := List(s, i -> IntChar(i) - 63);\n\n  # Get n the number of vertices of the graph\n  if list[1] <> 63 then\n    n := list[1];\n    start := 2;\n  elif Length(list) > 300 then\n    if list[2] = 63 then\n      n := 0;\n      for i in [0 .. 5] do\n        n := n + 2 ^ (6 * i) * list[8 - i];\n      od;\n      start := 9;\n    else\n      n := 0;\n      for i in [0 .. 2] do\n        n := n + 2 ^ (6 * i) * list[4 - i];\n      od;\n      start := 5;\n    fi;\n  else\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid graph6 string,\");\n  fi;\n\n  maxedges := n * (n - 1) / 2;\n  if list <> [0] and list <> [1] and\n      not (Int((maxedges - 1) / 6) + start = Length(list) and\n           list[Length(list)] mod 2 ^ ((0 - maxedges) mod 6) = 0) then\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid graph6 string,\");\n  fi;\n\n  out := List([1 .. n], x -> []);\n\n  # Obtaining the adjacency vector\n  pos := 1;\n  nredges := 0;\n  for j in [start .. Length(list)] do  # Every integer corresponds to 6 bits\n    i := list[j];\n    bpos := 1;\n    while i > 0 do\n      if i mod 2 = 0 then\n        i := i / 2;\n      else\n        edge := FindCoord(pos + 6 - bpos, 0);\n        out[edge[1]][Length(out[edge[1]]) + 1] := edge[2];\n        out[edge[2]][Length(out[edge[2]]) + 1] := edge[1];\n        nredges := nredges + 1;\n        i := (i - 1) / 2;\n      fi;\n      bpos := bpos + 1;\n    od;\n    pos := pos + 6;\n  od;\n  return DigraphNC(IsMutableDigraph, out);\nend);\n\nInstallMethod(DigraphFromGraph6StringCons,\n\"for IsImmutableDigraph and a string\",\n[IsImmutableDigraph, IsString],\n{filt, s} -> MakeImmutable(DigraphFromGraph6StringCons(IsMutableDigraph, s)));\n\nInstallMethod(DigraphFromGraph6String, \"for a function and a string\",\n[IsFunction, IsString],\nDigraphFromGraph6StringCons);\n\nInstallMethod(DigraphFromGraph6String, \"for a string\", [IsString],\ns -> DigraphFromGraph6String(IsImmutableDigraph, s));\n\nInstallMethod(DigraphFromDigraph6StringCons, \"for IsMutableDigraph and a string\",\n[IsMutableDigraph, IsString],\nfunction(func, s)\n  local legacy, list, n, start, i, range, source, pos, len, j, bpos, tabpos;\n  # NOTE: this package originally used a version of digraph6 that reads down\n  # the columns of an adjacency matrix, and appends a '+' to the start.  This\n  # has been replaced by the Nauty standard, which reads across the rows of the\n  # matrix, and appends a '&' to the start.  For backwards compatibility, this\n  # now accepts both formats, sending an info warning if the old format is used.\n\n  s := Chomp(s);\n  # Check non-emptiness\n  if Length(s) = 0 then\n    ErrorNoReturn(\"the 2nd argument <s> must be a non-empty string,\");\n  fi;\n\n  # Check for the special '&' character (or the deprecated '+')\n  if s[1] = '&' then\n    legacy := false;\n  elif s[1] = '+' then\n    legacy := true;\n    Info(InfoDigraphs, 1, \"Digraph6 strings beginning with '+' use an old\");\n    Info(InfoDigraphs, 1, \"specification of the Digraph6 format that is\");\n    Info(InfoDigraphs, 1, \"incompatible with the present standard.  They can\");\n    Info(InfoDigraphs, 1, \"still be read by the Digraphs package, but are\");\n    Info(InfoDigraphs, 1, \"unlikely to be recognised by other programs.\");\n    Info(InfoDigraphs, 1, \"Please consider re-encoding with the new format.\");\n  else\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid digraph6 string,\");\n  fi;\n\n  # Convert ASCII chars to integers\n  list := List(s, i -> IntChar(i) - 63);\n\n  # Get n the number of vertices of the graph\n  if list[2] <> 63 then\n    n := list[2];\n    start := 3;\n  elif Length(list) > 300 then\n    if list[3] = 63 then\n      n := 0;\n      for i in [0 .. 5] do\n        n := n + 2 ^ (6 * i) * list[9 - i];\n      od;\n      start := 10;\n    else\n      n := 0;\n      for i in [0 .. 2] do\n        n := n + 2 ^ (6 * i) * list[5 - i];\n      od;\n      start := 6;\n    fi;\n  else\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid digraph6 string,\");\n  fi;\n\n  range := [];\n  source := [];\n\n  # Obtaining the adjacency vector\n  pos := 1;\n  len := 1;\n  for j in [start .. Length(list)] do  # Every integer corresponds to 6 bits\n    i := list[j];\n    bpos := 1;\n    while i > 0 do\n      if i mod 2 = 0 then\n        i := i / 2;\n      else\n        tabpos := pos + 6 - bpos;\n        range[len] := (tabpos - 1) mod n + 1;\n        source[len] := (tabpos - range[len]) / n + 1;\n        len := len + 1;\n        i := (i - 1) / 2;\n      fi;\n      bpos := bpos + 1;\n    od;\n    pos := pos + 6;\n  od;\n\n  if legacy then  # source and range are reversed\n    return DigraphNC(IsMutableDigraph,\n                 rec(DigraphNrVertices := n,\n                     DigraphSource     := range,\n                     DigraphRange      := source));\n  fi;\n  return DigraphNC(IsMutableDigraph,\n               rec(DigraphNrVertices := n,\n                   DigraphRange      := range,\n                   DigraphSource     := source));\nend);\n\nInstallMethod(DigraphFromDigraph6StringCons,\n\"for IsImmutableDigraph and a string\",\n[IsImmutableDigraph, IsString],\n{filt, s} -> MakeImmutable(DigraphFromDigraph6StringCons(IsMutableDigraph, s)));\n\nInstallMethod(DigraphFromDigraph6String, \"for a function and a string\",\n[IsFunction, IsString],\nDigraphFromDigraph6StringCons);\n\nInstallMethod(DigraphFromDigraph6String, \"for a string\",\n[IsString], s -> DigraphFromDigraph6String(IsImmutableDigraph, s));\n\nInstallMethod(DigraphFromSparse6StringCons, \"for IsMutableDigraph and a string\",\n[IsMutableDigraph, IsString],\nfunction(func, s)\n  local list, n, start, blist, pos, num, bpos, k, range, source, len, v, i,\n  finish, x, j;\n\n  s := Chomp(s);\n  # Check non-emptiness\n  if Length(s) = 0 then\n    ErrorNoReturn(\"the 2nd argument <s> must be a non-empty string,\");\n  fi;\n\n  # Check for the special ':' character\n  if s[1] <> ':' then\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid sparse6 string,\");\n  fi;\n\n  # Convert ASCII chars to integers\n  list := [];\n  for i in s do\n    Add(list, IntChar(i) - 63);\n  od;\n\n  # Get n the number of vertices of the graph\n  if list[2] <> 63 then\n    n := list[2];\n    start := 3;\n  elif list[3] = 63 then\n    if Length(list) <= 8 then\n      ErrorNoReturn(\"the 2nd argument <s> is not a valid sparse6 string,\");\n    fi;\n    n := 0;\n    for i in [0 .. 5] do\n      n := n + 2 ^ (6 * i) * list[9 - i];\n    od;\n    start := 10;\n  elif Length(list) > 4 then\n      n := 0;\n      for i in [0 .. 2] do\n        n := n + 2 ^ (6 * i) * list[5 - i];\n      od;\n      start := 6;\n  else\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid sparse6 string,\");\n  fi;\n\n  # convert list into a list of bits;\n  blist := BlistList([1 .. (Length(list) - start + 1) * 6], []);\n  pos := 1;\n  for i in [start .. Length(list)] do\n    num := list[i];\n    bpos := 1;\n    while num > 0 do\n      if num mod 2 = 0 then\n        num := num / 2;\n      else\n        num := (num - 1) / 2;\n        blist[pos + 6 - bpos] := true;\n      fi;\n      bpos := bpos + 1;\n    od;\n    pos := pos + 6;\n  od;\n\n  if n > 1 then\n    k := LogInt(n - 1, 2) + 1;\n  else\n    k := 1;\n  fi;\n\n  range := [];\n  source := [];\n\n  len := 1;\n  v := 0;\n  i := 1;\n  # remove some of the padding\n  finish := Length(blist) - (Length(blist) mod (k + 1));\n  while i <= finish - k do\n    if blist[i] then\n      v := v + 1;\n      if v = n then  # We have reached the end\n        break;\n      fi;\n    fi;\n    x := 0;\n    for j in [1 .. k] do\n      if blist[i + j] then\n        x := x + 2 ^ (k - j);\n      fi;\n    od;\n    if x = n then  # We have reached the end\n      break;\n    elif x > v then\n      v := x;\n    else\n      range[len] := x;\n      source[len] := v;\n      len := len + 1;\n      if x <> v then\n        range[len] := v;\n        source[len] := x;\n        len := len + 1;\n      fi;\n    fi;\n    i := i + k + 1;\n  od;\n\n  range := range + 1;\n  source := source + 1;\n  return DigraphNC(IsMutableDigraph, (rec(DigraphNrVertices := n,\n                                      DigraphRange := range,\n                                      DigraphSource := source)));\nend);\n\nInstallMethod(DigraphFromSparse6StringCons,\n\"for IsImmutableDigraph and a string\",\n[IsImmutableDigraph, IsString],\n{filt, s} -> MakeImmutable(DigraphFromSparse6String(IsMutableDigraph, s)));\n\nInstallMethod(DigraphFromSparse6String, \"for a function and a string\",\n[IsFunction, IsString],\nDigraphFromSparse6StringCons);\n\nInstallMethod(DigraphFromSparse6String, \"for a string\",\n[IsString],\ns -> DigraphFromSparse6String(IsImmutableDigraph, s));\n\nInstallMethod(DigraphFromDiSparse6StringCons,\n\"for IsMutableDigraph and a string\",\n[IsMutableDigraph, IsString],\nfunction(func, s)\n  local list, n, start, blist, pos, num, bpos, k, range, source, len, v, i, x,\n  finish, j;\n\n  s := Chomp(s);\n\n  # Check non-emptiness\n  if Length(s) = 0 then\n    ErrorNoReturn(\"the 2nd argument <s> must be a non-empty string,\");\n  fi;\n\n  # Check for the special ':' character\n  if s[1] <> '.' then\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid disparse6 string,\");\n  fi;\n\n  # Convert ASCII chars to integers\n  list := [];\n  for i in s do\n    Add(list, IntChar(i) - 63);\n  od;\n\n  # Get n the number of vertices of the graph\n  if list[2] <> 63 then\n    n := list[2];\n    start := 3;\n  elif list[3] = 63 then\n    if Length(list) <= 8 then\n      ErrorNoReturn(\"the 2nd argument <s> is not a valid disparse6 string,\");\n    fi;\n    n := 0;\n    for i in [0 .. 5] do\n      n := n + 2 ^ (6 * i) * list[9 - i];\n    od;\n    start := 10;\n  elif Length(list) > 4 then\n      n := 0;\n      for i in [0 .. 2] do\n        n := n + 2 ^ (6 * i) * list[5 - i];\n      od;\n      start := 6;\n  else\n    ErrorNoReturn(\"the 2nd argument <s> is not a valid disparse6 string,\");\n  fi;\n\n  # convert list into a list of bits;\n  blist := BlistList([1 .. (Length(list) - start + 1) * 6], []);\n  pos := 1;\n  for i in [start .. Length(list)] do\n    num := list[i];\n    bpos := 1;\n    while num > 0 do\n      if num mod 2 = 0 then\n        num := num / 2;\n      else\n        num := (num - 1) / 2;\n        blist[pos + 6 - bpos] := true;\n      fi;\n      bpos := bpos + 1;\n    od;\n    pos := pos + 6;\n  od;\n\n  if n > 1 then\n    k := LogInt(n, 2) + 1;\n  else\n    k := 1;\n  fi;\n\n  range := [];\n  source := [];\n  # Get the decreasing edges first\n  len := 1;\n  v := 0;\n  i := 1;\n  while true do\n    if blist[i] then\n      v := v + 1;\n    fi;\n    x := 0;\n    for j in [1 .. k] do\n      if blist[i + j] then\n        x := x + 2 ^ (k - j);\n      fi;\n    od;\n    if x >= n then\n      break;\n    elif x > v then\n      v := x;\n    else\n      range[len] := x;\n      source[len] := v;\n      len  := len + 1;\n    fi;\n    i := i + k + 1;\n  od;\n\n  i := i + k + 1;\n\n  # Get the increasing edges\n  finish := Length(blist) - (Length(blist) mod (k + 1));\n  v := 0;\n  while i <= finish - k do\n    if blist[i] then\n      v := v + 1;\n    fi;\n    x := 0;\n    for j in [1 .. k] do\n      if blist[i + j] then\n        x := x + 2 ^ (k - j);\n      fi;\n    od;\n    if x >= n then\n      break;\n    elif x > v then\n      v := x;\n    else\n      range[len] := v;\n      source[len] := x;\n      len := len + 1;\n    fi;\n    i := i + k + 1;\n  od;\n  range := range + 1;\n  source := source + 1;\n  return DigraphNC(IsMutableDigraph, (rec(DigraphNrVertices := n,\n                                      DigraphRange      := range,\n                                      DigraphSource     := source)));\nend);\n\nInstallMethod(DigraphFromDiSparse6StringCons,\n\"for IsImmutableDigraph and a string\",\n[IsImmutableDigraph, IsString],\n{filt, s} -> MakeImmutable(DigraphFromDiSparse6String(IsMutableDigraph, s)));\n\nInstallMethod(DigraphFromDiSparse6String,\n\"for a function and a string\",\n[IsFunction, IsString],\nDigraphFromDiSparse6StringCons);\n\nInstallMethod(DigraphFromDiSparse6String,\n\"for a string\",\n[IsString],\ns -> DigraphFromDiSparse6String(IsImmutableDigraph, s));\n\n# one graph per line\nBindGlobal(\"DIGRAPHS_PlainTextLineDecoder\",\nfunction(func, delimiter1, delimiter2, offset)\n  local retval;\n  retval := function(s)\n    local edges, x;\n    s := DIGRAPHS_SplitStringBySubstring(Chomp(s), delimiter1);\n    Apply(s, x -> DIGRAPHS_SplitStringBySubstring(x, delimiter2));\n    edges := EmptyPlist(Length(s));\n    for x in s do\n      Apply(x, Int);\n      x := x + offset;\n      Add(edges, x);\n    od;\n    return func(edges);\n  end;\n  return retval;\nend);\n\nInstallMethod(DigraphFromPlainTextStringCons,\n\"for IsMutableDigraph and a string\", [IsMutableDigraph, IsString],\nfunction(filt, s)\n  local f;\n  f := x -> DigraphByEdges(IsMutableDigraph, x);\n  return DIGRAPHS_PlainTextLineDecoder(f, \"  \", \" \", 1)(Chomp(s));\nend);\n\nInstallMethod(DigraphFromPlainTextStringCons,\n\"for IsImmutableDigraph and a string\", [IsImmutableDigraph, IsString],\n{filt, s} -> MakeImmutable(DigraphFromPlainTextStringCons(IsMutableDigraph, s)));\n\nInstallMethod(DigraphFromPlainTextString, \"for a function and a string\",\n[IsFunction, IsString],\nDigraphFromPlainTextStringCons);\n\nInstallMethod(DigraphFromPlainTextString, \"for a string\",\n[IsString],\ns -> DigraphFromPlainTextString(IsImmutableDigraph, s));\n\n# DIMACS format: for symmetric digraphs, one per file, can have loops and\n# multiple edges.\n\nBindGlobal(\"DIGRAPHS_ReadDIMACSDigraph\",\nfunction(func, name)\n  local file, malformed_file, int_from_string, next, split, first_char,\n  nr_vertices, vertices, vertex_labels, nr_edges, directed_edges,\n  symmetric_edges, nbs, vertex, label, i, j, D;\n\n  file := IO_CompressedFile(UserHomeExpand(name), \"r\");\n  if file = fail then\n    ErrorNoReturn(\"cannot open the file given as the 2nd argument <name>,\");\n  fi;\n\n  # Helper function for when an error is found in the file's formatting\n  malformed_file := function()\n    IO_Close(file);\n    ErrorNoReturn(\"the format of the file given as the 2nd argument <name> \",\n                  \"cannot be determined,\");\n  end;\n\n  # Helper function to read a string into a non-negative integer\n  int_from_string := function(string)\n    local int;\n    int := Int(string);\n    if int = fail or int < 0 then\n      malformed_file();\n    fi;\n    return int;\n  end;\n\n  next := IO_ReadLine(file);\n  while not IsEmpty(next) do\n    NormalizeWhitespace(next);\n\n    # the line is entirely whitespace or a comment\n    if IsEmpty(next) or next[1] = 'c' then\n      next := IO_ReadLine(file);\n      continue;\n    fi;\n\n    split := SplitString(next, \" \");\n\n    # the line doesn't have a `type'\n    if Length(split[1]) <> 1 then\n      malformed_file();\n    fi;\n\n    first_char := next[1];\n\n    # digraph definition line\n    if first_char = 'p' then\n      if IsBound(vertices) or Length(split) <> 4 or split[2] <> \"edge\" then\n        malformed_file();\n      fi;\n      nr_vertices     := int_from_string(split[3]);\n      vertices        := [1 .. nr_vertices];\n      vertex_labels   := vertices * 0 + 1;\n      nr_edges        := int_from_string(split[4]);\n      directed_edges  := 0;\n      symmetric_edges := 0;\n      nbs := List(vertices, x -> []);\n      next := IO_ReadLine(file);\n      continue;\n    fi;\n\n    if not IsBound(vertices) then\n      # the problem definition line must precede all other types\n      malformed_file();\n    elif first_char = 'n' then\n      # type: vertex label\n      if Length(split) <> 3 then\n        malformed_file();\n      fi;\n      vertex := int_from_string(split[2]);\n      if not vertex in vertices then\n        malformed_file();\n      fi;\n      label := Int(split[3]);\n      if label = fail then\n        malformed_file();\n      fi;\n      vertex_labels[vertex] := label;\n    elif first_char = 'e' then\n      # type: edge\n      if Length(split) <> 3 then\n        malformed_file();\n      fi;\n      i := int_from_string(split[2]);\n      j := int_from_string(split[3]);\n      if not (i in vertices and j in vertices) then\n        malformed_file();\n      fi;\n      Add(nbs[i], j);\n      directed_edges := directed_edges + 1;\n      symmetric_edges := symmetric_edges + 1;\n      if i <> j then\n        Add(nbs[j], i);\n        directed_edges := directed_edges + 1;\n      fi;\n    elif first_char in \"dvx\" then\n      # type: unsupported lines\n      Info(InfoDigraphs, 1,\n           \"Lines beginning with 'd', 'v', or 'x' are not supported,\");\n    else\n      # type: unknown\n      malformed_file();\n    fi;\n    next := IO_ReadLine(file);\n  od;\n\n  if not IsBound(vertices) then\n    malformed_file();\n  fi;\n\n  if not nr_edges in [directed_edges, 2 * directed_edges, symmetric_edges] then\n    Info(InfoDigraphs,\n         1,\n         \"An unexpected number of edges was found,\");\n  fi;\n\n  IO_Close(file);\n  D := func(nbs);\n  if IsImmutableDigraph(D) then\n    SetDigraphVertexLabels(D, vertex_labels);\n  fi;\n  return D;\nend);\n\nInstallMethod(ReadDIMACSDigraph, \"for a string\", [IsString],\ns -> DIGRAPHS_ReadDIMACSDigraph(ConvertToImmutableDigraphNC, s));\n\nBindGlobal(\"DIGRAPHS_TournamentLineDecoder\",\nfunction(func, s)\n  local out, pos, n, i, j;\n  pos := 0;\n  n := (Sqrt(8 * Length(s) + 1) + 1) / 2;\n  out := List([1 .. n], x -> []);\n  for i in [1 .. n - 1] do\n    for j in [i + 1 .. n] do\n      pos := pos + 1;\n      if s[pos] = '1' then\n        Add(out[i], j);\n      else\n        Add(out[j], i);\n      fi;\n    od;\n  od;\n  return func(out);\nend);\n\nInstallMethod(TournamentLineDecoder, \"for a string\", [IsString],\ns -> DIGRAPHS_TournamentLineDecoder(ConvertToImmutableDigraphNC, s));\n\nInstallMethod(DigraphPlainTextLineDecoder,\n\"for a string, string, and integer\",\n[IsString, IsString, IsInt],\nfunction(delimiter1, delimiter2, offset)\n  return DIGRAPHS_PlainTextLineDecoder(DigraphByEdges,\n                                       delimiter1,\n                                       delimiter2,\n                                       offset);\nend);\n\n# one edge per line, one graph per file\nBindGlobal(\"DIGRAPHS_ReadPlainTextDigraph\",\nfunction(func, name, delimiter, offset, ignore)\n  local file, lines, edges, nr, decoder, line;\n\n  file := IO_CompressedFile(UserHomeExpand(name), \"r\");\n  if file = fail then\n    ErrorNoReturn(\"cannot open the file given as the 2nd argument <name>,\");\n  fi;\n\n  lines := IO_ReadLines(file);\n  edges := EmptyPlist(Length(lines));\n  nr := 0;\n\n  decoder := function(string)\n    string := DIGRAPHS_SplitStringBySubstring(Chomp(string), delimiter);\n    Apply(string, Int);\n    return string + offset;\n  end;\n\n  for line in lines do\n    if Length(line) > 0 and not (line[1] in ignore) then\n      nr := nr + 1;\n      edges[nr] := decoder(Chomp(line));\n    fi;\n  od;\n\n  return func(edges);\nend);\n\nInstallMethod(ReadPlainTextDigraph,\n\"for a string, string, integer, and string\",\n[IsString, IsString, IsInt, IsString],\nfunction(name, delimiter, offset, ignore)\n  return DIGRAPHS_ReadPlainTextDigraph(DigraphByEdges,\n                                       name,\n                                       delimiter,\n                                       offset,\n                                       ignore);\nend);\n\nBindGlobal(\"DIGRAPHS_AdjacencyMatUpperTriLineDecoder\",\nfunction(func, s)\n  local out, pos, n, i, j;\n  s := Chomp(s);\n  pos := 0;\n  n := (Sqrt(8 * Length(s) + 1) + 1) / 2;\n  out := List([1 .. n], x -> []);\n  for i in [1 .. n - 1] do\n    for j in [i + 1 .. n] do\n      pos := pos + 1;\n      if s[pos] = '1' then\n        Add(out[i], j);\n      fi;\n    od;\n  od;\n  return func(out);\nend);\n\nInstallMethod(AdjacencyMatrixUpperTriangleLineDecoder, \"for a string\",\n[IsString],\ns -> DIGRAPHS_AdjacencyMatUpperTriLineDecoder(ConvertToImmutableDigraphNC,\n                                              s));\n\nBindGlobal(\"DIGRAPHS_TCodeDecoder\",\nfunction(func, s)\n  local out, i;\n\n  s := SplitString(Chomp(s), \" \");\n  Apply(s, EvalString);\n\n  if not ForAll(s, x -> IsInt(x) and x >= 0) then\n    ErrorNoReturn(\"the 2nd argument <s> must be a string of \",\n                  \"space-separated non-negative integers,\");\n  elif not Length(s) >= 2 then\n    ErrorNoReturn(\"the 2nd argument <s> must be a string of \",\n                  \"at least two integers,\");\n  elif not ForAll([3 .. Length(s)], i -> s[i] < s[1]) then\n    ErrorNoReturn(\"the 2nd argument <s> must be a string consisting of \",\n                  \"integers in the range [0 .. \", s[1], \"],\");\n  elif Length(s) < 2 * s[2] + 2 then\n    ErrorNoReturn(\"the 2nd argument <s> must be a string of length \",\n                  \"at least \", 2 * s[2] + 2);\n  fi;\n  out := List([1 .. s[1]], x -> []);\n  for i in [1 .. s[2]] do\n    Add(out[s[2 * i + 1] + 1], s[2 * i + 2] + 1);\n  od;\n\n  return func(out);\nend);\n\nInstallMethod(TCodeDecoder, \"for a string\", [IsString],\ns -> DIGRAPHS_TCodeDecoder(ConvertToImmutableDigraphNC, s));\n\nInstallGlobalFunction(TCodeDecoderNC,\nfunction(str)\n  local out, i;\n  str := SplitString(Chomp(str), \" \");\n  Apply(str, Int);\n  out := List([1 .. str[1]], x -> []);\n  for i in [1 .. str[2]] do\n    Add(out[str[2 * i + 1] + 1], str[2 * i + 2] + 1);\n  od;\n  return ConvertToImmutableDigraphNC(out);\nend);\n\n################################################################################\n# 4. Encoders\n################################################################################\n\nInstallMethod(WriteDIMACSDigraph, \"for a digraph\", [IsString, IsDigraph],\nfunction(name, D)\n  local file, n, verts, nbs, nr_loops, m, labels, i, j;\n\n  if not IsSymmetricDigraph(D) then\n    ErrorNoReturn(\"the 2nd argument <D> must be a symmetric digraph,\");\n  fi;\n\n  file := IO_CompressedFile(UserHomeExpand(name), \"w\");\n  if file = fail then\n    ErrorNoReturn(\"cannot open the file given as the 1st argument <name>,\");\n  fi;\n\n  n := DigraphNrVertices(D);\n  verts := DigraphVertices(D);\n  nbs := OutNeighbours(D);\n\n  nr_loops := 0;\n  if not HasDigraphHasLoops(D) or DigraphHasLoops(D) then\n    for i in verts do\n      for j in nbs[i] do\n        if i = j then\n          nr_loops := nr_loops + 1;\n        fi;\n      od;\n    od;\n    if IsImmutableDigraph(D) then\n      SetDigraphHasLoops(D, nr_loops <> 0);\n    fi;\n  fi;\n  m := ((DigraphNrEdges(D) - nr_loops) / 2) + nr_loops;\n\n  # Problem definition\n  IO_WriteLine(file, Concatenation(\"p edge \", String(n), \" \", String(m)));\n\n  # Edges\n  for i in verts do\n    for j in nbs[i] do\n      if i <= j then\n        IO_WriteLine(file, Concatenation(\"e \", String(i), \" \", String(j)));\n      fi;\n      # In the case that j < i, the edge will be written elsewhere in the file\n    od;\n  od;\n\n  # Vertex labels\n  if n > 0 then\n    labels := DigraphVertexLabels(D);\n    if not (IsHomogeneousList(labels) and IsInt(labels[1])) then\n      Info(InfoDigraphs, 1,\n           \"Only integer vertex labels are supported by the DIMACS format.\");\n      Info(InfoDigraphs, 1,\n           \"The vertex labels of the 2nd argument <a digraph> will not be\",\n           \" saved.\");\n    else\n      for i in verts do\n        IO_WriteLine(file,\n                     Concatenation(\"n \", String(i), \" \", String(labels[i])));\n      od;\n    fi;\n  fi;\n\n  IO_Close(file);\n  return IO_OK;\nend);\n\nInstallGlobalFunction(DigraphPlainTextLineEncoder,\n{delimiter1, delimiter2, offset} ->\nfunction(D)\n  local str, i, edges;\n  edges := DigraphEdges(D);\n\n  if Length(edges) = 0 then\n    return \"\";\n  fi;\n\n  str := Concatenation(String(edges[1][1] + offset), delimiter2,\n                       String(edges[1][2] + offset));\n\n  for i in [2 .. Length(edges)] do\n    Append(str, Concatenation(delimiter1, String(edges[i][1] + offset),\n                              delimiter2, String(edges[i][2] + offset)));\n  od;\n  return str;\nend);\n\nInstallGlobalFunction(WritePlainTextDigraph,\nfunction(name, D, delimiter, offset)\n  local file, edge;\n\n  if not IsString(name) then\n    ErrorNoReturn(\"the 1st argument <name> must be a string,\");\n  elif not IsString(delimiter) then\n    ErrorNoReturn(\"the 3rd argument <delimiter> must be a string,\");\n  elif not IsInt(offset) then\n    ErrorNoReturn(\"the 4th argument <offset> must be an integer,\");\n  fi;\n  file := IO_CompressedFile(UserHomeExpand(name), \"w\");\n\n  if file = fail then\n    ErrorNoReturn(\"cannot open the file given as the 1st argument <name>,\");\n  fi;\n\n  for edge in DigraphEdges(D) do\n    IO_WriteLine(file, Concatenation(String(edge[1] + offset),\n                                     delimiter,\n                                     String(edge[2] + offset)));\n  od;\n  IO_Close(file);\nend);\n\nInstallMethod(Graph6String, \"for a digraph by out-neighbours\",\n[IsDigraphByOutNeighboursRep],\nfunction(D)\n  local list, adj, n, lenlist, tablen, blist, i, j, pos, block;\n  if (IsMultiDigraph(D) or not IsSymmetricDigraph(D)\n      or DigraphHasLoops(D)) then\n    ErrorNoReturn(\"the argument <D> must be a symmetric digraph \",\n                  \"with no loops or multiple edges,\");\n  fi;\n\n  list := [];\n  adj := OutNeighbours(D);\n  n := Length(DigraphVertices(D));\n\n  # First write the number of vertices\n  lenlist := DIGRAPHS_Graph6Length(n);\n  if lenlist = fail then\n    ErrorNoReturn(\"the argument <D> must be a digraph with between 0 and \",\n                  \"68719476736 vertices,\");\n  fi;\n  Append(list, lenlist);\n\n  # Find adjacencies (non-directed)\n  tablen := n * (n - 1) / 2;\n  blist := BlistList([1 .. tablen + 6], []);\n  for i in DigraphVertices(D) do\n    for j in adj[i] do\n      # Loops not allowed\n      if j > i then\n        blist[i + (j - 2) * (j - 1) / 2] := true;\n      elif i > j then\n        blist[j + (i - 2) * (i - 1) / 2] := true;\n      fi;\n    od;\n  od;\n\n  # Read these into list, 6 bits at a time\n  pos := 0;\n  while pos < tablen do\n    block := 0;\n    for i in [1 .. 6] do\n      if blist[pos + i] then\n        block := block + 2 ^ (6 - i);\n      fi;\n    od;\n    Add(list, block);\n    pos := pos + 6;\n  od;\n\n  # Create string to return\n  return List(list, i -> CharInt(i + 63));\nend);\n\nInstallMethod(Digraph6String, \"for a digraph by out-neighbours\",\n[IsDigraphByOutNeighboursRep],\nfunction(D)\n  local list, adj, n, lenlist, tablen, blist, i, j, pos, block;\n  # NOTE: this package originally used a version of digraph6 that reads down\n  # the columns of an adjacency matrix, and appends a '+' to the start.  This\n  # has been replaced by the Nauty standard, which reads across the rows of the\n  # matrix, and appends a '&' to the start.  The old '+' format can be read by\n  # DigraphFromDigraph6String, but can no longer be written by this function.\n\n  list := [];\n  adj := OutNeighbours(D);\n  n := Length(DigraphVertices(D));\n\n  # First write the special character '&'\n  Add(list, -25);\n\n  # Now write the number of vertices\n  lenlist := DIGRAPHS_Graph6Length(n);\n  if lenlist = fail then\n    ErrorNoReturn(\"the argument <D> must be a digraph with between 0 and \",\n                  \"68719476736 vertices,\");\n  fi;\n  Append(list, lenlist);\n\n  # Find adjacencies\n  tablen := n ^ 2;\n  blist := BlistList([1 .. tablen + 6], []);\n  for i in DigraphVertices(D) do\n    for j in adj[i] do\n      blist[j + n * (i - 1)] := true;\n    od;\n  od;\n\n  # Read these into list, 6 bits at a time\n  pos := 0;\n  while pos < tablen do\n    block := 0;\n    for i in [1 .. 6] do\n      if blist[pos + i] then\n        block := block + 2 ^ (6 - i);\n      fi;\n    od;\n    Add(list, block);\n    pos := pos + 6;\n  od;\n\n  # Create string to return\n  return List(list, i -> CharInt(i + 63));\nend);\n\nInstallMethod(Sparse6String, \"for a digraph by out-neighbours\",\n[IsDigraphByOutNeighboursRep],\nfunction(D)\n  local list, n, lenlist, adj, nredges, k, blist, v, nextbit, AddBinary, i, j,\n        bitstopad, pos, block;\n  if not IsSymmetricDigraph(D) then\n    ErrorNoReturn(\"the argument <D> must be a symmetric digraph,\");\n  fi;\n\n  list := [];\n  n := Length(DigraphVertices(D));\n\n  # First write the special character ':'\n  Add(list, -5);\n\n  # Now write the number of vertices\n  lenlist := DIGRAPHS_Graph6Length(n);\n  if lenlist = fail then\n    ErrorNoReturn(\"the argument <D> must be a digraph with between 0 and \",\n                  \"68719476736 vertices,\");\n  fi;\n  Append(list, lenlist);\n\n  # Get the out-neighbours - half these edges will be discarded\n  adj := OutNeighbours(D);\n  nredges := DigraphNrEdges(D);\n\n  # k is the number of bits in a vertex label\n  if n > 1 then\n    k := Log2Int(n - 1) + 1;\n  else\n    k := 1;\n  fi;\n\n  # Add the edges one by one\n  blist := BlistList([1 .. nredges * (k + 1) / 2], []);\n  v := 0;\n  nextbit := 1;\n  AddBinary := function(blist, i)\n    local b;\n    for b in [1 .. k] do\n      blist[nextbit] := Int((i mod (2 ^ (k - b + 1))) / (2 ^ (k - b))) = 1;\n      nextbit := nextbit + 1;\n    od;\n  end;\n  for i in [1 .. Length(adj)] do\n    for j in adj[i] do\n      if i < j then\n        continue;\n      elif i = v + 1 then\n        blist[nextbit] := false;\n        nextbit := nextbit + 1;\n      elif i = v + 2 then\n        blist[nextbit] := true;\n        nextbit := nextbit + 1;\n        v := v + 1;\n      elif i > v + 2 then\n        blist[nextbit] := true;\n        nextbit := nextbit + 1;\n        AddBinary(blist, i - 1);\n        v := i - 1;\n        blist[nextbit] := false;\n        nextbit := nextbit + 1;\n      fi;\n      AddBinary(blist, j - 1);\n    od;\n  od;\n\n  # Add padding bits:\n  #  1. If (n,k) = (2,1), (4,2), (8,3) or (16,4), and vertex\n  #     n-2 has an edge but n-1 doesn't have an edge, and\n  #     there are k+1 or more bits to pad, then pad with one\n  #     0-bit and enough 1-bits to complete the multiple of 6.\n  #  2. Otherwise, pad with enough 1-bits to complete the\n  #     multiple of 6.\n\n  bitstopad := 5 - ((nextbit - 2) mod 6);\n  if ((n = 2 and k = 1) or\n      (n = 4 and k = 2) or\n      (n = 8 and k = 3) or\n      (n = 16 and k = 4)) and\n      (v = n - 2) and\n      (bitstopad > k) then\n    blist[nextbit] := false;\n    bitstopad := bitstopad - 1;\n  fi;\n  for i in [1 .. bitstopad] do\n    Add(blist, true);\n  od;\n\n  # Read blist into list, 6 bits at a time\n  pos := 0;\n  while pos < Length(blist) do\n    block := 0;\n    for i in [1 .. 6] do\n      if blist[pos + i] then\n        block := block + 2 ^ (6 - i);\n      fi;\n    od;\n    Add(list, block);\n    pos := pos + 6;\n  od;\n\n  # Create string to return\n  return List(list, i -> CharInt(i + 63));\nend);\n\nInstallMethod(DiSparse6String, \"for a digraph by out-neighbours\",\n[IsDigraphByOutNeighboursRep],\nfunction(D)\n  local list, n, lenlist, adj, source_i, range_i, source_d, range_d, len1,\n  len2, sort_d, perm, sort_i, k, blist, v, nextbit, AddBinary, bitstopad,\n  pos, block, i, j;\n\n  list := [];\n  n := Length(DigraphVertices(D));\n\n  # First write the special character '.'\n  list[1] := -17;\n\n  # Now write the number of vertices\n  lenlist := DIGRAPHS_Graph6Length(n);\n  if lenlist = fail then\n    ErrorNoReturn(\"the argument <D> must be a digraph with between 0 and \",\n                  \"68719476736 vertices,\");\n  fi;\n  Append(list, lenlist);\n\n  # Separate edges into increasing and decreasing\n  adj := OutNeighbours(D);\n  source_i := [];\n  range_i := [];\n  source_d := [];\n  range_d := [];\n  len1 := 1;\n  len2 := 1;\n  for i in DigraphVertices(D) do\n    for j in adj[i] do\n      if i <= j then\n        source_i[len1] := i - 1;\n        range_i[len1] := j - 1;\n        len1 := len1 + 1;\n      else\n        source_d[len2] := i - 1;\n        range_d[len2] := j - 1;\n        len2 := len2 + 1;\n      fi;\n    od;\n  od;\n\n  # Sort decreasing edges according to source and then range\n  sort_d := function(i, j)\n    if source_d[i] < source_d[j]\n        or (source_d[i] = source_d[j] and range_d[i] <= range_d[j]) then\n      return true;\n    else\n      return false;\n     fi;\n  end;\n\n  perm := Sortex([1 .. Length(source_d)], sort_d);\n  source_d := Permuted(source_d, perm);\n  range_d := Permuted(range_d, perm);\n\n  # Sort increasing edges according to range and then source\n  sort_i := function(i, j)\n    if range_i[i] < range_i[j]\n        or (range_i[i] = range_i[j] and source_i[i] <= source_i[j]) then\n      return true;\n    else\n      return false;\n     fi;\n  end;\n\n  perm := Sortex([1 .. Length(range_i)], sort_i);\n  source_i := Permuted(source_i, perm);\n  range_i := Permuted(range_i, perm);\n\n  # k is the number of bits in a vertex label we also want to be able to\n  # encode n as a separation symbol between increasing and decreasing edges\n  if n > 1 then\n    k := LogInt(n, 2) + 1;\n  else\n    k := 1;\n  fi;\n\n  # Add the edges one by one\n  blist := [];\n  v := 0;\n  nextbit := 1;\n  AddBinary := function(blist, i)\n    local b;\n    for b in [1 .. k] do\n      blist[nextbit] := Int((i mod (2 ^ (k - b + 1))) / (2 ^ (k - b))) = 1;\n      nextbit := nextbit + 1;\n    od;\n  end;\n  for i in [1 .. Length(source_d)] do\n    if source_d[i] = v then\n      blist[nextbit] := false;\n      nextbit := nextbit + 1;\n    elif source_d[i] = v + 1 then\n      blist[nextbit] := true;\n      nextbit := nextbit + 1;\n      v := v + 1;\n    elif source_d[i] > v + 1 then  # is this check necessary\n      blist[nextbit] := true;\n      nextbit := nextbit + 1;\n      AddBinary(blist, source_d[i]);\n      v := source_d[i];\n      blist[nextbit] := false;\n      nextbit := nextbit + 1;\n    fi;\n    AddBinary(blist, range_d[i]);\n  od;\n\n  # Add a separation symbol (1 n).\n  blist[nextbit] := true;\n  nextbit := nextbit + 1;\n  AddBinary(blist, n);\n\n  # Repeat everything for increasing edges\n  v := 0;\n  for i in [1 .. Length(range_i)] do\n    if range_i[i] = v then\n      blist[nextbit] := false;\n      nextbit := nextbit + 1;\n    elif range_i[i] = v + 1 then\n      blist[nextbit] := true;\n      nextbit := nextbit + 1;\n      v := v + 1;\n    elif range_i[i] > v + 1 then  # is this check necessary\n      blist[nextbit] := true;\n      nextbit := nextbit + 1;\n      AddBinary(blist, range_i[i]);\n      v := range_i[i];\n      blist[nextbit] := false;\n      nextbit := nextbit + 1;\n    fi;\n    AddBinary(blist, source_i[i]);\n  od;\n\n  # Add padding bits:\n  bitstopad := 5 - ((nextbit - 2) mod 6);\n  for i in [1 .. bitstopad] do\n    Add(blist, true);\n  od;\n\n  # Read blist into list, 6 bits at a time\n  pos := 0;\n  while pos < Length(blist) do\n    block := 0;\n    for i in [1 .. 6] do\n      if blist[pos + i] then\n        block := block + 2 ^ (6 - i);\n      fi;\n    od;\n    Add(list, block);\n    pos := pos + 6;\n  od;\n\n  # Create string to return\n  return List(list, i -> CharInt(i + 63));\nend);\n\nInstallMethod(PlainTextString, \"for a digraph\", [IsDigraph],\nD -> DigraphPlainTextLineEncoder(\"  \", \" \", -1)(D));\n", "meta": {"hexsha": "43417b5cf9e6b5c2e72e9c443c56605bca2b465c", "size": 50121, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "data/github.com/gap-packages/Digraphs/d81d4e1c1e5869148d6cff09f4b777f13924eaae/gap/io.gi", "max_stars_repo_name": "ajnavarro/language-dataset", "max_stars_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 9, "max_stars_repo_stars_event_min_datetime": "2018-08-07T11:54:33.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-11T09:48:45.000Z", "max_issues_repo_path": "data/github.com/gap-packages/Digraphs/d81d4e1c1e5869148d6cff09f4b777f13924eaae/gap/io.gi", "max_issues_repo_name": "ajnavarro/language-dataset", "max_issues_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 91, "max_issues_repo_issues_event_min_datetime": "2019-11-11T15:41:26.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-21T04:17:18.000Z", "max_forks_repo_path": "data/github.com/gap-packages/Digraphs/d81d4e1c1e5869148d6cff09f4b777f13924eaae/gap/io.gi", "max_forks_repo_name": "ajnavarro/language-dataset", "max_forks_repo_head_hexsha": "34e2980af98ff2ded500619edce3e0907a6e9050", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-11-13T12:44:41.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-06T19:34:26.000Z", "avg_line_length": 26.8026737968, "max_line_length": 81, "alphanum_fraction": 0.5760060653, "num_tokens": 14931, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4339814794452761, "lm_q2_score": 0.044018651273822144, "lm_q1q2_score": 0.01910327940299902}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(RollingPointers, rec(\n    __call__ := (self, code, opts) >> CopyFields(self, rec(opts := opts)).apply(code),\n\n    _linearPatterns := Set([[], [mul]]),\n\n    _contains    := (v, U) -> CollectNR(U, @.cond(u->u=v))<>[],\n    _linear_exp  := (self, e, v) >> Length(Collect(e, @@.cond((x, cx)-> x=v and (List(cx.parents, ObjId) in self._linearPatterns))))=1,\n\n    _basePtr  := (summands) -> let( p := Filtered(summands, e->IsPtrT(e.t) or IsArrayT(e.t)), Checked(Length(p)=1, p[1]) ),\n\n    # _collectPtrs(<l>) -- <l> loop \n    _collectPtrs := meth(self, l)\n        local free, vptr, pattern, ptradds, ptrs, e, p, d, id, clusters, loopinv, i;\n\n        # Collecting innermost ponter arithmetic additions.\n        # Index computation expression expected to be in normalized form.\n        pattern := @@(1, [add], (x, cx) -> IsPtrT(x.t) and (Filtered(cx.parents, IsLoop)=[] or Last(Filtered(cx.parents, IsLoop))=l));\n         \n        ptradds := Collect(l, pattern);\n        ptradds := Filtered(ptradds, x -> Collect(x.args, pattern)=[]);\n        \n        ptrs := tab();\n\n        free := Set(l.free() :: [l.var]);\n        # extracting base pointer and common subexpression with this pointer.\n        # relying on expression print method to get string id. \n        for e in ptradds do\n            p  := self._basePtr(e.args);\n            # we may have buffer defined in the loop referenced by loop variable\n            vptr := Collect(p, var);\n            if vptr=[] or Intersection(vptr, free)<>[] then\n                id := StringPrint(p);\n                if IsBound(ptrs.(id)) then\n                    ptrs.(id).cmn := Checked(ptrs.(id).ptr = p, Intersection(ptrs.(id).cmn, Set(e.args)));\n                else\n                    ptrs.(id) := rec( ptr := p, cmn := Set(e.args), offs := [] );\n                fi;\n            fi;\n        od;\n        # make sure common expression doesn't have local loop variables\n        for id in UserNSFields(ptrs) do\n            ptrs.(id).cmn := Filtered(ptrs.(id).cmn, a -> IsSubset(free, Collect(a, var)));\n        od;\n        # preparing offsets list for each base expression.\n        #\n        # offset record: rec( \n        #    ref  := <full original expression>,\n        #    tail := <offset from common base expression, as summands list> \n        # )\n        for e in ptradds do\n            id := StringPrint(self._basePtr(e.args));\n            if IsBound(ptrs.(id)) then\n                d := Difference(e.args, ptrs.(id).cmn);\n                Add(ptrs.(id).offs, rec( ref := e, tail := d ));\n            fi;\n        od;\n\n        # when loop variable is not in common subexpression 'cmn' but still in 'tail' \n        # try to split pointer so that variable goes to 'cmn' in each resulting pointer\n        for id in UserNSFields(ptrs) do\n            p := ptrs.(id);\n            if not self._contains(l.var, p.cmn) then\n                [ clusters, loopinv ] := SplitBy(ConcatList(p.offs, o -> o.tail), s -> self._linear_exp(s, l.var));\n                if ForAll(loopinv, s -> not self._contains(l.var, s)) then\n                    clusters := Set(clusters);\n                    # NOTE: hardcoded max number of resulting rolling pointers\n                    if Length(clusters)<=4 then\n                        for i in [1..Length(clusters)] do\n                            ptrs.(id :: \"_\" :: StringInt(i)) := rec(\n                                ptr  := p.ptr, \n                                cmn  := Set( p.cmn :: [clusters[i]] ),\n                                # each original <offs> can contain only one expression from <clusters>\n                                # because previousely summands were grouped by loop variables\n                                offs := List(Filtered(p.offs, o -> clusters[i] in o.tail), \n                                          o -> rec( ref := o.ref, tail := RemoveList(o.tail, clusters[i]) )),\n                            );\n                        od;\n                        Unbind(ptrs.(id));\n                    fi;\n                fi;\n            fi;\n        od;\n\n        return ptrs;\n    end,\n\n    _offsetsInit := function(vars, init, coeff)\n        vars.linv := vars.linv :: vars.offs;\n        init.linv := init.linv :: List( [1..Length(coeff)], i -> assign(vars.offs[i], vars.strides*coeff[i]));\n    end,\n\n    # cost is number of rolling pointers + their stride + number of offsets from rolling pointers \n    _offsetsCost := (self, k) >> Cond(Length(k.rp_coeff)>4, 100000, self.rpCost*Length(k.rp_coeff) + 1 + self.coeffCost*Length(k.coeff)),\n   \n    # default cost of rolling pointer and coefficient\n    rpCost    := 3,\n    coeffCost := 1,\n\n    # includeValues\n    includeValues := false,\n\n    \n    _strideGrp := s -> CondPat( s, @(1, Value),       V(1), \n                                   [mul, Value, @],   s.args[2],\n                                # else\n                                   s ),\n    _strideVal := s -> CondPat( s, @(1, Value),       s.v,   \n                                   [mul, Value, @],   s.args[1].v, \n                                # else\n                                   1 ),\n\n    _getStrides := meth(self, l, offs)\n        local s, strides, offsets, free;\n\n        if self.includeValues then\n            s := ConcatList(offs, e -> e.tail);\n        else\n            s := ConcatList(offs, e -> Filtered(e.tail, x -> not (x _is Value)));\n        fi;\n        # ignore expressions with loop-local variables\n        free := Set(l.free() :: [l.var]);\n        s := Filtered(s, a -> IsSubset(free, Collect(a, var)));\n        \n        # get strides vector\n        strides := Filtered(GroupList(s, self._strideGrp), e -> Length(e[2])>1);\n        if strides<>[] then\n            strides := TransposedMat(strides)[1];\n        fi;\n\n        # get stride coefficients for each offset + leftover expression\n        offsets := TransposedMat(List(offs, function(e)\n            local c, leftovers, x, p;\n            leftovers := [];\n            c := Replicate(Length(strides), 0);\n            for x in e.tail do\n                p := Position(strides, self._strideGrp(x));\n                if p<>false then\n                    c[p] := self._strideVal(x);\n                else\n                    Add(leftovers, x);\n                fi;\n            od;\n            return [c, rec(ref := e.ref, leftovers := leftovers)];\n        end));\n\n        return [strides, offsets[1], offsets[2]];\n    end,\n\n    # reduce <coeff> offsets list to coefficients relative to <k> \"evenly\" spaced rolling pointers\n    _k_func := function(k, coeff)\n        local n, rp, offs, i;\n        n     := Length(coeff);\n        rp    := List([0..k-1], i -> QuoInt(n*i, k)+1) :: [n+1];\n        offs := [];\n        for i in [1..k] do\n            offs := UnionSet(offs, List(coeff{[rp[i]+1..rp[i+1]-1]}, c -> c - coeff[rp[i]]));\n        od;\n        return rec(\n            rp_coeff := List(DropLast(rp, 1), i -> coeff[i]), \n            coeff    := offs,\n        );\n    end,\n\n    # finds best split [<rolling ptrs>, <offsets>] for <coeff> offsets list.\n    # returns record:\n    #    .rp_coeff - list of coefficients for rolling pointers\n    #    .coeff    - reduced <coeff> list so that every original <coeff>\n    #                can be expressed as some <rp_coeff> plus some <coeff>\n    #                from this list.\n    #\n    # Brute force, _offsetsCost can be redefined\n\n    _bestSplit := meth(self, coeff)\n        local scoeff, min_k, min_cost, i, j, k, o, cost;\n        scoeff := Set(coeff);\n        min_k := self._k_func(1, scoeff);\n        min_cost := self._offsetsCost(min_k);\n        for i in [1..Length(scoeff[1])] do\n            o := Sort(ShallowCopy(scoeff), (a,b) -> Cond(a[i]=b[i], a<b, a[i]<b[i]));\n            for j in [1..Length(Set(List(o, e -> e[i])))] do\n                k := self._k_func(j, o);\n                cost := self._offsetsCost(k);\n                if cost < min_cost then\n                    min_k := k;\n                    min_cost := cost;\n                fi;\n            od;\n        od;\n        return min_k;\n    end,\n\n    \n    # find indices in <offsets> of a given <offs> (not including crossed-out in <refs>) \n    _offsetsIndices := (offsets, offs, refs) -> Filtered([1..Length(offsets)], i -> offsets[i]=offs and refs[i].ref<>false),\n\n    # add mapping pair to <map> and cross-out index.\n    _mapRecord := function(map, rem, summands)\n        Add(map, rec(\n            ref := rem.ref,\n            subst := ApplyFunc(add, summands :: rem.leftovers)\n        ));\n        rem.ref := false;\n    end,\n\n    # split pointer expressions into rolling pointers + offsets\n    _splitPtr := meth(self, ptr, loop, vars, init, incr, map)\n        local strides, offsets_coeff, offsets_rem, cfg, i, j, k, ld, li, p;\n\n        [strides, offsets_coeff, offsets_rem] := self._getStrides(loop, ptr.offs);\n        \n        cfg := self._bestSplit(offsets_coeff);\n\n        # temporary variables lists.\n        # Doing CSE is smarter as we may have same stride and offset computation expressions\n        # for other pointers. I don't have this situation in DFTs though.\n        vars.rp      := List(cfg.rp_coeff, e -> var.fresh_t(\"rp\",   Cond(IsArrayT(ptr.ptr.t), ptr.ptr.t.toPtrType(), ptr.ptr.t)));\n        vars.offs    := List(cfg.coeff,    e -> var.fresh_t(\"offs\", TInt));\n        vars.strides := List(strides,      e -> var.fresh_t(\"s\",    TInt));\n        vars.inc     := var.fresh_t(\"inc\", TInt);\n\n        # vars.offs is not added here as they might be declared in or outside of the loop\n        # this is done by initOffsets method later\n        vars.linv    := vars.linv :: vars.rp :: vars.strides :: [vars.inc];\n\n        # preparing mapping from original pointer expressions to rolling pointers expressions\n        for i in [1..Length(cfg.rp_coeff)] do\n            # for each expression which correspond to this rolling pointer\n            for k in self._offsetsIndices(offsets_coeff, cfg.rp_coeff[i], offsets_rem) do\n                self._mapRecord(map, offsets_rem[k], [vars.rp[i]]);\n            od;\n\n            for j in [1..Length(cfg.coeff)] do\n                # for each expression which correspond to this offset from current rolling pointer\n                for k in self._offsetsIndices(offsets_coeff, cfg.rp_coeff[i]+cfg.coeff[j], offsets_rem) do\n                    self._mapRecord(map, offsets_rem[k], [vars.rp[i], vars.offs[j]]);\n                od;\n            od;\n        od;\n\n        Checked(ForAll(offsets_rem, e -> e.ref=false), \"paranoid\");\n       \n        # <ld> loop var dependent summands, <li> - loop invariant summands\n        [ld, li] := SplitBy(ptr.cmn, e -> self._contains(loop.var, e));\n\n        # initialization code\n        init.strides := List([1..Length(strides)], i -> assign(vars.strides[i], strides[i]));\n        init.rp      := List([1..Length(cfg.rp_coeff)], i -> assign(vars.rp[i], SReduce(ApplyFunc(add, li :: SubstVars( Copy(ld), rec( (loop.var.id) := V(0))) :: Cond(vars.strides<>[], [vars.strides*cfg.rp_coeff[i]], [])), self.opts)));\n        init.inc     := assign(vars.inc, SReduce(ApplyFunc(add, SubstVars( Copy(ld), rec( (loop.var.id) := V(1)))), self.opts));\n\n        init.linv    := init.linv :: init.strides :: init.rp :: [init.inc];\n\n        for p in vars.rp do\n            Add(incr, assign(p, add(p, vars.inc)));\n        od;\n        \n        self._offsetsInit(vars, init, cfg.coeff);\n    end,\n        \n\n    _processPointer := meth(self, ptr, loop, vars, init, incr, map)\n        local ld;\n        # process pointers with separable base and loop dependent linear offset\n        ld := Filtered(ptr.cmn, e -> self._contains(loop.var, e));\n        if ld<>[] \n           and ForAll(ld, s -> self._linear_exp(s, loop.var))\n           and ForAll(ptr.offs, e -> not self._contains(loop.var, e.tail)) \n        then\n            self._splitPtr(ptr, loop, vars, init, incr, map);\n        fi;\n    end,\n\n    inject := (self, code, vars, prologue, epilogue) >> Cond(\n         code _is decl,  decl(code.vars, self.inject(code.cmd, vars, prologue, epilogue)),\n         code _is data,  data(code.var, code.value, self.inject(code.cmd, vars, prologue, epilogue)),\n         # else\n             decl(vars, chain(prologue, code, epilogue))),\n\n    transformLoop := meth(self, l)\n        local new_loop, ptrs, field, vars, init, incr, map, idx, oid, cmd, cp, subst;\n\n        # collect references grouped by base pointers and extracted common summands\n        ptrs := self._collectPtrs(l);\n\n        # variables updated by _processPointer method\n        #   vars.linv - loop invariant (outer) variables list\n        #   vars.loop - inner variables list (declared in the loop body)\n        #\n        # initialization:\n        #   init.linv - outer commands\n        #   init.loop - inner commands\n        #\n        # incr - list of commands that increment pointers (loop body footer)\n        # map - list of mapping records:\n        #   map[i].ref - expression to replace\n        #   map[i].subst \n        # \n        vars := rec( linv := [], loop := [] );\n        init := rec( linv := [], loop := [] );\n        incr := [];\n        map  := [];\n\n        for field in UserNSFields(ptrs) do\n            self._processPointer( ptrs.(field), l, vars, init, incr, map );\n        od;\n\n        if map<>[] then\n            # copy propagation of simple loop invariant expressions\n            cp  := tab();\n            init.linv := Filtered(init.linv, function(e) local prop;\n                    prop := CondPat( e,\n                              [assign, var, Value], true,\n                              [assign, var, param], true,\n                              false);\n                    if prop then\n                        cp.(e.loc.id) := e.exp;\n                    fi;\n                    return not prop;\n                end);\n            vars.linv := Filtered(vars.linv, e -> not IsBound(cp.(e.id)));\n\n            subst := (c) -> SubstVars(c, cp);\n\n            idx := Set(List(map, e -> e.ref));\n            oid := Set(List(map, e -> ObjId(e.ref)));\n            cmd := SubstTopDownNR_named(l.cmd, @(1, oid, x -> x in idx),\n                    e -> subst(map[PositionProperty( map, x -> x.ref=e )].subst), \"toRollingPointer\");\n            new_loop := decl( vars.linv, chain( subst(init.linv) :: [\n                                loop( l.var, l.range, self.inject(cmd, subst(vars.loop), subst(init.loop), subst(incr)))\n                        ]));\n        else\n            new_loop := l;\n        fi;\n\n        return new_loop;\n    end,\n\n    \n    apply := meth(self, code)\n\n        # normalize linear expressions, group summands and pull out loop variables\n        code := SubstTopDownNR_named(code, @(1, self.opts.simpIndicesInside), e -> \n                   SubstBottomUp(GroupSummandsExp(ESReduce(e, self.opts)), add, a->__groupSummandsVar(a.args)), \"rollingPtrNormalize\");\n\n        # transform loops, innermost first\n        code := SubstBottomUp(code, @(1, [loop, loopn]), e -> self.transformLoop(e));\n\n        return code;\n    end,\n));\n\n\n\n", "meta": {"hexsha": "12f636973d2f5a0991cc13792638f5c2aec10b8d", "size": 15023, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/rollingptr.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/rollingptr.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/rollingptr.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.9636871508, "max_line_length": 236, "alphanum_fraction": 0.5223324236, "num_tokens": 3779, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4726834766204329, "lm_q2_score": 0.04023794636414335, "lm_q1q2_score": 0.019019812379469786}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n########################################################################\n#   vector constructs\n########################################################################\n\nIsSIMD_ISA := s -> IsRec(s) and IsBound(s.isSIMD_ISA) and s.isSIMD_ISA;\nIsISA      := x -> IsRec(x) and IsBound(x.isISA) and x.isISA;\n\nClass(AVecReg, AGenericTag, rec(\n    isReg := true,\n    isRegCx := false,\n    isVec := true,\n    updateParams := meth(self)\n        Checked(IsSIMD_ISA(self.params[1]));\n        Checked(Length(self.params)=1);\n        self.v := self.params[1].v;\n        self.isa := self.params[1];\n    end,\n    container := (self, spl) >> paradigms.vector.sigmaspl.VContainer(spl, self.isa)\n));\n\n\nClass(AVecRegCx, AVecReg, rec(\n    updateParams := meth(self)\n        Checked(IsSIMD_ISA(self.params[1]));\n        Checked(Length(self.params)=1);\n        self.v := self.params[1].v/2;\n        self.isa := self.params[1];\n    end,\n    container := (self, spl) >> paradigms.vector.sigmaspl.VContainer(spl, self.isa.cplx()),\n    isRegCx := true\n));\n\n# AMultiVec - list of ISAs, must be list of AVecReg tags in the future\n#\n\nClass(AMultiVec, AGenericTag, rec(\n    isVec := true,\n    updateParams := meth(self)\n        Checked(ForAll(self.params, IsSIMD_ISA));\n        Checked(Length(self.params)>=1);\n    end,\n));\n\nClass(AISA, AGenericTag, rec(\n    updateParams := meth(self)\n        Checked(IsISA(self.params[1]));\n        Checked(Length(self.params)=1);\n        self.isa := self.params[1];\n    end,\n    # it's not a vectorized code, maybe defferent kind of containers?\n    # containers do not go along well with OL though\n    container := (self, spl) >> paradigms.vector.sigmaspl.VContainer(spl, self.isa)\n));\n\n", "meta": {"hexsha": "5e18e713391e8478ba5d84728d35449c6d26c4e1", "size": 1776, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/tag.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/tag.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/tag.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.6, "max_line_length": 91, "alphanum_fraction": 0.579954955, "num_tokens": 472, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.5, "lm_q2_score": 0.03789242309851158, "lm_q1q2_score": 0.01894621154925579}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F Replaces RemoteData inside a BB with RemoteDataUnrolled\nUnrollRemoteData := function(e, cx)\n   local extvars, loopvar, i, unrolledLoopVars, BBLoopVars, unrolledRange, newobj, newvar, newFofs, newofs, newfdataofs, f;\n\n   # Compute list of loopvars that will be unrolled (ones inside BB)\n   # These are all loops under the BB\n   i := Length(cx.parents);\n   unrolledLoopVars := [];\n   unrolledRange := 1;\n   while (ObjId(cx.parents[i])<>MultiBufISum and ObjId(cx.parents[i]) <> MultiBufISumFinal) do\n      i := i-1;\n      if ObjId(cx.parents[i])=ISum then\n         unrolledLoopVars := unrolledLoopVars :: [cx.parents[i].var];\n      fi;\n   od;\n\n   #Error(\"BP\");\n\n  # Take intersection because twiddle might not involve all loops under BB.\n  BBLoopVars := Intersection(e.ofs.free(), unrolledLoopVars);\n  unrolledRange := ListProduct(List(unrolledLoopVars, i->i.range));\n  unrolledRange := When(unrolledRange=0, 1, unrolledRange);\n\n  #NOTE: why was this an issue?\n  #if BBLoopVars = [] then\n  #   PrintLine(\"------------------> Going ahead with no Isum inside BB\");\n  #fi;\n\n  # a) return RemoteDataUnrolled\n  # b) with FDataOfs_mbuf that has a new range\n\n  #Error(\"BP\");\n\n  newobj := e.child(1);    # This is the VRCDiag or similar obj\n\n\n  # Change the FDataOfs_mbuf to include a different length and offset\n\n\n  # Offset for FDataOfs_mbuf is RemoteData.ofs, with freevars that are not inside the BB set to zero.\n  newFofs := Copy(e.ofs);\n\n  extvars := newFofs.free();\n  SubtractSet(extvars, BBLoopVars);\n\n  for loopvar in extvars do\n     SubstVars(newFofs, rec( (loopvar.id) := 0));\n  od;\n\n  newobj := SubstTopDown(newobj, FDataOfs_mbuf, f->FDataOfs_mbuf(f.var, f.len*unrolledRange, newFofs));\n\n  e.var.t.size    := e.var.t.size    * unrolledRange;\n  e.altbuf.t.size := e.altbuf.t.size * unrolledRange;\n\n  # Must manually set unrolled loopvars to zero here because this will go to\n  # init, and won't be taken care of by unrolling\n  newofs := e.ofs;\n  for loopvar in BBLoopVars do\n     SubstVars(newofs, rec( (loopvar.id) := V(0) ));\n  od;\n\n  return(RemoteDataUnrolled(e.var, e.altbuf, e.value, e.ofs, newobj));\nend;\n\n\nClass(MBufCodegen, DistCodegen, rec(\n\n    RemoteDataInit := meth(self, o, y, x, opts)\n    #-----------------------------------------------------------------------------\n        local r;\n        r := Collect(o, RemoteDataUnrolled);\n        # NOTE: handle multiple RemoteDataUnrolleds here.\n\n        if Length(r) > 1 then\n           Error(\"ERROR: Multi RemoteDataInit case NOT implemented!\");\n        fi;\n        r := r[1];\n        return(chain(\n          self( RemoteDataNoBody(r.var, r.value, r.ofs, r.child(1)), y, x, opts ),\n          self(o.child(1), y, x, opts)\n        ));\n    end,\n\n    # This is called only from the BB body. So codegen only o.child(1)\n    RemoteDataUnrolled := (self, o, y, x, opts) >> self( o.child(1), y, x, opts ),\n    #-----------------------------------------------------------------------------\n\n    # This is called in situations where there is no unrolled code.\n    RemoteDataNoBody := meth(self, o, y, x, opts)\n    #-----------------------------------------------------------------------------\n\n      local pkSizeInBytes, dmaCommand;\n\n      dmaCommand := var(\"GATHMEM_DIAG\");\n      pkSizeInBytes := o.child(1).element.len * opts.vector.vlen * (opts.vector.isa.bits/8);\n\n      if pkSizeInBytes > 16384 then\n         if pkSizeInBytes = 32768 then\n            dmaCommand := var(\"GATHMEM_DIAG_32K\");\n         elif pkSizeInBytes = 65536 then\n            dmaCommand := var(\"GATHMEM_DIAG_64K\");\n         else\n           Error(\"Too large a packet size for getting twiddles\");\n         fi;\n      fi;\n     return(chain(\n       call(dmaCommand,\n       o.altbuf.id,    # Destination base address\n       0,              # Destination offset\n       \"spe_info.\"::o.value.id,     # Source base address\n       o.ofs*opts.vector.vlen,       # Source offset\n       o.child(1).element.len * opts.vector.vlen # Packet size in elements\n       )\n\n       # Only if \n\n       #call(var(\"spu_writech\"),\n       #\"MFC_WrTagMask\",\n       #\"1 << 3\"),\n       #\n       #call(var(\"spu_mfcstat\"),\n       #\"MFC_TAG_UPDATE_ALL\"\n       #)\n     ));\n    end,\n\n\n    # # These should've gotten converted to RemoteDataUnrolled and RemoteDataInit\n    # RemoteData := meth(self, o, y, x, opts)\n    #     Error(\"# These should've gotten converted to RemoteDataUnrolled and RemoteDataInit\");\n    # end,\n\n\n    # These should've gotten converted to RemoteDataUnrolled and RemoteDataInit\n    # But during DP, these might not always be contained in a MultiBufISum. In\n    # this case, we should ideally add a new MultiBufISum. Here's a hack instead:\n    #RemoteData := (self, o, y, x, opts) >> self(o.child(1), y, x, opts),\n    RemoteData := (self, o, y, x, opts) >> skip(),\n\n#-----------------------------------------------------------------------------\n    Formula := meth(self, o, y, x, opts)\n#-----------------------------------------------------------------------------\n#NOTE: Formula needs major cleanup Tue 31 Mar 2009 12:58:40 AM EDT\n        local icode, datas, datas_ppe, prog, params, sub, initsub, initsub_ppe, io, e, d;\n\n        [x, y] := self.initXY(x, y, opts);\n\n        o :=  Process_fPrecompute(o, opts);\n\n        o := o.child(1);\n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n\n\n        SubstTopDown(o, @@(1, VRCDiag,\n            (e,cx)->(ObjId(e.element)=FDataOfs\n                     and e.element.var.t.size * opts.vector.vlen >= opts.maxSPETwiddles\n                     #and IsBound(cx.MultiBufISum)\n                     #and IsBound(cx.BB)\n                     )\n            ),\n          e->let(v := @@(1).val,\n                 f     := v.element,\n                 dmbuf     := var.fresh_t(\"Tmbuf\",  TArray(f.var.t.t, f.len)),\n                 dmbuf_alt := var.fresh_t(\"TmbufAlt\", TArray(f.var.t.t, f.len)),\n                 RemoteData(dmbuf, dmbuf_alt, f.var, f.ofs, VRCDiag(FDataOfs_mbuf(dmbuf, f.len, 0), v.v))\n              )\n        );\n\n\n        # Replace FDataOfs that won't fit inside an SPE with FDataOfs_mbuf\n        #SubstTopDown(o, @@(1, FDataOfs,\n        #    (e,cx)->(e.var.t.size*opts.vector.vlen >= opts.maxSPETwiddles\n        #             #and IsBound(cx.MultiBufISum)\n        #             #and IsBound(cx.BB)\n        #             )\n        #    ),\n        #e->let(f:=@@(1).val, FDataOfs_mbuf(f.rChildren()[1], f.rChildren()[2], f.rChildren()[3]))\n        #);\n\n        datas := Collect(o, FDataOfs);\n\n        datas_ppe := Collect(o, RemoteData);\n\n        #datas_ppe := [];\n        #for d in datas do\n        #   if d.var.t.size * opts.vector.vlen >= opts.maxSPETwiddles then\n        #      datas_ppe := datas_ppe :: [d];\n        #      datas := RemoveList(datas, d);\n        #   fi;\n        #od;\n\n        # Replace RemoteData with RemoteDataUnroll where necessary\n        #NOTE: Checking for context is not enough: must check for length\n        #SubstTopDown(o, @@(1, RemoteData, (e,cx)->IsBound(cx.BB)), UnrollRemoteData);\n\n\n        #SubstTopDown(o, @@(1, RemoteData, (e,cx)->(IsBound(cx.MultiBufISum) or IsBound(cx.MultiBufISumFinal))),\n        #    UnrollRemoteData);\n\n        SubstTopDown(o, @@(1, RemoteData, (e,cx)->IsBound(cx.MultiBufISum) or IsBound(cx.MultiBufISumFinal)),\n            UnrollRemoteData);\n\n        # Enclose BBs within a RemoteDataInit if needed (if the BB contains one or more\n        # RemoteDataUnrolled's)\n        #SubstTopDown(o, @@(1, MultiBufISum, (e,cx)->(\n        #    Length(Collect(e, RemoteDataUnrolled))>=1\n        #    and (not IsBound(cx.RemoteDataInit) or Length(cx.RemoteDataInit) = 0)\n        #  )),\n        #  f->RemoteDataInit(f)\n        #);\n\n\n        #return(o);\n\n        o := BlockSumsOpts(o, opts);\n        icode := self(o, y, x, opts);\n        icode := ESReduce(icode, opts);\n        icode := RemoveAssignAcc(icode);\n        icode := BlockUnroll(icode, opts);\n        # icode := PowerOpt(icode);\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        initsub_ppe := Cond(IsBound(opts.subName), Concat(\"init_ppe_\", opts.subName), \"init_ppe\");\n        icode := func(TVoid, sub, Concatenation(io, params), icode);\n\n        #Error(\"BP\");\n\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            prog := program(\n                #decl(List(datas, x->x.var)::List(datas_ppe, x->x.var),\n                decl(List(datas, x->x.var),\n                    chain(\n                        func(    TVoid, initsub,     params, chain(List(datas,     x -> SReduce(x.var.init, opts)))),\n                        func_ppe(TVoid, initsub_ppe, params, decl(List(datas_ppe, x->x.value), chain(List(datas_ppe, x -> SReduce(x.value.init, opts)))) ),\n                        icode\n                    )));\n        else\n            prog := program( func(TVoid, initsub, params, chain()), icode);\n        fi;\n\n        # FF: I really don't know why suddenly AVX_8x32f requires me to do that !!\n        if IsBound(opts.vector.isa.fixProblems) then prog := opts.vector.isa.fixProblems(prog, opts); fi;\n\n        prog.dimensions := o.dims();\n\n        # Perform software pipelining\n        # prog := MarkPreds(prog);\n        # prog := MarkDefUse(prog);\n        # SubstTopDown(prog, @(1, loop, e->(Length(Collect(e, loop))=1 and Length(e.range) >= 4)),\n        #     e->let(l := @(1).val, loop_sw(l.rChildren()[1], l.rChildren()[2], l.rChildren()[3]) )\n        # );\n        # SubstTopDown(prog, loop_sw, e->SoftwarePipeline(e));\n\n        return prog;\n    end,\n\n\n\n    GathMem := meth(self, o, y, x, opts)\n        #Gath: loop(i, o.func.domain(), assign(nth(y,i), nth(x, func.at(i))));\n        #DO_DMA(Xalt, spe_info.X, IDEAL_DMA_SIZE_BYTES, MFC_GET_CMD); // Xalt = spe_info.X\n        local func, pkSize, i, numPkts, pkSizeInBytes, dmaCommand;\n        func        := o.func.lambda();\n        pkSize      := o.pkSize;\n        numPkts     := o.func.domain();\n        #i          := 0;\n        i           := Ind(numPkts);\n\n\n        dmaCommand := var(\"GATHMEM_GET\");\n        pkSizeInBytes := o.pkSize * (opts.vector.isa.bits/8);\n\n        #NOTE: 16384 is the largest packet we can send on the Cell\n        # If we're not using tables, then we can go higher using backend macros\n        if (pkSizeInBytes > 16384) then\n          # NOTE: How to handle cases where pkSize is greater than 16k?\n          if (pkSizeInBytes = 32768) then\n             dmaCommand := var(\"GATHMEM_GET_32K\");\n          elif (pkSizeInBytes = 65536) then\n             dmaCommand := var(\"GATHMEM_GET_64K\");\n          elif (pkSizeInBytes = 131072) then\n             dmaCommand := var(\"GATHMEM_GET_128K\");\n          else\n          Error(\"Selected packet size - \", o.pkSize, \" - is higher than the Cell's max allowed (using macros).\");\n          fi;\n       fi;\n\n        # NOTE: remove this after testing\n        if (numPkts <= 16 ) then\n            #16 is the size of the SPU's DMA Command queue. Exceeding this\n            #means taking a huge performance loss because in effect, DMAs won't\n            #be done in the background.\n            # NOTE: this (16) is hardcoded for the implementation than for the ISA\n            return(loop(i, numPkts, call(\n                   dmaCommand,\n                   #y,\n                   var(Concatenation(y.id, \"alt\")),\n                   i*pkSize,\n                   var(Concatenation(\"spe_info.\", y.id)),\n                   func.at(i)*pkSize,\n                   pkSize\n                )));\n        fi;\n\n        if (numPkts > 2048) then\n          Error(\"Selected attemping to DMA more than 2048 packets at one time.  The Cell architecture has no facility for this. (Doing multiple sets is possible, but in most cases, a better algorithm is needed).\");\n        fi;\n\n        #NOTE: 16384 is the largest packet we can send on the Cell using DMA tables\n        if (pkSizeInBytes > 16384) then\n          Error(\"Selected packet size - \", o.pkSize, \" - is higher than the Cell's max allowed.\");\n        fi;\n\n\n        return(chain(\n            # Build DMA list\n            loop(i, numPkts, chain(\n              call(var(\"GATH_LIST_SETSIZE\"), pkSize, i.id),\n              call(var(\"GATH_LIST_SETADDR\"), func.at(i)*pkSize, i.id, var(Concatenation(\"spe_info.\", y.id)))\n            )),\n\n            # Execute DMA list\n            call(var(\"GATHMEM_LIST\"),\n                var(Concatenation(y.id, \"alt\")),\n                var(Concatenation(\"spe_info.\", y.id)),\n                numPkts\n            )\n        ));\n\n\n    end,\n\n    ScatMem := meth(self, o, y, x, opts)\n        #Scat: return loop(i, o.func.domain(), assign(nth(y,func.at(i)), nth(x, i)));\n        local func, pkSize, i, numPkts, pkSizeInBytes, dmaCommand;\n        func          := o.func.lambda();\n        pkSize        := o.pkSize;\n        numPkts     := o.func.domain();\n        #i          := 0;\n        i           := Ind(numPkts);\n\n        pkSizeInBytes := o.pkSize * (opts.vector.isa.bits/8);\n\n        #NOTE: 16384 is the largest packet we can send on the Cell\n        # If we're not using tables, then we can go higher using backend macros\n        dmaCommand := var(\"SCATMEM_PUT\");\n        pkSizeInBytes := o.pkSize * (opts.vector.isa.bits/8);\n\n        #NOTE: 16384 is the largest packet we can send on the Cell\n        # If we're not using tables, then we can go higher using backend macros\n        if (pkSizeInBytes > 16384) then\n          # NOTE: How to handle cases where pkSize is greater than 16k?\n\n          if (pkSizeInBytes = 32768) then\n             dmaCommand := var(\"SCATMEM_PUT_32K\");\n          elif (pkSizeInBytes = 65536) then\n             dmaCommand := var(\"SCATMEM_PUT_64K\");\n          elif (pkSizeInBytes = 131072) then\n             dmaCommand := var(\"SCATMEM_PUT_128K\");\n          else\n          Error(\"Selected packet size - \", o.pkSize, \" - is higher than the Cell's max allowed (using macros).\");\n          fi;\n        fi;\n\n        #DO_DMA(Yalt, spe_info.Y, IDEAL_DMA_SIZE_BYTES, MFC_PUT_CMD); // spe_info.Y = Yalt\n\n        if (numPkts <= 16 ) then\n            return(loop(i, numPkts, call(\n                dmaCommand,\n                #x,\n                var(Concatenation(x.id, \"alt\")),\n                i*pkSize,\n                var(Concatenation(\"spe_info.\", x.id)),\n                func.at(i)*pkSize,\n                pkSize\n            )));\n        fi;\n\n        if (numPkts > 2048) then\n          Error(\"Selected attemping to DMA more than 2048 packets at one time. The Cell architecture has no facility for this\");\n        fi;\n\n        #NOTE: 16384 is the largest packet we can send on the Cell using DMA tables\n        if (pkSizeInBytes > 16384) then\n          Error(\"Selected packet size - \", o.pkSize, \" - is higher than the Cell's max allowed for DMA lists.\");\n        fi;\n\n\n        return(chain(\n            # Build DMA list\n            loop(i, numPkts, chain(\n              call(var(\"SCAT_LIST_SETSIZE\"), pkSize, i.id),\n              call(var(\"SCAT_LIST_SETADDR\"), func.at(i)*pkSize, i.id, var(Concatenation(\"spe_info.\", x.id)))\n            )),\n\n            # Execute DMA list\n            call(var(\"SCATMEM_LIST\"),\n                var(Concatenation(x.id, \"alt\")),\n                var(Concatenation(\"spe_info.\", x.id)),\n                numPkts\n            )\n        ));\n\n    end,\n\n     R2Sum := (self, o, y, x, opts) >> \n            loop(o.var1, o.domain1, loop(o.var2, o.domain2, self(o.child(1), y, x, opts))),\n\n\n    # Note: to perform multibuffering, x,y are reversed in some of the following calls.\n    MultiBufISum := meth(self, o, y, x, opts)\n       local r, mbufvars, mloop, loopbody;\n\n        r := Collect(o, RemoteDataUnrolled);\n\n        # NOTE: handle multiple RemoteDataUnrolleds here.\n        if Length(r) > 1 then Error(\"ERROR: Multi RemoteDataInit case NOT implemented!\"); fi;\n\n        mbufvars := [];\n        if Length(r) > 0 then\n           r := r[1];\n           mbufvars := [r.var]::[r.altbuf];\n        fi;\n\n        mloop := multibuffer_loop;\n        if IsBound(opts.nombuf) and opts.nombuf=true then mloop := mem_loop; fi;\n\n#loopvar, range, y, x, gathmem, twiddles, bufs, cmd, scatmem)\n        return(decl(mbufvars,\n          mloop(o.var, o.domain, y, x,\n               self(o.gathmem, x, y, opts),\n               When(r=[], [], self( RemoteDataNoBody(r.var, r.altbuf, r.value, r.ofs, r.child(1)), y, x, opts )),\n               mbufvars,\n               self(o.child(1), y, x, opts),\n               self(o.scatmem, x, y, opts)\n          )\n        ));\n    end,\n\n    MultiBufISumFinal := (self, o, y, x, opts) >>\n        self(MultiBufISum(o.var, o.domain, o.scatmem, o.child(1), o.gathmem), y, x, opts),\n\n    #HACK: this won't work if twiddles need to be streamed.\n    MemISum := (self, o, y, x, opts) >> \n       mem_loop(o.var, o.domain, y, x,\n            self(o.gathmem, x, y, opts),\n            [],\n            [],\n            self(o.child(1), y, x, opts),\n            self(o.scatmem, x, y, opts)\n       ),\n\n    MemISumFinal := (self, o, y, x, opts) >>\n       mem_loop(o.var, o.domain, y, x,\n            self(o.gathmem, x, y, opts),\n            self(o.child(1), y, x, opts),\n            self(o.scatmem, x, y, opts)\n       ),\n\n\n    MultiBufDistSum := (self, o, y, x, opts) >>\n        self(MultiBufISum(o.var, o.domain, o.scatmem, o.child(1), o.gathmem), y, x, opts)\n));\n", "meta": {"hexsha": "43106ba4e5be6b02c0c752f3bcd81f2133f0ec27", "size": 17636, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/multibuffer/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/multibuffer/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/multibuffer/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 37.1284210526, "max_line_length": 214, "alphanum_fraction": 0.5492742118, "num_tokens": 4843, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.38491214448393346, "lm_q2_score": 0.04885777948775907, "lm_q1q2_score": 0.01880595267735648}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\n\n_dim3 := d -> \"dim3(\"::d.id::\")\";\n\nClass(HIPUnparser, CudaUnparser, rec(\n    cu_call := (self, o, i, is) >>\n        Print(Blanks(i), \"hipLaunchKernelGGL(\",  \n                self.infix([o.func, _dim3(o.dim_grid), _dim3(o.dim_block), \"0\", \"0\"]::o.args, \", \"), \");\\n\"),\n));\n", "meta": {"hexsha": "2ef8031688a0f4508f659e1a3f2bb291070e9686", "size": 359, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/cuda/unparser.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "platforms/cuda/unparser.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "platforms/cuda/unparser.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 27.6153846154, "max_line_length": 109, "alphanum_fraction": 0.5626740947, "num_tokens": 122, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.3702253786982541, "lm_q2_score": 0.05033063046076395, "lm_q1q2_score": 0.018633676722458217}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nneg.doPeel := true;\n\n#F CopyPropagate(<code>) \n#F     Performs copy propagation and strength reduction\n#F     If <code> has IFs it MUST be in SSA form, i.e., \n#F     SSA(<code>) must be run first.\n#F\nClass(SubstVarsRules, RuleSet, rec(\n    create := (self, varmap) >> Inherit(self, \n\trec(\n            rules := rec(\n\t\tv := Rule(@(1,var,e->IsBound(varmap.(e.id))), e -> varmap.(e.id))\n\t    )\n\t)).compile()\n));\n\n# apply linear normalization to index expressions, this will simplify cases like\n# 3x + 2x = 5x\n#\nClass(SimpIndicesRules, RuleSet, rec(\n    create := (self, opts) >> Inherit(self, \n\trec(\n\t    rules := rec(\n\t\tsimp_indices := Rule(@(1, opts.simpIndicesInside), x -> GroupSummandsExp(x))\n\t    )\n\t)).compile()\n));\n\n# Transforms nth(x, idx) to deref(x + idx)\nClass(RulesDerefNth, RuleSet);\nRewriteRules(RulesDerefNth, rec(\n    deref_nth := Rule(\n\t[nth, @(1).cond( x -> not (x _is [Value, param]) or not IsBound(x.value)), @(2)], \n\te -> let(\n\t    b := @(1).val, idx := @(2).val, \n\t    Cond(\n\t\tObjId(idx) = add, deref(ApplyFunc(add, [b] :: idx.args)),\n\t\tObjId(idx) = sub, deref(ApplyFunc(add, [b] :: [idx.args[1], neg(idx.args[2])])),\n                                  deref(b + idx))))\n));\n\n# sorts the incoming array of assignments by the offset of the\n# variable being assigned TO, rather than the one assigned FROM.\n# improves locality hence cache performance.\n_sortByIdx := function(array)\n    local newarray;\n    newarray := Copy(array);\n\n    SortParallel(\n        List(array, e -> Double(SubString(e.args[2].id, 2))),\n        newarray\n    );\n\n    return newarray;\nend;\n\nCopyTab := function (t)\n   local r, a;\n   r := tab();\n   for a in NSFields(t) do\n      r.(a):=Copy(t.(a));\n   od;\n   return r;\nend;\n\nClass(CopyPropagate, CSE, rec(\n    propagate := (self, cloc, cexp) >> let(cebase := ObjId(cexp),\n        ((cebase in [var, Value, noneExp])\n            or (self.propagateNth and cebase in [nth, deref] and IsValue(cexp.idx)) \n            or (IsBound(self.opts.autoinline) and IsBound(cloc.succ) and Length(cloc.succ)<=1)\n            or (IsBound(cloc.succ) and Length(cloc.succ)=0))),\n\n    # sreduce_and_subst(c.exp) can lead to inf loop - why?\n    procRHS := (self, x) >> self.sreduce(self.subst3(self.sreduce(self.subst2(x)))),\n\n    procLHS := (self, x) >> self.sreduce3(self.sreduce(self.subst2(x))),\n\n    # NOTE: explain this\n    prepVarMap := meth(self, initial_map, do_sreduce, do_init_scalarized, do_idx)\n        local v, varmap, rs_subst, rs2, rs_deref, rs_idx;\n        self.varmap := initial_map;\n\n        if do_sreduce then\n\t    # do_idx is done initially, at the same time as scalarization\n\t    # deref prevents scalarization, so  must be disabled at that moment\n\t    rs_deref := When(not do_idx and self.opts.useDeref, RulesDerefNth, EmptyRuleSet);\n\t    rs_idx   := When(do_idx, SimpIndicesRules.create(self.opts), EmptyRuleSet);\n\n            rs_subst := SubstVarsRules.create(self.varmap);\n\t    rs2 := MergedRuleSet(rs_subst, rs_deref);\n\t    rs_subst.__avoid__ := [Value];\n\t    rs_idx.__avoid__ := [Value];\n\t    rs2.__avoid__ := [Value];\n\t    \n            self.subst   := x -> SubstVars(x, self.varmap);\n            self.subst2  := x -> BU(x, rs2);\n            self.subst3  := x -> SubstBottomUpRules(BU(x, rs_subst), rs_idx.rules);\n            self.sreduce := x -> SReduce(x, self.opts);\n            self.sreduce3 := x -> SubstBottomUpRules(x, rs_idx.rules);\n            self.sreduce_and_subst := MergedRuleSet(rs_subst, rs_deref, RulesStrengthReduce);\n        else\n            self.subst   := x -> SubstVars(x, self.varmap);\n            self.subst2  := x -> SubstVars(x, self.varmap);\n            self.subst3  := x -> SubstVars(x, self.varmap);\n            self.sreduce := x -> x;\n            self.sreduce_and_subst := self.subst;\n        fi;\n\n        if do_init_scalarized then\n            for v in compiler.Compile.scalarized do \n                self.varmap.(v.id) := noneExp(v.t); \n            od;\n        fi;\n        return self;\n    end,\n\n    assumeSSA := false,\n    afterSSA := self >> WithBases(self, rec(assumeSSA:=true)),\n\n    closeVarMap := meth(self, other, newcmds)\n        local v;\n        for v in UserNSFields(other.varmap) do\n            if (not IsBound(self.varmap.(v)) or self.varmap.(v) <> other.varmap.(v)) and SuccLoc(var(v))<>[] then\n                if self.assumeSSA then ;\n                #    self.varmap.(v) := other.subst(other.varmap.(v));\n                #    PrintLine(\"close \", v, \" => \", other.subst(other.varmap.(v)));\n                else\n                    Unbind(self.varmap.(v));\n                    Add(newcmds.cmds, assign(var(v), other.subst(other.varmap.(v))));\n                fi;\n            fi;\n        od;\n        #Print(\"-----\\n\");\n    end,\n\n    init := meth(self, opts)\n        self.opts := opts;\n        self.prepVarMap(tab(), true, true, false);\n        self.doScalarReplacement := opts.doScalarReplacement;\n        self.propagateNth := opts.propagateNth;\n        self.flush();\n        return self;\n    end,\n\n    initial := meth(self, code, opts)\n        self.opts := opts;\n        self.prepVarMap(tab(), true, true, true);\n        self.doScalarReplacement := opts.doScalarReplacement;\n        self.propagateNth := opts.propagateNth;\n        self.flush();\n        return self.copyProp(code);\n    end,\n\n    __call__ := (self, code, opts) >> self.init(opts).copyProp(code),\n\n    flush := meth(self)\n         self.csetab := tab();\n         if (self.doScalarReplacement) then self.lhsCSE := CSE.init(); fi;\n    end,\n\n    fast := meth(self, code, opts)\n        self.prepVarMap(tab(), false, false, false);\n        self.doScalarReplacement := opts.doScalarReplacement;\n        self.propagateNth := opts.propagateNth;\n        self.opts := opts;\n        self.flush();\n        return self.copyProp(code);\n    end,\n\n    procAssign := meth(self, c, newcmds, live_out)\n        local newloc, newexp, cid, cloc, op, varmap, lkup;\n        varmap := self.varmap;\n\n        # NOTE: generalize this, use .in()/.out()/.inout() somehow\n        if IsBound(c.p) then  \n            cid := (loc, exp) -> ObjId(c)(loc, exp, c.p); \n        else cid := ObjId(c); fi;\n\n        # to my current understanding, if we assign a phi function, nothing can be propagated.\n        # If you propagate inside a phi, you lose the branch information.\n        if (ObjId(c.exp)=phi) then Add(newcmds, c); return; fi;\n\n        # Run strength reduction, variable remapping, and all other rewrite rules\n        newexp := self.procRHS(c.exp); \n        cloc := When(not IsVar(c.loc) or (c.loc in c.op_inout()), \n\t             self.procLHS(c.loc), c.loc);\n\n        # check if newexp was already computed\n        lkup := self.cseLookup(newexp);\n        if lkup <> false then newexp := lkup; fi;\n\n\t# if cloc is marked as live_out, save it in the list, so that its not kicked out\n        When(IsVar(cloc) and IsBound(cloc.live_out), AddSet(live_out, cloc));\n\n        # invalidate the LHS in the CSE tables\n        if (self.cseLookup(cloc) <> false) \n            then self.cseInvalidate(cloc); fi;      \n        if (self.doScalarReplacement and self.lhsCSE.cseLookup(cloc) <> false) \n            then self.lhsCSE.cseInvalidate(cloc); fi;\n    \n        # propagate\n        if IsVar(cloc) and cid=assign and self.propagate(cloc,newexp) then\n            # this should not happen due to sreduce/subst above \n            When(IsVar(newexp) and IsBound(varmap.(newexp.id)), Error(\"Should not happen\"));\n            varmap.(cloc.id) := newexp; \n\n        # do not propagate\n        else\n            # NOTE: YSV: is this right???\n            #        it seems that its correct, above case catches var=noneExp,\n            #        so this looks like a mem-store, e.g.,  nth(..) = noneExp\n            if ObjId(newexp)=noneExp then return; fi;\n\n            # do not propagate AND cloc is a variable\n            if IsVar(cloc) and not (cloc in c.op_inout()) then          \n                # propagate 'neg' like unary operators outwards\n                if IsBound(newexp.doPeel) and newexp.doPeel then\n                    op := ObjId(newexp); \n                    newexp := newexp.args[1];\n                    if self.propagate(cloc, newexp) then\n                        if IsVar(newexp) and IsBound(varmap.(newexp.id)) then\n                            varmap.(cloc.id) := op(varmap.(newexp.id));\n                        else\n                            varmap.(cloc.id) := op(newexp);\n                        fi;\n                    else\n                        newloc := cloc.clone();\n                        varmap.(cloc.id) := op(newloc);\n                        Add(newcmds, cid(newloc, newexp)); \n                        # careful! cid can be any storeop, not always <assign>\n                        When(cid=assign, self.cseAdd(newloc, newexp));\n                    fi;\n                else \n                    # variable that is not propagated is remapped to a fresh name (to get code in SSA form)\n                    newloc := cloc.clone(); \n                    varmap.(cloc.id) := newloc;\n                    Add(newcmds, cid(newloc, newexp));   # cid == assign | assign_nop | ...\n                    # careful! cid can be any storeop, not always <assign>\n                    When(cid=assign, self.cseAdd(newloc, newexp));\n                fi;\n\n            #  do not propagate AND cloc is *not* a variable (ie. nth(X, i)) or it is an inout variable\n            else\n                if self.doScalarReplacement or not (self.propagateNth or IsVar(newexp) or IsValue(newexp)) then\n                    # for non-variable newexp a fresh temporary var sXX is created to hold the result\n                    newloc := var.fresh_t(\"s\", newexp.t);\n                    self.cseAdd(newloc, newexp);\n                    Add(newcmds, assign(newloc, newexp));\n                    newexp := newloc;\n                fi;\n\n                if self.doScalarReplacement then\n                    When(cid<>assign or not (ObjId(cloc) in [nth,deref]), \n                        Error(\"Scalar replacement can't handle <cloc> of type \", ObjId(cloc))); \n                    self.cseAdd(newexp, cloc);\n                    self.lhsCSE.cseAdd(newexp, cloc);\n                else\n                    Add(newcmds, cid(cloc, newexp));\n                fi;\n            fi;\n        fi;\n    end,\n\n    procIF := meth(self, c, newcmds, live_out)\n        local lo_map, v, orig, then_cmd, else_cmd, then_cp, else_cp;\n        c.cond := self.procRHS(c.cond);\n\n        if IsValue(c.cond) then\n            Error(\"This is a constant IF, it should be folded away before reaching copyprop\");\n            # Following code should work if needed (if you uncomment the error) but it is not optimized\n            # self.flush(); # YSV: why is this needed??? I will comment this out.\n            if c.cond.v=0 or c.cond.v=false then  Add(newcmds, self.copyProp(c.else_cmd));\n            else                                  Add(newcmds, self.copyProp(c.then_cmd));\n            fi;\n        else\n            # Here the idea is that each part of the branch should work with\n            # the original csetab (there cannot be crossings) and the final thing\n            # should be restored to the original csetab\n\n            then_cp := CopyFields(self, rec(csetab := CopyTab(self.csetab)))\n                .prepVarMap(CopyTab(self.varmap), true, false, false);\n\n            else_cp := CopyFields(self, rec(csetab := CopyTab(self.csetab)))\n                .prepVarMap(CopyTab(self.varmap), true, false, false);\n\n            then_cmd := then_cp.copyProp(c.then_cmd);\n            self.closeVarMap(then_cp, then_cmd);\n\n            else_cmd := else_cp.copyProp(c.else_cmd);\n            self.closeVarMap(else_cp, else_cmd);\n\n            Add(newcmds, IF(c.cond, then_cmd, else_cmd));\n            #self.flush();\n        fi;\n    end,\n        \n    #if we do Scalar Replacement on the fly, reinject the final writes as assigns (for now)\n    finalizeScalarReplacement := meth(self, newcmds)\n        local entry;\n            if IsBound(self.lhsCSE.csetab.nth) then \n                # MRT: sort by order of variable being assigned TO rather\n                # than variable assigned FROM. This reduces cache misses by\n                # exploiting possible locality in the output array.\n                #\n                # eg: Y[0]  := a1   ===>  Y[0]   := a1\n                #     Y[32] := a2         Y[1]   := a3\n                #     Y[1]  := a3         Y[32]  := a2\n\n                for entry in _sortByIdx(self.lhsCSE.csetab.nth) do\n                    if Length(entry.args)=2 then\n                        Add(newcmds, \n                            assign(nth(entry.args[1],entry.args[2]),\n                                entry.loc));\n                    fi;\n                od;\n            fi;\n            if IsBound(self.lhsCSE.csetab.deref) then \n                for entry in self.lhsCSE.csetab.deref do\n                    if Length(entry.args)=1 then\n                        Add(newcmds, \n                            assign(deref(entry.args[1]),\n                        entry.loc));\n                    fi;\n                od;\n            fi;\n    end,\n\n    # create the reverse mapping, to map last assignment to live_out variable \n    #  to the actual variable intead of an SSA related substitute\n    substLiveOut := meth(self, newcmds, live_out)\n        local varmap, lo_map, active, v;\n        varmap := self.varmap;\n        lo_map := tab();\n        active := Set(Collect(newcmds, var));  # explain this\n        for v in live_out do \n           # NOTE: The commented out lines with #X removed extra copies \n           #  associated with live_out variables. But it turns out that this \n           #  does not work if a live_out variable is never actually remapped,\n           #  but has an entry in varmap due to copy propagation.\n           #  For example (a = t11; b = a) if a is live_out will be compiled to\n           #  (b=t11) b CopyPropagate and converted to (b=a) by function below.\n           #   which is incorrect \n\n           #X if not IsVar(varmap.(v.id)) or not (varmap.(v.id) in active) then\n                Add(newcmds, assign(v, varmap.(v.id)));\n           #X else\n           #X     lo_map.(varmap.(v.id).id) := v;\n           #X fi;\n            Unbind(varmap.(v.id));   # prevent duplication of cleanup code due to closeVarMap\n        od;\n        newcmds := SubstVars(newcmds, lo_map); \n        return newcmds;\n    end,\n\n    copyProp := meth(self, code)\n        local c, cid, cmds, newcmds, live_out;\n        cmds := When(ObjId(code)=chain, code.cmds, [code]); \n        newcmds := [];\n        live_out := Set([]);\n        for c in cmds do\n            cid := ObjId(c); \n            if   IsAssign(c)     then  self.procAssign(c, newcmds, live_out);\n            elif (cid = IF)      then  self.procIF(c, newcmds, live_out);\n            elif IsExpCommand(c) then  Add(newcmds, self.procRHS(c));\n            elif (cid = skip)    then  ;  # do nothing\n\n            # if .sideeffect is bound, the command is assumed have side effects\n            # so one has to enable array scalarization inside all its children\n            elif IsRec(c) and IsBound(c.sideeffect) and c.sideeffect then\n               Add(newcmds, map_children_safe(c, x -> self.procRHS(x)));\n\n            # the command is a container for other functions, copyprop all children\n            else Add(newcmds, map_children_safe(c, \n\t\t\tx -> Cond(IsCommand(x), self.copyProp(x), self.procRHS(x))));\n            fi;\n        od;\n\n        When(self.doScalarReplacement, self.finalizeScalarReplacement(newcmds));\n        newcmds := self.substLiveOut(newcmds, live_out);\n        # self.flush();\n        return chain(newcmds);\n    end\n));\n", "meta": {"hexsha": "38fa67a58a9f202ef920d8aad2178edd796f9bf8", "size": 15744, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/copyprop.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/copyprop.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/copyprop.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 40.4730077121, "max_line_length": 113, "alphanum_fraction": 0.5527184959, "num_tokens": 4021, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3886180408675583, "lm_q2_score": 0.04672495331630389, "lm_q1q2_score": 0.01815815981741014}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nmemo := function(context, prefix, exp)\n   local v, isum;\n   exp := SReduce(toExpArg(exp), SpiralDefaults); ##Pass the real opts instead\n   if IsValue(exp) then return exp.v;\n   elif IsVar(exp) then return exp;\n   else\n       if IsBound(context.ISum) and context.ISum <> [] then\n       isum := Last(context.ISum);\n       v := var.fresh_t(prefix, TInt);\n       if not IsBound(isum.memos) then isum.memos := []; fi;\n       Add(isum.memos, [v, exp]);\n       #Print(v.id , \" -> \", exp, \" [\", isum.var, \" in \", isum.domain, \"]\\n\");\n       v.mapping := exp;\n       return v;\n       else \n       return exp;\n       fi;\n   fi;\nend;\n\nnomemo := (cx,pfx,exp) -> exp;\n\nmemo := nomemo; # memo feature is currently broken -- disable it\n\nClass(ProcessMemos, RuleSet);\nRewriteRules(ProcessMemos, rec(\n   # pull out cmemos\n   PullOutCmemo := Rule(cmemo, \n     function(e,cx) \n         local target;\n\t target := cx.(e.target);\n         if not IsBound(target.memos) then \n\t     target.memos := [ e.args[1], e.mapping ]; \n\t else Add(target.memos, [ e.args[1], e.mapping ]);\n\t fi;\n\t return e.args[1];\n     end),\n\n   # process memos at ISum\n   ProcessISumMemos := Rule(@(1, [ISum, ISumAcc], e->IsBound(e.memos)), \n     e -> ObjId(@(1).val)(e.var, e.domain,\n\t      FoldL(Reversed(e.memos), \n\t\t  (ex,m) -> Data(m[1], m[2], ex)), e.child(1)))\n));\n", "meta": {"hexsha": "54b8f4c08e2c711f06bbb9348cb91ef3854c36a0", "size": 1404, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/sigma/memo.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/sigma/memo.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/sigma/memo.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.08, "max_line_length": 78, "alphanum_fraction": 0.5854700855, "num_tokens": 428, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.48828339529583464, "lm_q2_score": 0.03676946554783728, "lm_q1q2_score": 0.017953919480911202}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n########################################################\n#   Machinery for being able to translate\n#   vector-sigma-sums into vector code\n########################################################\n\nvref := (loc, idx, vlen) -> When(vlen=1, \n    nth(loc, idx), \n    nth(tcast(TPtr(TVect(loc.t.t, vlen)), loc), idx/vlen));\n\nnth.toPtr := (self, t) >> let( \n    exp := When(IsPtrT(self.loc.t), self.loc, tcast(self.loc.t.toPtrType(), self.loc)) + self.idx,\n    exp_t := exp.t, \n    new_t := When( IsPtrT(exp_t), TPtr(t, exp_t.qualifiers).withAlignment(exp_t), TPtr(t)),\n    When(new_t=exp_t, exp, tcast(new_t, exp))\n);\n\nDeclareVars := function(code)\n    local vars, vects,good;\n\n    vars  := Set(List(Collect(code, [assign, @(1,var), @]),     e->e.loc));\n    vects := Set(List(Collect(code, [assign, [vref,@(1,var),@], @]), e->e.loc.loc));\n    good:=Set(Flat(List(Collect(code, decl), e->e.vars)));\n    SubtractSet(vects, good);\n    SubtractSet(vects, Set([X,Y]));\n    SubtractSet(vars, good);\n\n    if Length(vars) > 0 then code := decl(vars, code); fi;\n    if Length(vects) > 0 then code := decl(vects, code); fi;\n    return code;\nend;", "meta": {"hexsha": "2cf47c95887437b79e0fb50878b10aceb12d6a68", "size": 1212, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/vref.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/vref.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/vref.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.6285714286, "max_line_length": 98, "alphanum_fraction": 0.5585808581, "num_tokens": 356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4416730056646256, "lm_q2_score": 0.04023794363068103, "lm_q1q2_score": 0.01777201350512667}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(ScratchpadGlobals, rec(\n    getOpts := meth(arg)\n        local lssize, opts, swp, brules, nrules, br, nrsgmts, vlen, globalUnrolling,size, ttype;\n\n\tlssize := When (Length(arg) >= 2, arg[2], 2);\n\tnrsgmts := When (Length(arg) >= 3, arg[3], 1);\n\tvlen := When (Length(arg) >= 4, arg[4], 1);\n\tsize := When (Length(arg) >= 5, arg[5], 2);\n    ttype := When (Length(arg) >= 6, arg[6], 'R');\n\tswp := When (Length(arg) >= 7, arg[7], false);\n\tglobalUnrolling := When(Length(arg) >=8, arg[8], 1);\n\n    brules := When(IsRec(SpiralDefaults.breakdownRules),\n        UserRecFields(SpiralDefaults.breakdownRules),\n        Filtered(Dir(SpiralDefaults.breakdownRules), i->not i in SystemRecFields));\n    nrules := rec();\n    for br in brules do\n        nrules.(br) := List(SpiralDefaults.breakdownRules.(br), i->CopyFields(i));\n    od;\n    opts := CopyFields(SpiralDefaults);\n    opts.breakdownRules := nrules;\n\n    opts.breakdownRules.TCompose := [ TCompose_tag];\n    opts.breakdownRules.DFT := [DFT_Base, DFT_CT, DFT_tSPL_CT, DFT_PD, DFT_Rader];\n    opts.breakdownRules.TTwiddle := [ TTwiddle_Tw1];\n \n\topts.breakdownRules.WHT := [WHT_tSPL_BinSplit, WHT_Base, WHT_BinSplit];\n   \n\topts.breakdownRules.TTensor := [AxI_IxB,IxB_AxI];\n\topts.breakdownRules.TTensorI := Concat([IxA_scratch_push, IxA_base, AxI_base, IxA_L_base, L_IxA_base], [IxA_scratch, AxI_scratch, IxAL_scratch]);\n\t\n\topts.tags := [Cond( ttype = 'R', ALStore(lssize,nrsgmts,vlen), ALStoreCx(lssize,nrsgmts,vlen)) ];\n\n\topts.formulaStrategies.sigmaSpl := [ MergedRuleSet(RulesSumsScratch, RulesFuncSimpScratch, RulesDiag, RulesDiagStandalone, RulesStrengthReduce, RulesRCScratch,RulesII,OLRules) ];\n    opts.formulaStrategies.preRC := [ MergedRuleSet(RulesSumsScratch, RulesFuncSimpScratch, RulesDiag, RulesDiagStandalone, RulesStrengthReduce, RulesRCScratch, RulesII, OLRules), (s,o) -> ScratchModel.updateInfo(s) ];\n\topts.formulaStrategies.rc := [ MergedRuleSet(RulesSums, RulesFuncSimp, RulesDiag, RulesDiagStandalone, RulesStrengthReduce, RulesRCScratch, RulesII, OLRules) ];\n    #opts.formulaStrategies.postProcess := [(s, opts) -> compiler.BlockSums(opts.globalUnrolling, s)];\n    opts.size := size;\n\topts.swp := swp;\n    opts.globalUnrolling := globalUnrolling;\n\n    opts.sumsgen := ScratchSumsGen;\n\topts.codegen := ScratchCodegen;\n    opts.unparser := CScratchUnparserProg;\n\n    opts.memModifier := \"__memory\";\n    opts.scratchModifier := \"__scratch\";\n    opts.arrayDataModifier := \"__rom\";\n    opts.romModifier := \"__rom\";\n\t\n\topts.includes := [];\n    Add(opts.includes, \"\\\"scratch.h\\\"\");\n\n    opts.dmaSignal := (self, opts) >> \"DMA_signal\";\n    opts.dmaWait := (self, opts) >> \"DMA_wait\";\n    opts.cpuSignal := (self, opts) >> \"CPU_signal\";\n    opts.cpuWait := (self, opts) >> \"CPU_wait\";\n    opts.dmaFence := (self, opts) >> \"DMA_fence\";\n    opts.dmaLoad := (self, opts) >> \"DMA_load\";\n    opts.dmaStore := (self, opts) >> \"DMA_store\";\n    opts.model := ScratchModel;\n\n    return opts;\n    end\n));\n\n", "meta": {"hexsha": "3fbbed013009328b15e017e6060620316ae78a87", "size": 3040, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/opts.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/opts.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/opts.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 42.2222222222, "max_line_length": 218, "alphanum_fraction": 0.6861842105, "num_tokens": 938, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.47268347662043286, "lm_q2_score": 0.03732688439914231, "lm_q1q2_score": 0.017643801489195584}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(SMP_Unparser,      SMP_UnparseMixin, CUnparserProg);\nClass(SMP_MacroUnparser, SMP_UnparseMixin, CMacroUnparserProg);\n\nClass(OpenMP_Unparser,      OpenMP_UnparseMixin, CUnparserProg);\nClass(OpenMP_MacroUnparser, OpenMP_UnparseMixin, CMacroUnparserProg);\n\n# suggested values: bufIters=64 (16 for older machines), maxRank=1 (larger value increases search space)\n# Example: opts := InitGTLibgen(64, 1)\n#\nInitGTLibgen := function(bufIters, maxRank, useComplex)\n    local opts;\n    LibgenHardcodeStrides();\n\n    opts := CopyFields(InitLibgen(When(useComplex, CplxLibgenDefaults, LibgenDefaults)),  \n        rec(\n            useDeref := true,\n            breakdownRules := rec(\n                GT  := [ CopyFields(GT_Base, rec(maxSize := 32)),\n                         CopyFields(GT_BufReshape, rec(bufIters := bufIters)),\n                         CopyFields(GT_DFT_CT, rec(minSize := 33, maxRank := maxRank)),\n                         GT_NthLoop, GT_Par ],\n                DFT := [ CopyFields(DFT_CT, rec(maxSize:=32)),\n                         CopyFields(DFT_GT_CT, rec(minSize:=32)),\n                         DFT_Base ],\n                InfoNt := [Info_Base])\n        ));\n    opts.formulaStrategies.preRC := [ HfuncSumsRules ];\n    return opts;\nend;\n\nInitSMPGTLibgen := function(bufIters, maxRank, useComplex, useOpenMP)\n    local opts;\n    opts := CopyFields(InitGTLibgen(bufIters, maxRank, useComplex), rec(\n            unparser := Cond(\n                useComplex and useOpenMP,         OpenMP_MacroUnparser,\n                useComplex and not useOpenMP,        SMP_MacroUnparser,\n                not useComplex and useOpenMP,     OpenMP_Unparser,\n                not useComplex and not useOpenMP,    SMP_Unparser)));\n\n    opts.formulaStrategies.sigmaSpl := [ MergedRuleSet(StandardSumsRules,RulesSMP), HfuncSumsRules ];\n    opts.formulaStrategies.rc := opts.formulaStrategies.sigmaSpl;\n\n    if not useOpenMP then\n        opts.subParams := [var(\"num_threads\", TInt), var(\"tid\", TInt)];\n        opts.profile := When(LocalConfig.osinfo.isWindows(),\n            LocalConfig.cpuinfo.profile.threads(),\n            profiler.default_profiles.linux_x86_threads\n        );        \n    fi;\n    return opts;\nend;\n\n\n", "meta": {"hexsha": "f611d93af8ed25f9c09eafa1788903a511314c02", "size": 2293, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/libgen/recgt.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/libgen/recgt.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/libgen/recgt.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 38.8644067797, "max_line_length": 104, "alphanum_fraction": 0.6332315744, "num_tokens": 581, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45713671682749485, "lm_q2_score": 0.038466192707252364, "lm_q1q2_score": 0.017584309043047072}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n@TInt := @.cond(x->x.t=TInt);\n@TReal := @.cond(x->IsRealT(x.t));\n@_scalar := @.cond(x->IsOrdT(x.t) or IsRealT(x.t) or ObjId(x.t)=TPtr);\n@TVect := @.cond(x->IsVecT(x.t));\n@Value := @.cond(x->IsValue(x));\n@nth := @.cond(x->ObjId(x)=nth);\n\n_isa := self -> self.opts.vector.isa;\n_epi := (self, o) -> Concat(\"epi\", self.ctype_suffixval(o.t, _isa(self)));\n_px := (self, o) -> self.ctype_suffixval(o.t, _isa(self));\n_vp := (o) -> let(pp := Last(o.args), \n    Cond(ObjId(pp)=vparam, pp.p,\n\t IsValue(pp), pp.v,\n\t pp));\n\nClass(AVXUnparser, SSEUnparser, rec(\n    # --------------------------------\n    # ISA constructs, general\n    # -------------------------------\n\n    # This is a general suffix for intrinsics that is determine from the data type\n    ctype_suffix := (self, t, isa) >> Cond(\n        t = TVect(T_Real(64), 4), \"pd\",\n        t = TVect(T_Real(32), 8), \"ps\",\n        t = TVect(TReal, 4) and isa=AVX_4x64f, \"pd\",\n        t = TVect(TReal, 8) and isa=AVX_8x32f, \"ps\",\n        Inherited(t, isa)\n    ),\n\n    ctype_prefix := (self, t) >> Cond( _avxT(t, self.opts), \"_mm256\", \"_mm\" ),\n\n    # This is the type used for declarations of vector variables\n    ctype := (self, t, isa) >> Cond(\n        t in [TReal, TVect(TReal, 1)],\n          Cond(\n            isa = AVX_4x64f, \"double\",\n            isa = AVX_8x32f, \"float\",\n            \"UNKNOWN_TYPE\"),\n        t = T_Real(64), \"double\",\n        t = T_Real(32), \"float\",\n        # else\n          Cond(\n            t = TVect(TReal, 2), \n              Cond(\n                isa = AVX_4x64f, \"__m128d\",\n                isa = AVX_8x32f, \"__m64\",\n                \"UNKNOWN_TYPE\"),\n            t = TVect(TReal, 4), \n              Cond(\n                isa = AVX_4x64f, \"__m256d\",\n                isa = AVX_8x32f, \"__m128\",\n                \"UNKNOWN_TYPE\"),\n            t = TVect(TReal, 8), \n              Cond(\n                isa = AVX_8x32f, \"__m256\",\n                \"UNKNOWN_TYPE\"),\n            t = TVect(T_Real(64), 4), \"__m256d\",\n            t = TVect(T_Real(32), 8), \"__m256\",\n            t = TVect(T_Int(32),  8), \"__m256i\",\n            t = TVect(T_UInt(32), 8), \"__m256i\",\n            t = TVect(T_Real(64), 2), \"__m128d\",\n            t = TVect(T_Real(32), 4), \"__m128\",\n            t = TVect(T_Real(32), 2), \"__m64\",\n            Inherited(t, isa))\n    ),\n\n    cvalue_suffix  := (self, t)  >> let( isa := _isa(self), Cond(\n        (t = TReal and isa = AVX_8x32f) or t = T_Real(32), \"f\",\n        (t = TReal and isa = AVX_4x64f) or t = T_Real(64), \"\",\n        Inherited(t)\n    )),\n\n\n    vhex := (self, o, i, is) >> Print(\"_mm_set_\", _epi(self, o), \"(\", self.infix(Reversed(o.p), \", \"), \")\"),\n\n    vparam := (self, o, i, is) >> When(Length(o.p)=1, Print(o.p[1]), iclshuffle(o.p)),\n\n    Value := (self, o, i, is) >> Cond(\n        o.t = TString, Print(o.v),\n\n        o.t = TReal or ObjId(o.t) = T_Real, let(v := When(IsCyc(o.v), ReComplex(Complex(o.v)), Double(o.v)),\n            When(v<0, Print(\"(\", v, self.cvalue_suffix(o.t), \")\"), Print(v, self.cvalue_suffix(o.t)))),\n\n        o.t = TComplex, Print(\"COMPLEX(\", ReComplex(Complex(o.v)), self.cvalue_suffix(TReal), \", \", ImComplex(Complex(o.v)), self.cvalue_suffix(TReal), \")\"),\n\n\to.t in [TInt, TUChar, TChar],\n            When(o.v < 0, Print(\"(\", o.v, \")\"), Print(o.v)),\n\n        ObjId(o.t) = TVect and Length(Set(o.v)) = 1,\n            Cond( self.cx.isInside(Value) and Length(self.cx.Value) >= 2, # nested in an array\n\t\t    Print(\"{\", self.infix(Replicate(o.t.size, o.v[1]), \", \"), \"}\"),\n                  # else\n                    Cond( _avxT(o.t, self.opts), let( sfx := self.ctype_suffix(o.t, _isa(self)), pfx := self.ctype_prefix(o.t),\n                        Cond( o.v[1] = 0, \n                            self.printf(\"$1_setzero_$2()\", [pfx, sfx]),\n                            self.printf(\"$1_set1_$2($3)\", [pfx, sfx, o.v[1]]))),\n                        Inherited(o, i, is))),\n        ObjId(o.t) = TVect,\n            Cond( self.cx.isInside(Value) and Length(self.cx.Value) >= 2, # nested in an array\n\t\t    Print(\"{\", self.infix((o.v), \", \"), \"}\"),\n                # else\n                    Cond( _avxT(o.t, self.opts), let( sfx := self.ctype_suffix(o.t, _isa(self)), pfx := self.ctype_prefix(o.t),\n\t\t        Print(pfx, \"_set_\", sfx, \"(\", self.infix(Reversed(o.v), \", \"), \")\")),\n                        Inherited(o, i, is))),\n\n        IsArray(o.t),\n           Print(\"{\", self.infix(o.v, \", \"), \"}\"),\n\n        ObjId(o.t) = TSym,\n            Print(\"(\", self.declare(o.t, [], 0, 0), \") \", o.v),\n\n\to.t = TBool, Print(When(o.v, \"1\", \"0\")),\n\n\t#Error(self,\".Value cannot unparse type \",o.t)\n        Inherited(o, i, is)\n    ),\n\n    vpack := (self, o, i, is) >> Cond( _avxT(o.t, self.opts),\n            Print(\"_mm256_set_\", self.ctype_suffix(o.t, _isa(self)), \"(\", self.infix(Reversed(o.args), \", \"), \")\"),\n        \n        Inherited(o, i, is)),\n\n    vdup := (self, o, i, is) >> CondPat(o,\n            [vdup, @(1, [nth, deref]), @TInt], let( isa := _isa(self),\n                t := o.args[1].t, pfx := self.ctype_prefix(o.t),\n                Cond( t = T_Real(32) or (t=TReal and isa=AVX_8x32f),  \n                        self.printf(\"$1_broadcast_ss($2)\", [pfx, o.args[1].toPtr(t)]),\n                      t = T_Real(64) or (t=TReal and isa=AVX_4x64f), \n                        self.printf(\"$1_broadcast_sd($2)\", [pfx, o.args[1].toPtr(t)]),\n                      t = TVect(T_Real(32), 2) or (t=TVect(TReal, 2) and isa=AVX_8x32f),\n                        self.printf(\"$1_castpd_ps($1_broadcast_sd($2))\", [pfx, o.args[1].toPtr(T_Real(64))]),\n                      t = TVect(T_Real(64), 2) or (t=TVect(TReal, 2) and isa=AVX_4x64f),\n                        self.printf(\"$1_broadcast_pd($2)\", [pfx, o.args[1].toPtr(t)]),\n                      t = TVect(T_Real(32), 4) or (t=TVect(TReal, 4) and isa=AVX_8x32f),\n                        self.printf(\"$1_castpd_ps($1_broadcast_pd($2))\", [pfx, o.args[1].toPtr(TVect(T_Real(64), 2))]),\n                      Error(\"unexpected vdup load\"))),\n            #[vdup, @nth,@.cond(x->x.t=TInt and x.v=2)],\n            #    Print(\"_mm_loaddup_\", sfx, \"(&(\", self(o.args[1], i, is), \"))\"),\n            [vdup, @, @TInt],\n                Print(When(_isa(self).v = 4, \"_mm256_set1_pd\", \"_mm256_set1_ps\"), \"(\", self(o.args[1], i, is), \")\")\n        ),\n\n    # Declarations\n    TVect := (self, t, vars, i, is) >> let( ctype := self.ctype(t, _isa(self)),\n        Print(ctype, \" \", self.infix(vars, \", \"))),\n\n    TReal := ~.TVect,\n\n    TInt := (self, t, vars, i, is) >> Print(\"int \", self.infix(vars, \", \")),\n\n    TBool := (self, t, vars, i, is) >> Print(\"BOOL \", self.infix(vars, \", \")),\n\n    # Arithmetic\n    mul := (self, o, i, is) >> let(n := Length(o.args), Cond(\n        not IsVecT(o.t),\n            Print(\"(\", self.pinfix(o.args, \")*(\"), \")\"),\n        not _avxT(o.t, self.opts),\n            Inherited(o, i, is),\n\tn > 2 and n mod 2 <> 0,\n            self(mul(o.args[1], ApplyFunc(mul, Drop(o.args, 1))), i, is),\n        n > 2, \n            self(mul(ApplyFunc(mul, o.args{[1..n/2]}), ApplyFunc(mul, o.args{[n/2+1..n]})), i, is),\n        let( sfx := self.ctype_suffix(o.t, _isa(self)),\n         CondPat(o,\n           [mul, @TReal, @TVect],\n              self(mul(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n           [mul, @TVect, @TReal],\n              self(mul(o.args[1], vdup(o.args[2],o.t.size)), i, is),\n           [mul, @TInt, @TVect],\n              self(mul(vdup(_toReal(o.args[1]),o.t.size), o.args[2]), i, is),\n           [mul, @TVect, @TInt],\n              self(mul(o.args[1], vdup(_toReal(o.args[2]),o.t.size)), i, is),\n           [mul, @TVect,   @TVect],\n              self.printf(\"_mm256_mul_$1($2, $3)\", [sfx, o.args[1], o.args[2]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")))\n    )),\n\n    # -- add --\n    add := (self, o, i, is) >> let(n := Length(o.args), Cond(\n\tnot IsVecT(o.t),\n            self.pinfix(o.args, \" + \"),\n        not _avxT(o.t, self.opts),\n            Inherited(o, i, is),\n        n > 2 and n mod 2 <> 0,\n            self(add(o.args[1], ApplyFunc(add, Drop(o.args, 1))), i, is),\n        n > 2, \n            self(add(ApplyFunc(add, o.args{[1..n/2]}), ApplyFunc(add, o.args{[n/2+1..n]})), i, is),\n        let(sfx := self.ctype_suffix(o.t, _isa(self)), saturated:= When(_isa(self).isFixedPoint and _isa(self).saturatedArithmetic, \"s\", \"\"), \n          CondPat(o,\n            [add, @TReal, @TVect],\n                self(add(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n            [add, @TVect, @TReal],\n                self(add(o.args[1], vdup(o.args[2],o.t.size)), i, is),\n            [add, @TInt, @TVect],\n                self(add(vdup(_toReal(o.args[1]),o.t.size), o.args[2]), i, is),\n            [add, @TVect, @TInt],\n                self(add(o.args[1], vdup(_toReal(o.args[2]),o.t.size)), i, is),\n            [add, @TVect,   @TVect],\n                self.printf(\"_mm256_add$1_$2($3, $4)\", [saturated, sfx, o.args[1], o.args[2]]),\n            Error(\"Don't know how to unparse <o>. Unrecognized type combination\")))\n    )),\n\n    sub := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), let(\n            isa       := _isa(self),\n            sfx       := self.ctype_suffix(o.t, isa),\n            saturated := When(isa.isFixedPoint and isa.saturatedArithmetic, \"s\", \"\"),\n            self.printf(\"_mm256_sub$1_$2($3, $4)\", [saturated, sfx, o.args[1], o.args[2]])),\n        # else\n            Inherited(o, i, is)),\n\n    neg := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        self(mul(neg(o.t.one()), o.args[1]), i, is),\n        Inherited(o, i, is)),\n\n    stickyNeg := ~.neg,\n\n    sqrt  := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        Checked( IsRealT(o.t.t), self.printf(\"_mm256_sqrt_$1($2)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1]])),\n        Inherited(o, i, is)),\n\n    rsqrt := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        let( sfx := self.ctype_suffix(o.t, _isa(self)),\n            Checked( sfx=\"ps\", self.printf(\"_mm256_rsqrt_ps($1)\", [o.args[1]]))),\n        Inherited(o, i, is)),\n\n    max := (self, o, i, is) >> let(n := Length(o.args), Cond(\n        not _avxT(o.t, self.opts),\n            Inherited(o, i, is),\n\tn > 2 and n mod 2 <> 0,\n            self(max(o.args[1], ApplyFunc(max, Drop(o.args, 1))), i, is),\n        n > 2, \n            self(max(ApplyFunc(max, o.args{[1..n/2]}), ApplyFunc(max, o.args{[n/2+1..n]})), i, is),\n        let( sfx := self.ctype_suffix(o.t, _isa(self)),\n         CondPat(o,\n           [max, @TReal, @TVect],\n              self(max(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n           [max, @TVect, @TReal],\n              self(max(o.args[1], vdup(o.args[2],o.t.size)), i, is),\n           [max, @TInt, @TVect],\n              self(max(vdup(_toReal(o.args[1]),o.t.size), o.args[2]), i, is),\n           [max, @TVect, @TInt],\n              self(max(o.args[1], vdup(_toReal(o.args[2]),o.t.size)), i, is),\n           [max, @TVect,   @TVect],\n              self.printf(\"_mm256_max_$1($2, $3)\", [sfx, o.args[1], o.args[2]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")))\n    )),\n\n    min := (self, o, i, is) >> let(n := Length(o.args), Cond(\n        not _avxT(o.t, self.opts),\n            Inherited(o, i, is),\n\tn > 2 and n mod 2 <> 0,\n            self(min(o.args[1], ApplyFunc(min, Drop(o.args, 1))), i, is),\n        n > 2, \n            self(min(ApplyFunc(min, o.args{[1..n/2]}), ApplyFunc(min, o.args{[n/2+1..n]})), i, is),\n        let( sfx := self.ctype_suffix(o.t, _isa(self)),\n         CondPat(o,\n           [min, @TReal, @TVect],\n              self(min(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n           [min, @TVect, @TReal],\n              self(min(o.args[1], vdup(o.args[2],o.t.size)), i, is),\n           [min, @TInt, @TVect],\n              self(min(vdup(_toReal(o.args[1]),o.t.size), o.args[2]), i, is),\n           [min, @TVect, @TInt],\n              self(min(o.args[1], vdup(_toReal(o.args[2]),o.t.size)), i, is),\n           [min, @TVect,   @TVect],\n              self.printf(\"_mm256_min_$1($2, $3)\", [sfx, o.args[1], o.args[2]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")))\n    )),\n    \n    # assuming we have ICC <ia32intrin.h> here\n    log := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx in [\"ps\", \"pd\"], Cond(\n            Length(o.args)>1 and (o.args[2]=2 or o.args[2]=o.t.value(2)),\n                self.printf(\"_mm256_log2_$1($2)\", [sfx, o.args[1]]),\n            Length(o.args)>1 and (o.args[2]=10 or o.args[2]=o.t.value(10)),\n                self.printf(\"_mm256_log10_$1($2)\", [sfx, o.args[1]]),\n            Length(o.args)=1 or o.args[2]=d_exp(1) or o.args[2]=o.t.value(d_exp(1)),\n                self.printf(\"_mm256_log_$1($2)\", [sfx, o.args[1]]),\n            self.printf(\"_mm256_div_$1(_mm256_log_$1($2), _mm256_log_$1($3))\", [sfx, o.args[1]])))),\n        Inherited(o, i, is)),\n\n    # assuming we have ICC <ia32intrin.h> here\n    exp := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx in [\"ps\", \"pd\"], self.printf(\"_mm256_exp_$1($2)\", [sfx, o.args[1]]))),\n        Inherited(o, i, is)),\n\n    # assuming we have ICC <ia32intrin.h> here\n    pow := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx in [\"ps\", \"pd\"], Cond( \n            o.args[1]=2 or o.args[1]=o.t.value(2),\n                self.printf(\"_mm256_exp2_$1($2)\", [sfx, o.args[2]]),\n            o.args[1]=d_exp(1) or o.args[1]=o.t.value(d_exp(1)),\n                self.printf(\"_mm256_exp_$1($2)\", [sfx, o.args[2]]),\n            self.printf(\"_mm256_pow_$1($2, $3)\", [sfx, o.args[1], o.args[2]])))),\n        Inherited(o, i, is)),\n\n    # --------------------------------\n    # logic\n    #\n    bin_xor := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        self.printf(\"_mm256_xor_$1($2, $3)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1], o.args[2]]),\n        Inherited(o, i, is)),\n    bin_and := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        self.printf(\"_mm256_and_$1($2, $3)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1], o.args[2]]),\n        Inherited(o, i, is)),\n    bin_or := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        self.printf(\"_mm256_or_$1($2, $3)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1], o.args[2]]),\n        Inherited(o, i, is)),\n    bin_andnot := (self, o, i, is) >> Cond( _avxT(o.t, self.opts), \n        self.printf(\"_mm256_andnot_$1($2, $3)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1], o.args[2]]),\n        Inherited(o, i, is)),\n\n    # --------------------------------\n    # ISA specific : AVX_4x64f\n    #\n    cmpge_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_cmp_pd\", Concat(o.args, [\"_CMP_GE_OQ\"])),\n    logic_and_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_and_pd\", o.args),\n    logic_xor_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_xor_pd\", o.args),\n\n\n    vloadu_4x64f   := (self, o, i, is) >> self.prefix(\"_mm256_loadu_pd\", o.args),\n    vstoreu_4x64f  := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm256_storeu_pd\", o.args), \";\\n\"),\n\n    vinsert_2l_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_insertf128_pd\", o.args),\n    vloadmask_4x64f  := (self, o, i, is) >> self.printf(\"_mm256_maskload_pd($1, _mm256_set_epi32($2))\", [o.args[1], ()->PrintDel(_vp(o), \", \")]),\n    vbroadcast_4x64f := (self, o, i, is) >> self.printf(\"_mm256_broadcast_sd($1)\", [o.args[1]]),\n    # doublecheck this\n    vextract_2l_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_extractf128_pd\", o.args),\n\n    vstore_2l_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_extractf128_pd\", o.args),\n    vstoremask_4x64f := (self, o, i, is) >> Print(Blanks(i), self.printf(\"_mm256_maskstore_pd($1, _mm256_set_epi32($3), $2)\", [o.args[1], o.args[2], ()->PrintDel(List(_vp(o), e->e.v), \", \")]), \";\\n\"),\n\n    vunpacklo_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_unpacklo_pd\", o.args),\n    vunpackhi_4x64f := (self, o, i, is) >> self.prefix(\"_mm256_unpackhi_pd\", o.args),\n    vpermf128_4x64f := (self, o, i, is) >> self.printf(\"_mm256_permute2f128_pd($1, $2, ($3) | (($4) << 4))\",\n        let(l := _vp(o)-1, [o.args[1], o.args[2], l[1], l[2]])),\n    vshuffle_4x64f := (self, o, i, is) >> self.printf(\"_mm256_shuffle_pd($1, $2, ($3) | (($4) << 1) | (($5) << 2) | (($6) << 3))\",\n        let(l := _vp(o)-1, [o.args[1], o.args[2], l[1], l[2], l[3], l[4]])),\n    vperm_4x64f := (self, o, i, is) >> self.printf(\"_mm256_permute_pd($1, ($2) | (($3) << 1) | (($4) << 2) | (($5) << 3))\",\n        let(l := _vp(o)-1, [o.args[1], l[1], l[2], l[3], l[4]])),\n    vblend_4x64f := (self, o, i, is) >> self.printf(\"_mm256_blend_pd($1, $2, ($3) | (($4) << 1) | (($5) << 2) | (($6) << 3))\",\n        let(l := _vp(o)-1, [o.args[1], o.args[2], l[1], l[2], l[3], l[4]])),\n\n    vuunpacklo_4x64f := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vuunpackhi_4x64f := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vupermf128_4x64f := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vushuffle_4x64f  := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vuperm2_4x64f    := (self, o, i, is) >> self(o.toBinop(), i, is),\n    \n    \n    addsub_4x64f := (self, o, i, is) >> When(Length(o.args) > 2,\n        Error(\"addsub_2x64f is strictly binary\"),\n        CondPat(o,\n           [addsub_4x64f, @TReal, @TVect],\n              self(_computeExpType(addsub_4x64f(vdup(o.args[1],o.t.size), o.args[2])), i, is),\n           [addsub_4x64f, @TVect, @TReal],\n              self(_computeExpType(addsub_4x64f(o.args[1], vdup(o.args[2],o.t.size))), i, is),\n           [addsub_4x64f, @TInt, @TVect],\n              self(_computeExpType(addsub_4x64f(vdup(_toReal(o.args[1]),o.t.size), o.args[2])), i, is),\n           [addsub_4x64f, @TVect, @TInt],\n              self(_computeExpType(addsub_4x64f(o.args[1], vdup(_toReal(o.args[2]),o.t.size))), i, is),\n           [addsub_4x64f, @TVect,   @TVect],\n              self.printf(\"_mm256_addsub_pd($1, $2)\", [o.args[1], o.args[2]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n        )),\n\n    fmaddsub_4x64f := (self, o, i, is) >> When(\n        Length(o.args) <> 3, Error(\"fmaddsub_4x64f is strictly ternary\"),\n        CondPat(o,\n           [fmaddsub_4x64f, @TVect, @TVect, @TVect],\n              self.printf(\"_mm256_fmaddsub_pd($1, $2, $3, 0)\", [o.args[1], o.args[2], o.args[3]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n        )),\n\n    vzero_4x64f := (self, o, i, is) >> Print(\"_mm256_setzero_pd()\"),\n\n    # --------------------------------\n    # ISA specific : AVX_8x32f\n    #\n    logic_and_8x32f := (self, o, i, is) >> self.prefix(\"_mm256_and_ps\", o.args),\n    logic_xor_8x32f := (self, o, i, is) >> self.prefix(\"_mm256_xor_ps\", o.args),\n\n    vloadu_8x32f      := (self, o, i, is) >> self.prefix(\"_mm256_loadu_ps\", o.args),\n    vstoreu_8x32f     := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm256_storeu_ps\", o.args), \";\\n\"),\n\n    vinsert_4l_8x32f  := (self, o, i, is) >> self.prefix(\"_mm256_insertf128_ps\", o.args),\n    vloadmask_8x32f   := (self, o, i, is) >> self.printf(\"_mm256_maskload_ps($1, _mm256_set_epi32($2))\", [o.args[1], ()->PrintDel(_vp(o), \", \")]),\n    vhdup_8x32f       := (self, o, i, is) >> self.printf(\"_mm256_movehdup_ps($1)\", [o.args[1]]),\n    vldup_8x32f       := (self, o, i, is) >> self.printf(\"_mm256_moveldup_ps($1)\", [o.args[1]]),\n\n    vextract_4l_8x32f := (self, o, i, is) >> self.prefix(\"_mm256_extractf128_ps\", o.args),\n    vstore_4l_8x32f   := (self, o, i, is) >> self.prefix(\"_mm256_extractf128_ps\", o.args),\n    vstoremask_8x32f  := (self, o, i, is) >> Print(Blanks(i), self.printf(\"_mm256_maskstore_ps($1, _mm256_set_epi32($3), $2)\", [o.args[1], o.args[2], ()->PrintDel(List(_vp(o), e->e.v), \", \")]), \";\\n\"),\n\n    vunpacklo_8x32f   := (self, o, i, is) >> self.prefix(\"_mm256_unpacklo_ps\", o.args),\n    vunpackhi_8x32f   := (self, o, i, is) >> self.prefix(\"_mm256_unpackhi_ps\", o.args),\n\n    vpermf128_8x32f   := (self, o, i, is) >> self.printf(\"_mm256_permute2f128_ps($1, $2, ($3) | (($4) << 4))\",\n        let(l := _vp(o)-1, [o.args[1], o.args[2], l[1], l[2]])),\n\n    vshuffle_8x32f    := (self, o, i, is) >> self.printf(\"_mm256_shuffle_ps($1, $2, ($3) | (($4) << 2) | (($5) << 4) | (($6) << 6))\",\n        let(l := _vp(o)-1, [o.args[1], o.args[2], l[1], l[2], l[3], l[4]])),\n\n    vperm_8x32f       := (self, o, i, is) >> self.printf(\"_mm256_permute_ps($1, ($2) | (($3) << 2) | (($4) << 4) | (($5) << 6))\",\n        let(l := _vp(o)-1, [o.args[1], l[1], l[2], l[3], l[4]])),\n    vblend_8x32f := (self, o, i, is) >> self.printf(\"_mm256_blend_ps($1, $2, ($3) | (($4) << 1) | (($5) << 2) | (($6) << 3) | (($7) << 4) | (($8) << 5) | (($9) << 6) | (($10) << 7))\",\n        let(l := _vp(o)-1, [o.args[1], o.args[2], l[1], l[2], l[3], l[4], l[5], l[6], l[7], l[8]])),\n\n    vuunpacklo_8x32f := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vuunpackhi_8x32f := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vupermf128_8x32f := (self, o, i, is) >> self(o.toBinop(), i, is),\n    vushuffle_8x32f  := (self, o, i, is) >> self(o.toBinop(), i, is),\n    \n    addsub_8x32f := (self, o, i, is) >> When(Length(o.args) > 2,\n        Error(\"addsub_2x64f is strictly binary\"),\n        CondPat(o,\n           [addsub_8x32f, @TReal, @TVect],\n              self(_computeExpType(addsub_8x32f(vdup(o.args[1],o.t.size), o.args[2])), i, is),\n           [addsub_8x32f, @TVect, @TReal],\n              self(_computeExpType(addsub_8x32f(o.args[1], vdup(o.args[2],o.t.size))), i, is),\n           [addsub_8x32f, @TInt, @TVect],\n              self(_computeExpType(addsub_8x32f(vdup(_toReal(o.args[1]),o.t.size), o.args[2])), i, is),\n           [addsub_8x32f, @TVect, @TInt],\n              self(_computeExpType(addsub_8x32f(o.args[1], vdup(_toReal(o.args[2]),o.t.size))), i, is),\n           [addsub_8x32f, @TVect,   @TVect],\n              self.printf(\"_mm256_addsub_ps($1, $2)\", [o.args[1], o.args[2]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n        )),\n\n    fmaddsub_8x32f := (self, o, i, is) >> When(\n        Length(o.args) <> 3, Error(\"fmaddsub_8x32f is strictly ternary\"),\n        CondPat(o,\n           [fmaddsub_8x32f, @TVect, @TVect, @TVect],\n              self.printf(\"_mm256_fmaddsub_ps($1, $2, $3, 0)\", [o.args[1], o.args[2], o.args[3]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n        )),\n\n    vzero_8x32f := (self, o, i, is) >> Print(\"_mm256_setzero_ps()\"),\n\n    #--------------------------------\n    # Conversion\n\n    vcvt_8x32f_4x64f  := (self, o, i, is) >> self.printf(\"_mm256_cvtpd_ps($1)\", [o.args[1]]),\n    vcvt_4x64f_4x32f  := (self, o, i, is) >> self.printf(\"_mm256_cvtps_pd($1)\", [o.args[1]]),\n    vcvt_4x64f_4x32i  := (self, o, i, is) >> self.printf(\"_mm256_cvtepi32_pd($1)\", [o.args[1]]),\n    vcvt_4x32i_4x64f  := (self, o, i, is) >> self.printf(\"_mm256_cvtpd_epi32($1)\", [o.args[1]]),\n    vcvtt_4x32i_4x64f := (self, o, i, is) >> self.printf(\"_mm256_cvttpd_epi32($1)\", [o.args[1]]),\n    vcvt_8x32f_8x32i  := (self, o, i, is) >> self.printf(\"_mm256_cvtepi32_ps($1)\", [o.args[1]]),\n    vcvt_8x32i_8x32f  := (self, o, i, is) >> self.printf(\"_mm256_cvtps_epi32($1)\", [o.args[1]]),\n    vcvtt_8x32i_8x32f := (self, o, i, is) >> self.printf(\"_mm256_cvttps_epi32($1)\", [o.args[1]]),\n\n\n\n));\n", "meta": {"hexsha": "d68c0902fbfde40afc046430adbec4d6715cb748", "size": 23452, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/avx/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/avx/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/avx/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 50.9826086957, "max_line_length": 201, "alphanum_fraction": 0.507589971, "num_tokens": 8410, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45326186278634367, "lm_q2_score": 0.03846618788475608, "lm_q1q2_score": 0.017435255974934026}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n#   FF: needed to merge integer tables due to SAR grds. not sure where to put yet...\nMergeIntData := function(s, opts)\n    local datas, first, eqdata, subst;\n    datas := Filtered(Set(Collect(s, @(1, var, e->IsBound(e.value) and not IsLoopIndex(e)))), i->i.t.t=TInt); \n\n    while datas <> [] do    \n        first := datas[1];\n        datas := Drop(datas, 1);\n        eqdata := Filtered(datas, i->i.value=first.value);\n        if Length(eqdata) > 0 then\n            SubtractSet(datas, Set(eqdata));\n            for subst in eqdata do\n                SubstVars(s, rec((subst.id) := first));\n            od;\n        fi;\n    od;\n    return s;\nend;\n\n\n", "meta": {"hexsha": "fbf905c4e63af3dfd9901744d07c48a762751d5d", "size": 728, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/inttab.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/inttab.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/inttab.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.12, "max_line_length": 110, "alphanum_fraction": 0.5741758242, "num_tokens": 199, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.39606818053136394, "lm_q2_score": 0.04401864782501479, "lm_q1q2_score": 0.017434385753504488}}
{"text": "#############################################################################\n##\n#W  selfsimgroup.gi           automgrp package                 Yevgen Muntyan\n#W                                                             Dmytro Savchuk\n##\n#Y  Copyright (C) 2003 - 2018 Yevgen Muntyan, Dmytro Savchuk\n##\n\n\n###############################################################################\n##\n#M  SelfSimilarGroup(<list>)\n##\nInstallMethod(SelfSimilarGroup, \"for [IsList]\", [IsList],\nfunction(list)\n  return SelfSimilarGroup(list, false);\nend);\n\n\n###############################################################################\n##\n#M  SelfSimilarGroup(<list>, <bind_vars>)\n##\nInstallMethod(SelfSimilarGroup, \"for [IsList, IsBool]\", [IsList, IsBool],\nfunction(list, bind_vars)\n  if not AG_IsCorrectRecurList(list, true) then\n    Error(\"in SelfSimilarGroup(IsList, IsBool):\\n\",\n          \"  given list is not a correct list representing self-similar group\\n\");\n  fi;\n\n  return GroupOfSelfSimFamily(SelfSimFamily(list, bind_vars));\nend);\n\n\n###############################################################################\n##\n#M  SelfSimilarGroup(<list>, <names>)\n##\nInstallMethod(SelfSimilarGroup, \"for [IsList, IsList]\", [IsList, IsList],\nfunction(list, names)\n  return SelfSimilarGroup(list, names, AG_Globals.bind_vars_autom_family);\nend);\n\n\n###############################################################################\n##\n#M  SelfSimilarGroup(<list>, <names>, <bind_vars>)\n##\nInstallMethod(SelfSimilarGroup,\n              \"for [IsList, IsList, IsBool]\", [IsList, IsList, IsBool],\nfunction(list, names, bind_vars)\n  if not AG_IsCorrectRecurList(list, true) then\n    Error(\"error in SelfSimilarGroup(IsList, IsList, IsBool):\\n\",\n          \"  given list is not a correct list representing self-similar group\\n\");\n  fi;\n\n  return GroupOfSelfSimFamily(SelfSimFamily(list, names, bind_vars));\nend);\n\n\n###############################################################################\n##\n#M  SelfSimilarGroup(<string>)\n#M  SelfSimilarGroup(<string>, <bind_vars>)\n##\nInstallMethod(SelfSimilarGroup, \"for [IsString]\", [IsString],\nfunction(string)\n  return SelfSimilarGroup(string, AG_Globals.bind_vars_autom_family);\nend);\n\nInstallMethod(SelfSimilarGroup, \"for [IsString, IsBool]\", [IsString, IsBool],\nfunction(string, bind_vars)\n  local s;\n  s := AG_ParseAutomatonStringFR(string);\n  return SelfSimilarGroup(s[2], s[1], bind_vars);\nend);\n\n\n###############################################################################\n##\n#M  SelfSimilarGroup(<A>)\n#M  SelfSimilarGroup(<A>, <bind_vars>)\n##\nInstallMethod(SelfSimilarGroup, \"for [IsMealyAutomaton]\", [IsMealyAutomaton],\nfunction(A)\n  if not IsInvertible(A) then\n    Error(\"Automaton <A> is not invertible\");\n  fi;\n  return SelfSimilarGroup(AutomatonList(A), A!.states);\nend);\n\nInstallMethod(SelfSimilarGroup, \"for [IsMealyAutomaton, IsBool]\", [IsMealyAutomaton, IsBool],\nfunction(A, bind_vars)\n  if not IsInvertible(A) then\n    Error(\"Automaton <A> is not invertible\");\n  fi;\n  return SelfSimilarGroup(AutomatonList(A), A!.states, bind_vars);\nend);\n\n\n\n###############################################################################\n##\n#M  GroupOfSelfSimFamily(<G>)\n##\nInstallMethod(GroupOfSelfSimFamily, \"for [IsSelfSimGroup]\",\n                   [IsSelfSimGroup],\nfunction(G)\n  return GroupOfSelfSimFamily(UnderlyingSelfSimFamily(G));\nend);\n\n\n###############################################################################\n##\n#M  IsGroupOfSelfSimFamily(<G>)\n##\nInstallMethod(IsGroupOfSelfSimFamily, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  return G = GroupOfSelfSimFamily(G);\nend);\n\n\n###############################################################################\n##\n#M  UseSubsetRelation(<G>)\n##\nInstallMethod(UseSubsetRelation,\n              \"for [IsSelfSimGroup, IsSelfSimGroup]\",\n              [IsSelfSimGroup, IsSelfSimGroup],\nfunction(super, sub)\n  ## the full group is self similar, so if <super> is smaller than the full\n  ##  group then sub is smaller either\n  if HasIsGroupOfSelfSimFamily(super) then\n    if not IsGroupOfSelfSimFamily(super) then\n      SetIsGroupOfSelfSimFamily(sub, false); fi; fi;\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  __AG_SubgroupOnLevel(<G>, <gens>, <level>)\n##\nInstallMethod(__AG_SubgroupOnLevel, [IsSelfSimGroup,\n                                    IsList and IsTreeAutomorphismCollection,\n                                    IsPosInt],\nfunction(G, gens, level)\n  local overgroup;\n\n  if IsEmpty(gens) or (Length(gens) = 1 and IsOne(gens[1])) then\n    return TrivialSubgroup(G);\n  fi;\n\n  if HasIsGroupOfSelfSimFamily(G) and IsGroupOfSelfSimFamily(G) then\n    overgroup := G;\n  else\n    overgroup := GroupOfSelfSimFamily(UnderlyingSelfSimFamily(G));\n  fi;\n\n  return SubgroupNC(overgroup, gens);\nend);\n\nInstallOtherMethod(__AG_SubgroupOnLevel, [IsSelfSimGroup, IsList and IsEmpty, IsPosInt],\nfunction(G, gens, level)\n  return TrivialSubgroup(G);\nend);\n\nInstallMethod(__AG_SubgroupOnLevel, [IsTreeAutomorphismGroup,\n                                    IsList and IsSelfSimCollection,\n                                    IsPosInt],\nfunction(G, gens, level)\n  local overgroup;\n\n  overgroup := GroupOfSelfSimFamily(FamilyObj(gens[1]));\n\n  if Length(gens) = 1 and IsOne(gens[1]) then\n    return TrivialSubgroup(overgroup);\n  fi;\n\n  return SubgroupNC(overgroup, gens);\nend);\n\nInstallMethod(__AG_SimplifyGroupGenerators, \"for [IsList and IsInvertibleSelfSimCollection]\",\n                          [IsList and IsInvertibleSelfSimCollection],\nfunction(gens)\n  local words, fam;\n\n  if IsEmpty(gens) then\n    return [];\n  fi;\n\n  fam := FamilyObj(gens[1]);\n  words := FreeGeneratorsOfGroup(Group(List(gens, a -> a!.word)));\n\n  if fam!.use_rws and not IsEmpty(words) then\n    words := AG_ReducedForm(fam!.rws, words);\n    if IsEmpty(words) then\n      return [];\n    fi;\n    words := FreeGeneratorsOfGroup(Group(words));\n  fi;\n\n  return List(words, w -> SelfSim(w, fam));\nend);\n\n###############################################################################\n##\n#M  PrintObj(<G>)\n##\nInstallMethod(PrintObj, \"for [IsSelfSimilarGroup]\",\n              [IsSelfSimilarGroup],\nfunction(G)\n  Print(\"SelfSimilarGroup(\\\"\", String(G), \"\\\")\");\nend);\n\n\n###############################################################################\n##\n#M  Display(<G>)\n##\nInstallMethod(Display, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  local i, gens, printone;\n\n  printone := function(a)\n    Print(a, \" = \", Decompose(a));\n  end;\n\n  gens := GeneratorsOfGroup(G);\n  if gens = [] then Print(\"< >\"); fi;\n  if Length(gens) = 1 then\n    Print(\"< \"); printone(gens[1]); Print(\" >\");\n  else\n    Print(\"< \"); printone(gens[1]); Print(\", \\n\");\n    for i in [2..Length(gens)-1] do\n      Print(\"  \"); printone(gens[i]); Print(\", \\n\");\n    od;\n    Print(\"  \"); printone(gens[Length(gens)]); Print(\" >\");\n  fi;\nend);\n\n\n#############################################################################\n##\n#M  String(<G>)\n##\nInstallMethod(String, \"for [IsSelfSimGroup]\", [IsSelfSimGroup],\nfunction(G)\n  local i, gens, formatone, s;\n\n  formatone := function(a)\n    return Concatenation(String(a), \" = \", String(Decompose(a)));\n  end;\n\n  gens := GeneratorsOfGroup(G);\n\n  s := \"\";\n  for i in [1..Length(gens)] do\n    Append(s, formatone(gens[i]));\n    if i <> Length(gens) then\n      Append(s, \", \");\n    fi;\n  od;\n\n  return s;\nend);\n\n\n###############################################################################\n##\n#M  ViewObj(<G>)\n##\nInstallMethod(ViewObj, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  local i, gens;\n  gens := List(GeneratorsOfGroup(G), g -> Word(g));\n  if gens = [] then Print(\"< >\"); fi;\n  Print(\"< \");\n  for i in [1..Length(gens)-1] do\n    if IsOne(gens[i]) then\n      Print(AG_Globals.identity_symbol, \", \");\n    else\n      Print(gens[i], \", \");\n    fi;\n  od;\n  if IsOne(gens[Length(gens)]) then\n    Print(AG_Globals.identity_symbol, \" >\");\n  else\n    Print(gens[Length(gens)], \" >\");\n  fi;\nend);\n\n\n\n###############################################################################\n##\n#M  IsFractalByWords(G)\n##\nInstallMethod(IsFractalByWords, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction (G)\n  local freegens, stab, i, sym, f;\n\n  sym := GroupWithGenerators(List(GeneratorsOfGroup(G), g -> Perm(g)));\n  if not IsTransitive(sym, [1..DegreeOfTree(G)]) then\n    Info(InfoAutomGrp, 1, \"group is not transitive on first level\");\n    return false;\n  fi;\n\n  f := GroupWithGenerators(List(GeneratorsOfGroup(G), g -> Word(g)));\n  stab := StabilizerOfFirstLevel(G);\n  stab := List(GeneratorsOfGroup(stab), a -> StatesWords(a));\n\n  for i in [1..DegreeOfTree(G)] do\n    if f <> GroupWithGenerators(List(stab, s -> s[i])) then\n      return false;\n    fi;\n  od;\n  return true;\nend);\n\n\n###############################################################################\n##\n#M  Size(G)\n##\nInstallMethod(Size, \"for [IsSelfSimGroup]\", [IsSelfSimGroup],\nfunction (G)\n  local f;\n  if IsTrivial(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): 1, G is trivial\");\n    return 1;\n  fi;\n\n  if CanEasilyTestSphericalTransitivity(G) and IsSphericallyTransitive(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): infinity, G is spherically transitive\");\n    return infinity;\n  fi;\n\n  if IsFractalByWords(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): infinity, G is fractal by words\");\n    return infinity;\n  fi;\n\n  if HasIsFractal(G) and IsFractal(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): infinity, G is fractal\");\n    return infinity;\n  fi;\n\n  if IsSelfSimilarGroup(G) and LevelOfFaithfulAction(G, 8)<>fail then\n    return Size(G);\n  fi;\n\n  f := FindElementOfInfiniteOrder(G, 10, 10);\n\n  if HasSize(G) or f <> fail then\n    return Size(G);\n  fi;\n\n  Info(InfoAutomGrp, 1, \"You can try to use IsomorphismPermGroup(<G>) or\\n\",\n                        \"   FindElementOfInfiniteOrder( <G>, <length>, <depth> ) with bigger bounds\");\n  TryNextMethod();\nend);\n\n\nInstallOtherMethod(LevelOfFaithfulAction, \"for [IsSelfSimGroup and IsSelfSimilar, IsCyclotomic]\",\n              [IsSelfSimGroup and IsSelfSimilar, IsCyclotomic],\nfunction(G, max_lev)\n  local s, s_next, lev;\n  if HasIsFinite(G) and not IsFinite(G) then return fail; fi;\n  if HasLevelOfFaithfulAction(G) then return LevelOfFaithfulAction(G); fi;\n  lev := 0; s := 1; s_next := Size(PermGroupOnLevel(G, 1));\n  while s<s_next and lev<max_lev do\n    lev := lev+1;\n    s := s_next;\n    s_next := Size(PermGroupOnLevel(G, lev+1));\n  od;\n  if s=s_next then\n    SetSize(G, s);\n    SetLevelOfFaithfulAction(G, lev);\n    return lev;\n  else\n    return fail;\n  fi;\nend);\n\n\nInstallMethod(LevelOfFaithfulAction, \"for [IsSelfSimGroup and IsSelfSimilar]\",\n              [IsSelfSimGroup and IsSelfSimilar],\nfunction(G)\n  return LevelOfFaithfulAction(G, infinity);\nend);\n\n\n################################################################################\n##\n#O  IsomorphismPermGroup (<G>)\n#O  IsomorphismPermGroup (<G>, <max_lev>)\n##\n##  For a given finite group <G> generated by initial automata or by elements defined by\n##  wreath recursion\n##  computes an isomorphism from <G> into a finite permutational group.\n##  If <G> is not known to be self-similar (see \"IsSelfSimilar\") the isomorphism is based on the\n##  regular representation, which works generally much slower. If <G> is self-similar\n##  there is a level of the tree (see \"LevelOfFaithfulAction\"), where <G> acts faithfully.\n##  The corresponding representation is returned in this case. If <max_lev> is given\n##  it finds only the first <max_lev> quotients by stabilizers and if all of them have\n##  different size it returns `fail'.\n##  If <G> is infinite and <max_lev> is not specified it will loop forever.\n##\n##  For example, consider a subgroup $\\langle a, b\\rangle$ of Grigorchuk group.\n##  \\beginexample\n##  gap> Grigorchuk_Group := AutomatonGroup(\"a=(1,1)(1,2),b=(a,c),c=(a,d),d=(1,b)\");\n##  < a, b, c, d >\n##  gap> f := IsomorphismPermGroup(Group(a, b));\n##  MappingByFunction( < a, b >, Group(\n##  [ (1,2)(3,5)(4,6)(7,9)(8,10)(11,13)(12,14)(15,17)(16,18)(19,21)(20,22)(23,\n##      25)(24,26)(27,29)(28,30)(31,32), (1,3)(2,4)(5,7)(6,8)(9,11)(10,12)(13,\n##      15)(14,16)(17,19)(18,20)(21,23)(22,24)(25,27)(26,28)(29,31)(30,32)\n##   ]), function( g ) ... end, function( b ) ... end )\n##  gap> Size(Image(f));\n##  32\n##  gap> H := SelfSimilarGroup(\"a=(a*b,1)(1,2), b=(1,b*a^-1)(1,2), c=(b, a*b)\");\n##  < a, b, c >\n##  gap> f1 := IsomorphismPermGroup(H);\n##  MappingByFunction( < a, b, c >, Group([ (1,3)(2,4), (1,3)(2,4), (1,2)\n##   ]), function( g ) ... end, function( b ) ... end )\n##  gap> Size(Image(f1));\n##  8\n##  gap> PreImagesRepresentative(f1, (1,3,2,4));\n##  a*c\n##  gap> (a*c)^f1;\n##  (1,3,2,4)\n##  \\endexample\n##\nInstallOtherMethod(IsomorphismPermGroup, \"for [IsSelfSimilarGroup, IsCyclotomic]\",\n                   [IsSelfSimGroup and IsSelfSimilar, IsCyclotomic],\nfunction (G, n)\n  local H, lev;\n  lev := LevelOfFaithfulAction(G, n);\n  if lev <> fail then\n    H := PermGroupOnLevel(G, LevelOfFaithfulAction(G));\n    return AG_GroupHomomorphismByImagesNC(G, H, GeneratorsOfGroup(G), GeneratorsOfGroup(H));\n  fi;\n  return fail;\nend);\n\n\n###############################################################################\n##\n#M  IsSphericallyTransitive(G)\n##\nInstallMethod(IsSphericallyTransitive, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction (G)\n  local x, rat_gens, abel_hom, lev;\n\n  if IsFractalByWords(G) then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n    Info(InfoAutomGrp, 3, \"  G is fractal\");\n    return true;\n  fi;\n\n  if IsTrivial(G) then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): false\");\n    Info(InfoAutomGrp, 3, \"  G is trivial: G = \", G);\n    return false;\n  fi;\n\n  if HasIsFinite(G) and IsFinite(G) then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): false\");\n    Info(InfoAutomGrp, 3, \"  IsFinite(G): G = \", G);\n    return false;\n  fi;\n\n  if DegreeOfTree(G) = 2 and TestSelfSimilarity(G) and IsSelfSimilar(G) then\n    if HasIsFinite(G) and IsFinite(G)=false then\n      Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n      Info(InfoAutomGrp, 3, \"  <G> is infinite self-similar acting on binary tree\");\n      return true;\n    fi;\n    if PermGroupOnLevel(G, 2)=Group((1, 4, 2, 3)) then\n      Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n      Info(InfoAutomGrp, 3, \"  any element which acts transitively on the first level acts spherically transitively\");\n      return true;\n    fi;\n  fi;\n\n  for lev in [1..8] do\n    if not IsTransitiveOnLevel(G,lev) then\n      Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): false\");\n      Info(InfoAutomGrp, 3, \"  the group does not act transitively on level \", lev);\n      return false;\n    fi;\n  od;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  DiagonalPower(<G>, <n>)\n##\nInstallOtherMethod( DiagonalPower,\n                    \"for [IsSelfSimGroup and IsGroupOfSelfSimFamily, IsPosInt]\",\n                    [IsSelfSimGroup and IsGroupOfSelfSimFamily, IsPosInt],\nfunction(G, n)\n  return DiagonalPower(UnderlyingSelfSimFamily(G), n);\nend);\n\n\n###############################################################################\n##\n#M  MultAutomAlphabet(<G>, <n>)\n##\nInstallOtherMethod( MultAutomAlphabet,\n                    \"for [IsSelfSimGroup and IsGroupOfSelfSimFamily, IsPosInt]\",\n                    [IsSelfSimGroup and IsGroupOfSelfSimFamily, IsPosInt],\nfunction(G, n)\n  return MultAutomAlphabet(UnderlyingSelfSimFamily(G), n);\nend);\n\n\n###############################################################################\n##\n#M  \\= (<G>, <H>)\n##\nInstallMethod(\\=, \"for [IsSelfSimGroup, IsSelfSimGroup]\",\n              IsIdenticalObj, [IsSelfSimGroup, IsSelfSimGroup],\nfunction(G, H)\n  local fgens1, fgens2, fam;\n\n  if HasIsGroupOfSelfSimFamily(G) and HasIsGroupOfSelfSimFamily(H) then\n    if IsGroupOfSelfSimFamily(G) <> IsGroupOfSelfSimFamily(H) then\n      Info(InfoAutomGrp, 3, \"G = H: false, exactly one is GroupOfSelfSimFamily\");\n      return false;\n    fi;\n    if IsGroupOfSelfSimFamily(G) then\n      Info(InfoAutomGrp, 3, \"G = H: true, both are GroupOfSelfSimFamily\");\n      return true;\n    fi;\n  fi;\n\n  fgens1 := List(GeneratorsOfGroup(G), g -> Word(g));\n  fgens2 := List(GeneratorsOfGroup(H), g -> Word(g));\n  fam := UnderlyingSelfSimFamily(G);\n\n  if fam!.rws <> fail then\n    fgens1 := AG_ReducedForm(fam!.rws, fgens1);\n    fgens2 := AG_ReducedForm(fam!.rws, fgens2);\n  fi;\n\n  if GroupWithGenerators(fgens1) = GroupWithGenerators(fgens2) then\n    Info(InfoAutomGrp, 3, \"G = H: true, by subgroups of free group\");\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  IsSubset (<G>, <H>)\n##\nInstallMethod(IsSubset, \"for [IsSelfSimGroup, IsSelfSimGroup]\",\n              IsIdenticalObj, [IsSelfSimGroup, IsSelfSimGroup],\nfunction(G, H)\n  local h, fam, fgens1, fgens2;\n\n  if HasIsGroupOfSelfSimFamily(G) and IsGroupOfSelfSimFamily(G) then\n    Info(InfoAutomGrp, 3, \"IsSubgroup(G, H): true\");\n    Info(InfoAutomGrp, 3, \"  G is GroupOfSelfSimFamily\");\n    return true;\n  fi;\n\n  fgens1 := List(GeneratorsOfGroup(G), g -> Word(g));\n  fgens2 := List(GeneratorsOfGroup(H), g -> Word(g));\n  fam := UnderlyingSelfSimFamily(G);\n\n  if fam!.rws <> fail then\n    fgens1 := AG_ReducedForm(fam!.rws, fgens1);\n    fgens2 := AG_ReducedForm(fam!.rws, fgens2);\n  fi;\n\n  if IsSubgroup(GroupWithGenerators(fgens1), GroupWithGenerators(fgens2)) then\n    Info(InfoAutomGrp, 3, \"IsSubgroup(G, H): true\");\n    Info(InfoAutomGrp, 3, \"  by subgroups of free group\");\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  <g> in <G>\n##\nInstallMethod(\\in, \"for [IsSelfSim, IsSelfSimGroup]\",\n              [IsSelfSim, IsSelfSimGroup],\nfunction(g, G)\n  local fam, fgens, w;\n\n  if HasIsGroupOfSelfSimFamily(G) and IsGroupOfSelfSimFamily(G) then\n    return true;\n  fi;\n\n  fgens := List(GeneratorsOfGroup(G), g -> Word(g));\n  w := Word(g);\n\n  fam := UnderlyingSelfSimFamily(G);\n\n  if fam!.rws <> fail then\n    fgens := AG_ReducedForm(fam!.rws, fgens);\n    w := AG_ReducedForm(fam!.rws, w);\n  fi;\n\n  if w in GroupWithGenerators(fgens) then\n    Info(InfoAutomGrp, 3, \"g in G: true\");\n    Info(InfoAutomGrp, 3, \"  by elements of free group\");\n    Info(InfoAutomGrp, 3, \"  g = \", g, \"; G = \", G);\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#O  Random(<G>)\n##\n##  Returns a random element of a group (semigroup) <G>. The operation is based\n##  on the generator of random elements in free groups and semigroups.\n##\n##  \\beginexample\n##  gap> Basilica := AutomatonGroup( \"u=(v,1)(1,2), v=(u,1)\" );\n##  < u, v >\n##  gap> Random( Basilica );\n##  v*u^-3\n##  \\endexample\n##\nInstallMethodWithRandomSource(Random, \"for a random source and [IsSelfSimGroup]\",\n              [IsRandomSource, IsSelfSimGroup],\nfunction(rs, G)\n  local F, gens, pi;\n\n  if IsTrivial(G) then\n    return One(G);\n  elif IsSelfSimilarGroup(G) then\n    return SelfSim(Random(rs, UnderlyingFreeGroup(G)), UnderlyingSelfSimFamily(G));\n  else\n    gens := GeneratorsOfGroup(G);\n    F := FreeGroup(Length(gens));\n    pi := GroupHomomorphismByImagesNC(F, G,  GeneratorsOfGroup(F), gens);\n    return Random(rs, F)^pi;\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeSubgroup(<G>)\n##\nInstallMethod(UnderlyingFreeSubgroup, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  local f;\n  if HasIsGroupOfSelfSimFamily(G) and IsGroupOfSelfSimFamily(G) then\n    return UnderlyingFreeGroup(G);\n  fi;\n  f := Subgroup(UnderlyingFreeGroup(G), UnderlyingFreeGenerators(G));\n  if f = UnderlyingFreeGroup(G) then\n    SetIsGroupOfSelfSimFamily(G, true);\n  fi;\n  return f;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeGenerators(<G>)\n##\nInstallMethod(UnderlyingFreeGenerators, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  return List(GeneratorsOfGroup(G), g -> Word(g));\nend);\n\n\n###############################################################################\n##\n#M  TrivialSubmagmaWithOne(<G>)\n##\nInstallMethod(TrivialSubmagmaWithOne, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  return Subgroup(G, [One(G)]);\nend);\n\n\n###############################################################################\n##\n#M  IsSelfSimilarGroup(<G>)\n##\n##  Returns `true' if generators of <G> coincide with generators of the family\nInstallImmediateMethod(IsSelfSimilarGroup, IsSelfSimGroup, 0,\nfunction(G)\n  local fam;\n  fam := UnderlyingSelfSimFamily(G);\n  return fam!.numstates = 0 or\n         GeneratorsOfGroup(G) = fam!.recurgens{[1..fam!.numstates]};\nend);\n\n\n###############################################################################\n##\n#M  RecurList(<G>)\n##\nInstallMethod(RecurList, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  if IsSelfSimilarGroup(G) then\n    return RecurList(GroupOfSelfSimFamily(UnderlyingSelfSimFamily(G)));\n  else\n    Error(\"Group <G> is not necessarily self-similar\");\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  IsSelfSimilar(<G>)\n##\nInstallMethod(IsSelfSimilar, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  local g, i, res;\n  res := true;\n  for g in GeneratorsOfGroup(G) do\n    for i in [1..UnderlyingSelfSimFamily(G)!.deg] do\n      res := Section(g, i) in G;\n      if res = fail then\n        TryNextMethod();\n      elif not res then\n        return false;\n      fi;\n    od;\n  od;\n  return true;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingSelfSimFamily(<G>)\n##\nInstallMethod(UnderlyingSelfSimFamily, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  return FamilyObj(GeneratorsOfGroup(G)[1]);\nend);\n\n\n###############################################################################\n##\n#M  IsFiniteState(<G>)\n##\nInstallMethod(IsFiniteState, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  local states, MealyAutomatonLocal, aut_list, gens, images, H, g, hom_function, \\\n        inv_hom_function, hom, free_groups_hom, inv_free_groups_hom, inv_hom, \\\n        gens_in_freegrp, images_in_freegrp, preimages_in_freegrp, F, pi, pi_bar, \\\n        preimage_in_freegrp, MealyAutomatonLocalFinite;\n\n# if we do not know much, we compare just words in free group\n  MealyAutomatonLocal := function(g)\n    local cur_state;\n    if g!.word in states then return Position(states, g!.word); fi;\n    Add(states, g!.word);\n    cur_state := Length(states);\n    aut_list[cur_state] := List([1..g!.deg], x -> MealyAutomatonLocal(Section(g, x)));\n    Add(aut_list[cur_state], g!.perm);\n    return cur_state;\n  end;\n\n# if we do know that the groups is finite, we compare actual elements of the group\n  MealyAutomatonLocalFinite := function(g)\n    local cur_state;\n    if g in states then return Position(states, g); fi;\n    Add(states, g);\n    cur_state := Length(states);\n    aut_list[cur_state] := List([1..g!.deg], x -> MealyAutomatonLocalFinite(Section(g, x)));\n    Add(aut_list[cur_state], g!.perm);\n    return cur_state;\n  end;\n\n\n  if IsTrivial(G) then return true; fi;\n\n  states := [];\n  aut_list := [];\n  gens := GeneratorsOfGroup(G);\n  images := [];\n\n\n  if HasIsFinite(G) and IsFinite(G) then\n    for g in gens do\n      Add(images, MealyAutomatonLocalFinite(g));\n    od;\n    states := List(states, Word);\n  else\n    for g in gens do\n      Add(images, MealyAutomatonLocal(g));\n    od;\n  fi;\n\n  H := AutomatonGroup(aut_list);\n\n  if IsTrivial(H) then\n    SetIsTrivial( G, true);\n    return true;\n  fi;\n\n  images := UnderlyingAutomFamily(H)!.oldstates{images};\n\n  SetIsomorphicAutomGroup(G, GroupWithGenerators(UnderlyingAutomFamily(H)!.automgens{images}));\n  SetUnderlyingAutomatonGroup(G, H);\n\n# preimages of generators of G in UnderlyingFreeGroup(G)\n  gens_in_freegrp := List(GeneratorsOfGroup(G), Word);\n\n# preimages of generators of a subgroup of H isomorphic to G in UnderlyingFreeGroup(H)\n  images_in_freegrp := List(UnderlyingAutomFamily(H)!.automgens{images}, Word);\n\n\n  preimage_in_freegrp := function(x)\n    local w;\n    w := LetterRepAssocWord(x!.word)[1];\n    if w > 0 then\n      return states[ Position( UnderlyingAutomFamily(H)!.oldstates, w)];\n    else\n      return states[ Position( UnderlyingAutomFamily(H)!.oldstates, -w+UnderlyingAutomFamily(H)!.numstates)];\n    fi;\n  end;\n\n#  preimages of generators of H in UnderlyingFreeGroup(G)\n#  preimages_in_freegrp := List([1..Length(GeneratorsOfGroup(H))], x->states[Position(UnderlyingAutomFamily(H)!.oldstates, x)]);\n  preimages_in_freegrp := List(GeneratorsOfGroup(H), x -> preimage_in_freegrp(x));\n\n\n  if IsSelfSimilarGroup(G) then\n    free_groups_hom :=\n       GroupHomomorphismByImagesNC( Group(gens_in_freegrp), UnderlyingFreeGroup(H),\n                                    gens_in_freegrp, images_in_freegrp );\n\n    inv_free_groups_hom :=\n       GroupHomomorphismByImagesNC( UnderlyingFreeGroup(H), UnderlyingFreeGroup(G),\n                                    UnderlyingFreeGenerators(H), preimages_in_freegrp );\n\n    hom_function := function(a)\n      return Autom(Image(free_groups_hom, a!.word), UnderlyingAutomFamily(H));\n    end;\n\n    inv_hom_function :=  function(b)\n      return SelfSim(Image(inv_free_groups_hom, b!.word), UnderlyingSelfSimFamily(G));\n    end;\n\n    hom := GroupHomomorphismByFunction(G, GroupWithGenerators(UnderlyingAutomFamily(H)!.automgens{images}), hom_function, inv_hom_function);\n\n    SetMonomorphismToAutomatonGroup(G, hom);\n  else\n    F := FreeGroup(Length(GeneratorsOfGroup(G)));\n\n#        pi\n#    F ------> G ----> UnderlyingFreeGroup(H)\n#      -------------->\n#            pi_bar\n\n    pi := GroupHomomorphismByImages(F,                     Group(gens_in_freegrp),\n                                    GeneratorsOfGroup(F),  gens_in_freegrp);\n\n    pi_bar := GroupHomomorphismByImages(F,                     UnderlyingFreeGroup(H),\n                                        GeneratorsOfGroup(F),  images_in_freegrp);\n\n    hom_function := function(g)\n      return Autom(Image(pi_bar, PreImagesRepresentative(pi, g!.word)), UnderlyingAutomFamily(H));\n    end;\n\n\n    inv_hom_function :=  function(b)\n      return SelfSim(Image(pi, PreImagesRepresentative(pi_bar, b!.word)), UnderlyingSelfSimFamily(G));\n    end;\n\n    hom := GroupHomomorphismByFunction(G, GroupWithGenerators(UnderlyingAutomFamily(H)!.automgens{images}), hom_function, inv_hom_function);\n\n    SetMonomorphismToAutomatonGroup(G, hom);\n  fi;\n\n\n  return true;\nend);\n\n\n###############################################################################\n##\n#M  IsomorphicAutomGroup( <G> )\n##\nInstallMethod(IsomorphicAutomGroup, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  if IsFiniteState(G) then return IsomorphicAutomGroup(G); fi;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingAutomatonGroup( <G> )\n##\nInstallMethod(UnderlyingAutomatonGroup, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  if IsFiniteState(G) then return UnderlyingAutomatonGroup(G); fi;\nend);\n\n###############################################################################\n##\n#M  MonomorphismToAutomatonGroup( <G> )\n##\nInstallMethod(MonomorphismToAutomatonGroup, \"for [IsSelfSimGroup]\",\n              [IsSelfSimGroup],\nfunction(G)\n  if IsFiniteState(G) then return MonomorphismToAutomatonGroup(G); fi;\nend);\n\n\n\n###############################################################################\n##\n#M  IsContracting( <G> )\n##\nInstallMethod(IsContracting, \"for [IsSelfSimilarGroup]\",\n              [IsSelfSimilarGroup],\nfunction(G)\n  local res;\n  if not IsFiniteState(G) then\n#   every contracting self-similar group is finite-state\n    return false;\n  fi;\n\n  res := IsContracting(GroupOfAutomFamily(UnderlyingAutomFamily(UnderlyingAutomatonGroup(G))));\n\n  UnderlyingSelfSimFamily(G)!.use_contraction := true;\n  UnderlyingAutomFamily(UnderlyingAutomatonGroup(G))!.use_contraction := true;\n\n  return res;\nend);\n\n\n\n###############################################################################\n##\n#M  GroupNucleus( <G> )\n##\nInstallMethod(GroupNucleus, \"for [IsSelfSimilarGroup]\",\n              [IsSelfSimilarGroup],\nfunction(G)\n  local H;\n  if not IsFiniteState(G) then\n#   every contracting self-similar group is finite-state\n    Error(\"Group <G> is not finite-state\");\n  fi;\n\n  if not IsContracting(G) then\n    Error(\"Group <G> is not contracting\");\n  fi;\n\n  H := GroupOfAutomFamily( UnderlyingAutomFamily( UnderlyingAutomatonGroup(G)));\n\n  return List( GroupNucleus(H), x -> PreImagesRepresentative( MonomorphismToAutomatonGroup(G), x));\nend);\n\n\n\n###############################################################################\n##\n#M  UseContraction( <G> )\n##\nInstallMethod(UseContraction, \"for [IsSelfSimGroup]\", true,\n              [IsSelfSimGroup],\nfunction(G)\n  if not IsSelfSimilarGroup(G) then\n    Print(\"Error in UseContraction(<G>): The method is implemented only for IsSelfSimilarGroup\\n\");\n    return fail;\n  fi;\n\n  if not HasIsContracting(G) then\n    Print(\"Error in UseContraction(<G>): It is not known whether the group <G> is contracting\\n\");\n    return fail;\n  elif not IsContracting(G) then\n    Print(\"Error in UseContraction(<G>): The group <G> is not contracting\");\n    return fail;\n  fi;\n  #  IsContracting returns either true or false or an error (it can not return fail)\n\n  UnderlyingSelfSimFamily(G)!.use_contraction := true;\n  UnderlyingAutomFamily( UnderlyingAutomatonGroup(G))!.use_contraction := true;\n\n  return true;\nend);\n\n\n\n###############################################################################\n##\n#M  DoNotUseContraction( <G> )\n##\nInstallMethod(DoNotUseContraction, \"for [IsSelfSimGroup]\", true,\n              [IsSelfSimGroup],\nfunction(G)\n  UnderlyingAutomFamily(G)!.use_contraction := false;\n\n  if HasUnderlyingAutomatonGroup(G) then\n    UnderlyingAutomFamily( UnderlyingAutomatonGroup(G))!.use_contraction := false;\n  fi;\n  return true;\nend);\n\n\n\n\n###############################################################################\n##\n#M  FindNucleus( <G> )\n##\nInstallMethod(FindNucleus, \"for [IsSelfSimilarGroup, IsCyclotomic]\",\n              [IsSelfSimilarGroup, IsCyclotomic],\nfunction(G, max_nucl)\n  local H, nuclH, nuclG;\n  if not IsFiniteState(G) then\n#   every contracting self-similar group is finite-state\n    Error(\"Group <G> is not finite-state\");\n  fi;\n\n  if HasIsContracting(G) and not IsContracting(G) then\n    Error(\"Group <G> is not contracting\");\n  fi;\n\n  H := GroupOfAutomFamily( UnderlyingAutomFamily( UnderlyingAutomatonGroup( G )));\n\n  if HasIsContracting(H) and not IsContracting(H) then\n    Error(\"Group <G> is not contracting\");\n  fi;\n\n  nuclH := FindNucleus(H, max_nucl);\n\n  if nuclH=fail then return fail; fi;\n\n  nuclG := [];\n  Add(nuclG, List( GeneratingSetWithNucleus(H), x -> PreImagesRepresentative( MonomorphismToAutomatonGroup( G ), x )));\n  Add(nuclG, List( GroupNucleus(H), x -> PreImagesRepresentative( MonomorphismToAutomatonGroup( G ), x )));\n  Add(nuclG, GeneratingSetWithNucleusAutom(H));\n\n  SetGroupNucleus(G, nuclG[1]);\n  SetGeneratingSetWithNucleus(G, nuclG[2]);\n  SetGeneratingSetWithNucleusAutom(G, nuclG[3]);\n  SetContractingLevel(G, ContractingLevel(H));\n\n  return nuclG;\nend);\n\n\nInstallMethod(FindNucleus, \"for [IsSelfSimilarGroup]\", true,\n              [IsSelfSimilarGroup],\nfunction(G)\n  return FindNucleus(G, infinity);\nend);\n\n\nInstallMethod(GeneratingSetWithNucleus, \"for [IsSelfSimilarGroup]\", true,\n              [IsSelfSimilarGroup],\nfunction(G)\n  if IsContracting(G) then return GeneratingSetWithNucleus(G); fi;\nend);\n\n\nInstallMethod(GeneratingSetWithNucleusAutom, \"for [IsSelfSimilarGroup]\", true,\n              [IsSelfSimilarGroup],\nfunction(G)\n  if IsContracting(G) then return GeneratingSetWithNucleusAutom(G); fi;\nend);\n\n#E\n", "meta": {"hexsha": "3527d6cdc3929ed45fffe0041b1b44190fc6c0b4", "size": 32198, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/selfsimgroup.gi", "max_stars_repo_name": "gap-packages/automgrp", "max_stars_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-02T15:00:11.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-02T15:00:11.000Z", "max_issues_repo_path": "gap/selfsimgroup.gi", "max_issues_repo_name": "gap-packages/automgrp", "max_issues_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2019-09-21T22:10:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-26T23:51:41.000Z", "max_forks_repo_path": "gap/selfsimgroup.gi", "max_forks_repo_name": "gap-packages/automgrp", "max_forks_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.2709090909, "max_line_length": 140, "alphanum_fraction": 0.599571402, "num_tokens": 8618, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4882833952958347, "lm_q2_score": 0.03567855215943872, "lm_q1q2_score": 0.017421244587650275}}
{"text": "EW schwarz,1,Projekt\t\t//same as in cube.gap\r\n  S(2,2,3)\t\t\t//redifine edge size as (x,y,z)\r\n", "meta": {"hexsha": "f348ec1ab81267a2e0881bce0816f09f15c1e4cb", "size": 91, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "HowGAMfileswork/cuboid.gap", "max_stars_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_stars_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-03-14T08:02:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-14T08:02:54.000Z", "max_issues_repo_path": "HowGAMfileswork/cuboid.gap", "max_issues_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_issues_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HowGAMfileswork/cuboid.gap", "max_forks_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_forks_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.3333333333, "max_line_length": 45, "alphanum_fraction": 0.6263736264, "num_tokens": 41, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4921881357207955, "lm_q2_score": 0.03514484842196812, "lm_q1q2_score": 0.017297877424998432}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(Codegen, HierarchicalVisitor, rec(\n    initXY := function(x, y, opts)\n        if IsBound(opts.XType) and not IsList(x) then\n            if not IsArrayT(opts.XType) and not IsPtrT(opts.XType) \n                then Error(\"opts.XType must be a pointer or array type. This has recently changed.\",\n                           \"If you used TReal before, use TPtr(TReal) now\"); fi;\n            x.t := opts.XType;\n            x.t := When(IsBound(opts.useRestrict) and opts.useRestrict, x.t.restrict(), x.t);\n        fi;\n        if IsBound(opts.YType) and not IsList(y) then\n            if not IsArrayT(opts.YType) and not IsPtrT(opts.YType) \n                then Error(\"opts.YType must be a pointer or array type. This has recently changed.\",\n                           \"If you used TReal before, use TPtr(TReal) now\"); fi;\n            y.t := opts.YType;\n            y.t := When(IsBound(opts.useRestrict) and opts.useRestrict, y.t.restrict(), y.t);\n        fi;\n        return [x, y];\n    end,\n\n    # NOTE: get rid of _acc_\n\n    # This function substitutes assign by assign_acc (eliminated in a subsequent pass)\n    # This is done to achieve accumulation, and assign_acc is used to\n    #   prevent double accumulation.. Used in Codegen.ISumAcc and Codegen.SUMAcc.\n    # Must be handled better somehow.\n    #\n    _acc := (icode, y) ->\n        SubstTopDownNR(icode, [assign, [@(0,nth), @(1), @(2)], @(3)],\n            e -> assign_acc(@(0).val, @(3).val)),\n\n \n    _interleave := function(codes)\n        local decls, c, i, j, cmds;\n        decls := Set([]);\n        for i in [1..Length(codes)] do\n            c := codes[i];\n            while ObjId(c)=decl do UniteSet(decls, c.vars); c := c.cmd; od;\n            if ObjId(c)<>chain then\n                codes[i] := [c];\n            else\n                codes[i] := c.cmds;\n            fi;\n        od;\n\n        cmds := [];\n        for i in [1..Maximum(List(codes, Length))] do\n            for j in [1..Length(codes)] do\n                if IsBound(codes[j][i]) then Add(cmds, codes[j][i]); fi;\n            od;\n        od;\n        return decl(decls, chain(cmds));\n    end\n));\n\n#fAdd.rlambda := self >> let(i:=Ind(), Lambda(i,i+1));\n#H.rlambda := self >> let(i:=Ind(), Lambda(i,i+self.params[4]));\n\n\n# a version of the Dat1d call that also sets the 'no scalarize' flag on the variable 't'.\n_dat1d_donotscalarize := function(a,b)\n    local t;\n\n    t := Dat1d(a,b);\n    t.doNotScalarize := true;\n\n    return t;\nend;\n\n\nClass(DefaultCodegen, Codegen, rec(\n    Formula := meth(self, o, y, x, opts)\n        local icode, datas, prog, params, sub, initsub, destroysub, io, t, initcode, initparams;\n        \n        o := SumsUnification(o.child(1), opts);\n\n        [x, y] := self.initXY(x, y, opts);\n\n        #o :=  Process_fPrecompute(o, opts);\n        \n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n\n        datas := Collect(o, FDataOfs);\n        [o,t] := UTimedAction(BlockSumsOpts(o, opts)); #PrintLine(\"BlockSums \", t);\n        [icode,t] := UTimedAction(self(o, y, x, opts)); #PrintLine(\"codegen \", t);\n        #[icode,t] := UTimedAction(ESReduce(icode, opts)); #PrintLine(\"ESReduce \", t);\n        icode := RemoveAssignAcc(icode);\n        Unbind(Compile.times);\n        [icode,t] := UTimedAction(BlockUnroll(icode, opts)); #PrintLine(\"BlockUnroll \", t);\n        #PrintLine(\"---compile--\");\n        #DoForAll([1..Length(Compile.times)], i -> PrintLine(i, \" \", Compile.times[i], \" \",\n        #        let(f:=opts.compileStrategy[i], When(IsFunc(f) or IsMeth(f), \"---\", f))));\n\n        # icode := PowerOpt(icode);\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        initparams := Copy(params);\n        if IsBound(opts.symbol) then\n          params := Concatenation(params, opts.symbol);\n        fi;\n\n        if IsBound(opts.accStrategy) then\n          icode.iy := y;\n          icode.iy.n := o.dims()[1];\n          icode.ix := x;\n          icode.ix.n := o.dims()[2];\n          icode.ivars := Concatenation(params, List(datas, x->x.var));\n          icode := opts.accStrategy(icode);\n        fi;\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        destroysub := Cond(IsBound(opts.subName), Concat(\"destroy_\", opts.subName), \"destroy\");\n        icode := func(TVoid, sub, Concatenation(io, params), icode);\n\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n\t    initcode := chain(List(Filtered(datas, e -> IsBound(e.var.init)), x -> SReduce(x.var.init, opts)));\n            prog := program(\n                decl(List(datas, x->x.var),\n                    chain(\n                        func(TVoid, initsub, initparams :: Set(Collect(initcode, param)), initcode), \n                        icode,\n                        func(TVoid, destroysub, [], skip()) \n                    )));\n        else\n            prog := program( func(TVoid, initsub, params, chain()), icode);\n        fi;\n        prog.dimensions := o.dims();\n        return prog;\n    end,\n\n    Cross := meth(self, o, y, x, opts)\n        local i, mychain, xdims, ydims, myYdims, myXdims;\n        mychain:=[];xdims:=1;ydims:=1;\n        for i in [1..Length(o._children)] do\n            myYdims:=DimLength(o._children[i].dims()[1]);\n            myXdims:=DimLength(o._children[i].dims()[2]);\n            Add(mychain,self(o._children[i],\n                    StripList(y{[ydims..ydims+myYdims-1]}),\n                    StripList(x{[xdims..xdims+myXdims-1]}),opts));\n            ydims:=ydims+myYdims;\n            xdims:=xdims+myXdims;\n        od;\n        return chain(mychain);\n    end,\n\n    Glue:= meth(self,o,y,x,opts)\n        local size, als,iterator,n;\n        size := o.element[2];\n        n := EvalScalar(o.element[1]);\n        iterator :=Ind(size);\n        als  := List([0..n-1],t -> assign(nth(StripList(y),add(iterator,t*size)),nth(x[t+1],iterator)));\n        return loop(iterator, size, chain(als));\n    end,\n\n    Split:= meth(self,o,y,x,opts)\n        local size, als,iterator,n;\n        n := EvalScalar(o.element[2]);\n        size := o.element[1];\n        iterator :=Ind(idiv(size, n));\n        als  := List([0..(n-1)],t -> assign(nth(y[t+1],iterator),nth(StripList(x),add(iterator,t*size/n))));\n        return loop(iterator, idiv(size, n), chain(als));\n     end,\n\n\n    BB := (self,o,y,x,opts) >> MarkForUnrolling(\n        When(IsBound(o.bbnum),\n            o.bbnum,\n            0\n        ), \n        self(o.child(1), y, x, opts),\n        opts\n    ),\n    IDirSum := (self,o,y,x,opts) >> self(o.sums(), y, x, opts),\n    TTag := (self,o,y,x,opts) >> self(o.params[1], y, x, opts),\n    DPWrapper := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n\n    Buf := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    NoPull := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    PushL := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    PushR := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    PushLR := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    Grp := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    NoDiagPullin := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    NoDiagPullinLeft := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    NoDiagPullinRight := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n\n    COND := (self,o,y,x,opts) >> IF(\n        When(IsFunction(o.cond), o.cond.at(0), o.cond),\n        self(o.child(1), y, x, opts), self(o.child(2), y, x, opts)),\n\n    Diag := (self, o, y, x, opts) >> let(i := Ind(), elt := o.element.lambda(),\n        loop(i, elt.domain(), assign(nth(y,i), elt.at(i) * nth(x,i)))),\n    \n    DiagCpxSplit := (self, o, y, x, opts) >> let(i := Ind(), elt := o.element.lambda(),\n        re := elt.at(2*i), im := elt.at(2*i+1),\n        loop(i, elt.domain()/2, \n             assign(nth(y,i),   re * nth(x,i) + E(4) * im * nth(x,i)))),\n\n    TCast := (self, o, y, x, opts) >> let(i := Ind(), \n        loop(i, o.params[1], assign(nth(y,i), tcast(o.params[2], nth(x,i))))),\n\n    RCDiag := (self, o, y, x, opts) >> let(i := Ind(), elt := o.element.lambda(),\n        re := elt.at(2*i), im := elt.at(2*i+1),\n        loop(i, elt.domain()/2, chain(\n             assign(nth(y,2*i),   re * nth(x,2*i) - im * nth(x,2*i+1)),\n             assign(nth(y,2*i+1), im * nth(x,2*i) + re * nth(x,2*i+1))))),\n\n    ColVec := (self, o, y, x, opts) >> let(i := Ind(), func := o.element.lambda(),\n        loop(i, func.domain(), assign(nth(y,i), mul(func.at(i), nth(x,0))))),\n\n    RowVec := (self, o, y, x, opts) >> let(i := Ind(), func := o.element.lambda(),\n        t := TempVar(x.t.t),\n        chain(assign(t,0),\n            loop(i, func.domain(), assign(t, add(t, mul(func.at(i), nth(x,i))))),\n            assign(nth(y,0), t))),\n\n    Scale := (self, o, y, x, opts) >> let(i := Ind(),\n        chain(self(o.child(1), y, x, opts),\n              loop(i, Rows(o), assign(nth(y,i), mul(o.scalar, nth(y,i)))))),\n\n    I := (self, o, y, x, opts) >> Cond(x<>y,let(i := Ind(Rows(o)),\n            loop(i, i.range, assign(nth(y,i), nth(x,i)))),skip()),\n\n    2DI := (self, o, y, x, opts) >> Cond(x<>y, Error(\"Should not happen\"), skip()),\n\n    # this one will always unroll Blk's\n    Blk := (self, o, y, x, opts) >> let(\n\t# this is a hack, and it is needed, because without it we will be assigning to a \n\t# variable of type TArray (after binsplit), and some compilers (=icc) don't like that \n\t# (not an l-value)\n\t# NOTE: suggestion -- move this somewhere, as a compatibility patch (maybe postprocess?)\n\ttcst := Cond(IsSymbolic(o.element), x->tcast(TPtr(o.element.t.t.t), x), x->x),\n\tCond(\n            not IsSymbolic(o.element) and Rows(o)=2 and Cols(o)=2, Blk2code(o, y, x),\n            not IsSymbolic(o.element) and Rows(o)=4 and Cols(o)=4, Blk4code(o, y, x),\n            chain(\n\t\tList([0..Rows(o)-1], j -> let(\n\t\t    row := tcst(nth(o.element, j)),\n                    assign(nth(y,j), ApplyFunc(add, List([0..Cols(o)-1], i -> nth(row, i) * nth(x,i))))\n\t\t))\n\t    )\n\t)\n    ),\n\n# This one can loop Blk's if needed, but is much slower for large matrices, and eventually blows up in storage requirements\n#    Blk := (self, o, y, x, opts) >> Cond(\n#        Rows(o)=2 and Cols(o)=2, Blk2code(o, y, x),\n#        Rows(o)=4 and Cols(o)=4, Blk4code(o, y, x),\n#        let(j:=Ind(), i:=Ind(), t:=TempVar(x.t.t), mat:=V(o.element), d:=Dat(mat.t),\n#            data(d, mat,\n#                loop(j, Rows(o), decl(t, chain(\n#                     assign(t, 0),\n#                     loop(i, Cols(o), assign(t, t + nth(nth(d,j),i) * nth(x,i))),\n#                     assign(nth(y,j), t))))))),\n\n    toeplitz := (self, o, y, x, opts) >> self.Blk(o.obj, y, x, opts),\n\n    Blk1 := (self, o, y, x, opts) >> assign(nth(y,0), mul(toExpArg(o.element), nth(x,0))),\n\n    BlkConj := (self, o, y, x, opts) >> assign(nth(y,0), conj(nth(x,0))),\n\n    Prm := (self, o, y, x, opts) >> Cond(\n        x = y,\n            When(ObjId(o.func) = fId, skip(), Error(\"Inplace Permutation is not dealt with...\")),\n\n        let(i:=Ind(), func:=o.func.lambda(),\n            loop(i, Rows(o), assign(nth(y, i), nth(x, func.at(i)))))\n    ),\n\n    O := (self, o, y, x, opts) >> let(i:=Ind(),\n        loop(i, o.params[1], assign(nth(y, i), V(0)))),\n\n\n    Gath := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix;\n        i := Ind(); func := o.func.lambda();\n\n        if IsBound(o.func.rlambda) then\n            rfunc := o.func.rlambda();\n            ix := var.fresh_t(\"ix\", TInt);\n            return decl(ix, chain(\n                    assign(ix, func.at(0)),\n                    assign(nth(y, 0), nth(x, ix)),\n                    loop(i, o.func.domain()-1,\n                        chain(assign(ix, rfunc.at(ix)),\n                            assign(nth(y, i+1), nth(x, ix))))));\n        else\n            return loop(i, o.func.domain(), assign(nth(y,i), nth(x, func.at(i))));\n        fi;\n    end,\n\n    Scat := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix;\n        i := Ind(); func := o.func.lambda();\n        if IsBound(o.func.rlambda) then\n        rfunc := o.func.rlambda();\n        ix := var.fresh_t(\"ix\", TInt);\n        return decl(ix, chain(\n                assign(ix, func.at(0)),\n                assign(nth(y, ix), nth(x, 0)),\n                loop(i, o.func.domain()-1,\n                    chain(assign(ix, rfunc.at(ix)),\n                        assign(nth(y, ix), nth(x, i+1))))));\n        else\n            return loop(i, o.func.domain(), assign(nth(y,func.at(i)), nth(x, i)));\n        fi;\n    end,\n\n    ScatGath := meth(self, o, y, x, opts)\n        local i, sfunc, gfunc, decls;\n\n        i := Ind();\n        sfunc := o.sfunc.lambda();\n        gfunc := o.gfunc.lambda();\n        decls := Set(Concat(sfunc.free(),gfunc.free()));\n        return loopn(i, o.sfunc.domain(), assign(nth(y,sfunc.at(i)), nth(x, gfunc.at(i))));\n    end,\n\n    SUM := (self, o, y, x, opts) >> chain(List(o.children(), c -> self(c, y, x, opts))),\n\n    ISum := (self, o, y, x, opts) >> let(\n        myloop := When(IsSymbolic(o.domain), loopn, loop),\n        myloop(o.var, o.domain,\n            self(o.child(1), y, x, opts))),\n\n    JamISum := (self, o, y, x, opts) >> let(its := EvalScalar(o.domain),\n        Cond(IsSymbolic(its), \n                 self.ISum(o, y, x, opts),            \n             its > 32, Error(\"<o.domain> is too big (> 32), probably something went wrong. \",\n                             \"If you know what you are doing, then change DefaultCodegen.JamISum\"),\n             let(s := o.child(1),\n                 bodies := List([0..its-1], j ->\n                     Compile(self(SubstVars(Copy(s), rec((o.var.id):= V(j))), y, x, opts), opts)),\n                 self._interleave(bodies)))),\n\n    # NOTE: get rid of _acc\n    SUMAcc := (self, o, y, x, opts) >> let(ii := Ind(),\n        When(not Same(ObjId(o.child(1)), Gath),  # NOTE: come up with a general condition\n            chain(\n                loop(ii, Rows(o), assign(nth(y, ii), V(0))),\n                List(o.children(), c -> self._acc(self(c, y, x, opts), y))),\n            chain(\n                self(o.child(1), y, x, opts),\n                List(Drop(o.children(), 1), c -> self._acc(self(c, y, x, opts), y))))),\n\n    ISumAcc := (self, o, y, x, opts) >> let(ii := Ind(), chain(\n            loop(ii, Rows(o), assign(nth(y, ii), V(0))),\n            loop(o.var, o.domain, self._acc(self(o.child(1), y, x, opts), y)))),\n\n    ScatAcc := (self, o, y, x, opts) >> self._acc(self(Scat(o.func),y,x,opts),y),\n\n    # _composePropagate(<ch>, <y>, <x>, <mfunc>) - <x> and <y> and temp arrays propagation through \n    # identity/inplace operators and creating intermediate arrays using <mfunc> which\n    # has (c) -> ... signature (<c> is child operator). There is no assumption made on what is <x>, \n    # <y> and <mfunc> return so this function can be used to propagate other information same way \n    # as arrays in composition.\n\n    _composePropagate := function(ch, y, x, mfunc)\n        local numch, vecs, i, j, cmd, code, isI, crossCh, apos;\n        numch := Length(ch);\n        vecs  := [y];\n\n        isI   := (x) -> IsIdentitySPL(x) or x.isInplace();\n\n        # we like to evaluate right (last) to left (first), where the values\n        # in parens refer to the position of the elements in the array.\n        #\n        # So here, we start at the output (first entry in array) and\n        # walk towards the input, creating temporary arrays as necessary\n        \n        for i in [1..numch-1] do\n            vecs[i+1] := When(isI(ch[i]),\n                vecs[i],\n                mfunc(ch[i])\n            );\n            if ObjId(ch[i]) = Cross then\n                apos := [ 1, 1 ]; # apos holds starting input/output indexes \n                                  # as children's arity on input may be different from output arity.\n                crossCh := ch[i].rChildren();\n                for j in [1 .. Length(crossCh)] do\n                    if isI(crossCh[j]) then\n                        vecs[i+1][apos[2]] := vecs[i][apos[1]];\n                    fi;\n                    apos := apos + crossCh[j].arity();\n                od;\n            fi;\n        od;\n\n        # the last entry must be the input.\n        vecs[numch+1] := x;\n\n        # now we walk in the opposite direction, copying through\n        # input as far as we can.\n        # if there is a cross and one of the inputs is an identity,\n        # there's no point actually doing it\n        for i in Reversed([1..numch]) do\n            if isI(ch[i]) then\n                vecs[i] := vecs[i+1];\n            elif ObjId(ch[i]) = Cross then\n                apos := [ 1, 1 ]; # apos holds starting input/output indexes \n                                  # as children's arity on input may be different from output arity.\n                crossCh := ch[i].rChildren();\n                for j in [1 .. Length(crossCh)] do\n                    if isI(crossCh[j]) then\n                        vecs[i][apos[1]] := vecs[i+1][apos[2]];\n                    fi;\n                    apos := apos + crossCh[j].arity();\n                od;\n            fi;\n        od;\n\n        # If all children were evaluated inplace, the output will be in x\n        # Make it go from x -> y as expected\n        if vecs[1] = vecs[numch+1] then vecs[1] := y; fi;\n        if vecs[1] = vecs[numch+1] then vecs[numch+1] := x; fi;\n\n        return vecs;\n    end,\n\n    Compose := meth(self, o,y,x,opts)\n        local ch, numch, vecs;\n        ch    := o.children();\n        numch := Length(ch);\n\n        # propagate x and y arrays and create temporary arrays\n        vecs  := self._composePropagate(ch, y, x, c -> TempArray(y,x,c));\n\n        # order them so that first to be evaluated is first in array.\n        vecs := Reversed(vecs);\n        ch   := Reversed(ch);\n\n        # Wrap code in variable declaration. Each entry in vecs will contain multiple\n        # arrays in the case of multi-input/output (i.e. OL)\n        return decl(\n            Difference(Flat(vecs{[2..Length(vecs)-1]}), Flat([x,y])),\n            chain(\n                List([1..numch], i ->\n                     self(ch[i], vecs[i+1], vecs[i], opts)))\n        );\n    end,\n\n    # ComposeDists is meant to be like a Compose, but for parallel ISums. We\n    # need it for 2 reasons: a) The arrays declared are distributed among the\n    # nodes, so we need them to be of size N/p, and not N. b) We can ping-pong\n    # between 2 parallel buffers instead of declaring a ton of temp arrays, as\n    # long as a barrier-sync exists between the stages. NOTE: This won't work\n    # if we do full overlapping with micro-barriers. NOTE: This also might not\n    # work too well for partial/dirty-overlap.\n\n    ComposeDists := meth(self, o,y,x,opts)\n        local ch, numch, vecs, i, cmd, code, pt1, pt2;\n        ch    := o.children();\n        numch := Length(ch);\n\n        # order them so that first to be evaluated is first in array.\n        ch   := Reversed(ch);\n\n        # NOTE: We assume that the # of procs doesn't change across the ComposeDists!\n        pt1 := TempArraySeq(y,x,ch[1]);\n        pt2 := TempArraySeq(y,x,ch[1]);\n\n        return(\n            decl([pt1, pt2], chain( \n            List([1..numch], i -> \n                let(ppx := When(i mod 2 = 0, pt1, pt2),\n                    ppy := When(i mod 2 = 0, pt2, pt1),\n                    px  := When(i=1,     x, ppx),\n                    py  := When(i=numch, y, ppy),\n                    self(ch[i], py, px, opts))\n                )\n            ))\n        );\n    end,\n\n    ComposeStreams:= meth(self, o,y,x,opts)\n\n        # This is a compose of 2 or more multibuffered streams. The streams can\n        # ping-pong data between X and Y. This is okay only if we're allowed to\n        # clobber the input (reasonable to assume only when Inplace is\n        # requested). Also, whether the last stage is a ping or a pong will\n        # determine where the output is written to (which is not great).\n        # Currently, just a hack.\n\n        local ch, numch;\n        ch    := o.children();\n        numch := Length(ch);\n\n        # order them so that first to be evaluated is first in array.\n        ch   := Reversed(ch);\n\n        return chain( List([1..numch], i -> \n            let(ppy := When(i mod 2 = 0, x, y),\n                ppx := When(i mod 2 = 0, y, x),\n                self(ch[i], ppy, ppx, opts))\n            )\n        );\n    end,\n\n\n    Inplace := (self, o, y, x, opts) >>\n        self(o.child(1), y, x, opts), # Compose will handle these somehow\n#MRT: it really should do this... but it doesn't\n#        self(o.child(1), x, x, opts),\n\n    Data := meth(self, o, y, x, opts)\n        local val;\n        o.var.isData := true;\n        val := When(IsFunction(o.value), o.value.tolist(), o.value);\n        val := When(IsValue(val), val, o.var.t.value(val));\n        return data(o.var, val, self(o.child(1), y, x, opts));\n    end,\n\n    #   NOTE: use pointers to do pingpong?\n    ICompose := (self, o, y, x, opts) >> let(\n        t      := Dat1d(x.t.t, Rows(o)),\n        its    := o.domain,\n        newind := Ind( Int((its-1)/2) ),\n        # if orig loops has even # iterations, we peel 2 iterations, otherwise peel 1\n        peel_its := Cond(IsEvenInt(o.domain), 2, 1),\n\n        decl([t], chain(\n           Cond(IsOddInt(o.domain),\n                SubstVars(Copy(self(o.child(1), y, x, opts)), tab((o.var.id) := (V(its-1)))),\n\n                chain(\n                   SubstVars(Copy(self(o.child(1), t, x, opts)), tab((o.var.id) := (V(its-1)))),\n                   SubstVars(Copy(self(o.child(1), y, t, opts)), tab((o.var.id) := (V(its-2)))))),\n\n           When(o.domain <= 2, [],\n               loop(newind, newind.range,\n                   chain(\n                       SubstVars(Copy(self(o.child(1), t, y, opts)), tab((o.var.id) := (its-1-peel_its)-2*newind)),\n                       SubstVars(Copy(self(o.child(1), y, t, opts)), tab((o.var.id) := (its-2-peel_its)-2*newind)))))\n       ))),\n\n    Multiplication:= meth(self, o, y, x, opts)\n        local iterator;\n\n        iterator:=Ind();\n        return loop(iterator, [ 0 .. o.element[2]-1 ],\n            assign(nth(StripList(y), iterator), mul(nth(x[1], iterator),nth(x[2], iterator))));\n    end,\n\n    OLMultiplication := meth(self, o, y, x, opts)\n        local iterator;\n        iterator:=Ind();\n        return loop(iterator, [ 0 .. o.rChildren()[2]-1 ],\n            assign(nth(StripList(y), iterator),\n                ApplyFunc(mul, List([1..o.rChildren()[1]], i -> nth(x[i], iterator)))));\n    end,\n\n    OLConjMultiplication := meth(self, o, y, x, opts)\n        local iterator;\n        iterator:=Ind();\n        return loop(iterator, [ 0 .. o.rChildren()[2]-1 ],\n            assign(nth(StripList(y), iterator),\n                ApplyFunc(mul, [nth(x[1], iterator)] :: List([2..o.rChildren()[1]], i -> conj(nth(x[i], iterator))))));\n    end,\n\n    __RCOLMultiplication := (self, o, y, x, conj) >> let(\n        i  := Ind(),\n        n  := o.rChildren()[2], \n        m  := o.rChildren()[1],\n        yy := StripList(y),\n        re := List([1..m], e -> var.fresh_t(\"re\", yy.t.t)),\n        im := List([1..m], e -> var.fresh_t(\"re\", yy.t.t)),\n        loop(i, n, decl( re :: im, chain(\n            assign( re[1], nth(x[1], 2*i) ),\n            assign( im[1], nth(x[1], 2*i+1) ),\n            chain( List( [2..m], j -> \n                chain(\n                    assign(re[j], re[j-1] * nth(x[j],2*i) - conj * im[j-1] * nth(x[j],2*i+1)),\n                    assign(im[j], im[j-1] * nth(x[j],2*i) + conj * re[j-1] * nth(x[j],2*i+1))\n                ))),\n            assign(nth(yy,2*i),   re[m]),\n            assign(nth(yy,2*i+1), im[m]))))),\n\n    RCOLMultiplication     := (self, o, y, x, conj) >> self.__RCOLMultiplication(o, y, x, 1),\n    RCOLConjMultiplication := (self, o, y, x, conj) >> self.__RCOLMultiplication(o, y, x, -1),\n\n\n    OLDup := (self, o, y, x, opts) >> let(\n        i := Ind(o.params[2]),\n        loop(i, i.range, chain( \n            List( Flat([y]), yy -> assign(nth(yy, i), nth(x, i)))\n        ))\n    ),\n\n    SMAP := (self, o, y, x, opts) >> assign(nth(y, 0), o.at(List([1..Cols(o)], i -> nth(x, i-1)))),\n\n    ParSeqWrap := (self, o, y, x, opts) >> let( yy := Flat([y]), xx := Flat([x]),\n        self( o.p.child(o.ci),\n            StripList(yy :: o.p.filtSUMR(o.y)),\n            StripList(xx :: o.p.filtSUMR(o.x)),\n            opts)),\n\n    ParSeq := (self, o, y, x, opts) >> let( ch := o.children(), yy := Flat([y]), xx := Flat([x]),\n        self( Compose(List([1..Length(ch)], i -> ParSeqWrap(o, i, yy, xx))),\n            StripList(o.filtCompR(yy)), StripList(o.filtCompL(xx)), opts)),\n\n    IParSeq := (self, o, y, x, opts) >> let(\n            its := Ind(o.domain),\n            xs  := o.filtSUML(Flat([x])),\n            ys  := o.filtSUMR(Flat([y])),\n            xc  := o.filtCompL(Flat([x])),\n            yc  := o.filtCompR(Flat([y])),\n\n            rc  := o.filtCompR(Flat([Rows(o)])),\n            tc  := List(Zip2(yc, rc), a -> Dat1d(a[1].t.t, a[2])),\n\n            src := List( xc, e -> var.fresh_t(\"pX\", TPtr(e.t.t))),\n            dst := List( yc, e -> var.fresh_t(\"pY\", TPtr(e.t.t))),\n\n            ptr := (p) -> When(IsPtrT(p.t), p, nth(p, 0).toPtr(p.t.t)),\n\n            decl(src :: dst :: tc, chain(chain(\n                List( TransposedMat([src, xc]),\n                    e -> assign(e[1], ptr(e[2])) ) ::\n                List( TransposedMat([dst, tc, yc]),\n                    e -> assign(e[1], cond( eq(imod(o.domain, 2), 0), ptr(e[2]), ptr(e[3]))) )),\n                loopn( its, its.range, chain(\n                    self( SubstVars(Copy(o.child(1)), tab((o.var.id) := its)), StripList(dst :: ys), StripList(src :: xs), opts ),\n                    chain(\n                        List( TransposedMat([src, dst]),\n                            e -> assign(e[1], e[2])) :: \n                        List( TransposedMat([dst, yc, tc]),\n                            e -> assign(e[1], cond( eq(imod(add(o.domain, its), 2), 0), ptr(e[2]), ptr(e[3]) )))\n                )))\n            ))\n    ),\n\n    Cvt := (self, o, y, x, opts) >> o.params[1].code(y, x, opts),\n));\n\nStackAllocsToPtrs := function(icode, x, size, vars)\n    local arrayvars, replvars, offset, i;\n\n    # extract all temp array definitions\n    arrayvars := Flat(List(\n        Collect(icode, @(1, decl, e -> ForAny(e.vars, i -> ObjId(i.t) = TArray))),\n        f -> Filtered(f.vars, g -> ObjId(g.t) = TArray)\n    ));\n\n    # build a set of replacement pointers for these variables\n    replvars := List(arrayvars, e -> var.fresh_t(\"T\", TPtr(e.t.t)));\n\n    offset := 2*size;\n\n    for i in [1..Length(arrayvars)] do\n\n        # remove declaration of array\n        icode := SubstTopDown(icode, @(1, decl, e -> arrayvars[i] in e.vars), ee -> ee.cmd);\n\n        # change variables from TArray -> TPtr\n        icode := SubstTopDown(icode, arrayvars[i], e -> replvars[i]);\n\n        # prepend declaration and setup of ptr\n        icode := decl(replvars[i], chain(\n            assign(replvars[i], add(x, offset)),\n            icode\n        ));\n\n        offset := offset + size;\n    od;\n\n    Append(vars, arrayvars);\n\n    return icode;\nend;\n\nClass(SingleAllocCodegen, DefaultCodegen, rec(\n    Formula := meth(self, o, y, x, opts)\n        local icode, datas, prog, params, sub, initsub, io, vars, size;\n        \n        o := SumsUnification(o.child(1), opts);\n\n        [x, y] := self.initXY(x, y, opts);\n\n        size := Maximum(o.dimensions);\n        params := Set(Collect(o, param));\n\n        datas := Collect(o, FDataOfs);\n        o := BlockSums(opts.globalUnrolling, o);\n        icode := self(o, y, x, opts);\n        icode := RemoveAssignAcc(icode);\n        icode := BlockUnroll(icode, opts);\n\n        # replace all stack allocated arrays with offsets into input array\n        vars := [];\n        icode := StackAllocsToPtrs(icode, x, size, vars);\n\n        # icode := PowerOpt(icode);\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        icode := func(TVoid, sub, Concatenation(io, params), icode);\n\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            prog := program(\n                decl(List(datas, x->x.var),\n                    chain(\n                        func(TVoid, initsub, params, chain(List(datas, x -> SReduce(x.var.init)))),\n                        icode\n                    )));\n        else\n            prog := program( func(TVoid, initsub, params, chain()), icode);\n        fi;\n        prog.dimensions := o.dimensions;\n        return prog;\n    end,\n));\n\nClass(RecCodegenMixin, rec(\n    RecursStep := (self, o, y, x, opts) >> let(\n        name := spiral.libgen.CodeletName(spiral.libgen.CodeletShape(o.child(1))),\n        ApplyFunc(call, Concatenation(\n                [ var(name), y + o.yofs, x + o.xofs ],\n                spiral.libgen.CodeletParams(o.child(1))))),\n\n    RecursStepCall := (self, o, y, x, opts) >>\n        ApplyFunc(call, Concatenation(Flat([var(o.func), y, x,]), List(o.bindings, x->x[2]))),\n\n    Codelet := meth(self, o, y, x, opts)\n        local code;\n        [x, y] := self.initXY(x, y, opts);\n        o := o.child(1);\n        ## Generating code : main body\n        o := BlockSums(opts.libgen.basesUnrolling, o);\n        code := SReduce(self(o, y, x, opts), opts);\n        code := BlockUnroll(RemoveAssignAcc(code), opts);\n        code := DeclareHidden(code);\n        return code;\n    end,\n));\n\n\n", "meta": {"hexsha": "235f4ac49242fe370a279cc7006e1c19f85b18e7", "size": 29875, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 39.7802929427, "max_line_length": 130, "alphanum_fraction": 0.5093891213, "num_tokens": 8661, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.476579651063676, "lm_q2_score": 0.03622005508471649, "lm_q1q2_score": 0.01726174121378131}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# 2-operand intermediate representation.\n# Here we define 2-op commands and 3-op -> 2-op\n# conversion functions.\n#\n# This is relevant if one needs very low-level x86 representation,\n# eg. to optimize register use and generate assembly code.\n#\n\nClass(assign_two_op, assign, rec(\n    op_in := self >> Set(ArgsExp(self.exp)),\n    op_out := self >> Set([]),\n    op_inout := self >> Set([self.loc])\n));\n\nClass(assign_add, assign_two_op);\nClass(assign_mul, assign_two_op);\nClass(assign_sub, assign_two_op);\nClass(assign_neg, assign_two_op);\n\n# Examples: \n#   assign(t1, add(t1, t2)) == assign_add(t1, t2),\n#   assign(t1, add(t2, t3)) == chain(assign(t1, t2), assign_add(t2, t3)).\n#\n\nClass(TwoOpCodeRuleSet, RuleSet);\nRewriteRules(TwoOpCodeRuleSet, rec(\n    add := Rule([assign, @(1), [add, @(2), @(3)]], e -> let(\n\t    s2:=Length(SuccLoc(@(2).val)), s3:=Length(SuccLoc(@(3).val)),\n\tWhen(Length(Filtered(List(@(2).val.succ,x->x.def.n),y->y>@(1).val.def.n))>0,\n#\tWhen(IsBound(@(2).val.live_out) or (s3 < s2 and not IsBound(@(3).val.live_out)),\n\t    chain(assign(@(1).val, @(3).val), # copy+destroy @(3)\n\t\t  assign_add(@(1).val, @(2).val)), \n\t    chain(assign(@(1).val, @(2).val), # copy+destroy @(2)\n\t\t  assign_add(@(1).val, @(3).val))))),\n\n    mul := Rule([assign, @(1), [mul, @(2), @(3)]], e -> let(\n\t    s2:=Length(SuccLoc(@(2).val)), s3:=Length(SuccLoc(@(3).val)),\n\tWhen(Length(Filtered(List(@(2).val.succ,x->x.def.n),y->y>@(1).val.def.n))>0,\n#\tWhen(IsBound(@(2).val.live_out) or (s3 <= s2 and not IsBound(@(3).val.live_out)),\n\t    chain(assign(@(1).val, @(3).val), # copy+destroy @(3)\n\t\t  assign_mul(@(1).val, @(2).val)),\n\t    chain(assign(@(1).val, @(2).val), # copy+destroy @(2)\n\t\t  assign_mul(@(1).val, @(3).val))))),\n\n    sub := Rule([assign, @(1), [sub, @(2), @(3)]], e -> \n\t    chain(assign(@(1).val, @(2).val),\n\t\t  assign_sub(@(1).val, @(3).val))),\n\n    neg := Rule([assign, @(1), [neg, @(2)]], e -> \n            chain(assign(@(1).val, @(2).val), \n\t          assign_neg(@(1).val)))\n));\n\nElimRedundantCopyChain := function(code)\n    local varmap, c, newcmds, succs;\n    varmap := tab();\n    newcmds := [];\n    for c in code.cmds do\n        c := SubstVars(c, varmap);\n        if ObjId(c)=assign and ObjId(c.loc)=var and ObjId(c.exp)=var and\n\t   not IsBound(c.exp.live_out) and\n\t   Filtered(SuccLoc(c.exp), x->x<>c.loc and x.def.n > c.n)=[] then\n\t    varmap.(c.loc.id) := c.exp; \n\telse\n\t    Add(newcmds, c);\n\tfi;\n    od;\n    return chain(newcmds);\nend;\n\n# Convert three-operand code -> two-operand code\n#\nTwoOpCode := function(code)\n    # NOTE: write a better binsplit\n    code := BinSplit(BinSplit(BinSplit(code)));\n    MarkLiveness(code);\n    code := TwoOpCodeRuleSet(code);\n    code := FlattenCode(code);\n    MarkLiveness(code);\n#    code := ElimRedundantCopyChain(code);\n#    code := CopyPropagate(code);\n    return code;\nend;\n\nX86Code := function(code, numregs)\n    local dims;\n    if IsBound(code.dimensions) then dims := code.dimensions; fi;\n    MarkLiveness(code);\n    code := HashConsts(code, rec(declareConstants := true));\n    code := TwoOpCode(code);\n    MarkLiveness(code);\n    code := RegAlloc(code, numregs, TDouble);\n    code := DeclareHidden(code);\n    if IsBound(dims) then code.dimensions := dims; fi;\n    return code;\nend;\n\n\n# assumes <code> is a chain of assigns\nTwoOpSSA := function(code)\n    local varmap, c, newcmds, succs, a, b, sa, sb, so, v, overwrite, antidep;\n    Constraint(IsChain(code) and ForAll(code.cmds, IsAssign));\n    varmap := tab();\n    newcmds := [];\n    for c in code.cmds do\n        c.exp := SubstVars(c.exp, varmap);\n\n        if (ObjId(c.exp) in [add, sub, mul]) and ForAny(c.exp.args, IsVar) then\n\t    Constraint(Length(c.exp.args)=2);\n\t    [a,b] := c.exp.args;\n\t    sa := Filtered(SuccLoc(a), x -> x.def.n > c.n);\n\t    sb := Filtered(SuccLoc(b), x -> x.def.n > c.n);\n\n\t    if not IsVar(b) then overwrite := a;\n\t    elif not IsVar(a) then overwrite := b;\n\t    elif ObjId(c.exp)=sub then overwrite :=a;\n\t    elif IsBound(b.live_out) or \n\t\t ((Length(sa) < Length(sb)) and not IsBound(a.live_out)) then\n\t\toverwrite := a;\n\t    else \n\t\toverwrite := b;\n\t    fi;\n\t    antidep := false;\n\t    so := When(overwrite=a, sa, sb);\n\t    if so <> [] then\n\t\tv := overwrite.clone();\n\t\tv.succ := so;\n\t\toverwrite.succ := Difference(overwrite.succ, so);\n\t\tAdd(newcmds, assign(v, overwrite));\n\t\tvarmap.(overwrite.id) := v;\n\t\tantidep := v;\n\t    fi;\n\t    if antidep<>false then c.antidep := [antidep]; fi;\n\t    Add(newcmds, c);\n\n\telse\n\t    Add(newcmds, c);\n\tfi;\n    od;\n    return chain(newcmds);\nend;\n\nClass(DirectTwoOpMapping, RuleSet);\nRewriteRules(DirectTwoOpMapping, rec(\n    add := Rule([assign, @(1), [add, @(2), @(3)]], e -> \n\tCond(@(1).val = @(2).val, assign_add(@(2).val, @(3).val), \n\t     @(1).val = @(3).val, assign_add(@(3).val, @(2).val),\n\t     Error(\"Statement \", e, \" is not 2-op ready, must be a=a+b, or b=a+b\"))),\n\n    mul := Rule([assign, @(1), [mul, @(2), @(3)]], e -> \n\tCond(@(1).val = @(2).val, assign_mul(@(2).val, @(3).val), \n\t     @(1).val = @(3).val, assign_mul(@(3).val, @(2).val),\n\t     Error(\"Statement \", e, \" is not 2-op ready, must be a=a*b, or b=a*b\"))),\n\n    sub := Rule([assign, @(1), [sub, @(2), @(3)]], e -> \n\tCond(@(1).val = @(2).val, assign_sub(@(2).val, @(3).val), \n\t     Error(\"Statement \", e, \" is not 2-op ready, must be a=a-b\")))\n));\n# def b1\n# a1: consume b1\n# a2: consume b1\n\n# def b1\n# cpy b1->b2\n\n# a1: consume b1\n# a2: consume b2\n", "meta": {"hexsha": "02f63927567c09d2f0e80cc076a8a8f4ffd29ef0", "size": 5484, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/two_op.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/two_op.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/two_op.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.6994219653, "max_line_length": 83, "alphanum_fraction": 0.5847921225, "num_tokens": 1781, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4035668680822513, "lm_q2_score": 0.04272219922237624, "lm_q1q2_score": 0.01724126413776037}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_VConstructR := [VBase, VRCDiag, BlockVPerm, VPerm, VTensor, VDiag_x_I, VDiag, VGath, VScat, VScatAcc, VPrm_x_I, VGath_sv, VBlk, VContainer, RCVDiag, VO1dsJ, VScale, VGath_zero, VReplicate, VIxJ2, VJxI];\n_VConstructL := [VBase, VRCDiag, BlockVPerm, VPerm, VTensor, VDiag_x_I, VDiag, VGath, VScat, VScatAcc, VPrm_x_I, VScat_sv, VScat_svAcc, VScat_pc, VBlk, VContainer, RCVDiag, VReplicate, VO1dsJ, VScale, VGath_zero, VIxJ2, VJxI];\n\n_VTags := [AVecReg, AVecRegCx];\n\n_v_divides_cols := x -> _divides(getV(x), Cols(x));\n_v_divides_rows := x -> _divides(getV(x), Rows(x));\n_v_tagged_ntR := x->IsNonTerminal(x) and x.hasAnyTag(_VTags) and _divides(x.getAnyTag(_VTags).v, Rows(x));\n_v_tagged_ntL := x->IsNonTerminal(x) and x.hasAnyTag(_VTags) and _divides(x.getAnyTag(_VTags).v, Cols(x));\n\nScat.svVariant := VScat_sv;\nScatAcc.svVariant := VScat_svAcc;\nGath.svVariant := VGath_sv;\n\nClass(RulesVec, RuleSet);\nRewriteRules(RulesVec, rec(\n    ############################################################\n    # Below 2 rules are required by SAR and autolib\n    # NOTE: They will cause problems when mixing scalar and vector code,\n    # because the entire code (including the scalar portion) will reside inside\n    # VContainer, and gath/scat in scalar code will be converted to vgath/vscat\n    #\n    VContainer__Gath_Scat := Rule(@@(1, [Gath, Scat, ScatAcc], (e,cx)->\n        cx.isInside(VContainer) and IsSIMD_ISA(Last(cx.VContainer).isa)\n        and let(sg := e, v := Last(cx.VContainer).isa.getV(), vsg := sg.svVariant(sg.func, v, 1), sg.dims() = vsg.dims())\n        and (not IsBound(cx.VTensor) or cx.VTensor = [])\n        and (not IsBound(cx.VJamL) or cx.VJamL = [])\n        and (not IsBound(cx.VJamR) or cx.VJamR = [])\n        and (not IsBound(cx.VJam1) or cx.VJam1 = [])\n        and (not IsBound(cx.VJam ) or cx.VJam  = [])\n        # FF, NOTE: this is a terrible hack to solve a contradiction: How to prevent the rader perm \n\t#            from turning into VGath. Need to find a better solution.\n        and (not ObjId(e.func) in [RM, RR])),\n     (e,cx) -> let(\n\t #inside_vrc := (IsBound(cx.vRC) and cx.vRC <> []) or \n\t #              (IsBound(cx.opts.assumeOuter_vRC) and cx.opts.assumeOuter_vRC),\n\t v := Last(cx.VContainer).isa.getV(), # / Cond(inside_vrc, 2, 1),\n\t # YSV: isa.getV() now takes care of 'inside_vrc', which is thus commented out, \n\t #      and can be removed. \n         e.svVariant(e.func, v, 1))),\n\n    VContainer__Diag := Rule(@@(1, [Diag], (e,cx) ->\n        cx.isInside(VContainer) and IsSIMD_ISA(Last(cx.VContainer).isa)\n        and not cx.isInside(VTensor)\n        and not cx.isInside(\"VJamL\")\n        and not cx.isInside(\"VJamR\")\n        and not cx.isInside(\"VJam1\")\n        and not cx.isInside(\"VJam\") \n\tand let(\n\t    #inside_vrc := cx.isInside(vRC) or (IsBound(cx.opts.assumeOuter_vRC) and cx.opts.assumeOuter_vRC),\n\t    v := Last(cx.VContainer).isa.getV(), # / Cond(inside_vrc, 2, 1),\n\t    Rows(e) mod v = 0)),\n     (e,cx) -> let(\n\t #inside_vrc := (IsBound(cx.vRC) and cx.vRC <> []) or \n\t #              (IsBound(cx.opts.assumeOuter_vRC) and cx.opts.assumeOuter_vRC),\n\t v := Last(cx.VContainer).isa.getV(), # / Cond(inside_vrc, 2, 1),\n\t # YSV: isa.getV() now takes care of 'inside_vrc', which is thus commented out, \n\t #      and can be removed. \n         VDiag(e.element, v))),\n\n# YSV: if VContainer is used, then I need the following (in particular the VDiag)\n    VContainer_XXX := ARule(Compose, [@(1, VContainer), @(2, [VDiag, Diag, Gath, Scat, ScatAcc])],\n        e -> [ CopyFields(@(1).val, rec(_children := [@(1).val._children[1] * @(2).val])) ]),\n\n    XXX_VContainer := ARule(Compose, [@(1, [VDiag, Diag, Gath, Scat, ScatAcc]), @(2, VContainer)],\n        e -> [ CopyFields(@(2).val, rec(_children := [@(1).val * @(2).val._children[1]])) ]),\n\n    VContainer_VContainer := Rule( [@(1, VContainer), @(2, VContainer, x -> x.isa = @(1).val.isa and x.isa.isCplx()=@(1).val.isa.isCplx())],\n        e -> e.child(1)),\n\n#    Gath_Scat_ScatGath_XXX := ARule(Compose, [ @(1, Scat), @(2, ScatGath) ],\n##    Gath_Scat_ScatGath_XXX := ARule(Compose, [@@(1, [Scat, Gath], (e,cx)->IsBound(cx.VContainer) and cx.VContainer <> []), @(2, ScatGath)],\n#        (e, cx)->let(sg := @@(1).val, v := Last(cx.VContainer).v,\n#            Concat(Error(Caught), [ sg.svVariant(sg.func, vrc.v, 1)]) )),\n\n#############################\n    # Composition of subvector and full vector accesses\n    # The result is VScat_sv that has rem=0 guaranteed, i.e., does not use partially filled vectors\n    VScat_sv__VScat := ARule(Compose, [@(1,[VScat_sv, VScat_svAcc]), @(2, [VScat, VScatAcc])],\n    e -> let(func := @(1).val.func,  vfunc := @(2).val.func,\n             v    := getV(@(1).val), sv    := @(1).val.sv,\n\t     oid  := Cond(ObjId(@(1).val)=VScat_svAcc or ObjId(@(2).val)=VScatAcc, VScat_svAcc, VScat_sv),\n        [ oid(fCompose(func, fTensor(vfunc, fId(v/sv))), v, sv, 0) ])),\n\n    # The result is VGath_sv that has rem=0 guaranteed, i.e., does not use partially filled vectors\n    VGath__VGath_sv := ARule(Compose, [@(1,VGath), @(2,VGath_sv)],\n    e -> let(func := @(2).val.func,  vfunc := @(1).val.func,\n             v    := getV(@(2).val), sv    := @(2).val.sv,\n         [ VGath_sv(fCompose(func, fTensor(vfunc, fId(v/sv))), v, sv, 0) ])),\n\n    # Composition of subvector and scalar accesses\n    Scat__VScat_sv := ARule(Compose, [@(1, Scat), @(2, VScat_sv)], e -> let(s := @(2).val,\n        [ VScat_sv(fCompose(@(1).val.func, fTensor(s.func, fId(s.sv))), s.v, 1, s.rem) ])),\n\n    ScatAcc__VScat_sv := ARule(Compose, [@(1, ScatAcc), @(2, VScat_sv)], e -> let(s := @(2).val,\n        [ VScat_svAcc(fCompose(@(1).val.func, fTensor(s.func, fId(s.sv))), s.v, 1, s.rem) ])),\n\n    VGath_sv__Gath := ARule(Compose, [@(1, VGath_sv), @(2, Gath)], e -> let(s := @(1).val,\n        [ VGath_sv(fCompose(@(2).val.func, fTensor(s.func, fId(s.sv))), s.v, 1, s.rem) ])),\n\n    # Subvector access --> full vector access\n    VScat_sv_to_VScat := Rule(@(1,VScat_sv,e->getV(e)=e.sv), e->VScat(@(1).val.func, @(1).val.v)),\n    VGath_sv_to_VGath := Rule(@(1,VGath_sv,e->getV(e)=e.sv), e->VGath(@(1).val.func, @(1).val.v)),\n    VScat_svAcc_to_VScatAcc := Rule(@(1,VScat_svAcc,e->getV(e)=e.sv), e->VScatAcc(@(1).val.func, @(1).val.v)),\n\n    # Increase granularity if possible (when function is fId(n) or fTensor(X, fId(n)))\n    GathScat_sv_fTensor := Rule([@(1, [VGath_sv, VScat_sv, VScat_svAcc]),\n         [@(2,fTensor), ..., [fId, @(3).cond(e -> Gcd(@(1).val.v/@(1).val.sv, EvalScalar(e)) > 1 )]]],\n     e -> let(v := @(1).val.v, sv := @(1).val.sv, \n          n := EvalScalar(@(3).val),   gcd := Gcd(v / sv, n),\n\t  rem := Cond(@(1).val.rem _is Unk, Unk(TInt), @(1).val.rem/gcd),\n          ObjId(@(1).val)(fTensor(DropLast(@(2).val.children(), 1), fId(n/gcd)), v, sv*gcd, rem))),\n\n    GathScat_sv_HofTensor := Rule([@(1, [VGath_sv, VScat_sv, VScat_svAcc]),\n                        [fCompose, @(9, H, e->_divides(@(1).val.sv, e.params[3]) and e.params[4]=1), \n\t\t\t    [@(2,fTensor), ..., [fId, @(3).cond(e -> Gcd(@(1).val.v/@(1).val.sv, EvalScalar(e)) > 1)]]]],\n     e -> let(v := @(1).val.v, sv := @(1).val.sv, \n          n := EvalScalar(@(3).val),   gcd := Gcd(v / sv, n), hp := @(9).val.params,\n\t  rem := Cond(@(1).val.rem _is Unk, Unk(TInt), @(1).val.rem/gcd),\n          ObjId(@(1).val)(fCompose(H(hp[1]/gcd, hp[2]/gcd, hp[3]/gcd, 1),  fTensor(DropLast(@(2).val.children(), 1), fId(n/gcd))), v, sv*gcd, rem))),\n\n    GathScat_sv_fId := Rule([@(1, [VGath_sv, VScat_sv, VScat_svAcc]), \n\t                         [fId, @(3).cond(e -> Gcd(@(1).val.v/@(1).val.sv, EvalScalar(e)) = @(1).val.v)]],\n     e -> let(v := @(1).val.v, sv := @(1).val.sv, \n          n := EvalScalar(@(3).val),   gcd := Gcd(v / sv, n),\n\t  rem := Cond(@(1).val.rem _is Unk, Unk(TInt), @(1).val.rem/gcd),\n          ObjId(@(1).val)(fId(n/gcd), v, sv*gcd))),\n\n    # Convert objects that are adjacent to vector constructs to vector objects\n    #\n\n    VConstruct_Gath := ARule(Compose, [ @(1, _VConstructL), @(2, Gath, e -> _v_divides_cols(@(1).val)) ],\n        e -> [ @(1).val, VGath_sv(@(2).val.func, getV(@(1).val), 1) ]),\n    VConstruct_Scat := ARule(Compose, [ @(1, _VConstructL), @(2, Scat, e -> _v_divides_cols(@(1).val)) ],\n        e -> [ @(1).val, VScat_sv(@(2).val.func, getV(@(1).val), 1) ]),\n    VConstruct_ScatAcc := ARule(Compose, [ @(1, _VConstructL), @(2, ScatAcc, e -> _v_divides_cols(@(1).val)) ],\n        e -> [ @(1).val, VScat_svAcc(@(2).val.func, getV(@(1).val), 1) ]),\n    VConstruct_Diag := ARule(Compose, [ @(1, _VConstructL), [Diag, @(2).cond(e -> _v_divides_cols(@(1).val))] ],\n        e -> [ @(1).val, VDiag(@(2).val, getV(@(1).val)) ]),\n\n    Scat_VConstruct := ARule(Compose, [ @(1, Scat), @(2, _VConstructR, _v_divides_rows) ],\n        e -> [ VScat_sv(@(1).val.func, getV(@(2).val), 1), @(2).val ]),\n    ScatAcc_VConstruct := ARule(Compose, [ @(1, ScatAcc), @(2, _VConstructR, _v_divides_rows) ],\n        e -> [ VScat_svAcc(@(1).val.func, getV(@(2).val), 1), @(2).val ]),\n    Gath_VConstruct := ARule(Compose, [ @(1, Gath), @(2, _VConstructR, _v_divides_rows) ],\n        e -> [ VGath_sv(@(1).val.func, getV(@(2).val), 1), @(2).val ]),\n    Diag_VConstruct := ARule(Compose, [ [Diag, @(1)], @(2, _VConstructR, _v_divides_rows) ],\n        e -> [ VDiag(@(1).val, getV(@(2).val)), @(2).val ]),\n\n    VGath_Prm := ARule(Compose, [ @(1, VGath), @(2, Prm) ],\n        e -> [ @(1).val, VGath_sv(@(2).val.func, getV(@(1).val), 1) ]),\n    Prm_VScat := ARule(Compose, [ @(1, Prm), @(2, VScat) ],\n        e -> [ VScat_sv(@(1).val.func.transpose(), getV(@(2).val), 1), @(2).val ]),\n    Prm_VScatAcc := ARule(Compose, [ @(1, Prm), @(2, VScatAcc) ],\n        e -> [ VScat_svAcc(@(1).val.func.transpose(), getV(@(2).val), 1), @(2).val ]),\n\n    # NOTE: RowVec must be of constant size, fix this limitation\n    VRowVec := Rule([@(1, VTensor), @(2, RowVec, e -> not IsSymbolic(e.element.domain()))], \n        e -> VTensor(@(2).val.toDiagBlk(), @(1).val.vlen)),\n\n    VColVec := Rule([@(1, VTensor), @(2, ColVec, e -> not IsSymbolic(e.element.domain()))], \n        e -> VTensor(@(2).val.toDiagBlk(), @(1).val.vlen)),\n \n    VPrm_x_I := Rule([@(1, VTensor), @(2, Prm)], e->VPrm_x_I(@(2).val.func, @(1).val.vlen)),\n    VDiag_x_I := Rule([@(1, VTensor), @(2, Diag)], e->VDiag_x_I(@(2).val.element, @(1).val.vlen)),\n    RCDiag_x_I := Rule([@(1, VTensor), @(2, RCDiag)], e->VRCDiag(VDup(@(2).val.element, @(1).val.vlen), @(1).val.vlen)),\n\n    VPrm_x_I_Id := ARule(Compose,[@(1,VPrm_x_I), [Prm, fId]],e->[@(1).val]),\n    Id_VPrm_x_I := ARule(Compose, [[Prm, fId], @(1,VPrm_x_I)], e->[@(1).val]),\n\n    # Remove identity gathers / scatters\n    RemGSP := Rule([@(1, [Gath, Scat, Prm, VGath, VScat]), @(2, fId)], e->I(@(1).val.dims()[1])),\n    RemIL  := ARule(Compose, [ @(1), @(2, I) ], e -> [ @(1).val ]),\n    RemIR  := ARule(Compose, [ @(1, I), @(2) ], e -> [ @(2).val ]),\n\n    #   H rules\n    VGath_sv_H := Rule( [@(1,VGath_sv), [H,\n            @(2).cond(e->not IsSymbolic(e)),\n            @(3).cond(e->_divides(getV(@(1).val), e)),\n            @(4).cond(e->_divides(getV(@(1).val), e)), _1]], \n\te -> let(\n            d := e.v / e.sv,\n\t    rmod := EvalScalar(@(2).val) mod getV(@(1).val),\n\t    Cond(rmod=0,\n\t\t VGath(H(@(2).val/d, @(3).val/d, @(4).val/d, 1), e.v),\n\t\t VGath_pc(@(2).val*e.sv, @(3).val*e.sv, @(4).val*e.sv, e.v))\n\t)),\n\n    VScat_sv_H := Rule( [@(1, [VScat_sv, VScat_svAcc]), [H,\n            @(2).cond(e->not IsSymbolic(e)),\n            @(3).cond(e->_divides(getV(@(1).val), e)),\n            @(4).cond(e->_divides(getV(@(1).val), e)), _1]], \n\te -> let(\n            d := e.v / e.sv,\n\t    oid   := Cond(ObjId(@(1).val)=VScat_sv, VScat, VScatAcc),\n\t    oidpc := Cond(ObjId(@(1).val)=VScat_sv, VScat_pc, VScat_pcAcc),\n\t    rmod := EvalScalar(@(2).val) mod getV(@(1).val),\n\t    Cond(rmod=0,\n\t\t oid(H(@(2).val/d, @(3).val/d, @(4).val/d, 1), e.v), \n\t\t oidpc(@(2).val*e.sv, @(3).val*e.sv, @(4).val*e.sv, e.v))\n\t)),\n\n   Scat_VScat_pc_to_VScat_sv := ARule(Compose, [@(1, Scat), @(2, VScat_pc, x -> x.N=x.n and x.ofs = 0)],\n       e -> [VScat_sv(@(1).val.func, @(2).val.v, 1)]),\n\n   VGath_pc_Gath_H := ARule(Compose, [@(1, VGath_pc), [Gath, [@(2, H), @, @, @, _1]]],\n       e -> [VGath_pc(@(2).val.params[1], @(1).val.n, @(2).val.params[3], @(1).val.v)] ),\n\n   Scat_H_VScat_pc := ARule(Compose, [[Scat, [@(1, H), @, @, @, _1]], @(2, [VScat_pc, VScat_pcAcc])],\n       e -> [ObjId(@(2).val)(@(1).val.params[1], @(2).val.n, @(1).val.params[3], @(2).val.v)] ),\n        \n   ScatGath := Rule([@(1, VTensor), @(2, ScatGath)], \n       e -> ScatGath(fTensor(@(2).val.sfunc, fId(@(1).val.vlen)), fTensor(@(2).val.gfunc, fId(@(1).val.vlen)))),\n\n   Scat_Cvt := ARule(Compose, [@(1, Scat), @(2, Cvt, x -> IsSIMD_ISA(x.params[1].isa_to) and _divides(x.params[1].isa_to.v, Cols(@(1).val)) )],\n      e -> let(isa := @(2).val.params[1].isa_to, [ VContainer(VScat_sv(@(1).val.func, isa.v, 1), isa), @(2).val ])),\n   Cvt_Gath := ARule(Compose, [@(1, Cvt, x -> IsSIMD_ISA(x.params[1].isa_from)), @(2, Gath, x -> _divides(@(1).val.params[1].isa_from.v, Rows(x)))],\n      e -> let(isa := @(1).val.params[1].isa_from, [ @(1).val, VContainer(VGath_sv(@(2).val.func, isa.v, 1), isa) ])),\n));\n", "meta": {"hexsha": "55ef65379cedae8d171f153828bea837dc406486", "size": 13187, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/rewrite/vectorize.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/rewrite/vectorize.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/rewrite/vectorize.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 58.6088888889, "max_line_length": 226, "alphanum_fraction": 0.5601728976, "num_tokens": 4911, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46879062662624377, "lm_q2_score": 0.036769466075598736, "lm_q1q2_score": 0.017237181042292344}}
{"text": "# Copyright (c) 2018-2020, Carnegie Mellon University\n# See LICENSE for details\n\nDeclare(sve_gath, sve_scat, sve_ld2, sve_st2);\n\nClass(TVectSVE, TReal);\nTVectSVEx2 := TVect(TVectSVE, 2);\n\nClass(TBoolSVE, TBool);\nClass(TInt64SVE, TInt);\n\n# SVE vector loop\nClass(sve_loopn, loopn);\n\nClass(sve_svcntd, Exp, rec(    \n    computeType := self >> TInt\n));\n\n\n# svfloat64_t svld1_gather_[u64]offset[_f64](svbool_t pg, const float64_t *base, svuint64_t offsets) \n\nClass(sve_gath, Loc, rec(\n    __call__ := (self, loc, n, pg, stride) >> WithBases(self,\n        rec(operations := NthOps,\n            loc := toExpArg(loc),\n            n := toExpArg(n),\n            pg := toExpArg(pg),\n            stride := toExpArg(stride))).setType(),\n\n    can_fold := False,\n\n    rChildren := self >> [self.loc, self.n, self.pg, self.stride],\n    rSetChild := rSetChildFields(\"loc\", \"n\", \"pg\", \"stride\"),\n\n    ev := self >> let(e := self.eval(), Cond(IsBound(e.v), e.v, e)),\n\n    eval := self >> sve_gath(self.loc.eval(), self.n.eval(), self.pg.eval(), self.stride.eval()),\n\n    computeType := self >> TVectSVE,\n\n    isExpComposite := true\n));\n\n\nClass(sve_scat, Command, rec(\n   __call__ := (self, loc, n, pg, stride, exp) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       n := toExpArg(n),\n       pg := toExpArg(pg),\n       stride := toExpArg(stride),\n       exp := toExpArg(exp)\n       )),\n\n   rChildren := self >> [self.loc, self.n, self.pg, self.stride, self.exp],\n   rSetChild := rSetChildFields(\"loc\", \"n\", \"pg\", \"stride\", \"exp\"),\n   unroll := self >> self,\n\n   print := (self,i,si) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.n, \", \", self.pg, \", \", self.stride, \", \", self.exp, \")\"))\n));\n\n\n# svfloat64x2_t svld2[_f64](svbool_t pg, const float64_t *base)\n\nClass(sve_ld2, Loc, rec(\n    __call__ := (self, loc, n, pg) >> WithBases(self,\n        rec(operations := NthOps,\n            loc := toExpArg(loc),\n            n := toExpArg(n),\n            pg := toExpArg(pg))).setType(),\n\n    can_fold := False,\n\n    rChildren := self >> [self.loc, self.n, self.pg],\n    rSetChild := rSetChildFields(\"loc\", \"n\", \"pg\"),\n\n    ev := self >> let(e := self.eval(), Cond(IsBound(e.v), e.v, e)),\n\n    eval := self >> sve_ld2(self.loc.eval(), self.n.eval(), self.pg.eval()),\n\n    computeType := self >> TVectSVEx2,\n\n    isExpComposite := true\n));\n\n\nClass(sve_st2, Command, rec(\n   __call__ := (self, loc, n, pg, exp) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       n := toExpArg(n),\n       pg := toExpArg(pg),\n       exp := toExpArg(exp)\n       )),\n\n   rChildren := self >> [self.loc, self.n, self.pg, self.exp],\n   rSetChild := rSetChildFields(\"loc\", \"n\", \"pg\", \"exp\"),\n   unroll := self >> self,\n\n   print := (self,i,si) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.n, \", \", self.pg, \", \", self.exp, \")\"))\n));\n\n", "meta": {"hexsha": "6966b68b1b0e91a62406a01b224b7beca346ab1e", "size": 3979, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "code.gi", "max_stars_repo_name": "spiral-software/spiral-package-ffte", "max_stars_repo_head_hexsha": "19f751776c117e28bdbcc3d2530c895ad554d855", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "code.gi", "max_issues_repo_name": "spiral-software/spiral-package-ffte", "max_issues_repo_head_hexsha": "19f751776c117e28bdbcc3d2530c895ad554d855", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "code.gi", "max_forks_repo_name": "spiral-software/spiral-package-ffte", "max_forks_repo_head_hexsha": "19f751776c117e28bdbcc3d2530c895ad554d855", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-15T12:41:51.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:41:51.000Z", "avg_line_length": 34.0085470085, "max_line_length": 128, "alphanum_fraction": 0.5147021865, "num_tokens": 1033, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.42632157796989345, "lm_q2_score": 0.040237939746287525, "lm_q1q2_score": 0.01715430196689479}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n# Declaration of a sorter of one dimension within tuples of size n\n#n is the number of inputs in total. So, there are n/2 tuples\n#w should be minimum 2\nClass(SortVecBase, BaseMat, rec(\n   abbrevs   := [()-> []],\n   new       := (self) >> SPL( WithBases(self, rec()) ).setDims(),\n   dims      := self >> [ 4, 4 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [],\n   rSetChild := rSetChildFields(),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\nClass(SortVecConfigBase_w2, BaseMat, rec(\n   abbrevs   := [(a)-> [a] , (b)-> [b]],\n   new       := (self, a, b) >> SPL( WithBases(self, rec(dimensions:=[2,2], a := a, b:=b))),\n   print := (self, i, is) >> Print(self.name, \"(\", self.a, \",\", self.b, \")\"),\n   dims      := self >> [ 2, 2 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [self.a, self.b],\n   rSetChild := rSetChildFields(\"a\",\"b\"),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\n# Declaration of SortConfigBase, a 2x2 Configurable sorter.\nClass(SortVecConfigBase, BaseMat, rec(\n   abbrevs   := [(a)-> [a]],\n   new       := (self, a) >> SPL( WithBases(self, rec(dimensions:=[4,4], a := a))),\n   print := (self, i, is) >> Print(self.name, \"(\", self.a, \")\"),\n   dims      := self >> [ 4, 4 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [self.a],\n   rSetChild := rSetChildFields(\"a\"),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\nClass(SortVecBase_w2, BaseMat, rec(\n   abbrevs   := [(a)-> [a]],\n   new       := (self, a) >> SPL( WithBases(self, rec(dimensions:=[2,2], a := a))),\n   print := (self, i, is) >> Print(self.name, \"(\", self.a, \")\"),\n   dims      := self >> [ 2, 2 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [self.a],\n   rSetChild := rSetChildFields(\"a\"),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\nHDLCodegen.SortVecBase_w2 := (self, o, y, x, opts) >>\n   let(\n     t0 := TempVar(x.t.t),\n     t1 := TempVar(x.t.t),\n     t3 := TempVar(x.t.t),\n     t5 := TempVar(x.t.t),\n     t6 := TempVar(x.t.t),\n\n     t20 := TempVar(x.t.t),\n     t21 := TempVar(x.t.t),\n     t23 := TempVar(x.t.t),\n     t25 := TempVar(x.t.t),\n     t26 := TempVar(x.t.t),\n\n     chain(\n        assign(t3, imod(o.a, 2)),\n        regassign(t0, cond(t3, t0, nth(x,0))),\n        assign(t5, cond(leq(t0, nth(x,0)), nth(x,0), t0)),\n        assign(t6, cond(leq(t0, nth(x,0)), t0, nth(x,0))),\n        regassign(t1, cond(t3, t5, t1)),\n        assign(nth(y,0), cond(t3, t6, t1)),\n\n        regassign(t20, cond(t3, t20, nth(x,1))),\n        assign(t25, cond(leq(t0, nth(x,0)), nth(x,1), t20)),\n        assign(t26, cond(leq(t0, nth(x,0)), t20, nth(x,1))),\n        regassign(t21, cond(t3, t25, t21)),\n        assign(nth(y,1), cond(t3, t26, t21))\n\n     )\n  );\n\nHDLCodegen.SortVecConfigBase_w2 := (self, o, y, x, opts) >>\n   let(\n     t0 := TempVar(x.t.t),\n     t1 := TempVar(x.t.t),\n     t3 := TempVar(x.t.t),\n     t5 := TempVar(x.t.t),\n     t6 := TempVar(x.t.t),\n     t7 := TempVar(x.t.t),\n     t8 := TempVar(x.t.t),\n     t9 := TempVar(x.t.t),\n     t10 := TempVar(x.t.t),\n     t2 := TempVar(x.t.t),\n\n     t20 := TempVar(x.t.t),\n     t21 := TempVar(x.t.t),\n     t23 := TempVar(x.t.t),\n     t25 := TempVar(x.t.t),\n     t26 := TempVar(x.t.t),\n\n\n     chain(\n\tassign(t3, imod(o.a, 2)),\n\tregassign(t0, cond(t3, t0, nth(x,0))),\n\tassign(t7, eq(o.b,0)),\n\tassign(t8, eq(o.b,1)),\n\t\t\n\tassign(t2, leq(t0, nth(x,0))),\n\tassign(t9, cond(t2, t0, nth(x,0))),\n\tassign(t10, cond(t2, nth(x,0), t0)),\n\tassign(t5, cond(t7, nth(x,0) , t8, t9, t10)),\n\tassign(t6, cond(t7, t0 , t8, t10, t9)),\n\t\n\tregassign(t1, cond(t3, t5, t1)),\n\tassign(nth(y,0), cond(t3, t6, t1)),\n\n        regassign(t20, cond(t3, t20, nth(x,1))),\n        assign(t25, cond(leq(t0, nth(x,0)), nth(x,1), t20)),\n        assign(t26, cond(leq(t0, nth(x,0)), t20, nth(x,1))),\n        regassign(t21, cond(t3, t25, t21)),\n        assign(nth(y,1), cond(t3, t26, t21))\n\n     )\n    );\n\nHDLCodegen.SortVecBase := (self, o, y, x, opts) >>\n    chain(\n        assign(nth(y,0), cond(leq(nth(x,0), nth(x,2)), nth(x,0), nth(x,2))),\n        assign(nth(y,2), cond(leq(nth(x,0), nth(x,2)), nth(x,2), nth(x,0))),\n\n        assign(nth(y,1), cond(leq(nth(x,0), nth(x,2)), nth(x,1), nth(x,3))),\n        assign(nth(y,3), cond(leq(nth(x,0), nth(x,2)), nth(x,3), nth(x,1)))\n    );\n\n\n\nHDLCodegen.SortVecConfigBase := (self, o, y, x, opts) >>\n    let(\n\tt0 := TempVar(x.t.t),\n\tt1 := TempVar(x.t.t),\n\tt2 := TempVar(x.t.t),\n\tt3 := TempVar(x.t.t),\n\tchain(\n\t    assign(t2, nth(x,0)),\n\t    assign(t3, nth(x,2)),\n\t    assign(t0, cond(leq(t2, t3), t2, t3)), \n\t    assign(t1, cond(leq(t2, t3), t3, t2)),\t    \n\t    assign(nth(y,0), cond(eq(o.a,0), t2, eq(o.a,1), t1, t0)),\n\t    assign(nth(y,2), cond(eq(o.a,0), t3, eq(o.a,1), t0, t1)),\n\n            assign(nth(y,1), cond(leq(nth(x,0), nth(x,2)), nth(x,1), nth(x,3))),\n            assign(nth(y,3), cond(leq(nth(x,0), nth(x,2)), nth(x,3), nth(x,1)))\n\n\t)\n    ); \n\n\n\nClass(SortVec, TaggedNonTerminal, rec(\n    abbrevs := [\n    (n)       -> Checked(IsPosIntSym(n), [_unwrap(n)]),\n    ],\n\n    hashAs := self >> ObjId(self)(self.params[1]).withTags(self.getTags()),\n\n    dims := self >> [ self.params[1], self.params[1] ],\n\n    terminate := self >> Error(\"not supported\"), # we could probably support this\n));\n\nNewRulesFor(SortVec, rec(\n\n    Sort_Stream_Vec := rec(\n        info         := \"Streaming sorting network\",\n\n        applicable   := nt -> Length(nt.params) = 1 and IsTwoPower(nt.params[1]),\n\n        children := (self, nt) >> let(\n\n\t    tag_w_tmp := nt.tags[1],\n\t    tag_w := tag_w_tmp.bs,\n\t    t := Log2Int(nt.params[1]),\n\t    p := Ind(2^t),\n\t    #get_bb := w -> TTensorI(SortVecBase(), 2^(t-1), APar, APar),\n\t    get_bb := w -> Cond(w=2, TTensorInd(SortVecBase_w2(p), p, APar, APar),TTensorI(SortVecBase(), 2^(t-1), APar, APar)),\n\n\t    [[ TCompose(\n\t           [TCompose(List([1..t-1], i ->\n\t               TCompose([\n\t\t           #TTensorI(SortBase(), 2^(t-1), APar, APar),  \n\t\t           get_bb(tag_w), \n\t\t           TCompose(List([2..(t-i+1)], j -> \n\t\t               TCompose([\n\t\t\t       \n\t\t\t           # The one below *should* work, but it causes some rewriting problems.\n\t\t\t           #TPrm(Tensor(Tensor(I(2^(t-j)),(Tensor(I(2), L(2^(j-1), 2^(j-2))) * L(2^j,2))),I(2))),\n\t\t\t\t   # So, I'm going to pull the first I() out of the tensor product.  This\n\t\t\t\t   # changes it from: \n\t\t\t\t   #      TPrm(I x (IxL)*L x I) \n\t\t\t\t   # to:\n\t\t\t\t   #      I x (TPrm(IxL)*L x I)\n\t\t\t\t   TTensorI(TPrm(Tensor(Tensor(I(2), L(2^(j-1), 2^(j-2))) * L(2^j,2), I(2))), 2^(t-j), APar, APar),\n\n\t\t\t\t   # This one doesn't work because it has nested TPrms and it has TTensorI in a TPrm.\n\t\t\t           #TPrm(Tensor(TTensorI(TPrm(Tensor(I(2), L(2^(j-1), 2^(j-2))) * L(2^j,2)), 2^(t-j), APar, APar),I(2))),\n\t\t\t           get_bb(tag_w)\n\t\t\t           #TTensorI(SortBase(), 2^(t-1), APar, APar)\n\t\t\t       ])\n\t\t           )),\n\t\t\t \n\t\t\t   # TPrm(Tensor(TTensorI(TPrm(L(2^(t-i+1), 2^(t-i)) * SortIJPerm(2^(t-i+1))), 2^(i-1), APar, APar),I(2)))\n\t\t\t   # Like above, re-ordering these terms\n\t\t\t   # TPrm(Tensor(Tensor(I(2^(i-1)), L(2^(t-i+1), 2^(t-i)) * SortIJPerm(2^(t-i+1) ) ) ,I(2)))\n\t\t\t   TTensorI(TPrm(Tensor(L(2^(t-i+1), 2^(t-i)) * SortIJPerm(2^(t-i+1)), I(2))), 2^(i-1), APar, APar)\n\n\t\t       ])\n\t            )),\t\t\n\t\t    get_bb(tag_w)] \n\t\t    #TTensorI(SortBase(), 2^(t-1), APar, APar)] \n                ).withTags(nt.getTags())\n            ]]\n\t),\n\n        apply        := (nt, c, cnt) -> c[1],\n\n    ),\n\n   Sort_Stream4_Vec := rec(\n        info         := \"\",\n\n\tdepth := 1,\n\n        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n\t                              let (d := self.depth, t := Log2Int(nt.params[1]), IsInt(t*t/self.depth) and\n\t\t\t\t      (IsInt(d/t) or IsInt(t/d))),\n\n        children := (self, nt) >> let(\n   \t    t := Log2Int(nt.params[1]),\n\t    d := self.depth,\n\t    d1 := cond(leq(d,t), d, t).ev(),\n\t    d2 := cond(leq(d,t), 1, d/t).ev(), \n\n\t    k := Ind(2^(t-1)),\n\t    j := Ind(t),\n\t    l := Ind(t),\n\t    n := Ind(t/d2),\n\t    v := Ind(t/d1),\n\t    \n            d_tmp := cond(leq(d,t), t/d, 0).ev(),\n            d2_tmp := cond(leq(t,d), d/t, 0).ev(),\n\t    s_tmp := ((t*t)/d),\n            m2 := Ind(d_tmp),\n\t    s2 := Ind(s_tmp),\n\t    v2 := Ind(d2_tmp),\n\t    n2 := Ind(d),\n\t    n3 := Ind(d),\n\t    l2 := Ind(t),\n\t   \n\t    tag_w_tmp := nt.tags[1],\n\t    tag_w := tag_w_tmp.bs,\n\t    p := Ind(2^t),\n\n \n\t    c1 := (lp, jp) >> lt((t-1), (lp+jp)),\n\t    z := (lp, jp) >> (t-1)-(lp+jp),\n\t    z_w1 := (lp, jp) >> (t-1)-(lp+jp)+1,\n\t    c2 := (lp, jp) >> logic_and(eq(bit_sel(k, z(lp, jp)), 1), neq(lp, 0)),\n\t    c2_w1 := (lp, jp) >> logic_and(eq(bit_sel(p, z_w1(lp, jp)), 1), neq(lp, 0)),\n\t    \t    \n\t    access_f := (lp, jp) >> cond(c1(lp, jp), 0, c2(lp, jp), 1, 2),\n\t    access_f_w1 := (lp, jp) >> cond(c1(lp, jp), 0, c2_w1(lp, jp), 1, 2),\n\t   \n\t    get_bb := (lp,jp) -> Cond(tag_w=2, TTensorInd(SortVecConfigBase_w2(p,access_f_w1(lp,jp)), p, APar, APar),TTensorInd(SortVecConfigBase(access_f(lp, jp)), k, APar, APar)),\n\n\t    stage := (lp, jp) >> TCompose([\n\t\t       get_bb(lp, jp),\n\t\t       #TTensorInd(SortConfigBase(access_f(lp, jp)), k, APar, APar),\n\t\t       TPrm(Tensor(L(2^t, 2^(t-1)),I(2)))\n\t           ]),\n\n\t    full_stage := np_1 >> TCompose(List([0..t-1], m_1 -> TCompose(List([0..t-1], j_1 -> stage(m_1, j_1))))),\n\t    full_stage1 := np >> TCompose(List([0..d2-1], m -> TCompose(List([0..t-1], j -> stage(d2*np+m, j))))),\n\t    full_stage2 := vp >> TCompose(List([0..d1-1], s -> stage(l, vp+s))),\n            full_stage1b := np2 >> TICompose(m2,d_tmp, TICompose(j,t, stage((t/d)*np2+m2, j))),\n\n            # Old: problem is that it's assuming the l2 above, which is an unassigned iterator.  \n\t    # There is also a problem with the vp2+s2 parameter: you need to multiply vp2 by the number of iterations.\n            # full_stage2b := (vp2) >> TICompose(s2,s_tmp, stage(l2, vp2+s2)),\n            full_stage2b := (vp2, l3) >> TICompose(s2,s_tmp, stage(l3, vp2*s_tmp+s2)),\n\t\n  \t    [[ Cond(d=t*t, full_stage(0).withTags(nt.getTags()),\t\t\n\t\t    d<t, TCompose(List([0..d-1], n2 -> full_stage1b(n2))).withTags(nt.getTags()),\n                    d=t, TCompose(List([0..d-1], n3 -> full_stage1b(n3))).withTags(nt.getTags()),\n                    d>t, TCompose(List([0..t-1], l3 -> TCompose(List([0..d2_tmp-1], v2 -> full_stage2b(v2, l3))))).withTags(nt.getTags())) #the problem seems to be the outer most TCompose works if it was TICompose\t\t    \n\t\t    #d>t, TICompose(n, t/d2, full_stage1(n)).withTags(nt.getTags())) #old one but will leave it as new one does not work yet\n\t        ]]\n\t),\n\t\n#\n\n        apply        := (nt, c, cnt) -> c[1],\n\n    ),\n\n\n\n));\n", "meta": {"hexsha": "34f7377e218b979f44d89992a8628ee37a423777", "size": 10828, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/stream/sortvec.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/stream/sortvec.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/stream/sortvec.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.1577287066, "max_line_length": 219, "alphanum_fraction": 0.5063723679, "num_tokens": 3897, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.49609382947091946, "lm_q2_score": 0.03410042681663018, "lm_q1q2_score": 0.016917011326054904}}
{"text": "SetRecursionTrapInterval(100000);\n# No limit (may crash GAP if recursion is not controlled) :\nSetRecursionTrapInterval(0);\n", "meta": {"hexsha": "1260c06af66191e40ef5e0d240a0d7b7e9380cfd", "size": 123, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Find-limit-of-recursion/GAP/find-limit-of-recursion-2.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Find-limit-of-recursion/GAP/find-limit-of-recursion-2.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Find-limit-of-recursion/GAP/find-limit-of-recursion-2.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 30.75, "max_line_length": 59, "alphanum_fraction": 0.8048780488, "num_tokens": 31, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.29421497216298875, "lm_q2_score": 0.057493282030230575, "lm_q1q2_score": 0.01691538437208315}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(ICompose, ISum, fTensor, fBase, fId, fCompose);\nDeclare(RC);\n\n# ===========================================================================\n# SPL Sums Notation\n# ===========================================================================\n# Blk - block\n# Blk1 - 1x1 block\n# Data(var, value, expr) - data\n# ISum - iterative sum\n# SUM - sum\n#\n# Gath(N,n,func) - gather matrix\n# Scat(N,n,func) - scatter matrix\n# Prm(N, read_func, write_func) - read: output->input, write: input->output\n# Conj, ConjL, ConjR, ConjLR - generalized conjugation (arbitrary/no matrix to left and right)\n# ConjDiag to conjugate block diagonals\n# ===========================================================================\n\nClass(SumsBase, rec(\n    isSums := true,\n    area := self >> Sum(self.children(), x->x.area()),\n    sums := meth(self)\n       local children, i, res;\n       res := Copy(self);\n       children := Map(res.rChildren(), c -> Cond(IsSPL(c), c.sums(), c));\n       for i in [1..Length(children)] do\n           res.rSetChild(i, children[i]);\n       od;\n       return res;\n    end\n));\n\nCompose.area   := self >> Sum(self.children(), x->x.area());\nDiag.area      := self >> Rows(self);\nScale.area     := self >> 0;\nIsSumsSPL := o -> IsRec(o) and\n                ((IsBound(o.isSums) and o.isSums) or\n                 (Same(ObjId(o), Compose) and ForAll(o.children(), IsSumsSPL)));\n\n# ==========================================================================\n# TCast(<n>, <to_type>, <from_type>) - type conversion on <n> elements\n# ==========================================================================\nClass(TCast, SumsBase, Sym, rec(\n    abbrevs := [\n        (n, to_type)            -> Checked(IsPosInt0Sym(n), IsType(to_type), [n, to_type, TUnknown]),\n        (n, to_type, from_type) -> Checked(IsPosInt0Sym(n), IsType(to_type), [n, to_type, from_type])\n    ],\n    def := (n, to_type, from_type) -> Perm((), n),\n    dmn := self >> [ TArray(self.params[3], self.params[1]) ],\n    rng := self >> [ TArray(self.params[2], self.params[1]) ],\n\n    transpose := self >> self,\n    conjTranspose := self >> self,\n    inverse := self >> self,\n    isSymmetric := True,\n    isPermutation := False,\n));\n\n# ==========================================================================\n# BB(<spl>) - basic block container, serves as barrier for rule application\n# ==========================================================================\nClass(BB, SumsBase, BaseContainer, rec(isBlock:=true,\n    rng := meth(self) return self._children[1].rng(); end,\n    dmn := meth(self) return self._children[1].dmn(); end,\n));\n\nClass(Buf, SumsBase, BaseContainer, rec(\n    rng := meth(self) return self._children[1].rng(); end,\n    dmn := meth(self) return self._children[1].dmn(); end\n));\n\nDeclare(PushL, PushR, PushLR, NoPullLeft, NoPullRight);\n\n# Forces propagation into *left* construct (e.g. ISum, RecursStep, BB, etc)\n# Also .sums() conversion always returns same object, ie conversion of\n# child is not forced. This is done to avoid Sigma-SPLizing constructs\n# that we want to pull in .\nClass(PushL, Buf, rec(\n    sums := self >> self,\n    transpose := self >> PushR(self.child(1).transpose()),\n    normalizedArithCost := self >> self.child(1).normalizedArithCost(),\n));\n\n# Forces propagation into *right* construct (e.g. ISum, RecursStep, BB, etc)\n# Also .sums() conversion always returns same object, ie conversion of\n# child is not forced. This is done to avoid Sigma-SPLizing constructs\n# that we want to pull in .\nClass(PushR, Buf, rec(\n    sums := self >> self,\n    transpose := self >> PushL(self.child(1).transpose()),\n    normalizedArithCost := self >> self.child(1).normalizedArithCost(),\n));\n\n# Allows propagation into either right or left construct (e.g. ISum, RecursStep, BB, etc)\n# Also .sums() conversion always returns same object, ie conversion of\n# child is not forced. This is done to avoid Sigma-SPLizing constructs\n# that we want to pull in .\nClass(PushLR, Buf, rec(sums := self >> self));\n\n# Prevents propagation into constructs on both sides (e.g. ISum, RecursStep, BB, etc)\nClass(NoPull, Buf);\n\n# Prevents pull-in. Used for distributed stuff.\nClass(NoPull_Dist, Buf);\n\n# Prevents propagation pulling in of diags\nDeclare(NoDiagPullinRight);\nClass(NoDiagPullin, Buf);\nClass(NoDiagPullinLeft, Buf, rec(\n    transpose := self >> NoDiagPullinRight(self.child(1).transpose())\n));\nClass(NoDiagPullinRight, Buf, rec(\n    transpose := self >> NoDiagPullinLeft(self.child(1).transpose())\n));\n\n# Prevents propagation into left construct (e.g. ISum, RecursStep, BB, etc)\nClass(NoPullLeft, Buf, rec(transpose := self >> NoPullRight(self.child(1).transpose())));\n\n# Prevents propagation into right construct (e.g. ISum, RecursStep, BB, etc)\nClass(NoPullRight, Buf, rec(transpose := self >> NoPullLeft(self.child(1).transpose())));\n\n# Top level wrapper for Sigma-SPL formulas\nClass(Formula, BaseContainer, SumsBase);\n\n#F RecursStep(<expr>)\n#F RecursStep(<yofs>, <xofs>, <expr>) - with implicit\n#F     fAdd on Gath (xofs) and Scat (yofs) side\n#F\nClass(RecursStep, SumsBase, BaseContainer, rec(\n    abbrevs := [ ch -> [0,0,ch],\n                 (yofs,xofs,ch) -> [yofs, xofs, ch] ],\n    new := (self, yofs, xofs, ch) >> SPL(WithBases(self,\n    rec(yofs:=yofs, xofs:=xofs, _children := [ch], dimensions := ch.dims()))),\n    rChildren := self >> [self.yofs, self.xofs, self._children[1]],\n    rSetChild := meth(self, n, what)\n        if n=1 then self.yofs := what;\n        elif n=2 then self.xofs := what;\n        elif n=3 then self._children[1] := what;\n        else Error(\"<n> must be in [1..3]\");\n        fi;\n    end,\n));\n\nClass(Inplace, SumsBase, BaseContainer, rec(\n  rng:=self>>self._children[1].rng(),\n  dmn:=self>>self._children[1].dmn(),\n  numops:=self >>0, # YSV: what is this? pls remove or document\n  toNonInplace := self >> self._children[1],\n  isInplace := self >> true,\n  normalizedArithCost := self >> self._children[1].normalizedArithCost(),\n));\n\nClass(LStep, SumsBase, BaseContainer, rec(\n    toAMat := self >> AMatMat(Sum([I(Rows(self)), self.child(1)], MatSPL))\n));\n\nDeclare(RTWrap); # to avoid complaints in .transpose\n\nClass(RTWrap, SumsBase, BaseContainer, rec(\n    new := (self, rt) >> Checked(Global.formgen.IsRuleTree(rt),\n    SPL(WithBases(self, rec(\n        rt   := rt,\n        root := rt.node))).setDims()),\n\n    area := self >> Rows(self) * Cols(self),\n    children := self >> [self.rt],\n    child := (self, n) >> When(n=1, self.rt, Error(\"<n> must be 1\")),\n    setChild := rSetChildFields(\"rt\"),\n    rSetChild := ~.setChild,\n    rChildren := ~.children,\n\n    dims          := self >> self.rt.dims(),\n    isPermutation := self >> self.rt.node.isPermutation(),\n    isReal        := self >> self.rt.node.isReal(),\n    toAMat        := self >> self.rt.node.toAMat(),\n\n    transpose     := self >> RTWrap(self.rt.transpose()),\n    conjTranspose := self >> InertConjTranspose(self),\n    isInertConjTranspose := True,\n));\n\n# ==========================================================================\n# COND(<spl>) - This is a 'switch' statement for SPLs \n# ==========================================================================\nClass(COND, SumsBase, BaseContainer, rec(\n    abbrevs := [ arg -> let(f:=Flat(arg), [f[1], Drop(f, 1)]) ],\n    new := (self, cond, spls) >> SPL(WithBases(self, rec(\n        _children := spls,\n        dimensions := spls[1].dimensions,\n        cond := cond))),\n\n    toAMat := self >> When(self.cond.ev()=V(true) or self.cond.ev()=1,\n        self.child(1).toAMat(),\n        self.child(2).toAMat()),\n\n    rChildren := self >> Concatenation([self.cond], self._children),\n    rSetChild := meth(self, n, newC)\n        if n = 1 then self.cond := newC;\n        else self.setChild(n-1, newC);\n        fi;\n    end,\n\n    area := self >> Maximum(List(self.children(), x->x.area())),\n\n    sums := self >> CopyFields(self, rec(_children := List(self._children, x->x.sums()))),\n    transpose := self >> CopyFields(self, rec(_children := List(self._children, x->x.transpose()))),\n));\n\nClass(RC, SumsBase, BaseContainer, rec(\n    dims := self >> let(d:=self.child(1).dims(), [2*d[1], 2*d[2]]),\n    isReal := self >> true,\n\n    # when RC(M) is transposed with M - complex, not only M is transposed, but also\n    # each complex element of M as a 2x2 matrix is transposed == complex conjugation\n    transpose := self >> CopyFields(self, rec(_children := [self.child(1).conjTranspose()],\n        dimensions := [self.dimensions[2], self.dimensions[1]])),\n\n    # RC(.) is real, conjTranspose is just a regular transpose\n    conjTranspose := self >> self.transpose(),\n    inverse := self >> CopyFields(self, rec(_children := [self.child(1).inverse()],\n        dimensions := [self.dimensions[2], self.dimensions[1]])),\n\n    sums := self >> CopyFields(self, rec(_children := [self.child(1).sums()])),\n    area := self >> 2*self.child(1).area(),\n    toAMat := self >> AMatMat(RealMatComplexMat(MatSPL(self.child(1)))),\n    createCode := self >> Cond(IsBound(self.child(1).createCode), RC(self.child(1).createCode()), self),\n\n    # assume that normalizedArithCost() always returns cost in real ops\n    normalizedArithCost := self >> self.child(1).normalizedArithCost(),\n\n));\n\n# This takes a real matrix that can be seen as RC(A) and returns A as complex matrix\nClass(CR, SumsBase, BaseContainer, rec(\n    dims := self >> List(self.child(1).dimensions, e -> _unwrap(div(e,2))),\n\n    # the derived matrix is real, but over the complex field\n    isReal := self >> false,\n\n    transpose := self >> CopyFields(self, rec(\n\t_children := [self.child(1).transpose()],\n        dimensions := [self.dimensions[2], self.dimensions[1]])),\n\n    # CR(.) is complex, but all entries are real, conjTranspose is just a regular transpose\n    conjTranspose := self >> self.transpose(),\n\n    inverse := self >> CopyFields(self, rec(_children := [self.child(1).inverse()],\n        dimensions := [self.dimensions[2], self.dimensions[1]])),\n\n    sums := self >> CopyFields(self, rec(_children := [self.child(1).sums()])),\n\n    area := self >> 1/2*self.child(1).area(),\n\n    toAMat := self >> let(mat := MatSPL(self.child(1)),\n        rmat := List(mat{2*[1..Length(mat)/2]}, m -> m{2*[1..Length(m)/2]}),\n        AMatMat(rmat)\n        ),\n\n    # assume that normalizedArithCost() always returns cost in real ops\n    normalizedArithCost := self >> self.child(1).normalizedArithCost(),\n    vcost := self >> self.child(1).vcost()\n\n));\n\n# ==========================================================================\n# Blk(<mat>) - matrix block\n# ==========================================================================\n# Note: Blk should not check for M being a matrix, \n#   otherwise cant reuse Blk for vector code\nClass(Blk, SumsBase, Mat, rec(\n    new := (self, M) >> SPL(WithBases(self, rec(\n            element := M,\n            TType   := Cond( # NOTE: add checks to M\n                            IsList(M),     UnifyTypes(List(Flat(M), InferType)),\n                            IsValue(M),    M.t.t,\n\t\t\t    IsSymbolic(M), M.t.t),\n\t\t\t))).setDims(),\n    area := self >> Length(Filtered(Flat(self.element), k -> k<>0)),\n    new  := (self, M) >> SPL(WithBases(self, rec(element := M))).setDims(),\n    dims := self >> Dimensions(self.element)\n));\n\n# ==========================================================================\n# Blk1(<val>) - 1x1 block\n# ==========================================================================\nClass(Blk1, SumsBase, BaseMat, rec(\n    # Compare mathematically Blks disregarding differences in way to express code-level elements.\n#    new := (self, val) >> SPL(WithBases(self, rec(dimensions:=[1,1], element:=val))),\n#    toAMat := self >> AMatMat([[EvalScalar(Eval(self.element))]]),\n    new := (self, val) >> SPL(WithBases(self, rec(dimensions:=[1,1], element:=EvalScalar(Eval(val))))),\n    toAMat := self >> AMatMat([[self.element]]),\n    transpose := self >> self,\n    conjTranspose := self >> CopyFields(self, rec(element := Global.Conjugate(self.element))),\n    inverse := self >> CopyFields(self, rec(element := 1 / self.element)),\n    area := self >> 1,\n    dims := self >> [1,1],\n));\n\n\n# ==========================================================================\n# BlkConj() - pseudo 1x1 matrix when multiplied w/ complex number conjugates it\n# ==========================================================================\nClass(BlkConj, SumsBase, BaseMat, rec(\n    rChildren := self >> [],\n    rSetChild := (self, n, what) >> Error(\"no children\"),\n    new := (self) >> SPL(WithBases(self, rec(dimensions:=[1,1]))),\n    toAMat := self >> AMatMat([[1]]),\n    transpose := self >> self,\n    conjTranspose := self >> self,\n    inverse := self >> self,\n    area := self >> 1\n));\n\n# ==========================================================================\n# Data(<var>, <value>, <spl>) - introduces a data constant bound in <spl>\n# ==========================================================================\nClass(Data, SumsBase, BaseContainer, rec(\n    new := (self, var, value, spl) >> Checked(IsVar(var), IsSPL(spl),\n\tSPL(WithBases(self, rec(\n\t    var := var, value := value, _children := [spl],\n            dimensions := spl.dims())))),\n    #-----------------------------------------------------------------------\n    area := self >> self.child(1).area(),\n    #-----------------------------------------------------------------------\n    eval := meth(self)\n        local d, c;\n        if IsBound(self._evaluated) then return self._evaluated;\n        else\n            d := Cond(\n                IsValue(self.value) or IsSymbolic(self.value), self.value,\n                IsBound(self.value.tolist), V(self.value.tolist()),\n                IsSPL(self.value), V(MatSPL(self.value)),\n                self.value);\n            c := Copy(self._children[1]);\n            self._evaluated := SubstBottomUp(c, @(1, var, e->Same(e,self.var)), e -> d);\n            return self._evaluated;\n        fi;\n    end,\n\n    rChildren := self >> [self.var, self.value, self.child(1)],\n    rSetChild := meth(self, n, newC)\n        if n=1 then self.var := newC;\n        elif n=2 then self.value := newC;\n        elif n=3 then self._children[1] := newC;\n        else Error(\"<n> must be between [1..3]\");\n        fi;\n    end,\n    from_rChildren := (self, rch) >> CopyFields(self, rec(\n        var := rch[1], value := rch[2], _children := [rch[3]])),\n    #-----------------------------------------------------------------------\n    uneval := meth(self) Unbind(self._evaluated); return self; end,\n    #-----------------------------------------------------------------------\n    transpose := self >> CopyFields(self, rec(\n        _children := [self.child(1).transpose()])).uneval(),\n    #-----------------------------------------------------------------------\n    toAMat := self >> self.eval().toAMat(),\n    #-----------------------------------------------------------------------\n    sums := self >> CopyFields(self, rec(_children := [self.child(1).sums()])),\n));\n\nDeclare(Scat);\n\n#F ==========================================================================\n#F Gath(<func>) - gather (read) matrix\n#F NOTE: implements affine transformations via funcExp hack.\n\n#F as of Dec '2010, <func> can contain fInsert/fPad, which will create\n#F funcExp(..) in the code. This is used for simulating affine (rather\n#F than linear) transformation.\n#F\n#F Affine transformations can only be experessed using matrices, if we\n#F use homogeneous coordinates, i.e., instead of [x_1, ..., x_n] use\n#F always [x_1, ..., x_n, 1], for input/output vectors\n#F\n#F Gath.toAMat and everything else does NOT use homogeneous\n#F coordinates, and thus we can't represent affine \"gathers\" with a\n#F proper matrix, the only special case is when funcExp(0) is used to\n#F insert 0s (this preserves linearity).\n#F\n#F Currently, we use the following semantics (to implement affine transf. using a hack)\n#F\n#F  nth(X, i)          == X[i]\n#F  nth(X, funcExp(i)) == i\n#F\n#F The proper way of doing this would be instead (using h. coords, X[len(x)] = 1)\n#F nth(X, funcExp(i)) -> i * nth(X, len(X)) = i * X[len(X)] = i \n#F\n#F See http://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations\n# ==========================================================================\nClass(Gath, SumsBase, BaseMat, rec(\n    #-----------------------------------------------------------------------\n    rChildren := self >> [self.func],\n    rSetChild := rSetChildFields(\"func\"),\n    #-----------------------------------------------------------------------\n    new := (self, func) >> SPL(WithBases(self, rec(\n      \tfunc := Checked(IsFunction(func) or IsFuncExp(func), func)))).setDims(),\n    #-----------------------------------------------------------------------\n    dims := self >> [self.func.domain(), self.func.range()],\n    sums := self >> self,\n    area := self >> Sum(Flat([self.func.domain()])),\n    isReal := self >> true,\n    transpose := self >> Scat(self.func),\n    conjTranspose := self >> self.transpose(),\n    inverse := self >> self.transpose(),\n    #-----------------------------------------------------------------------\n    toAMat := self >> let(\n\tn := EvalScalar(self.func.domain()),\n        N := EvalScalar(self.func.range()),\n        func := self.func.lambda(),\n        AMatMat(List([0..n-1], row -> let(\n            idx := EvalScalar(func.at(row)),\n\t    Cond(idx _is funcExp,\n\t\t     When(idx.args[1]=0, Replicate(N, 0), \n\t\t\t Error(\"<self> is an affine (non-linear) transformation \",\n\t\t\t       \"and can't be represented as a matrix\")),\n\t\t BasisVec(N, idx)))))\n    ),\n    #-----------------------------------------------------------------------\n    toloop := (self, bksize) >> let(\n\ti := Ind(self.func.domain()),\n\tISum(i, \n            Scat(fTensor(fBase(i), fId(1))) *\n            Gath(fCompose(self.func, fTensor(fBase(i), fId(1))))\n\t).split(bksize)\n    ),\n    #-----------------------------------------------------------------------\n    normalizedArithCost := self >> 0,\n    #-----------------------------------------------------------------------\n    isIdentity := self >> IsIdentity(func),\n));\n\n#F ==========================================================================\n#F Prm(<func>) - permutation, semantically same as Gath(<func>), but square\n#F\n#F NB: Prm should not be used with fPad/fInsert, which lead to affine \n#F     transformations when used with Gath.\n#F\n#F Prm(f).transpose() = Prm(f.transpose())\n#F\n#F ==========================================================================\nClass(Prm, Gath, rec(\n    transpose := self >> CopyFields(self, rec(func:=self.func.transpose())),\n    toAMat := self >> Perm(PermList(List(self.func.lambda().tolist(), e->e.v)+1),\n                           self.func.domain()).toAMat(),\n    #-----------------------------------------------------------------------\n    normalizedArithCost := self >> 0\n));\n\n#   special perm to be gotten rid of in rewriting\nClass(DelayedPrm, Prm);\nClass(FormatPrm, Prm);\n\n#F ==========================================================================\n#F Scat(<func>) - scatter (write) matrix,  Scat(f) = Gath(f).transpose()\n#F\n#F NOTE: implements affine transformations via funcExp workaround. \n#F        See Doc(Gath) for explanation\n#F ==========================================================================\nClass(Scat, SumsBase, BaseMat, rec(\n    #-----------------------------------------------------------------------\n    rChildren := self >> [self.func],\n    rSetChild := rSetChildFields(\"func\"),\n    #-----------------------------------------------------------------------\n    new := (self, func) >> SPL(WithBases(self, rec(\n\tfunc := Checked(IsFunction(func) or IsFuncExp(func), func)))).setDims(),\n    #-----------------------------------------------------------------------\n    dims := self >> [self.func.range(), self.func.domain()],\n    sums := self >> self,\n    area := self >> Sum(Flat([self.func.domain()])),\n    isReal := self >> true,\n    transpose := self >> Gath(self.func),\n    conjTranspose := self >> self.transpose(),\n    inverse := self >> self.transpose(),\n    #-----------------------------------------------------------------------\n    toAMat := self >> TransposedAMat(Gath(self.func).toAMat()),\n    #-----------------------------------------------------------------------\n    toloop := (self, bksize) >> Gath(self.func).toloop(bksize).transpose(),\n    #-----------------------------------------------------------------------\n    normalizedArithCost := self >> 0,\n    #-----------------------------------------------------------------------\n    isIdentity := self >> IsIdentity(self.func),\n));\n\nClass(ScatAcc, Scat, rec(\n    codeletName:=\"SA\", \n    toloop := (self, bksize) >> Error(\"Not implemented\")\n));\n\nDeclare(ScatGath);\n\n# ==========================================================================\n# ScatGath(<sfunc>, <gfunc>)\n# ==========================================================================\nClass(ScatGath, SumsBase, BaseMat, rec(\n    rChildren := self >> [self.sfunc, self.gfunc],\n    rSetChild := rSetChildFields(\"sfunc\", \"gfunc\"),\n    #-----------------------------------------------------------------------\n    new := (self, sfunc, gfunc) >> SPL(WithBases(self,\n        rec(dimensions := [sfunc.range(), gfunc.range()], \n\t    sfunc := Checked(IsFunction(sfunc) or IsFuncExp(sfunc), sfunc),\n\t    gfunc := Checked(IsFunction(gfunc) or IsFuncExp(gfunc), gfunc)))),\n    #-----------------------------------------------------------------------\n    dims := self >> [self.sfunc.range(), self.gfunc.range()],\n    area := self >> self.sfunc.domain(),\n    isReal := self >> true,\n    transpose := self >> ScatGath(self.gfunc, self.sfunc),\n    conjTranspose := self >> self.transpose(),\n    inverse := self >> self.transpose(),\n    #-----------------------------------------------------------------------\n    toAMat := meth(self)\n        local s, gfunc, g, sdomain, gdomain, idx;\n        # NOTE: FF: this is a temporary solution to work around Lamda \n\t#        problems with symbolic domains and variable substitution\n        s := Scat(self.sfunc);\n        sdomain := EvalScalar(self.sfunc.domain());\n        gdomain := spiral.code.RulesStrengthReduce(self.gfunc.domain());\n        if ObjId(self.gfunc) = Lambda and IsExp(gdomain) then\n            idx := Ind(sdomain);\n            gfunc := Lambda(idx, self.gfunc.at(idx)).setRange(self.gfunc.range());\n        else\n            gfunc := self.gfunc;\n        fi;\n        g :=Gath (gfunc);\n        return s.toAMat() * g.toAMat();\n    end,\n       # Correct semantics: Scat(self.sfunc).toAMat() * Gath(self.gfunc).toAMat(),\n    #-----------------------------------------------------------------------\n    sums := self >> self, #self.toloop(self.maxBkSize()),\n    #-----------------------------------------------------------------------\n    maxBkSize := meth(self)\n        local exp, l, d;\n        exp := self.gfunc.domain();\n\n        if IsValue(exp) or IsInt(exp) then return exp; fi;\n\n        if IsExp(exp) and ObjId(exp)=mul and IsValue(exp.args[1]) then\n            return exp.args[1];\n        fi;\n\n        if IsInt(exp.eval()) or IsValue(exp.eval()) then return EvalScalar(exp); fi;\n        l := Lambda(Filtered(exp.free(), IsLoopIndex), exp);\n        if Length(l.vars) > 1 then return 1; fi;\n        d := List(spiral.sigma.GenerateData(l).tolist(), EvalScalar);\n        return Gcd(d);\n    end,\n    #-----------------------------------------------------------------------\n    toloop := (self, bksize) >> let(\n\ti := Ind(self.gfunc.domain()),\n        ISum(i, \n            Scat(fCompose(self.sfunc, fTensor(fBase(i), fId(1)))) *\n            Gath(fCompose(self.gfunc, fTensor(fBase(i), fId(1))))\n        ).split(bksize)\n    )\n));\n\n\n# ==========================================================================\n# SUM(<spl1>, <spl2>, ...) - non-overlapping matrix sum\n# ==========================================================================\nDeclare(SUM, SUMAcc);\nClass(SUM, SumsBase, BaseOperation, rec(\n    area := self >> Sum(self.children(), x->x.area()),\n    abbrevs := [ arg ->\n    [ Flat(List(Flat(arg),\n        s -> When(IsSPL(s) and Same(ObjId(s), SUM), s.children(), s))) ] ],\n    #-----------------------------------------------------------------------\n    new := meth(self, L)\n        local dims;\n        Constraint(Length(L) >= 1); Constraint(ForAll(L, IsSPL));\n        if Length(L) = 1 then return L[1]; fi;\n        dims := L[1].dims();\n        if not (IsSymbolic(dims[1]) or IsSymbolic(dims[2])) and\n           not ForAll(Drop(L, 1), x -> let(d:=x.dims(),\n                   IsSymbolic(d[1]) or IsSymbolic(d[2]) or d = dims))\n            then Error(\"Dimensions of summands do not match\"); fi;\n        return SPL(WithBases(self, rec( _children := L, dimensions := dims)));\n    end,\n    #-----------------------------------------------------------------------\n    rng := self >> self.child(1).rng(),\n    #-----------------------------------------------------------------------\n    dmn := self >> self.child(1).dmn(),\n\n    advdims := self >> self._children[1].advdims(),\n    #-----------------------------------------------------------------------\n#    dims := self >> self.child(1).dimensions,\n    #-----------------------------------------------------------------------\n    toAMat := self >> AMatMat(Sum(self._children, MatSPL)),\n    #-----------------------------------------------------------------------\n    isPermutation := self >> false,\n    #-----------------------------------------------------------------------\n    transpose := self >>   # we use CopyFields to copy all fields of self\n        CopyFields(self, rec(\n           _children := List(self._children, x->x.transpose()),\n           dimensions := Reversed(self.dimensions))),\n    inverse := self >>   # we use CopyFields to copy all fields of self\n        CopyFields(self, rec(\n           _children := List(self._children, x->x.inverse()),\n           dimensions := Reversed(self.dimensions))),\n    conjTranspose := self >>   # we use CopyFields to copy all fields of self\n        CopyFields(self, rec(\n           _children := List(self._children, x->x.conjTranspose()),\n           dimensions := Reversed(self.dimensions)))\n));\n\n# ==========================================================================\n# SUMAcc(<spl1>, <spl2>, ...) - overlapping matrix sum\n# ==========================================================================\nClass(SUMAcc, SUM, rec(\n   abbrevs := [ arg ->\n    [ Flat(List(Flat(arg),\n        s -> When(IsSPL(s) and Same(ObjId(s), SUMAcc), s.children(), s))) ] ]\n ));\n\n# ==========================================================================\n# ISum(<var>, <domain>, <spl>) - non-overlapping iterative matrix sum\n# ==========================================================================\nClass(ISum, SumsBase, BaseIterative, rec(\n    needInterleavedLeft := self >> self.child(1).needInterleavedLeft(),\n    needInterleavedRight := self >> self.child(1).needInterleavedRight(),\n    cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat(),\n    totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat(),\n\n    directOper := SUM,\n    area := self >> let(ac:=self._children[1].area(), ac * self.domain),\n    #-----------------------------------------------------------------------\n    rng := self >> self._children[1].rng(),\n    dmn := self >> self._children[1].dmn(),\n    dims := self >> [StripList(List(self.rng(),l->l.size)),StripList(List(self.dmn(),l->l.size))],\n\n    advdims := self >> self._children[1].advdims(),\n\n    #-----------------------------------------------------------------------\n    transpose := self >> CopyFields(self, rec(\n           _children := [self._children[1].transpose()],\n           dimensions := Reversed(self.dimensions))),\n    conjTranspose := self >> CopyFields(self, rec(\n           _children := [self._children[1].conjTranspose()],\n           dimensions := Reversed(self.dimensions))),\n    inverse := self >> CopyFields(self, rec(\n           _children := [self._children[1].inverse()],\n           dimensions := Reversed(self.dimensions))),\n    #-----------------------------------------------------------------------\n    unroll := self >> SUM(self.unrolledChildren()),\n    #-----------------------------------------------------------------------\n    sums := self >> CopyFields(self, rec(\n        _children := [self._children[1].sums()]))\n));\n\nClass(ISumLS, ISum);\nClass(JamISum, ISum, rec(isBlockTransitive := true));\nClass(Grp, Buf);\n\n# ==========================================================================\n# ICompose(<var>, <domain>, <spl>) - iterative matrix product\n# ==========================================================================\nClass(ICompose, SumsBase, BaseIterative, rec(\n    area := self >> self._children[1].area() * self.domain,\n    #-----------------------------------------------------------------------\n    dims := self >> self._children[1].dimensions,\n    #-----------------------------------------------------------------------\n    unroll := self >> Compose(self.unrolledChildren()),\n    #-----------------------------------------------------------------------\n    transpose := self >> ICompose(self.var, self.domain,\n        SubstVars(Copy(self._children[1].transpose()), \n\t          tab((self.var.id) := self.domain-1-self.var))),\n\n    createCode := self >> Cond(IsBound(self._children[1].createCode),\n        ICompose(self.var, self.domain, self._children[1].createCode()), self),\n\n    prods := self >> let(base := self.__bases__[1],\n        base(self.var, self.domain, self._children[1].prods())),\n\n#    rChildren := self >> [self.var, self.domain, self._children[1]],\n#\n#    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n#\n#    rSetChild := meth(self, n, newChild)\n#        if n=1 then self.var := newChild;\n#        elif n=2 then self.domain := newChild;\n#        elif n=3 then self._children := [newChild];\n#        else Error(\"<n> must be in [1..3]\");\n#        fi;\n#    end\n));\n\n\n# ==========================================================================\n# ISumAcc(<var>, <domain>, <spl>) - overlapping iterative matrix sum\n# ==========================================================================\nClass(ISumAcc, ISum);\n\n# ==========================================================================\n# IParSeq(<var>, <domain>, <fb>, <spl>) \n# ==========================================================================\nDeclare(ParSeq);\nClass(IParSeq, SumsBase, BaseIterative, rec(\n    abbrevs := [ (v, fb_cnt, expr) -> [v, v.range, fb_cnt, expr]  ],\n    new := meth(self, v, domain, fb_cnt, expr)\n        local obj;\n        #NOTE: check dimensions\n        obj := Inherited(v, domain, expr);\n        obj.fb_cnt := fb_cnt;\n        return obj;\n    end,\n\n    dims := self >> self._children[1].dims(),\n    unroll := self >> ParSeq( self.fb_cnt, Reversed(self.unrolledChildren())),\n\n    filtCompL := (self, lst) >> lst{[1..self.fb_cnt]},\n    filtCompR := (self, lst) >> lst{[1..self.fb_cnt]},\n    filtSUML  := (self, lst) >> lst{[self.fb_cnt+1..Length(lst)]},\n    filtSUMR  := (self, lst) >> lst{[self.fb_cnt+1..Length(lst)]},\n\n    # area doesn take into account that we have composition and sum\n    area := self >> self._children[1].area() * self.domain,\n\n    print := (self, i, is) >> Print(\n        self.name, \"(\", self.var, \", \", self.domain, \", \", self.fb_cnt, \",\\n\",\n        Blanks(i+is), self._children[1].print(i+is, is), \"\\n\",\n        Blanks(i), \")\", self.printA(),\n        When(IsBound(self._setDims), Print(\".overrideDims(\", self._setDims, \")\"), Print(\"\"))\n    ),\n));\n\n##############################################################################\nDeclare(Conj, ConjL, ConjR, ConjLR, ConjDiag);\n\nClass(Conj, SumsBase, BaseOperation, rec(\n    new    := (self, spl) >> SPL(WithBases(self, rec(_children:=[spl], dimensions := spl.dimensions))),\n    dims   := self >> self._children[1].dims(),\n    toAMat := self >> self.child(1).toAMat(),\n    sums   := self >> self,\n    transpose := self >> Conj(self.child(1).transpose())\n));\n\nClass(ConjL, Conj, rec(\n    new    := (self, spl, lprm) >> SPL(WithBases(self, rec(_children:=[spl, lprm]))).setDims(),\n    dims   := self >> [self.child(2).dims()[1], self.child(1).dims()[2]],\n    toAMat := self >> self.child(2).toAMat() * self.child(1).toAMat(),\n    sums   := self >> ConjL(self.child(1).sums(), self.child(2)),\n    transpose := self >> ConjR(self.child(1).transpose(), self.child(2).transpose()),\n));\n\nClass(ConjR, Conj, rec(\n    new    := (self, spl, rprm) >> SPL(WithBases(self, rec(_children:=[spl, rprm]))).setDims(),\n    dims   := self >> [self._children[1].dims()[1], self._children[2].dims()[2]],\n    toAMat := self >> self.child(1).toAMat() * self.child(2).toAMat(),\n    sums   := self >> ConjR(self.child(1).sums(), self.child(2)),\n    transpose := self >> ConjL(self.child(1).transpose(), self.child(2).transpose()),\n));\n\nClass(ConjLR, Conj, rec(\n    new    := (self, spl, lprm, rprm) >> SPL(WithBases(self, rec(_children:=[spl, lprm, rprm]))).setDims(),\n    dims   := self >> [ self.child(2).dims()[1], self.child(3).dims()[2] ],\n    toAMat := self >> self.child(2).toAMat() * self.child(1).toAMat() * self.child(3).toAMat(),\n    sums   := self >> ConjLR(self.child(1).sums(), self.child(2), self.child(3)),\n    transpose := self >> ConjLR(self.child(1).transpose(), self.child(3).transpose(), self.child(2).transpose()),\n));\n\nClass(ConjDiag, Conj, rec(\n    new    := (self, spl, lprm, rprm) >> SPL(WithBases(self, rec(_children:=[spl, lprm, rprm]))).setDims(),\n    dims   := self >> [Rows(self.child(2)), Cols(self.child(3))],\n    toAMat := self >> self.child(2).toAMat() * self.child(1).toAMat() * self.child(3).toAMat(),\n    sums   := self >> ConjDiag(self.child(1).sums(), self.child(2), self.child(3)),\n    transpose := self >> ConjDiag(self.child(1).transpose(), self.child(3).transpose(), self.child(2).transpose()),\n));\n\nClass(NeedInterleavedComplex, BaseContainer, rec(\n    needInterleavedLeft := True,\n    needInterleavedRight := True,\n    sums := self >> self,\n    area:= self >> self.child(1).area()\n));\n", "meta": {"hexsha": "31f5b4e4d00cf65e51dbc67a9461516f7e5d38a0", "size": 34134, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/sums.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/sums.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/sums.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 43.7615384615, "max_line_length": 115, "alphanum_fraction": 0.5026952599, "num_tokens": 8318, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4687906266262437, "lm_q2_score": 0.035678549339680746, "lm_q1q2_score": 0.01672576950206429}}
{"text": "#############################################################################\n####\n##\n#W  general.gi                 ACE Package                   Alexander Hulpke\n#W                                                                Greg Gamble\n##\n##  This file installs mainly non-interactive ACE  variables  and  functions.\n##  Though Alexander will barely recognise it,  some  of his ideas are  still\n##  present.\n##    \n#Y  Copyright (C) 2000  Centre for Discrete Mathematics and Computing\n#Y                      Department of Information Technology & Electrical Eng.\n#Y                      University of Queensland, Australia.\n##\n\n\n#############################################################################\n####\n##\n#V  ACETCENUM . . . . . . . .  The ACE version of the coset enumerator TCENUM\n##  . . . .  CosetTableFromGensAndRels is set to ACECosetTableFromGensAndRels\n##\nInstallValue(ACETCENUM, rec(\n  name := \"ACE (Advanced Coset Enumerator)\",\n  CosetTableFromGensAndRels := ACECosetTableFromGensAndRels\n));\n\n#############################################################################\n####\n##\n#F  InfoACELevel . . . . . . . . . . . . . . .  Get the InfoLevel for InfoACE\n##\n##\nInstallGlobalFunction(InfoACELevel, function()\n  return InfoLevel(InfoACE);\nend);\n\n#############################################################################\n####\n##\n#F  SetInfoACELevel . . . . . . . . . . . . . . Set the InfoLevel for InfoACE\n##\n##\nInstallGlobalFunction(SetInfoACELevel, function(arg)\n  if IsEmpty(arg) then\n    SetInfoLevel(InfoACE, 1);     # Set to default level\n  else\n    SetInfoLevel(InfoACE, arg[1]);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEPackageVersion() \n##\n##  returns the version number of the current ACE package.\n##\nInstallGlobalFunction(ACEPackageVersion, function()\n\n  return GAPInfo.PackagesInfo.ace[1].Version;\nend);\n\n#############################################################################\n####\n##\n#F  CALL_ACE . . . . . . . . . Called by ACECosetTable, ACEStats and ACEStart\n##\n##\nInstallGlobalFunction(CALL_ACE, function(ACEfname, fgens, rels, sgens)\nlocal optnames, echo, errmsg, onbreakmsg, infile, datarec, ToACE, gens,\n      standard, ignored;\n\n  if ValueOption(\"aceexampleoptions\") = true and\n     IsBound(ACEData.aceexampleoptions) then\n    SANITISE_ACE_OPTIONS(OptionsStack[ Length(OptionsStack) ],\n                         ACEData.aceexampleoptions);\n    PushOptions(ACEData.aceexampleoptions);\n    Unbind(ACEData.aceexampleoptions);\n    ACEData.options := OptionsStack[ Length(OptionsStack) ];\n    PopOptions();\n    OptionsStack[ Length(OptionsStack) ] := ACEData.options;\n    Unbind(ACEData.options);\n  fi;\n  optnames := ACE_OPT_NAMES();\n  # We have hijacked ACE's echo option ... we don't actually pass it to ACE\n  echo := ACE_VALUE_ECHO(optnames);\n\n  ECHO_ACE_ARGS( echo, ACEfname, rec(fgens := fgens, \n                                     rels  := rels, \n                                     sgens := sgens) );\n  # Check arguments are valid\n  while IsEmpty(fgens) do\n    errmsg := \n        [\"fgens (arg[1]) must be a non-empty list of group generators ...\"];\n    onbreakmsg := \n        [\"Type: 'quit;' to quit to outer loop, or\",\n         \"type: 'fgens := <val>; return;' to assign <val> to fgens to continue.\"\n        ];\n    Error(ACE_ERROR(errmsg, onbreakmsg), \"\\n\");\n  od;\n  fgens := ACE_FGENS_ARG_CHK(fgens);\n  rels  := ACE_WORDS_ARG_CHK(fgens, rels, \"relators\");\n  sgens := ACE_WORDS_ARG_CHK(fgens, sgens, \"subgp gen'rs\");\n\n  infile  := VALUE_ACE_OPTION(optnames, fail, \"aceinfile\");\n  if ACEfname = \"ACECosetTableFromGensAndRels\" and infile <> fail then\n    datarec := rec(\n        infile  := infile,\n        outfile := VALUE_ACE_OPTION(optnames, ACEData.outfile, \"aceoutfile\"),\n        stream  := OutputTextFile(infile, false) );\n    ToACE := function(list) WRITE_LIST_TO_ACE_STREAM(datarec.stream, list); end;\n  else\n    datarec := rec(\n        stream := InputOutputLocalProcess(ACEData.tmpdir, ACEData.binary, []) );\n    if datarec.stream = fail then\n      Error(\"sorry! Run out of pseudo-ttys. Can't initiate stream\\n\");\n    fi;\n    if ACEfname <> ACEStart then\n      datarec.procId := 0;\n      ACEData.ni := datarec;\n    fi;\n    FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                           line -> IsMatchingSublist(line, \"name\", 3));\n    ToACE := function(list) \n                 INTERACT_TO_ACE_WITH_ERRCHK(datarec, list);\n             end;\n  fi;\n  datarec.args    := rec(fgens := fgens, rels := rels, sgens := sgens);\n  datarec.options := ACE_OPTIONS();\n  standard := ACE_COSET_TABLE_STANDARD( datarec.options );\n\n  # Define the group generators ACE will use\n  gens := TO_ACE_GENS(fgens);\n  ToACE([ \"Group Generators: \", gens.toace, \";\"]);\n  datarec.acegens := gens.acegens;\n\n  # Define the group relators ACE will use\n  datarec.enforceAsis := \n      (ACEfname <> \"ACEStats\") and (standard = \"lenlex\") and\n      not IsACEGeneratorsInPreferredOrder(fgens, rels, \"noargchk\");\n  ToACE([ \"Group Relators: \", \n          ACE_RELS(rels, fgens, datarec.acegens, datarec.enforceAsis), \";\" ]);\n\n  # Define the subgroup generators ACE will use\n  ToACE([ \"Subgroup Generators: \", \n          ACE_WORDS(sgens, fgens, datarec.acegens), \";\" ]);\n\n  if ACEfname  = \"ACECosetTableFromGensAndRels\" then\n    ignored := [ ];\n  else \n    ignored := [ \"aceinfile\" ];\n  fi;\n  if ACEfname  = \"ACEStart\" then\n    Add(ignored, \"aceoutfile\");\n  fi;\n  if datarec.enforceAsis then\n    Add(ignored, \"asis\");\n    ToACE([ \"Asis: 1;\" ]);\n  fi;\n\n  PROCESS_ACE_OPTIONS(\n      ACEfname, optnames, optnames, echo, datarec, \n      rec(group      := ACE_ERRORS.argnotopt, # disallowed options\n          generators := ACE_ERRORS.argnotopt,\n          relators   := ACE_ERRORS.argnotopt), \n      ignored\n      );\n              \n  if not IsInputOutputStream(datarec.stream) then\n    if VALUE_ACE_OPTION(optnames, fail, [\"start\", \"aep\", \"rep\"]) = fail then\n      # if the user hasn't issued there own enumeration initiation directive\n      # ... initiate the enumeration\n      ToACE([ \"Start;\" ]);\n    fi;\n    if ACEfname = \"ACECosetTableFromGensAndRels\" then\n      if standard = \"lenlex\" then\n        ToACE([ \"Standard;\" ]);\n      fi;\n      ToACE([ \"Print Table;\" ]);\n    fi;\n    CloseStream(datarec.stream);\n  elif ACEfname <> \"ACEStart\" then\n    if VALUE_ACE_OPTION(optnames, fail, [\"start\", \"aep\", \"rep\"]) = fail then\n      ACE_MODE( \"Start\", datarec );\n    fi;\n    if ACEfname = \"ACECosetTableFromGensAndRels\" and standard = \"lenlex\" then\n      ToACE([ \"Standard;\" ]);\n    fi;\n  fi;\n\n  if ACEfname = \"ACEStart\" then\n    datarec.procId := Length(ACEData.io) + 1;\n    Add(ACEData.io, datarec);\n    return Length(ACEData.io);\n  elif ACEfname = \"ACECosetTableFromGensAndRels\" then\n    datarec.silent := VALUE_ACE_OPTION(optnames, false, \"silent\");\n  fi;\n  return datarec;\nend);\n\n#############################################################################\n####\n##\n#F  ACECosetTableFromGensAndRels . . . . . . .  Non-interactive ACECosetTable\n##\n##\nInstallGlobalFunction(ACECosetTableFromGensAndRels, function(fgens, rels, sgens)\n  # Use ACECosetTable non-interactively\n  return ACECosetTable(fgens, rels, sgens);\nend);\n\n#############################################################################\n####\n##\n#F  IsACEStandardCosetTable . . . . . . Returns true if table is standardised\n##  . . . . . . . . . . . . . . . . . . according to GAP's default scheme  or\n##  . . . . . . . . . . . . . . . . . . with the lenlex option, according  to\n##  . . . . . . . . . . . . . . . . . . . . the lenlex standardisation scheme\n##\nInstallGlobalFunction(IsACEStandardCosetTable, function(table)\nlocal standard, geninvIndices, index, next, j, i;\n\n  standard := ACE_COSET_TABLE_STANDARD( ACE_OPTIONS() );\n  if standard in [\"lenlex\", \"GAPlenlex\"] then\n    geninvIndices := [1 .. Length(table)];\n  elif standard in [\"semilenlex\", \"GAPsemilenlex\"] then\n    geninvIndices := [1, 3 .. Length(table) - 1];\n  else\n    return IsStandardized(table); # Should only get here with GAP 4.3+\n                                  # ... by which time `IsStandardized'\n                                  # will hopefully have been generalised\n                                  # to cope with any other standardisation\n                                  # schemes\n  fi;\n\n  index := Length( table[1] );\n  next := 2;\n  for j in [1 .. index - 1] do\n    for i in geninvIndices do\n      if table[i][j] >= next then\n        if table[i][j] > next then\n          return false;\n        fi;\n        next := next + 1;\n      fi;\n    od;\n  od;\n  return true;\nend);\n\n#############################################################################\n####\n##\n#F  IsACEGeneratorsInPreferredOrder . . . . . Returns true if the  generators\n##  . . . . . . . . . . . . . . . . . . . . . gens are already in  the  order\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  preferred by ACE\n##\n##  For a presentation with more than one generator, the first  generator  of\n##  which is an involution and the second is not, ACE prefers to  switch  the\n##  first two generators. IsACEGeneratorsInPreferredOrder returns true if the\n##  order of the generators gens would not  be  changed  by  ACE  and  false,\n##  otherwise. When necessary, the argument rels (the  relators)  is  scanned\n##  for relators that determine  whether  or  not  gens[1]  and  gens[2]  are\n##  involutions.\n##\n##  If IsACEGeneratorsInPreferredOrder would return false, it is possible  to\n##  enforce a user's order of the generators within ACE, by  enforcing  ACE's\n##  `asis' option and passing the relator,  that  determines  gens[1]  is  an\n##  involution,  explicitly  to  ACE   as:   gens[1]*gens[1]   (rather   than\n##  gens[1]^2).\n##\nInstallGlobalFunction(IsACEGeneratorsInPreferredOrder, function(arg)\nlocal ioIndex, gens, rels;\n\n  if Length(arg) < 2 then\n    ioIndex := CallFuncList(ACEProcessIndex, arg);\n    gens := ACEGroupGenerators(ioIndex);\n    rels := ACERelators(ioIndex);\n  elif Length(arg) = 2 then\n    gens := ACE_FGENS_ARG_CHK(arg[1]);\n    rels := ACE_WORDS_ARG_CHK(gens, arg[2], \"relators\");\n  elif Length(arg) = 3 and arg[3] = \"noargchk\" then\n    # This scenario only intended for use internally\n    gens := arg[1];\n    rels := arg[2];\n  else\n    Error(\"expected at most 2 arguments, not \", Length(arg), \" arguments.\\n\");\n  fi;\n\n  if Length(gens) = 1 or not ForAny(rels, rel -> rel = gens[1]^2) then\n    return true;\n  else\n    return ForAny(rels, rel -> rel = gens[2]^2);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_READ_AS_FUNC  . . . . . . . . . . . . . . . Variant of ReadAsFunction \n##  . . . . . . . . . . . .  that allows the passing of the function argument\n##  . . . . . . . . . . . . . . . . . . . . ACEfunc to ReadAsFunction(file)()\n##\n##\nInstallGlobalFunction(ACE_READ_AS_FUNC, function(file, ACEfunc)\nlocal line, instream, rest;\n\n  instream := InputTextFile(file);\n  # We don't want the user to see this ... so we flush at InfoACE level 10.\n  line := FLUSH_ACE_STREAM_UNTIL( instream, 10, 10, ReadLine,\n                                  line -> IsMatchingSublist(line, \"local\") );\n  rest := ReadAll(instream);\n  CloseStream(instream);\n  return ReadAsFunction(\n             InputTextString(\n                 Concatenation([ ReplacedString(line, \";\", \", ACEfunc;\"),\n                                 \"ACEfunc := \", NameFunction(ACEfunc), \";\",\n                                 rest ]) ) )();\nend);\n\n#############################################################################\n####\n##\n#F  ACEExample( )\n#F  ACEExample( <file>[, <ACEfunc>] )\n##\n##  With no arguments, or with single argument \"index\", or a string  that  is\n##  not a filename  in  the  `examples'  directory,  an  index  of  available\n##  examples is displayed.\n##\n##  With argument <file> that is a filename in the `examples' directory other\n##  than \"index\" the example is displayed as it would  be  when  called  with\n##  <ACEfunc> (or `ACEStats', if  the  2nd  argument  is  omitted)  and  then\n##  executed via a call to `ReadAsFunction' and a little internal  ``magic''.\n##  <ACEfunc>    must    be    one    of    `ACEStats'     (the     default),\n##  `ACECosetTableFromGensAndRels'  (or  equivalently   `ACECosetTable',   or\n##  `ACEStart'.\n##\nInstallGlobalFunction(ACEExample, function(arg)\nlocal name, file, instream, line, ACEfunc,\n      EnquoteIfString, optnames, lastoptname, optname;\n\n  if IsEmpty(arg) then\n    name := \"index\";\n  else\n    name := arg[1];\n    if Length(arg) > 1 then\n      ACEfunc := arg[2];\n    else\n      ACEfunc := ACEStats;\n    fi;\n    if not IsEmpty(OptionsStack) then\n      ACEData.aceexampleoptions := OptionsStack[ Length(OptionsStack) ];\n      PopOptions();\n      PushOptions( rec(aceexampleoptions := true) );\n    fi;\n  fi;\n  file := Filename( DirectoriesPackageLibrary( \"ace\", \"examples\"), name );\n  if file = fail then\n    Info(InfoACE + InfoWarning, 1,\n         \"Sorry! There is no ACE example file with name `\", name, \"'\");\n    name := \"index\";\n    file := Filename( DirectoriesPackageLibrary(\"ace\", \"examples\"), name );\n  fi;\n  # Display file ... after a few minor modifications\n  instream := InputTextFile(file);\n  if name <> \"index\" then\n    line := FLUSH_ACE_STREAM_UNTIL( instream, 1, 10, ReadLine,\n                                    line -> IsMatchingSublist(line, \"local\") );\n    Info(InfoACE, 1,\n         \"#\", line{[Position(line, ' ')..Position(line, ';') - 1]},\n         \" are local to ACEExample\");\n    line := FLUSH_ACE_STREAM_UNTIL( instream, 1, 10, ReadLine, \n                                    line -> IsMatchingSublist(line, \"return\") );\n    Info(InfoACE, 1, \n         Chomp(ReplacedString(line, \"return ACEfunc\", NameFunction(ACEfunc)))\n         );\n    if IsBound(ACEData.aceexampleoptions) then\n      line := FLUSH_ACE_STREAM_UNTIL(\n                  instream, 1, 10, ReadLine, \n                  line -> PositionSublist(line, \");\") <> fail );\n      Info(InfoACE, 1, Chomp(ReplacedString(line, \");\", \", \")));\n      Info(InfoACE, 1, \"    # User Options\");\n      optnames := ShallowCopy( RecNames(ACEData.aceexampleoptions) );\n      lastoptname := optnames[ Length(optnames) ];\n      Unbind(optnames[ Length(optnames) ]);\n\n      EnquoteIfString := function(optval)\n      # Puts quotes around optval if it's a string\n        if IsString(optval) then\n          return Concatenation([\"\\\"\", optval, \"\\\"\"]);\n        else\n          return optval;\n        fi;\n      end;\n\n      for optname in optnames do\n        Info(InfoACE, 1, \"      \", optname, \" := \", \n                         EnquoteIfString(\n                             ACEData.aceexampleoptions.(optname) ), \",\");\n      od;\n      Info(InfoACE, 1, \"      \", lastoptname, \" := \", \n                       EnquoteIfString(\n                           ACEData.aceexampleoptions.(lastoptname) ), \");\");\n    fi;\n  fi;\n  FLUSH_ACE_STREAM_UNTIL( instream, 1, 10, ReadLine, line -> line = fail );\n  CloseStream(instream);\n  if name <> \"index\" then\n    return ACE_READ_AS_FUNC(file, ACEfunc);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEReadResearchExample  . . . . . . . .  Read  an  ACE  research  example \n##  . . . . . . . . . . . . . . . . . . . .  from the res-examples directory.\n##\n##  Currently,  all  examples  in  the  res-examples  directory   depend   on\n##  pgrelfind.g, which with Info text doubles as an index. This  function  is\n##  essentially equivalent to doing a Read of its argument or  \"pgrelfind.g\",\n##  if there is no argument.\n##\nInstallGlobalFunction(ACEReadResearchExample, function(arg)\nlocal name, file;\n\n  if IsEmpty(arg) then\n    name := \"pgrelfind.g\"; # If there is ever more than one key research\n                           # example, we should replace this with an index\n  else\n    name := arg[1];\n  fi;\n  file := Filename( DirectoriesPackageLibrary( \"ace\", \"res-examples\"), name );\n  if file = fail then\n    Error(\"ACEReadResearchExample: Sorry! There is no ACE research example\\n\",\n          \"file with name \\\"\", name, \"\\\"\\n\");\n  else\n    Read(file);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEPrintResearchExample . . . . . . . . Print  an  ACE  research  example \n##  . . . . . . . . . . . . . . . . . . . . from the  res-examples  directory\n##  . . . . . . . . . . . . . . . . . . . . to the terminal  or  to  a  file,\n##  . . . . . . . . . . . . . . . . . . . . . . . minus header and Info text.\n##\n##  ACEPrintResearchExample(examplefile) \n##      prints examplefile in res-examples directory to the terminal\n##\n##  ACEPrintResearchExample(examplefile, outfile) \n##      prints examplefile in res-examples directory to outfile\n##\nInstallGlobalFunction(ACEPrintResearchExample, function(arg)\nlocal outstream, print, file, instream, line;\n\n  if IsEmpty(arg) then\n    Error(\"expected 1 or 2 arguments\\n\");\n  fi;\n\n  file := Filename( DirectoriesPackageLibrary( \"ace\", \"res-examples\"), arg[1] );\n  if file = fail then\n    Error(\"ACEPrintResearchExample: Sorry! There is no ACE research example \",\n          \"file with name `\", arg[1], \"'\\n\");\n  fi;\n\n  if Length(arg) > 1 then\n    outstream := OutputTextFile(arg[2], false);\n    print := function(line) WriteAll(outstream, line); end;\n  else\n    print := Print;\n  fi;\n\n  instream := InputTextFile(file);\n  repeat\n    line := ReadLine(instream);\n  until IsMatchingSublist(line, \"## Begin\");\n  line := ReadLine(instream);\n  while not IsMatchingSublist(line, \"## End\") do\n    print(line);\n    line := ReadLine(instream);\n  od;\n  CloseStream(instream);\n\n  if print <> Print then\n    CloseStream(outstream);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEDirectoryTemporary( <dir> )\n##\n##  calls the UNIX command `mkdir' to create <dir>, which must be  a  string,\n##  and if successful a directory  object  for  <dir>  is  both  assigned  to\n##  `ACEData.tmpdir'  and   returned.   The   fields   `ACEData.infile'   and\n##  `ACEData.outfile' are also set to be files in  `ACEData.tmpdir',  and  on\n##  exit from {\\GAP} <dir> is removed.\n##\nInstallGlobalFunction(ACEDirectoryTemporary, function(dir)\nlocal created;\n\n  # check arguments\n  if not IsString(dir) then\n    Error(\"usage: ACEDirectoryTemporary( <dir> ) : <dir> must be a string.\\n\");\n  fi; \n\n  # create temporary directory\n  created := Process(DirectoryCurrent(),\n                     Filename( DirectoriesSystemPrograms(), \"sh\" ),\n                     InputTextUser(),\n                     OutputTextUser(),\n                     [ \"-c\", Concatenation(\"mkdir \", dir) ]);\n  if created = fail then\n    return fail;\n  fi;\n\n  Add( GAPInfo.DirectoriesTemporary, dir );\n  ACEData.tmpdir := Directory(dir);\n  ACEData.infile := Filename(ACEData.tmpdir, \"in\");\n  ACEData.outfile := Filename(ACEData.tmpdir, \"out\");\n  return ACEData.tmpdir;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_ERROR(<errmsg>, <onbreakmsg>)\n##\n##  sets `OnBreakMessage' to  print  <onbreakmsg>  in  order  to  generate  a\n##  one-off user-friendly message of how the user may recover from the error,\n##  and returns an error message formed from <errmsg> to be used by Error.\n##\n##  <errmsg> and <onbreakmsg> should be lists of strings;  <onbreakmsg>  must\n##  be non-empty and its first member must not be a null string.\n##\nInstallGlobalFunction(ACE_ERROR, function(errmsg, onbreakmsg)\nlocal NormalOnBreak, NormalOnBreakMessage;\n\n  errmsg := JoinStringsWithSeparator(errmsg, \"\\n \");\n  NormalOnBreakMessage := OnBreakMessage;\n  onbreakmsg[1]{[1]} := LowercaseString( onbreakmsg[1]{[1]} );\n  OnBreakMessage := function()\n    local s;\n\n    for s in onbreakmsg do\n      Print(\" \", s, \"\\n\");\n    od;\n    OnBreakMessage := NormalOnBreakMessage;\n  end;\n\n  return errmsg;\nend);\n\n#############################################################################\n####\n##\n#F  CallACE . . . . . . . . . . . . . . . . . . . . . . . . . . .  deprecated\n##\nInstallGlobalFunction(CallACE, function(arg)\n\n  Error(\"CallACE is deprecated: Use `ACECosetTableFromGensAndRels' or\\n\",\n        \"`ACECosetTable'.\\n\");\nend);\n\n#E  general.gi  . . . . . . . . . . . . . . . . . . . . . . . . . . ends here \n", "meta": {"hexsha": "b7242110040843a83b8fb09165ed04c2943b74ac", "size": 20320, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/general.gi", "max_stars_repo_name": "wilfwilson/ace", "max_stars_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-10-11T23:08:47.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-01T16:47:18.000Z", "max_issues_repo_path": "gap/general.gi", "max_issues_repo_name": "wilfwilson/ace", "max_issues_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 25, "max_issues_repo_issues_event_min_datetime": "2016-02-26T09:00:39.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-23T12:28:10.000Z", "max_forks_repo_path": "gap/general.gi", "max_forks_repo_name": "wilfwilson/ace", "max_forks_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2017-04-17T21:40:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-11T21:10:37.000Z", "avg_line_length": 35.5244755245, "max_line_length": 80, "alphanum_fraction": 0.5736220472, "num_tokens": 5464, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3775406547908327, "lm_q2_score": 0.04401865143058612, "lm_q1q2_score": 0.01661883048411291}}
{"text": "dimX := 0;\ndimY := 1;\ndimZ := 2;\ndimW := 3;\n\ndimXYZ := [dimX, dimY, dimZ];\n\n\n", "meta": {"hexsha": "57d69021f495e2f8b843c9619ce4d1be78212460", "size": 77, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "api.gi", "max_stars_repo_name": "spiral-software/spiral-package-mpi", "max_stars_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "api.gi", "max_issues_repo_name": "spiral-software/spiral-package-mpi", "max_issues_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "api.gi", "max_forks_repo_name": "spiral-software/spiral-package-mpi", "max_forks_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-24T13:52:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-24T13:52:26.000Z", "avg_line_length": 8.5555555556, "max_line_length": 29, "alphanum_fraction": 0.4935064935, "num_tokens": 37, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.43782349911420193, "lm_q2_score": 0.03789242825934403, "lm_q1q2_score": 0.01659019553043987}}
{"text": "InstallGlobalFunction(MitM_XMLToOMRec,\nfunction(str)\n    local tree;\n    tree := ParseTreeXMLString(str);\n\n    # Strip out unnecessary contents recursively\n    tree := MitM_SimplifiedTree(tree);\n\n    # Get a single object\n    if Length(MitM_Content(tree)) > 1 then\n        Error(\"There are several top-level objects\");\n    fi;\n    tree := MitM_Content(tree)[1];\n\n    return tree;\nend);\n\nInstallGlobalFunction(MitM_SimplifiedTree,\nfunction(tree)\n    local out, item, len, data;\n    if tree.name = \"PCDATA\" then\n        # content should be a string\n        if IsEmpty(NormalizedWhitespace(tree.content)) then\n            return fail;\n        fi;\n        return tree.content;\n    elif tree.name = \"XMLCOMMENT\" then\n        return fail;\n    fi;\n    out := rec();\n    out.name := tree.name;\n    if IsBound(tree.attributes) and not IsEmpty(RecNames(tree.attributes)) then\n        out.attributes := tree.attributes;\n    fi;\n    if tree.content <> 0 then\n        out.content := [];\n        len := 0;\n        for item in tree.content do\n            # item should be a record\n            data := MitM_SimplifiedTree(item);\n            if data <> fail then\n                if len>0 and IsString(data) and IsString(out.content[len]) then\n                    Append(out.content[len], data);\n                else\n                    len := len + 1;\n                    out.content[len] := data;\n                fi;\n            fi;\n        od;\n    fi;\n    return Objectify(MitM_OMRecType, out);\nend);\n", "meta": {"hexsha": "8e73ce86ec68cc0a58632b784949cdfd81b176e2", "size": 1486, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/XMLToOMRec.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/XMLToOMRec.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/XMLToOMRec.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 28.0377358491, "max_line_length": 79, "alphanum_fraction": 0.5753701211, "num_tokens": 347, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.45713671682749485, "lm_q2_score": 0.036220053394157015, "lm_q1q2_score": 0.0165575162919215}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_prepVars := function(vars, vargen, pfx) \n    local v, res, newpfx, newv;\n    res := []; newpfx := Concat(\"p\", pfx);\n    for v in vars do\n        if IsArrayT(v.t) then\n\t    newv := vargen.next(TPtr(v.t.t), newpfx);\n\t    Add(res, [ v, newv, zallocate(newv, v.t) ]);\n\telse\n\t    Add(res, [ v, v, skip() ]);\n\tfi;\n    od;\n    return res;\nend;\n\nGenerateMultiIOBench := function(t,code, domain, range, opts)\n    local vargen, code, inp, out, inout, args, allocs;\n    vargen := VarGenNumeric();\n    inp := List(domain, t -> vargen.next(t, \"_in\"));\n    inp := _prepVars(inp, vargen, \"_in\");\n\n    out := List(range, t -> vargen.next(t, \"_out\"));\n    out := _prepVars(out, vargen, \"_out\");\n    \n    inout := Concatenation(out, inp);\n    args := List(inout, x->x[2]);\n    allocs := List(inout, x->x[3]);\n    \n    code := program(\n\tdecl(args, \n\t    chain(\n\t\tSubstTopDown(code, program, x->chain(x.cmds)),\n\t\tfunc(TVoid, \"init\", [], \n\t\t    chain(allocs,\n\t\t    ApplyFunc(call, [var(opts.subInitName)]))),\n\t\tfunc(TVoid, \"transform\", [When(IsBound(opts.subParams), opts.subParams, [])],\n\t\t    ApplyFunc(call, Concatenation([var(opts.subName)], When(IsBound(opts.subParams), opts.subParams, []),args))))));\n    return code;\nend;\n\n# Generate Bench does allocation for a program (a function and its initialization).\n# It indirects both the init and the transform, does memory allocation for parameters\n# in the new init and uses them to call the function in the new body.\n#\n#     init(){...} \n#     transform(...){...}\n# \n# will be thus be renamed to:\n#\n#      <opts.subInitName>(){...}\n#      <opts.subName>(...){...}\n#\n# and the following functions will be added:\n#\n#      init(){params=malloc();<opts.subInitName>();}\n#      transform(){<opts.subName>(params);}\n#\n# GenerateBench(<t>,<code>,<opts>)\n# <t> is the sums corresponding to the program <code> compiled with options <opts> \nGenerateBench := (t,code,opts) -> \n    GenerateMultiIOBench(t, code, t.dmn(), t.rng(), opts);\n", "meta": {"hexsha": "a822ccd5cd47190f179b5a03839464d64602ae0c", "size": 2042, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/nontransforms/ol/autobench.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/nontransforms/ol/autobench.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/nontransforms/ol/autobench.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 30.9393939394, "max_line_length": 118, "alphanum_fraction": 0.6145935357, "num_tokens": 603, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4035668680822513, "lm_q2_score": 0.04084572014241186, "lm_q1q2_score": 0.016483979352437284}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(SIMD_VMX, SIMD_ISA, rec(\n#    gen := self >> CellCGenSIMD,\n    compileStrategy := self >> CellCompileStrategyVector,\n#    hackUnparser := self >> CellVHackUnparser(VectorDefaults.expandConstants),\n\n    #NOTE: unparser should point to SIMD_ISA's unparser\n    unparser := SSEUnparser,\n    arch := \"AltiVec\",\n    info := \"AltiVec, VMX, Cell BE PPU and SPU\",\n    file := \"vmx\"\n));\n\nClass(AltiVec_4x32f, SIMD_VMX, rec(\n    active := true,\n    isFixedPoint := false,\n    info := \"AltiVec 4 x 32-bit float\",\n    v := 4,\n    ctype := \"float\",\n    vtype := \"vector float\",\n    stype := \"__attribute__ ((aligned(16))) float\",\n    instr := [vunpacklo_4x32f_av, vunpackhi_4x32f_av, vperm_4x32f, vuperm_4x32f],\n    #instr := [vunpacklo_4x32f_spu, vunpackhi_4x32f_spu, vperm_4x32f_spu, vuperm_4x32f_spu], # <- cheat-code!\n    bits := 32,\n    isFloat := true,\n    isFix := false,\n    header := \"#include <altivec.h>\\n\\n\",\n    infix_op := false,\n    infix_assign := true,\n    vadd := \"vec_add\",\n    vsub := \"vec_sub\",\n    vmul := \"vec_madd\",\n    vmuladd := true,\n    vconst := vconstpr_av,\n    vconstv := \"(vector float)\",\n    vconst1 := \"(vector float)\",\n    splopts := rec(precision := \"single\")\n));\n\n\n#Class(AltiVec_8x16i, rec(\n#    active := false,\n#    isFixedPoint := true,\n#    info := \"AltiVec 8 x 16-bit integer\",\n#    v := 8,\n#    ctype := \"int16\",\n#    vtype := \"vector int16\",\n#    stype := \"__attribute__ ((aligned(16))) int16\",\n#    instr := [vunpacklo_8x16i, vunpackhi_8x16i, vperm_8x16i, vuperm_8x16i],\n#    bits := 16,\n#    isFloat := true,\n#    isFix := false,\n#    header := \"\",\n#    infix_op := false,\n#    infix_assign := true,\n#    vadd := \"vec_add\",\n#    vsub := \"vec_sub\",\n#    vmul := \"vec_mul\",\n#    vconst := \"\"\n#));\n#\n#Class(AltiVec_16x8i, rec(\n#    active := false,\n#    isFixedPoint := true,\n#    info := \"AltiVec 16 x 8-bit integer\",\n#    v := 16,\n#    ctype := \"int8\",\n#    vtype := \"vector int8\",\n#    stype := \"__attribute__ ((aligned(16))) int8\",\n#    instr := [vunpacklo_16x8i, vunpackhi_16x8i, vperm_16x8i, vuperm_16x8i],\n#    bits := 8,\n#    isFloat := true,\n#    isFix := false,\n#    header := \"\",\n#    infix_op := false,\n#    infix_assign := true,\n#    vadd := \"vec_add\",\n#    vsub := \"vec_sub\",\n#    vmul := \"vec_mul\",\n#    vconst := \"\"\n#));\n\nSIMD_ISA_DB.addISA(AltiVec_4x32f);\n#SIMD_ISA_DB.addISA(AltiVec_8x16i);\n#SIMD_ISA_DB.addISA(AltiVec_16x8i);\n", "meta": {"hexsha": "fccf5007e73d5e645bb3ff2f6bc39791766ecabe", "size": 2464, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/vmx/isa.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/vmx/isa.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/vmx/isa.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.3777777778, "max_line_length": 109, "alphanum_fraction": 0.5998376623, "num_tokens": 877, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45713671682749485, "lm_q2_score": 0.035678549852363996, "lm_q1q2_score": 0.016309975140675777}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_IsCompute  := (asgn) >> (IsBound(asgn.isCompute) and asgn.isCompute);\n_IsLoad  := (asgn) >> (IsBound(asgn.isLoad) and asgn.isLoad);\n_IsStore  := (asgn) >> (IsBound(asgn.isStore) and asgn.isStore);\n\n#NOTE: Need a much better marking heuristic\nMarkSWPLoops := function(loop)\n  # Obviously, we can't sw-pipeline if we don't have adequate iterations\n  if Length(loop.range) >=4 then\n    # Current heuristic: Mark loops where the loop body has at least 10 commands.\n    if IsBound(loop.cmd) and IsBound(loop.cmd.cmd) and IsBound(loop.cmd.cmd.cmds) and Length(loop.cmd.cmd.cmds) >= 10 then\n      return(loop_sw(loop.rChildren()[1], loop.rChildren()[2], loop.rChildren()[3]));\n    else\n      return(loop);\n    fi;\n  else\n    return(loop);\n  fi;\nend;\n\nMarkLoadinPreds := function(asgn)\n  local i;\n   if not _IsCompute(asgn) then # Mark as load\n      asgn.isLoad := true;\n   fi;\n\n   # Mark all predecessors as loads\n   if IsBound(asgn.loc) and IsBound(asgn.loc.pred) then\n     for i in [1..Length(asgn.loc.pred)] do\n        if IsBound(asgn.loc.pred[i].def) then\n           MarkLoadinPreds(asgn.loc.pred[i].def);\n        fi;\n     od;\n   fi;\nend;\n\nMarkStoreinPreds := function(asgn)\n  local i;\n   if not _IsCompute(asgn) then # Mark as store\n      asgn.isStore := true;\n\n     # Mark all predecessors as stores (stops at computes)\n     for i in [1..Length(asgn.loc.pred)] do\n        if IsBound(asgn.loc.pred[i].def) then\n           MarkStoreinPreds(asgn.loc.pred[i].def);\n        fi;\n     od;\n   fi;\nend;\n\nMarkAllSucceedingLoadsAsComputes := function(asgn)\n  local i;\n  # Mark all successors that are loads as computes\n  #\n  for i in [1..Length(asgn.loc.succ)] do\n     if IsBound(asgn.loc.succ[i].def) and _IsLoad(asgn.loc.succ[i].def) then\n       #Error(\"Aha!\");\n       asgn.loc.succ[i].def.isLoad := false;\n       asgn.loc.succ[i].def.isCompute := true;\n     fi;\n  od;\n\nend;\n\nSubstLoopVarCopy := function(asgns, loopvar, value)\n   local retval, i;\n   retval := Copy(asgns);\n   for i in retval do\n      SubstVars(i, rec((loopvar.id) := value));\n   od;\n   return(retval);\nend;\n\n\n\nSoftwarePipeline := function(lsw)\nlocal alllsws, allasgns, loads, stores, loopvar, n1, n2, computes, isCompute, arg, asgn, asgns, g0, g1, c0, sn2, sn1, cn1, bodyload, vars, computeCount; \n# Collect all loops to be software pipelined\n\n   # Mark all computes\n   computes := Collect(lsw, [assign, ..., @(2, [add, mul, sub]), ...]);\n\n   #Error(\"BP\");\n   \n   # For each compute: kick out all those that don't have a TReal type for all exp.arg\n   # NOTE: Include TVects in TReal. NOTE: Won't work for code where loopvar datatype = compute datatype\n   computeCount := 0;\n   for asgn in computes do\n      isCompute := true;\n      for arg in asgn.exp.args do\n       if arg.t <> TReal and arg.t.__name__ <> \"TVect\" then\n          isCompute := false;\n       fi;\n      od;\n\n      if (isCompute) then\n         asgn.isCompute := true;\n         computeCount := computeCount + 1;\n         #Print(\".\");\n      fi;\n   od;\n\n   # Heuristic: if there're no computes, this is probably a huge permute (load or\n   # store) block, and should not be sw-pipelined.\n\n   if computeCount = 0 then\n     return(loop(lsw.rChildren()[1], lsw.rChildren()[2], lsw.rChildren()[3]));\n   fi;\n\n\n   #Error(\"BP\");\n   \n   # Mark all Loads\n   # Loads are all predcessors of all the computes\n   asgns := Collect(lsw, assign);\n   for asgn in asgns do\n      if IsBound(asgn.isCompute) and asgn.isCompute then\n         #Print(asgn);\n         MarkLoadinPreds(asgn);\n      fi;\n   od;\n\n   #Error(\"BP\");\n   \n   # HACK: must really check to ensure this is a store!\n   asgns := Collect(lsw, assign);\n   for asgn in asgns do\n      if not _IsCompute(asgn) and not _IsLoad(asgn) then\n         asgn.isStore := true;\n         MarkStoreinPreds(asgn);\n         #NOTE: the loopvar assign should also be a store\n      fi;\n   od;\n\n   # Mark loads which are to be marked as computes because they are\n   # both preceded by and succeeded by a compute\n\n   # For each compute, find all successors that are loads, and mark them as\n   # computes.\n\n   asgns := Collect(lsw, assign);\n   for asgn in asgns do\n      if IsBound(asgn.isCompute) and asgn.isCompute then\n         MarkAllSucceedingLoadsAsComputes(asgn);\n      fi;\n   od;\n\n   \n   # Now, change the loop_sw to a software pipelined loop\n   # Cmds should be strictly in order.\n\n   # Make a list of loads, computes, and stores\n   loads    := [];\n   computes := [];\n   stores   := [];\n   allasgns := Collect(lsw, chain)[1].cmds;\n   for asgn in allasgns do\n      if _IsLoad(asgn) then\n         loads := Concatenation(loads, [asgn]);\n      fi;\n      if _IsCompute(asgn) then\n         computes := Concatenation(computes, [asgn]);\n      fi;\n      if _IsStore(asgn) then\n         stores := Concatenation(stores, [asgn]);\n      fi;\n   od;\n\n   #Error(\"BP\");\n\n\n   loopvar := lsw.var;\n   n1 := Length(lsw.range)-1;\n   n2 := n1-1;\n\n   g0  := SubstLoopVarCopy(loads, loopvar, V(0));\n   g1  := SubstLoopVarCopy(loads, loopvar, V(1));\n   c0  := Copy(computes);\n\n   sn2 := SubstLoopVarCopy(stores, loopvar, V(n2));\n   sn1 := SubstLoopVarCopy(stores, loopvar, V(n1));\n   cn1 := Copy(computes);\n\n   bodyload  := SubstLoopVarCopy(loads,  loopvar, add(loopvar, V(2)));\n   #prologue := chain(g0,   c0,  g1); #epilogue := chain(sn2, cn1, sn1);\n\n   vars := Collect(lsw, decl)[1].vars;\n   lsw := decl(vars, chain(g0, c0, g1, loop(loopvar, n2, chain(stores, c0, bodyload)), sn2, cn1, sn1));\n   #Print(lsw);\n   return(lsw);\nend;\n\n\n", "meta": {"hexsha": "14bb37caa8fde6f1cb7c4d287afcb2e17b0d670c", "size": 5539, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/cellSPU/swpipe.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/cellSPU/swpipe.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/cellSPU/swpipe.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.9747474747, "max_line_length": 153, "alphanum_fraction": 0.6279111753, "num_tokens": 1684, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.43014733397551624, "lm_q2_score": 0.037892424320813946, "lm_q1q2_score": 0.01629932529946713}}
{"text": "#############################################################################\n####\n##\n#W  anupqopt.gi                ANUPQ package                    Werner Nickel\n#W                                                                Greg Gamble\n##\n##  Install file for functions to do with option manipulation.\n##    \n#Y  Copyright (C) 2001  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany\n##\n\n#############################################################################\n##\n#V  PQ_FUNCTION . . . . . . . . . internal functions called by user functions \n##\n##  A record whose fields are (function)  names  and  whose  values  are  the\n##  internal functions called by the functions with those names.\n##\nInstallValue( PQ_FUNCTION, \n              rec( Pq                   := PQ_EPI_OR_PCOVER,\n                   PqDescendants        := PQ_DESCENDANTS,\n                   StandardPresentation := PQ_EPIMORPHISM_STANDARD_PRESENTATION,\n                   PqDescendantsTreeCoclassOne := PqDescendantsTreeCoclassOne\n                  )\n             );\n\n#############################################################################\n##\n#V  ANUPQoptions  . . . . . . . . . . . . . . . . . . . .  admissible options\n##\n##  is a record of lists of names of admissible {\\ANUPQ} options,  such  that\n##  each field is either the name of a (``key'') {\\ANUPQ}  function  and  the\n##  corresponding value is the list of option names that are  admissible  for\n##  the function.\n##\nInstallValue( ANUPQoptions, \n              rec( # options for `Pq' and `PqEpimorphism'\n                   Pq  := [ \"Prime\", \n                            \"ClassBound\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"OutputLevel\", \n                            \"Relators\", \n                            \"Identities\",\n                            \"GroupName\", \n                            \"SetupFile\",\n                            \"PqWorkspace\",\n                            \"RedoPcp\" ],\n\n                   # options for `PqDescendants'\n                   PqDescendants\n                       := [ \"ClassBound\", \n                            \"OrderBound\", \n                            \"Relators\", \n                            \"GroupName\", \n                            \"StepSize\", \n                            \"PcgsAutomorphisms\", \n                            \"RankInitialSegmentSubgroups\", \n                            \"SpaceEfficient\", \n                            \"CapableDescendants\", \n                            \"AllDescendants\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"SubList\", \n                            \"BasicAlgorithm\",\n                            \"CustomiseOutput\",\n                            \"SetupFile\",\n                            \"PqWorkspace\" ],\n\n                   # options for `[Epimorphism][Pq]StandardPresentation'\n                   StandardPresentation\n                       := [ \"Prime\", \n                            \"pQuotient\",\n                            \"ClassBound\", \n                            \"Relators\", \n                            \"GroupName\", \n                            \"PcgsAutomorphisms\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"OutputLevel\", \n                            \"StandardPresentationFile\", \n                            \"SetupFile\",\n                            \"PqWorkspace\" ],\n\n                   # options for `PqDescendantsTreeCoclassOne'\n                   PqDescendantsTreeCoclassOne\n                       := [ \"ClassBound\", \n                            \"OrderBound\", \n                            \"Relators\", \n                            \"GroupName\", \n                            \"StepSize\", \n                            \"PcgsAutomorphisms\", \n                            \"RankInitialSegmentSubgroups\", \n                            \"SpaceEfficient\", \n                            \"CapableDescendants\", \n                            \"AllDescendants\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"SubList\", \n                            \"BasicAlgorithm\",\n                            \"CustomiseOutput\",\n                            \"TreeDepth\",\n                            \"SetupFile\",\n                            \"PqWorkspace\" ],\n\n                   PqList \n                       := [ \"SubList\" ],\n                   PqPcPresentation\n                       := [ \"Prime\", \n                            \"ClassBound\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"OutputLevel\", \n                            \"Relators\", \n                            \"Identities\",\n                            \"GroupName\" ],\n                   PqNextClass\n                       := [ \"QueueFactor\" ],\n                   PqEvaluateIdentities\n                       := [ \"Identities\" ],\n                   PqDoExponentChecks\n                       := [ \"Bounds\" ],\n                   PqDisplayStructure\n                       := [ \"Bounds\" ],\n                   PqDisplayAutomorphisms\n                       := [ \"Bounds\" ],\n                   PqSPComputePcpAndPCover\n                       := [ \"Prime\", \n                            \"ClassBound\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"OutputLevel\", \n                            \"Relators\", \n                            \"GroupName\" ],\n                   PqSPSavePresentation\n                       := [ \"ClassBound\", \n                            \"PcgsAutomorphisms\", \n                            \"StandardPresentationFile\" ],\n                   PqPGSetDescendantToPcp\n                       := [ \"Filename\" ], \n                   PqPGSupplyAutomorphisms\n                       := [ \"NumberOfSolubleAutomorphisms\",\n                            \"RelativeOrders\" ],\n                   PqPGConstructDescendants\n                       := [ \"ClassBound\", \n                            \"OrderBound\", \n                            \"StepSize\", \n                            \"PcgsAutomorphisms\", \n                            \"RankInitialSegmentSubgroups\", \n                            \"SpaceEfficient\", \n                            \"CapableDescendants\", \n                            \"AllDescendants\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"BasicAlgorithm\",\n                            \"CustomiseOutput\" ],\n                   PqAPGDegree\n                       := [ \"Exponent\" ],\n                   PqAPGPermutations\n                       := [ \"PcgsAutomorphisms\",\n                            \"SpaceEfficient\",\n                            \"PrintAutomorphisms\",\n                            \"PrintPermutations\" ],\n                   PqAPGOrbits\n                       := [ \"PcgsAutomorphisms\",\n                            \"SpaceEfficient\",\n                            \"CustomiseOutput\" ],\n                   PqAPGOrbitRepresentatives\n                       := [ \"PcgsAutomorphisms\", \n                            \"SpaceEfficient\", \n                            \"CapableDescendants\", \n                            \"AllDescendants\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"CustomiseOutput\",\n                            \"Filename\" ], \n                   PqAPGSingleStage\n                       := [ \"StepSize\", \n                            \"PcgsAutomorphisms\", \n                            \"RankInitialSegmentSubgroups\", \n                            \"SpaceEfficient\", \n                            \"CapableDescendants\", \n                            \"AllDescendants\", \n                            \"Exponent\", \n                            \"Metabelian\", \n                            \"BasicAlgorithm\",\n                            \"CustomiseOutput\" ]\n                  )\n             );\n\n#############################################################################\n##\n#F  AllANUPQoptions() . . . . . . . .  lists all options of the ANUPQ package\n##\n##  lists all the {\\GAP}  options  defined  for  functions  of  the  {\\ANUPQ}\n##  package.\n##\nInstallGlobalFunction( AllANUPQoptions, function()\n  return Set( Concatenation(\n                  List( RecNames(ANUPQoptions), fld -> ANUPQoptions.(fld) )\n                  ) );\nend );\n\n#############################################################################\n##\n#V  ANUPQGlobalOptions . . . . .  options that can be set globally by PqStart\n##\n##  A list of the options that `PqStart' can set and thereby  make  available\n##  to any function  interacting  with  the  {\\ANUPQ}  process  initiated  by\n##  `PqStart'.\n##\nInstallValue( ANUPQGlobalOptions, [ \"Prime\", \"Exponent\", \"Relators\" ] );\n\n#############################################################################\n##\n#V  ANUPQoptionChecks . . . . . . . . . . . the checks for admissible options\n##\n##  A record whose fields are the names of admissible ANUPQ options and whose\n##  values are one-argument functions that return `true' when given  a  value\n##  that is a valid value for the option, and `false' otherwise.\n##\nInstallValue( ANUPQoptionChecks,\n              rec( Prime := x -> IsInt(x) and IsPrimeInt(x),\n                   pQuotient  := IsPcGroup and IsPGroup,\n                   ClassBound := IsPosInt,\n                   OrderBound := IsPosInt,\n                   Exponent   := IsPosInt,\n                   Metabelian := IsBool,\n                   GroupName  := IsString,\n                   Identities := x -> IsList(x) and ForAll(x, IsFunction),\n                   OutputLevel := x -> x in [0..3],\n                   Relators   := x -> IsList(x) and ForAll(x, IsString),\n                   StandardPresentationFile := IsString,\n                   SetupFile  := IsString,\n                   PqWorkspace := IsPosInt,\n                   StepSize := x -> IsPosInt(x) or\n                                    (IsList(x) and ForAll(x, IsPosInt)), \n                   PcgsAutomorphisms := IsBool,\n                   BasicAlgorithm := IsBool,\n                   RankInitialSegmentSubgroups := x -> x = 0 or IsPosInt(x),\n                   SpaceEfficient := IsBool,\n                   CapableDescendants := IsBool,\n                   AllDescendants := IsBool,\n                   SubList := x -> IsPosInt(x) or\n                                   (IsSet(x) and ForAll(x, IsInt)\n                                    and IsPosInt(x[1])),\n                   CustomiseOutput := IsRecord,\n                   Bounds := x -> IsSet(x) and 2 = Length(x) and \n                                  ForAll(x, IsPosInt),\n                   QueueFactor := IsPosInt,\n                   RedoPcp := IsBool,\n                   PrintAutomorphisms := IsBool,\n                   PrintPermutations := IsBool,\n                   NumberOfSolubleAutomorphisms := x -> x = 0 or IsPosInt(x),\n                   RelativeOrders := x -> IsList(x) and ForAll(x, IsPosInt),\n                   Filename := IsString,\n                   TreeDepth := IsPosInt\n                   )\n             );\n\n#############################################################################\n##\n#V  ANUPQoptionTypes . . . . . .  the types (in words) for admissible options\n##\n##  A record whose fields are the names of admissible ANUPQ options and whose\n##  values are valid types of the options in plain words.\n##\nInstallValue( ANUPQoptionTypes,\n              rec( Prime := \"prime integer\",\n                   pQuotient  := \"pc p-group\",\n                   ClassBound := \"positive integer\",\n                   OrderBound := \"positive integer\",\n                   Exponent   := \"positive integer\",\n                   Metabelian := \"boolean\",\n                   GroupName  := \"string\",\n                   Identities := \"list of functions\",\n                   OutputLevel := \"integer in [0..3]\",\n                   Relators   := \"list of strings\",\n                   StandardPresentationFile := \"string\",\n                   SetupFile  := \"string\",\n                   PqWorkspace := \"positive integer\",\n                   StepSize := \"positive integer or positive integer list\",\n                   PcgsAutomorphisms := \"boolean\",\n                   BasicAlgorithm := \"boolean\",\n                   RankInitialSegmentSubgroups := \"nonnegative integer\",\n                   SpaceEfficient := \"boolean\",\n                   CapableDescendants := \"boolean\",\n                   AllDescendants := \"boolean\",\n                   SubList \n                       := \"pos've integer or increasing pos've integer list\",\n                   CustomiseOutput := \"record\",\n                   Bounds := \"pair of increasing positive integers\",\n                   QueueFactor := \"positive integer\",\n                   RedoPcp := \"boolean\",\n                   PrintAutomorphisms := \"boolean\",\n                   PrintPermutations := \"boolean\",\n                   NumberOfSolubleAutomorphisms := \"nonnegative integer\",\n                   RelativeOrders := \"list of positive integers\",\n                   Filename := \"string\",\n                   TreeDepth := \"positive integer\"\n                   )\n             );\n\n#############################################################################\n##\n#F  PQ_OTHER_OPTS_CHK( <funcname>, <interactive> ) . check opts belong to f'n\n##\n##  checks the `OptionsStack'  only  has  recognised  options  for  (generic)\n##  function <funcname> and if not and if  `ANUPQWarnOfOtherOptions  =  true'\n##  (see~\"ANUPQWarnOfOtherOptions\") `Info's  the  non-<funcname>  options  at\n##  `InfoANUPQ' level 1.\n##\n##  The argument <interactive> is only relevant for those functions that have\n##  both an interactive and non-interactive form, namely those with fields in\n##  `PQ_FUNCTION', for which some options need to be excluded.\n##\nInstallGlobalFunction(PQ_OTHER_OPTS_CHK, function(funcname, interactive)\nlocal optnames, excopts, generic, interactivestr;\n  if ANUPQWarnOfOtherOptions and ValueOption(\"recursive\") = fail and \n     not IsEmpty(OptionsStack) then\n    excopts := [];\n    if funcname in RecNames(PQ_FUNCTION) then\n      if interactive then\n        excopts := [\"PqWorkspace\", \"SetupFile\"];\n        interactivestr := \"interactive\";\n      else\n        interactivestr := \"non-interactive\";\n        if funcname = \"Pq\" then\n          excopts  := [\"RedoPcp\"];\n        fi;\n      fi;\n      generic := \"generic \";\n    else\n      generic := \"\";\n    fi;\n    optnames := Difference( RecNames( OptionsStack[ Length(OptionsStack) ] ),\n                            Difference( ANUPQoptions.(funcname), excopts ) );\n    if funcname = \"Pq\" then\n      optnames := Difference( optnames, [\"PqEpiOrPCover\"] );\n    fi;\n    if not IsEmpty(optnames) then\n      Info( InfoANUPQ + InfoWarning, 1, \n            \"ANUPQ Warning: Options: \", optnames, \" ignored\" );\n      if IsSubset(excopts, optnames) then\n        Info( InfoANUPQ + InfoWarning, 1, \n              \"(invalid for \", interactivestr, \" call of generic function: `\",\n              funcname, \"').\" );\n      else\n        Info( InfoANUPQ + InfoWarning, 1,\n              \"(invalid for \", generic, \"function: `\", funcname, \"').\" );\n      fi;\n    fi;\n  fi;\nend);\n\n#############################################################################\n##\n#F  VALUE_PQ_OPTION( <optname> ) . . . . . . . . . enhancement of ValueOption\n#F  VALUE_PQ_OPTION( <optname>, <defaultval> ) \n#F  VALUE_PQ_OPTION( <optname>, <datarec> ) \n#F  VALUE_PQ_OPTION( <optname>, <defaultval>, <datarec> ) \n##\n##  If the value <optval> of <optname> is not `fail' and it is  an  ok  value\n##  for <optname> then <optval> is returned; if <optval> is not an  ok  value\n##  an error is signalled. If <optval> is `fail' and <datarec> is  given  and\n##  <datarec>.(<optname>) is already  bound  then  that  value  is  returned;\n##  otherwise, if  <optval>  is  `fail'  and  a  default  value  <defaultval>\n##  different  from  `fail'  is  supplied  then  <defaultval>  is   returned.\n##  Supplying a <defaultval> of `fail' is special; it indicates  that  option\n##  <optname> must have a value i.e. <optval> is not allowed to be `fail' and\n##  if it is an error is signalled. If  a  <datarec>  argument  is  supplied,\n##  which must be a record, then the return value, if not `fail' and a  legal\n##  value, is also stored in `<datarec>.(<optname>)'.\n##\n##  *Note:* <defaultval> cannot be a record.\n##\nInstallGlobalFunction(VALUE_PQ_OPTION, function(arg)\nlocal optname, optval, len;\n  optname := arg[1];\n  optval := ValueOption(optname);\n  len := Length(arg);\n  if optval = fail then\n    if 1 = len then\n      return optval;\n    elif IsRecord( arg[len] ) and IsBound( arg[len].(optname) ) then\n      # return the previously recorded value\n      return arg[len].(optname);\n    elif not IsRecord(arg[2]) then\n      if arg[2] = fail then\n        Error(\"you must supply a value for option: \\\"\", optname, \"\\\"\\n\");\n      fi;\n      optval := arg[2]; \n    fi;\n  elif not ANUPQoptionChecks.(optname)(optval) then\n    Error(\"\\\"\", optname, \"\\\" value must be a \", \n          ANUPQoptionTypes.(optname), \"\\n\");\n  fi;\n  if (optval <> fail) and (2 <= len) and IsRecord(arg[len]) then\n    arg[len].(optname) := optval;\n  fi;\n  return optval;\nend);\n  \n#############################################################################\n##\n#F  PQ_OPTION_CHECK(<basefn>,<datarec>) . check optns present/setable if nec.\n##\n##  If `<basefn> = \"Pq\"' (i.e. this check is  carried  out  if  the  function\n##  called is `Pq', `PqEpimorphism' or  `PqPCover')  check  that  the  option\n##  `Prime' has been  passed  or,  in  a  special  `PqPCover'  case,  can  be\n##  determined from the `<datarec>.group'  which  must  be  present.  In  the\n##  special `PqPCover' case, the options `Prime' and `ClassBound'  determined\n##  are saved in <datarec>. If `Prime' is not supplied in the cases where  it\n##  needs to be, an error is emitted.\n##\nInstallGlobalFunction(PQ_OPTION_CHECK, function(basefn, datarec)\nlocal optname, out;\n  if basefn = \"Pq\" then\n    if datarec.calltype = \"interactive\" then\n      if VALUE_PQ_OPTION(\"RedoPcp\", false) then\n        PQ_UNBIND(datarec, [\"Prime\",  \"ClassBound\", \"Exponent\", \"Metabelian\",\n                            \"pCover\", \"pQuotient\",  \"pQepi\"] );\n      fi;\n    fi;\n    if ValueOption(\"PqEpiOrPCover\") = \"pCover\" and\n       HasIsPGroup(datarec.group) and IsPGroup(datarec.group) then\n      if VALUE_PQ_OPTION(\"Prime\", datarec) = fail then\n        if not HasPrimePGroup(datarec.group) then\n          Error( \"supplied group is not known to be a p-group or p unknown.\\n\",\n                 \"Option `Prime' must be supplied\" );\n        else\n          datarec.Prime := PrimePGroup(datarec.group);\n        fi;\n      fi;\n      if VALUE_PQ_OPTION(\"ClassBound\", datarec) = fail and\n         HasPClassPGroup(datarec.group) then\n        datarec.ClassBound := PClassPGroup(datarec.group);\n      fi;\n    else\n      VALUE_PQ_OPTION(\"Prime\", fail, datarec);\n    fi;\n    VALUE_PQ_OPTION(\"ClassBound\", 63, datarec);\n  elif basefn = \"StandardPresentation\" then\n    if VALUE_PQ_OPTION(\"Prime\", datarec) = fail and\n       VALUE_PQ_OPTION(\"pQuotient\", datarec) = fail then\n      if IsPcGroup(datarec.group) and IsPGroup(datarec.group) then\n        datarec.Prime := PrimePGroup(datarec.group);\n      else\n        Error( \"since group of process is not a pc p-group, a prime or\\n\",\n               \"p-quotient (pc group) of the group of the process \",\n               \"must be supplied\\n\" );\n      fi;\n    fi;\n  fi;\nend);\n\n#############################################################################\n##\n#F  PQ_CUSTOMISE_OUTPUT(<datarec>, <subopt>, <suboptstring>, <suppstrings>)\n##    \n##  writes the required output to the `pq' binary for the sub-option <subopt>\n##  of  the  option  `CustomiseOutput',  the  value  of  that  option  having\n##  previously been stored in `<datarec>.des.CustomiseOutput'; <suboptstring>\n##  is part of the comment written to the `pq' binary for the sub-option  and\n##  <suppstrings> is a list of such comments for the supplementary  questions\n##  asked by the `pq' binary for the sub-option <subopt>.\n##\nInstallGlobalFunction( PQ_CUSTOMISE_OUTPUT, \nfunction(datarec, subopt, suboptstring, suppstrings)\nlocal optrec, isOptionSet, i;\n  optrec := datarec.des.CustomiseOutput;\n  if IsEmpty(suppstrings) then\n    isOptionSet := IsBound( optrec.(subopt) ) and optrec.(subopt) in [1, true];\n    ToPQ_BOOL(datarec, isOptionSet, suboptstring);\n  elif IsBound( optrec.(subopt) ) and IsList( optrec.(subopt) ) then\n    ToPQ(datarec, [ 0 ], [ \"  #customise \", suboptstring ]);\n    for i in [1 .. Length(suppstrings)] do\n      isOptionSet := IsBound( optrec.(subopt)[i] ) and\n                     optrec.(subopt)[i] in [1, true];\n      ToPQ_BOOL(datarec, isOptionSet, suppstrings[i]);\n    od;\n  else\n    ToPQ(datarec, [ 1 ], [ \"  #default \", suboptstring ]);\n  fi;\nend);\n  \n#############################################################################\n##\n#F  PQ_APG_CUSTOM_OUTPUT(<datarec>, <subopt>, <suboptstring>, <suppstrings>)\n##    \n##  writes the required output to the `pq' binary for the sub-option <subopt>\n##  of the option `CustomiseOutput',  as  required  by  an  Advanced  p-Group\n##  Generation Menu item, the value of that  option  having  previously  been\n##  stored in `<datarec>.des.CustomiseOutput'; <suboptstring> is part of  the\n##  comment written to the `pq' binary for the sub-option  and  <suppstrings>\n##  is a list of such comments for the supplementary questions asked  by  the\n##  `pq' binary for the sub-option <subopt>.\n##\nInstallGlobalFunction( PQ_APG_CUSTOM_OUTPUT, \nfunction(datarec, subopt, suboptstring, suppstrings)\nlocal optrec, optlist, isOptionSet, i;\n  optrec := datarec.des.CustomiseOutput;\n  if not( IsRecord(optrec) and IsBound( optrec.(subopt) ) and \n          IsList( optrec.(subopt) ) ) then\n    optlist := [];\n    datarec.des.CustomiseOutput.(subopt) := optlist;\n  else\n    optlist := optrec.(subopt);\n  fi;\n  for i in [1 .. Length(suppstrings)] do\n    isOptionSet := IsBound( optlist[i] ) and optlist[i] in [1, true];\n    ToPQ_BOOL(datarec, isOptionSet, suppstrings[i]);\n  od;\nend);\n  \n#############################################################################\n##\n#F  SET_ANUPQ_OPTIONS( <funcname>, <fnname> )  . set options from OptionStack\n##    \n##  When called by a function with name  <funcname>  sets  the  options  from\n##  `OptionsStack'    checking    that    they    are     a     subset     of\n##  `ANUPQoptions.<fnname>'. Both <funcname> and <fnname> should be strings.\n##\nInstallGlobalFunction( SET_ANUPQ_OPTIONS, function( funcname, fnname )\n    local optrec, optnames, opt;\n\n    # there should be options\n    if IsEmpty( OptionsStack ) then\n        # no options??\n        optrec := rec();\n        Info( InfoANUPQ, 1, funcname, \" called with no options!\" );\n    else\n        optrec := ShallowCopy( OptionsStack[ Length( OptionsStack ) ] );\n        optnames := Set( REC_NAMES(optrec) );\n        SubtractSet( optnames, Set( ANUPQoptions.(fnname) ) );\n        Info( InfoANUPQ, 2, funcname, \" called with options: \", \n                            OptionsStack[ Length( OptionsStack ) ] );\n        if 0 < Length(optnames) then\n            # it's not an error to have unknown options,\n            # function may have been called recursively and the \n            # options may be intended for some other function\n            Info( InfoWarning + InfoANUPQ, 2,\n                  funcname, \" called with unknown options: \", optnames);\n        fi;\n        for opt in optnames do\n            Unbind( optrec.(opt) );\n        od;\n    fi;\n    return optrec;\nend );\n\n#############################################################################\n##\n#F  ANUPQoptError( <funcname>, <illegal> )  . . . . . create an error message\n##\n##  creates an error message  for  the  function  with  name  <funcname>.  If\n##  <illegal> is a string it is taken to be  the  first  line  of  the  error\n##  message. Otherwise <illegal> should be alist of illegal options (strings)\n##  found. The error message (string) returned also gives the list  of  valid\n##  options together with the value types expected for function <funcname>.\n##\nInstallGlobalFunction( ANUPQoptError, function( funcname, illegal )\n    local Optstring, Valstring, errmsg, optname;\n\n    Optstring := optname -> Concatenation(\"\\\"\", optname, \"\\\"\");\n    Valstring := optval  -> Concatenation(\"<\",  optval,  \">\");\n\n    if IsString(illegal) then\n        errmsg := illegal;\n    else # IsList(illegal)\n        errmsg := Concatenation(\"Illegal \", funcname, \" option\");\n        if Length(illegal) > 1 then\n            Append(errmsg, \"s\");\n        fi;\n        Append(errmsg, \": \");\n        Append(errmsg, JoinStringsWithSeparator( List(illegal, Optstring) ));\n    fi;\n    Append(errmsg, Concatenation(\".\\nValid \", funcname, \" options:\\n\"));\n    for optname in ANUPQoptions.(funcname) do\n        Append(errmsg, \"    \");\n        Append(errmsg, Optstring(optname));\n        if ANUPQoptionChecks.(optname) <> IsBool then\n            Append(errmsg, \", \");\n            Append(errmsg, Valstring( ANUPQoptionTypes.(optname) ));\n        fi;\n        Append(errmsg, \"\\n\");\n    od;\n    return errmsg;\nend );\n\n#############################################################################\n##\n#F  ANUPQextractOptions( <funcname>, <args> ) . . . . . . . . extract options\n##\n##  extracts options from  <args>  for  function  with  name  <funcname>  and\n##  returns a record suitable for use with `PushOptions'.  Abbreviations  are\n##  allowed for option names so long as  each  abbreviates  a  unique  option\n##  name.\n##\nInstallGlobalFunction( ANUPQextractOptions, function(funcname, args)\n    local   Match, error, optrec, i, optname;\n\n    # allow to give only a prefix\n    Match := function( argi )\n        local matches;\n        if IsString(argi) then\n            matches := Filtered(ANUPQoptions.(funcname), \n                                optname -> 0 < Length(argi) and\n                                           Length(argi) <= Length(optname) and\n                                           optname{[1..Length(argi)]} = argi);\n            if 1 = Length(matches) then\n                return matches[1];\n            fi;\n            error := Concatenation( \"argument: \\\"\", argi, \n                                    \"\\\" doesn't abbreviate a unique option\");\n        else\n            error := Concatenation( \"argument: \", String(argi),\n                                    \" is not a (non-null) string (option name)\"\n                                    );\n        fi;\n        return fail;\n    end;\n\n    # extract options from args\n    optrec := rec();\n    i := 1;\n    while i <= Length(args)  do\n        optname := Match( args[i] );\n        if optname = fail then \n            Error( ANUPQoptError( funcname, error ) );\n        elif ANUPQoptionChecks.(optname) = IsBool then\n            optrec.(optname) := true;\n            i := i + 1;\n        elif i = Length(args) then\n            # all remaining options are non-boolean and expect a value to\n            # follow\n            Error( ANUPQoptError( \n                       funcname,\n                       Concatenation( \"Expected value for option: \", args[i] )\n                       ) );\n        else\n            # checking values are ok is done later\n            optrec.(optname) := args[i + 1];\n            i := i + 2;\n        fi;\n    od;\n    return optrec;\n\nend );\n\n#E  anupqopt.gi . . . . . . . . . . . . . . . . . . . . . . . . . . ends here \n", "meta": {"hexsha": "dc30e23bc9c99331d449083fb997aebce75903c6", "size": 27613, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/anupqopt.gi", "max_stars_repo_name": "gap-system/anupq", "max_stars_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_stars_repo_licenses": ["Artistic-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/anupqopt.gi", "max_issues_repo_name": "gap-system/anupq", "max_issues_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_issues_repo_licenses": ["Artistic-2.0"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2015-03-04T12:41:28.000Z", "max_issues_repo_issues_event_max_datetime": "2015-09-27T22:17:27.000Z", "max_forks_repo_path": "lib/anupqopt.gi", "max_forks_repo_name": "gap-system/anupq", "max_forks_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_forks_repo_licenses": ["Artistic-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.3512269939, "max_line_length": 80, "alphanum_fraction": 0.4891536595, "num_tokens": 6386, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4493926344647597, "lm_q2_score": 0.036220053784286124, "lm_q1q2_score": 0.01627702539057563}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\n# Icode objects that are not cuda-specific (those are defined in cuda_icode.gi)\n\n# A simt index is derived from a SIMT dim tag\n\nClass(simtIdx, Exp, rec(\n    computeType := (self) >> TInt,\n    \n    size := self >> When(Length(self.args)>0, self.args[1], 0),\n\n    count := (self) >> let(rng := self.get_rng(), When(rng<>[], rng[2]-rng[1]+1, 0 ) ),\n\n    set_rng := meth(self, l, h)\n        if Length(self.args)>1 then\n            self.args[2] := [l, h];\n        else\n            Add(self.args, [l, h]);\n        fi;\n        return self;\n    end,\n    \n    eval := self >> self,\n    \n    can_fold := False,\n\n    get_rng := (self) >> Cond(Length(self.args)>1, When(IsValue(self.args[2]), self.args[2].v, self.args[2]), Length(self.args)>0, [0, self.args[1]-1], [])\n\n));\n\nClass(simtBlockIdx, simtIdx);\nClass(simtThreadIdx, simtIdx);\n\nClass(simtBlockIdxX, simtBlockIdx);\nClass(simtBlockIdxY, simtBlockIdx);\nClass(simtBlockIdxZ, simtBlockIdx);\n\nIsSimtBlockIdx := (idx) -> ObjId(idx) in simtBlockIdx._all_descendants();\n\nClass(simtThreadIdxX, simtThreadIdx);\nClass(simtThreadIdxY, simtThreadIdx);\nClass(simtThreadIdxZ, simtThreadIdx);\n\nIsSimtThreadIdx := (idx) -> ObjId(idx) in simtThreadIdx._all_descendants();\n\n# Used to identify blocks of code that can be mapped to a kernel\nClass(simt_block, chain);\n\nClass(simt_loop, loop, rec(\n    drop_range1 := false,\n\n    __call__ := meth(self, simt_idx, loopvar, range, cmd)\n        local result;\n        Constraint(IsCommand(cmd));\n        if IsSymbolic(range) then return loopn(loopvar, range, cmd); fi;\n        range := toRange(range);\n        if self.drop_range1 and range = 1 then\n            return SubstBottomUp(Copy(cmd), @(1, var, e->e=loopvar), e->V(0));\n        elif range = 0 then\n            return skip();\n        elif simt_idx = Ignore then\n            return loop(loopvar, range, cmd);\n        else\n            loopvar.setRange(range);\n            range := listRange(range);\n            result := WithBases(self,\n                rec(operations := CmdOps, simt_idx := simt_idx, cmd := cmd, var := loopvar, range := range));\n            loopvar.isLoopIndex := true;\n            #loopvar.loop := result;\n            return result;\n        fi;\n    end,\n\n    rChildren := self >> [self.simt_idx, self.var, self.range, self.cmd],\n    rSetChild := rSetChildFields(\"simt_idx\", \"var\", \"range\", \"cmd\"),\n\n    ));\n\n# A function that allows declaration specifiers (eg, __global__, __device__, etc..)\nClass(specifiers_func, func, rec(\n    __call__ := (self, decl_specs, ret, id, params, cmd) >> WithBases(self, rec(\n            decl_specs := Checked(IsList(decl_specs), decl_specs),\n            ret    := Checked(IsType(ret), ret),\n            id     := Checked(IsString(id), id),\n            params := Checked(IsList(params), params),\n            cmd    := Checked(IsCommand(cmd), cmd),\n            operations := CmdOps)),\n\n    rChildren := self >> [self.decl_specs, self.ret, self.id, self.params, self.cmd],\n    rSetChild := rSetChildFields(\"decl_specs\", \"ret\", \"id\", \"params\", \"cmd\"),\n\n    print := (self, i, si) >> Print(self.__name__, \"(\", self.decl_specs, \", \", self.ret, \", \\\"\", self.id, \"\\\", \", self.params, \", \\n\",\n        Blanks(i+si), self.cmd.print(i+si, si), \"\\n\", Blanks(i), \")\", self.printA()),\n    )\n);\n\n# sync primitives. Their relationship is defined by their sync scope (cluster < block < grid).\n# A grid is composed of blocks and blocks of clusters (eg, cuda: grid, blocks, warps).\n\nClass(simtSyncOps, CmdOps, rec(\n    \\< := (v1, v2) -> Cond(\n                            ObjId(v1) = ObjId(v2) or ObjId(v1) = simt_syncgrid, false,\n                            ObjId(v1) = skip, true,\n                            ObjId(v1) = simt_synccluster and ObjId(v2) <> skip, true,\n                            ObjId(v1) = simt_syncblock and not ObjId(v2) in [skip, simt_synccluster], true,\n                            false\n                        )\n    ));\n\nClass(simt_sync, call, rec(\n    __call__ := (arg) >> let(o := Inherited(), CopyFields(o, rec(operations := simtSyncOps) ) ) \n    ));\n\nClass(simt_synccluster, simt_sync);\n\nClass(simt_syncblock, simt_sync);\n\nClass(simt_syncgrid, simt_sync);\n\n# unparsed into C-style printf\n\nClass(cprintf, call);\n", "meta": {"hexsha": "0fb9bdc482904fd77cabc51f93a0a24f2c900c5a", "size": 4280, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "icode.gi", "max_stars_repo_name": "mikefranusich/spiral-package-simt", "max_stars_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "icode.gi", "max_issues_repo_name": "mikefranusich/spiral-package-simt", "max_issues_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-03-30T14:16:00.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-30T14:16:00.000Z", "max_forks_repo_path": "icode.gi", "max_forks_repo_name": "mikefranusich/spiral-package-simt", "max_forks_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:26:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-05T12:02:48.000Z", "avg_line_length": 34.24, "max_line_length": 155, "alphanum_fraction": 0.5922897196, "num_tokens": 1180, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3276682876897044, "lm_q2_score": 0.04958902122830425, "lm_q1q2_score": 0.016248749674086856}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(ScriptGenAVX, ScriptGenBase, rec(\n\t\n\n\t_arch := () -> \"AVX\",\n\n\n\t_init := meth(self)\n\t\tself._setTransform(SGKEY_FFT);\n\t\tself._setType(SGKEY_SPCX);\n\t\tself._setSize(64);\n\t\tself._setFilename(\"\");\n\tend,\n\t\n\n\t_validTransforms := meth(arg)\n\t\treturn [SGKEY_FFT, SGKEY_IFFT, SGKEY_FFT_2D, SGKEY_IFFT_2D];\n\tend,\n\t\n\t\n\t_validSizes := meth(arg)\n\t\tlocal self, szs, xform, type;\n\t\tself  := arg[1];\n\t\tszs   := [];\n\t\txform := self.getSettingsValue(SGKEY_TRANSFORM);\n\t\ttype  := self.getSettingsValue(SGKEY_DATATYPE);\n\t\t\n\t\tif xform in [SGKEY_FFT, SGKEY_IFFT] then\n\t\t\tif type = SGKEY_DPCX then\n\t\t\t\tszs := Filtered([1..1024], i->ForAll(Factors(i), j->j<=16) and IsInt(i/16));\n\t\t\t\tAppend(szs, List([11..16], i->2^i));\n\t\t\telse\n\t\t\t\tszs := Filtered([1..1024], i->ForAll(Factors(i), j->j<=16) and IsInt(i/64));\n\t\t\t\tAppend(szs, List([11..16], i->2^i));\n\t\t\tfi;\n\t\telif xform in [SGKEY_FFT_2D, SGKEY_IFFT_2D] then\n\t\t\tif type = SGKEY_DPCX then\n\t\t\t\tszs := List([4..8], i -> [2^i, 2^i]);\n\t\t\telse\n\t\t\t\tszs := List([6..9], i -> [2^i, 2^i]);\n\t\t\tfi;\n\t\telif xform = SGKEY_WHT then\n\t\t\tif type = SGKEY_DPCX then\n\t\t\t\tszs := List([4..8], i->2^i);\n\t\t\telse\n\t\t\t\tszs := List([6..8], i->2^i);\n\t\t\tfi;\n\t\tfi;\n\t\t\t\t\n\t\treturn szs;\n\tend,\n\t\n\t\n\t_validTypes := meth(arg)\n\t\treturn [SGKEY_SPCX, SGKEY_DPCX];\n\tend,\n\t\n\t\n\t_genScript := meth(self, runType)\n\t\tlocal scrstr, xform, type, szs, tempvar, tempopts, optrec, optstr, isa, funcstr,\n\t\t\tuse_cx, vec2;\n\t\t\n\t\ttempvar  := \"tdp\";\n\t\txform\t := self.getSettingsValue(SGKEY_TRANSFORM);\n\t\ttype\t := self.getSettingsValue(SGKEY_DATATYPE);\n\t\tszs      := self.getSettingsValue(SGKEY_SIZE);\n\t\tscrstr\t := \"\";\n\t\t\n\t\ttempopts := tempvar::\"Opts\";\n\t\t\n\t\tif (type = SGKEY_SPCX) then\n\t\t\tisa    := \"AVX_8x32f\";\n\t\t\tvec2   := 64;\n\t\telse\n\t\t\tisa    := \"AVX_4x64f\";\n\t\t\tvec2   := 16;\n\t\tfi;\n\t\t\n\t\tuse_cx := ForAny(szs, s -> not IsInt(s / vec2));\n\t\t\n\t\tif xform in [SGKEY_FFT, SGKEY_IFFT] then\n\t\t\toptrec := rec(\n\t\t\t\tglobalUnrolling    := 128,\n\t\t\t\ttsplRader          := false, \n\t\t\t\ttsplBluestein      := false, \n\t\t\t\ttsplPFA            := false, \n\t\t\t\toddSizes           := false, \n\t\t\t\tinterleavedComplex := true,\n\t\t\t\tcplxVect           := use_cx,\n\t\t\t\trealVect           := not use_cx,\n\t\t\t);\n\t\t\tif use_cx then\n\t\t\t\toptrec.RDFT  := false;\n            \toptrec.URDFT := true;\n\t\t\t\tif (type = SGKEY_SPCX) then\n\t\t\t\t\toptrec.CT      := false;\n\t\t\t\t\toptrec.PD      := false;\n\t\t\t\t\toptrec.svct    := true;\n\t\t\t\t\toptrec.flipIxA := true;\n\t\t\t\telif (type = SGKEY_DPCX) then\n\t\t\t        optrec.svct   := false;\n\t\t\t\t\toptrec.splitL := true;\n\t\t\t\tfi;\n\t\t\tfi;\n\t\t\tif xform = SGKEY_IFFT then\n\t\t\t\toptrec.transInverse := true;\n\t\t\tfi;\n\t\t\tfuncstr := \"doSimdDft(\"::String(szs)::\", \"::isa::\", \"::tempopts::\")\";\n\t\telif xform in [SGKEY_FFT_2D, SGKEY_IFFT_2D] then\n\t\t\toptrec := rec(\n\t\t\t\tinterleavedComplex := true,\n                oddSizes := false,\n\t\t\t\tsvct := true, \n\t\t\t\tsplitL := false, \n\t\t\t\tpushTag := true, \n\t\t\t\tflipIxA := false, \n\t\t\t\tstdTTensor := true, \n\t\t\t\ttsplPFA := false\n\t\t\t);\n\t\t\tif xform = SGKEY_IFFT_2D then\n\t\t\t\toptrec.transInverse := true;\n\t\t\tfi;\n\t\t\tfuncstr := \"doSimdMddft(\"::String(szs)::\", \"::isa::\", \"::tempopts::\")\";\n\t\telif xform = SGKEY_WHT then\n\t\t\toptrec := rec(\n\t\t\t\tverify   := true, \n\t\t\t\toddSizes := false, \n\t\t\t\tsvct     := true\n\t\t\t);\n\t\t\tfuncstr := \"doSimdWht(\"::String(szs)::\", \"::isa::\", \"::tempopts::\")\";\n\t\telse\n\t\t\treturn \"\";\n\t\tfi;\n\t\t\n\t\toptrec.faultTolerant := true;\n\t\t\n\t\tif IsBound(self._settings.(SGKEY_FUNCNAME)) then\n\t\t\toptrec.functionNameRoot := self._settings.(SGKEY_FUNCNAME);\n\t\tfi;\n\t\t\n\t\toptstr := StringPrint(optrec);\n\t\tscrstr := tempopts::\" := \"::optstr::\";;\\n\";\n\t\tAppend(scrstr, tempvar::\" := \"::funcstr::\";;\\n\");\n\t\tAppend(scrstr, tempvar::\".\"::runType::\"();\\n\");\n\t\t\n\t\treturn scrstr;\n\tend,\n\t\n\t_localSupport := function()\n\t\treturn (IsBound(LocalConfig) and IsBound(LocalConfig.cpuinfo) and IsBound(LocalConfig.cpuinfo.SIMD().hasAVX) and\n\t\t\tLocalConfig.cpuinfo.SIMD().hasAVX());\n\tend,\n\t\n)); # Class ScriptGenAVX\n\n\nSetScriptGenConstructor(ScriptGenAVX);\n\n", "meta": {"hexsha": "ce503d4ab42b60d3a4d957fd02e441875a65d091", "size": 3992, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/scriptgen/avx.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/scriptgen/avx.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/scriptgen/avx.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 24.490797546, "max_line_length": 114, "alphanum_fraction": 0.5881763527, "num_tokens": 1405, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46879062662624377, "lm_q2_score": 0.034618842698694585, "lm_q1q2_score": 0.0162289889617964}}
{"text": "# This is a rather basic helper function to do\n# completion. It is related to the completion\n# function provided in lib/cmdledit.g in the GAP\n# distribution\nInstallGlobalFunction(JUPYTER_Complete,\nfunction(code, cursor_pos)\n    local default, cand, i, matches, tokens, tok;\n\n    default := rec( matches := [], cursor_start := 0,\n                    cursor_end := cursor_pos, metadata := rec(),\n                    status := \"ok\" );\n\n    code := code{[1..cursor_pos]};\n    if Length(code) = 0 then\n        return default;\n    fi;\n    tokens := SplitString(code, \"():=<>,.[]?-+*/; \");\n\n    if tokens = [] then\n        return default;\n    fi;\n\n    tok := tokens[Length(tokens)];\n    cand := IDENTS_BOUND_GVARS();\n    matches := Filtered(cand, i -> PositionSublist(i, tok) = 1);\n    SortBy(matches, Length);\n    return rec( matches := matches\n              , cursor_start := cursor_pos - Length(tok)\n              , cursor_end := cursor_pos\n              , metadata := rec()\n              , status := \"ok\" );\nend);\n", "meta": {"hexsha": "ed9093da01d2301fff57590a838394a7aaa2230c", "size": 1011, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterCompletion.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterCompletion.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterCompletion.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 30.6363636364, "max_line_length": 64, "alphanum_fraction": 0.5736894164, "num_tokens": 248, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.29746994260479465, "lm_q2_score": 0.054198735170148525, "lm_q1q2_score": 0.016122494640316547}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F PrintActiveRules(<non-terminal>)\n#F PrintActiveRules(<non-terminal.name>)   \n#F PrintActiveRules([<rulelist>])\n#F \n#F Prints out all applicable rules for for the transform <non-terminal>\n#F together with their switches.\n#F Accepts a nonterminal spl, its symbol, or a rule list as an argument.\n#F  \n\nPrintActiveRules := function (nonterm)\n\nlocal rules, switches, i;\n\n# Check if rules are already found\nif IsList(nonterm) and not IsString(nonterm) then \n  if ForAll(nonterm, IsRule) then rules:=nonterm;\n  else Error(\"List must be a list of rules\");\n  fi; \nelse rules := AllRules(nonterm);\nfi;\n\nswitches := \n  List([1..Length(rules)], \n    function(i) \n      if rules[i].switch = false then return \"OFF\";\n      else return \"ON\";\n      fi;\n    end\n  );\nPrint(\"\\n\");\nPrint(\"No. \\t\\b\\bSwitch \\tRule\\n\");\nPrint(\"--------------------------------------------\\n\"); \nfor i in [1..Length(rules)] do\n  Print(i,\".\\t\",switches[i],\"\\t\",rules[i],\"\\n\");\nod;\nPrint(\"\\n\");\nend;\n\n#F SwitchRulesOn( <non-terminal>, <ind> )\n#F SwitchRulesOn( <non-terminal.name>, <ind> )\n#F SwitchRulesOn( [<rulelist>], <ind> )\n#F \n#F Switches on the rules with indices <ind> for a given <non-terminal>\n#F   <non-terminal> can be either a nonterminal spl or its symbol.\n#F   <ind> is either a single index or a list of indices\n#F\n#F Hint: Use PrintActiveRules(<non-terminal>) to find out more about \n#F       rules and their numbering.\n#F \n\nSwitchRulesOn := function ( nonterm , index )\nlocal i, L;\n\n# Check if rules are already found\nif IsList(nonterm) and not IsString(nonterm) then \n  if ForAll(nonterm, IsRule) then L := nonterm;\n  else Error(\"List must be a list of rules\");\n  fi; \nelse L := AllRules(nonterm);\nfi;\n\nif not IsList(index) then index := [index];fi; \nif ForAny(index, k-> not (IsInt(k) and k <= Length(L) and k > 0)) then\n     Error(\"Index to the rule list must be an integer in the proper range\");\nfi;\nfor i in index do\n  L[i].switch:=true;\nod;\n\nPrintActiveRules(L);\nend;\n\nDeclare(SwitchRulesQuiet, SwitchRulesByNameQuiet);\n\n#F SwitchRules( <non-terminal>, <ind> )\n#F SwitchRules( <non-terminal.name>, <ind> )\n#F SwitchRules( [<rulelist>], <ind> )\n#F \n#F Switches on the rules with indices <ind> for a given <non-terminal>\n#F   and off all the other rules for the same nonterm\n#F   <non-terminal> can be either a nonterminal spl or its symbol.\n#F   <ind> is either a single index or a list of indices\n#F\n#F Hint: Use PrintActiveRules(<non-terminal>) to find out more about \n#F       rules and their numbering.\n#F \nSwitchRules := function ( nonterm , index )\n    SwitchRulesQuiet(nonterm, index);\n    PrintActiveRules(nonterm);\nend;\n\nSwitchRulesQuiet := function ( nonterm , index )\nlocal i, L;\n\n# Check if rules are already found\nif IsList(nonterm) and not IsString(nonterm) then \n  if ForAll(nonterm, IsRule) then L := nonterm;\n  else Error(\"List must be a list of rules\");\n  fi; \nelse L := AllRules(nonterm);\nfi;\n\nif not IsList(index) then index := [index];fi; \nif ForAny(index, k-> not (IsInt(k) and k <= Length(L) and k > 0)) then\n     Error(\"Index to the rule list must be an integer in the proper range\");\nfi;\n\nfor i in [1..Length(L)] do \n  L[i].switch:=false;\nod;\n\nfor i in index do\n  L[i].switch:=true;\nod;\nend;\n\n\nSwitchRulesByName := function ( nonterm , rules )\n    SwitchRulesByNameQuiet(nonterm, rules);\n    PrintActiveRules(nonterm);\nend;\n\nSwitchRulesByNameQuiet := function ( nonterm , rules )\n    local r, L;\n    if not IsNonTerminal(nonterm) then Error(\"<nonterm> must be a non-terminal\");\n    elif not (IsList(rules) and ForAll(rules, IsRule)) then Error(\"<rules> must be a list of rules\");\n    fi;\n    SwitchRulesQuiet(nonterm, []);\n    for r in rules do\n        r.switch:=true;\n    od;\nend;\n\n#F SwitchRulesOff( <non-terminal>, <ind> )\n#F SwitchRulesOff( <non-terminal.name>, <ind> )\n#F SwitchRulesOff( [<rulelist>], <ind> )\n#F \n#F Switches off the rules with indices <ind> for a given <non-terminal>\n#F   <non-terminal> can be either a nonterminal spl or its symbol.\n#F   <ind> is either a single index or a list of indices\n#F\n#F Hint: Use PrintActiveRules(<non-terminal>) to find out more about \n#F       rules and their numbering.\n#F \n\nSwitchRulesOff := function ( nonterm , index )\nlocal i, L;\n\n# Check if rules are already found\nif IsList(nonterm) and not IsString(nonterm) then\n  if ForAll(nonterm, IsRule) then L := nonterm;\n  else Error(\"List must be a list of rules\");\n  fi; \nelse L := AllRules(nonterm);\nfi;\n\nif not IsList(index) then index := [index]; fi; \nif ForAny(index, k-> not (IsInt(k) and k <= Length(L) and k > 0)) then\n     Error(\"Index to the rule list must be an integer in the proper range\");\nfi;\nfor i in index do\n  L[i].switch:=false;\nod;\n\nPrintActiveRules(L);\nend;\n\n# VIENNA ADDED:\n#F SwitchRulesName( [<rulelist>], true|false )\n#F \n#F Switches the rules on and off by names \n#F   <rulelist> is a list of names of rules\n#F\nSwitchRulesName := function(l,s)\nlocal i;\nfor i in l do i.switch:=s; od;\nend;\n", "meta": {"hexsha": "b3d14a00528300c4b1545b18ec4d027262523782", "size": 5011, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/acarule.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/acarule.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/acarule.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.3825136612, "max_line_length": 101, "alphanum_fraction": 0.6755138695, "num_tokens": 1459, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.334589441253186, "lm_q2_score": 0.048136767532115654, "lm_q1q2_score": 0.016106054152305083}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# This is the code generator I use for generating HDL descriptions.  The\n# output from this is sent to my back-end. \n\nClass(HDLCodegen, Codegen, rec(\n    initXY := function(x, y, opts)\n        if IsBound(opts.XType) and not IsList(x) then\n            if not IsArrayT(opts.XType) and not IsPtrT(opts.XType) \n                then Error(\"opts.XType must be a pointer or array type. This has recently changed.\",\n                           \"If you used TReal before, use TPtr(TReal) now\"); fi;\n            x.t := opts.XType;\n            x.t := When(IsBound(opts.useRestrict) and opts.useRestrict, x.t.restrict(), x.t);\n        fi;\n        if IsBound(opts.YType) and not IsList(y) then\n            if not IsArrayT(opts.YType) and not IsPtrT(opts.YType) \n                then Error(\"opts.YType must be a pointer or array type. This has recently changed.\",\n                           \"If you used TReal before, use TPtr(TReal) now\"); fi;\n            y.t := opts.YType;\n            y.t := When(IsBound(opts.useRestrict) and opts.useRestrict, y.t.restrict(), y.t);\n        fi;\n        return [x, y];\n    end,\n\n    Formula := meth(self, o, y, x, opts)\n\n        local code, datas, prog, params, sub, initsub;\n\n\t[x, y] := self.initXY(x,y,opts);\n\n\to := o.child(1);\n\tparams := Set(Collect(o, param));\n\n\tdatas := Collect(o, FDataOfs);\n\to := BlockSums(opts.globalUnrolling, o);\n\tcode := self(o, y, x, opts);\n    code := ESReduce(code, opts);\n\tcode := RemoveAssignAcc(code);\n\tcode := BlockUnroll(code, opts);\n        # code := PowerOpt(code);\n\tcode := DeclareHidden(code);\n\tif IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n\t    code := FixedPointCode(code, opts.bits, opts.fracbits);\n\tfi;\n\n\tsub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n\tinitsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n#\tcode := func(TVoid, sub, Concatenation(params, [y, x]), code);\n#\tcode := \n\n#\tif IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n#\t    prog := program(\n#\t\tdecl(List(datas, x->x.var),\n#\t\t    chain(\n#\t\t\tfunc(TVoid, initsub, [], chain(List(datas, x -> SReduce(x.var.init, opts)))),\n#\t\t\tcode\n#\t\t    )));\n#\telse\n#\t    prog := program(code);\n#\tfi;\n\tprog := code;\n\tprog.dimensions := o.dimensions;\n\treturn prog;\n    end,\n\n    \n\n#    BB := (self,o,y,x,opts) >> MarkForUnrolling(self(o.child(1), y, x, opts)),\n    BB := (self,o,y,x,opts) >> MarkForUnrolling(\n        When(IsBound(o.bbnum),\n            o.bbnum,\n            0\n        ), \n        self(o.child(1), y, x, opts)\n    ),\n\n    Buf := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n    Grp := (self,o,y,x,opts) >> self(o.child(1), y, x, opts),\n\n    COND := (self,o,y,x,opts) >> IF(\n        When(IsFunction(o.cond), o.cond.at(0), o.cond),\n        self(o.child(1), y, x, opts), self(o.child(2), y, x, opts)),\n\n#    COND := (self,o,y,x,opts) >> IF(o.cond, self(o.child(1), y, x, opts), self(o.child(2), y, x, opts)),\n\n    Diag := (self, o, y, x, opts) >> let(i := Ind(), elt := o.element.lambda(),\n\tloop(i, elt.domain(), assign(nth(y,i), elt.at(i) * nth(x,i)))),\n\n    RCDiag := (self, o, y, x, opts) >> let(i := Ind(), elt := o.element.lambda(),\n\tre := elt.at(2*i), im := elt.at(2*i+1),\n\tloop(i, elt.domain()/2, chain(\n\t\tassign(nth(y,2*i),   re * nth(x,2*i) - im * nth(x,2*i+1)),\n\t\tassign(nth(y,2*i+1), im * nth(x,2*i) + re * nth(x,2*i+1))))),\n\n    ColVec := (self, o, y, x, opts) >> let(i := Ind(), func := o.element.lambda(),\n\tloop(i, func.domain(), assign(nth(y,i), mul(func.at(i), nth(x,0))))),\n\n    RowVec := (self, o, y, x, opts) >> let(i := Ind(), func := o.element.lambda(),\n\tt := TempVar(x.t.t),\n\tchain(assign(t,0),\n\t    loop(i, func.domain(), assign(t, add(t, mul(func.at(i), nth(x,i))))),\n\t    assign(nth(y,0), t))),\n\n    Scale := (self, o, y, x, opts) >> let(i := Ind(),\n\tchain(self(o.child(1), y, x, opts),\n\t    loop(i, Rows(o), assign(nth(y,i), mul(o.scalar, nth(y,i)))))),\n\n    I := (self, o, y, x, opts) >> let(i := Ind(Rows(o)),\n\tloop(i, i.range, assign(nth(y,i), nth(x,i)))),\n\n    Blk := (self, o, y, x, opts) >> Cond(\n\tRows(o)=2 and Cols(o)=2, Blk2code(o, y, x),\n        Rows(o)=4 and Cols(o)=4, Blk4code(o, y, x),\n\tlet(j:=Ind(), i:=Ind(), t:=TempVar(x.t.t), mat:=V(o.element), d:=Dat(mat.t),\n\t    data(d, mat,\n\t\tloop(j, Rows(o), decl(t, chain(\n\t\t     assign(t, 0),\n\t\t     loop(i, Cols(o), assign(t, t + nth(nth(d,j),i) * nth(x,i))),\n\t\t     assign(nth(y,j), t))))))),\n\n    toeplitz := (self, o, y, x, opts) >> self.Blk(o.obj, y, x, opts),\n\n    Blk1 := (self, o, y, x, opts) >> assign(nth(y,0), mul(toExpArg(o.element), nth(x,0))),\n\n    BlkConj := (self, o, y, x, opts) >> assign(nth(y,0), conj(nth(x,0))),\n\n\n    Prm := (self, o, y, x, opts) >> let(i:=Ind(), func:=o.func.lambda(),\n\tloop(i, Rows(o), assign(nth(y, i), nth(x, func.at(i))))),\n    \n    L := meth(self, o, y, x, opts)\n        return let(i:=Ind(), func:=o.lambda(),\n            loop(i, Rows(o), assign(nth(y, i), nth(x, func.at(i)))).unroll());\n    end,\n   \n    \n    O := (self, o, y, x, opts) >> let(i:=Ind(),\n\tloop(i, o.params[1], assign(nth(y, i), V(0)))),\n\n    DirectSum := (self,o,y,x,opts) >> self(o.sums(), y, x, opts),\n    Tensor := (self,o,y,x,opts) >> self(o.sums(), y, x, opts),\n    IDirSum := (self,o,y,x,opts) >> self(o.sums(), y, x, opts),\n\n    Gath := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix;\n\ti := Ind(); func := o.func.lambda();\n\n\tif IsBound(o.func.rlambda) then\n\t    rfunc := o.func.rlambda();\n\t    ix := var.fresh_t(\"ix\", TInt);\n\t    return decl(ix, chain(\n\t\tassign(ix, func.at(0)),\n\t\tassign(nth(y, 0), nth(x, ix)),\n\t\tloop(i, o.func.domain()-1, \n\t\t    chain(assign(ix, rfunc.at(ix)), \n\t\t\tassign(nth(y, i+1), nth(x, ix))))));\n\telse \n\t    return loop(i, o.func.domain(), assign(nth(y,i), nth(x, func.at(i))));\n\tfi;\n    end,\n\n    Scat := meth(self, o, y, x, opts)\n        local i, func, rfunc, ix;\n\ti := Ind(); func := o.func.lambda();\n\tif IsBound(o.func.rlambda) then\n\t    rfunc := o.func.rlambda();\n\t    ix := var.fresh_t(\"ix\", TInt);\n\t    return decl(ix, chain(\n\t\tassign(ix, func.at(0)),\n\t\tassign(nth(y, ix), nth(x, 0)),\n\t\tloop(i, o.func.domain()-1, \n\t\t    chain(assign(ix, rfunc.at(ix)), \n\t\t\tassign(nth(y, ix), nth(x, i+1))))));\n\telse \n\t    return loop(i, o.func.domain(), assign(nth(y,func.at(i)), nth(x, i)));\n\tfi;\n    end,\n\n    SUM := (self, o, y, x, opts) >> chain(List(o.children(), c -> self(c, y, x, opts))),\n\n    ISum := (self, o, y, x, opts) >> let(myloop := When(IsSymbolic(o.domain), loopn, loop),\n    myloop(o.var, o.domain,\n        self(o.child(1), y, x, opts))),\n\n    # NOTE: get rid of _acc\n    SUMAcc := (self, o, y, x, opts) >> let(ii := Ind(),\n       When(not Same(ObjId(o.child(1)), Gath),  # NOTE: come up with a general condition\n       chain(\n           loop(ii, Rows(o), assign(nth(y, ii), V(0))),\n           List(o.children(), c -> _acc(self(c, y, x, opts), y))),\n       chain(\n           self(o.child(1), y, x, opts),\n           List(Drop(o.children(), 1), c -> _acc(self(c, y, x, opts), y))))),\n\n    ISumAcc := (self, o, y, x, opts) >> let(ii := Ind(), chain(\n    loop(ii, Rows(o), assign(nth(y, ii), V(0))),\n    loop(o.var, o.domain, _acc(self(o.child(1), y, x, opts), y)))),\n\n#     Compose := meth(self, o,y,x,opts)\n#         local ch, numch, vecs, allow, i;\n# #   if IsBound(opts._inplace) and opts._inplace then\n# #       return chain(\n# #       List(Reversed(o.children()), c -> self(c, x, x, opts))); fi;\n#         #VIENNA filtering DMPGath, DMPScat out here because they do not generate code\n#     ch := Filtered(o.children(), i-> not i.name in [\"DMPGath\",\"DMPScat\"]);\n#     numch := Length(ch);\n#     vecs := [y];\n#     allow := (x<>y);\n#     for i in [1..numch-1] do\n#             if allow and ObjId(ch[i])=Inplace then vecs[i+1] := vecs[i];\n#         else vecs[i+1] := TempVec(TArray(TempArrayType(y, x), Cols(ch[i])));\n#         fi;\n#     od;\n#     vecs[numch+1] := x;\n#     for i in Reversed([1..numch]) do\n#             if allow and ObjId(ch[i])=Inplace\n#         then vecs[i] := vecs[i+1]; fi;\n#     od;\n\n#         # everything was inplace, make it go from x -> y as expected\n#     if vecs[1] = vecs[numch+1] then vecs[1] := y; fi;\n#     if vecs[1] = vecs[numch+1] then vecs[numch+1] := x; fi;\n\n#     [vecs, ch] := [Reversed(vecs), Reversed(ch)];\n#     return decl( Difference(vecs{[2..Length(vecs)-1]}, [x,y]),\n#         chain( List([1..numch], i -> When(vecs[i+1]=vecs[i],\n#             self(ch[i], vecs[i],   vecs[i], CopyFields(opts, rec(_inplace:=true))),\n#             self(ch[i], vecs[i+1], vecs[i], opts)))));\n#     end,\n\n    Compose := meth(self, o,y,x,opts)\n        local ch, numch, vecs, i, cmd, code;\n        ch    := o.children();\n        numch := Length(ch);\n        vecs  := [y];\n\n        # we like to evaluate right (last) to left (first), where the values\n        # in parens refer to the position of the elements in the array.\n        #\n        # So here, we start at the output (first entry in array) and\n        # walk towards the input, creating temporary arrays as necessary\n        for i in [1..numch-1] do\n            vecs[i+1] := When(ObjId(ch[i]) = Inplace,\n                vecs[i],\n                TempArray(y,x,ch[i])\n            );\n        od;\n\n        # the last entry must be the input.\n        vecs[numch+1] := x;\n\n        # now we walk in the opposite direction, copying through\n        # input as far as we can.\n        for i in Reversed([1..numch]) do\n            if ObjId(ch[i]) = Inplace then\n                vecs[i] := vecs[i+1];\n            fi;\n        od;\n\n        # If all children were evaluated inplace, the output will be in x\n        # Make it go from x -> y as expected\n        if vecs[1] = vecs[numch+1] then vecs[1] := y; fi;\n        if vecs[1] = vecs[numch+1] then vecs[numch+1] := x; fi;\n\n        # order them so that first to be evaluated is first in array.\n        vecs := Reversed(vecs);\n        ch   := Reversed(ch);\n\n        # Wrap code in variable declaration. Each entry in vecs will contain multiple\n        # arrays in the case of multi-input/output (i.e. OL)\n        return decl(\n            Difference(Flat(vecs{[2..Length(vecs)-1]}), Flat([x,y])),\n            chain(\n                List([1..numch], i ->\n                     self(ch[i], vecs[i+1], vecs[i], opts)))\n        );\n    end,\n\n\n    Inplace := (self, o, y, x, opts) >>\n#        self(o.child(1), x, x, CopyFields(opts, rec(_inplace:=true))),\n        self(o.child(1), y, x, opts), # Compose will handle these somehow\n\n    Data := meth(self, o, y, x, opts)\n        local val;\n        o.var.isData := true;\n        val := When(IsFunction(o.value), o.value.tolist(), o.value);\n        val := When(IsValue(val), val, o.var.t.value(val));\n        return data(o.var, val, self(o.child(1), y, x, opts));\n    end,\n\n#     Data := (self, o, y, x, opts) >> decl(o.var, chain(\n# \t    assign(o.var, o.value.tolist()),\n# \t    self(o.child(1), y, x, opts))\n#     ),\n\n    #   NOTE: use pointers to do pingpong?\n    ICompose := (self, o, y, x, opts) >>\n        chain([let(\n            t :=  Dat1d(x.t.t, Rows(o)),\n            newind := Ind(o.domain),\n            decl([t], chain(\n            When(IsOddInt(o.domain),\n            SubstVars(Copy(self(o.child(1), y, x, opts)), tab((o.var.id) := (V(0)))),\n                skip()\n            ),\n            When(IsEvenInt(o.domain),\n                chain(\n                    SubstVars(Copy(self(o.child(1), t, x, opts)), tab((o.var.id) := (V(0)))),\n                    SubstVars(Copy(self(o.child(1), y, t, opts)), tab((o.var.id) := (V(1))))\n                ),\n                skip()\n            ),\n            loop(newind, (o.domain/2),\n                chain([\n                    SubstVars(Copy(self(o.child(1), x, y, opts)), tab((o.var.id) := (2*newind)+2)),\n                    SubstVars(Copy(self(o.child(1), y, x, opts)), tab((o.var.id) := (2*newind)+3))\n                ])\n            )\n            )))])\n));\n", "meta": {"hexsha": "16827b40402e79c31089b8ae5be746319c03e920", "size": 11896, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/stream/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/stream/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/stream/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 36.6030769231, "max_line_length": 105, "alphanum_fraction": 0.5221923336, "num_tokens": 3759, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.46490157137338844, "lm_q2_score": 0.034618835602160426, "lm_q1q2_score": 0.016094351070561386}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(_ExpandInvars, RuleSet);\nRewriteRules(_ExpandInvars, rec(\n    shift_depends_left_in_add := ARule(add, [@(1).cond(e-> ObjId(e)<>depends), @(2,depends)], \n        e->[@(2).val, @(1).val]),\n\n    shift_depends_left_in_mul := ARule(mul, [@(1).cond(e-> ObjId(e)<>depends), @(2,depends)], \n        e->[@(2).val, @(1).val]),\n\n    fuse_depends_in_add := ARule(add, [@(1,depends), @(2,depends)], \n        e->[depends(add(@(1).val.args[1], @(2).val.args[1]), Union(@(1).val.args[2].v, @(2).val.args[2].v))]),\n\n    fuse_depends_in_mul := ARule(mul, [@(1,depends), @(2,depends)], \n        e->[depends(mul(@(1).val.args[1], @(2).val.args[1]), Union(@(1).val.args[2].v, @(2).val.args[2].v))]),\n\n    leq_depends := Rule([leq, @(1, depends), @(2, depends), @(3, depends)],\n        e->depends(leq(@(1).val.args[1], @(2).val.args[1], @(3).val.args[1]), \n                Union(@(1).val.args[2].v, @(2).val.args[2].v, @(3).val.args[2].v))),\n\n    imod_depends := Rule([imod, @(1, depends), @(2, depends)],\n        e-> depends(imod(@(1).val.args[1],@(2).val.args[1]), Union(@(1).val.args[2].v, @(2).val.args[2].v))),\n\n    extract_depends := Rule([@(0, [add,mul]), @(1,depends)],\n        e-> @(1).val),\n\n    div_depends := Rule([div, @(1, depends), @(2, depends)],\n        e-> depends(div(@(1).val.args[1],@(2).val.args[1]), Union(@(1).val.args[2].v, @(2).val.args[2].v))),\n\n    idiv_depends := Rule([idiv, @(1, depends), @(2, depends)],\n        e-> depends(idiv(@(1).val.args[1],@(2).val.args[1]), Union(@(1).val.args[2].v, @(2).val.args[2].v))),\n\n    tcast_depends := Rule([tcast, @(1), @(2, depends)],\n        e -> depends(tcast(@(1).val,@(2).val.args[1]), @(2).val.args[2])),\n\n    add_assoc := RulesStrengthReduce.rules.add_assoc,\n    \n    mul_assoc := RulesExpensiveStrengthReduce.rules.mul_assoc,\n\n    depends_deref := Rule( [deref, @(1,depends)],   #One needs to introduce depends memory to handle loads and stores differently\n        e -> depends_memory(deref(@(1).val.args[1]), @(1).val.args[2])),\n\n    nth_depends := Rule([nth, @(1, depends), @(2, depends)],           \n        e -> depends_memory(nth(@(1).val.args[1],@(2).val.args[1]),  Union(@(1).val.args[2].v, @(2).val.args[2].v))),\n\n    vdup_depends_memory := Rule([vdup, @(1,depends_memory), @(2)],\n        e -> depends_memory(vdup(@(1).val.args[1], @(2).val), @(1).val.args[2])),\n\n    assign_load_depends := Rule([assign, @(1), @(2, depends_memory)], #This is a load, good invariant!\n        e -> assign(@(1).val, depends(@(2).val.args[1], @(2).val.args[2]))),\n\n    mul_depends_accu := ARule(mul, [@(1,depends, e->Length(e.args[2].v)=0), @(2,accu)],\n        e -> [accu(mul(@(1).val, @(2).val.rChildren()[1]), \n            mul(@(1).val, @(2).val.rChildren()[2]), \n            mul(@(1).val, @(2).val.rChildren()[3]))]),\n\n    add_depends_accu := ARule(add, [@(1,depends, e->Length(e.args[2].v)=0), @(2,accu)],\n        e -> [accu(add(@(1).val, @(2).val.rChildren()[1]), \n            @(2).val.rChildren()[2], \n            add(@(1).val, @(2).val.rChildren()[3]))]),\n\n    div_depends_accu := Rule([div, @(1, accu), @(2,depends, e->Length(e.args[2].v)=0)],\n        e -> accu(div(@(1).val.rChildren()[1], @(2).val),\n            div(@(1).val.rChildren()[2], @(2).val),\n            div(@(1).val.rChildren()[3], @(2).val))),\n\n    accu_init := Rule( [accu, @(1,depends), @(2), @(3)], #The initialization step doesn't need to be hoisted \n        e -> accu(@(1).val.args[1], @(2).val, @(3).val)),        #Since it is gonna be out of the loop\n    \n    #These are security checks\n    depends_depends := Rule([depends, depends],\n        e->Error(\"Your code is somehow aliased and SimplifyLoop will probably mess it up. Fix it first then come back!\")),\n\n    assign_load_depends := Rule([assign, depends_memory, @], #This is a store invariant! Too good to be true...\n        e -> Error(\"A store invariant has been found which is unlikely to be correct\")),\n));\n\n\nClass(_ExpandInvarsUnsafeXXX, RuleSet);\nRewriteRules(_ExpandInvarsUnsafeXXX, rec(\n    unsafe_memory_depends := Rule(@(1,depends_memory), e-> depends(@(1).val.args[1], @(1).val.args[2]))\n));\n\n_ExpandInvarsUnsafe := MergedRuleSet(_ExpandInvarsUnsafeXXX, _ExpandInvars);\n\nDeclare(_CreateVirtualVars);\n_CreateVirtualVars := function(dep, str, csetable, opts)\n    local idx, rem, n, a, v, l;\n    if Length(dep.args[2].v)=0 then\n        v := SReduce(dep.args[1], opts);\n        if IsValue(v) or IsVar(v) or ObjId(v)=param then\n            return [v, skip()];\n        else\n            if csetable<>false then\n                l := csetable.cseLookup(v);\n                if (l<>false) then \n                    return [l, skip()]; \n                else\n                    n := var.fresh_t(str, dep.t);\n                    csetable.cseAdd(n, v);\n                    return [n, assign(n, v)];\n                fi;\n            else\n                n := var.fresh_t(str, dep.t);\n                return [n, assign(n, v)];\n            fi;\n        fi;\n    else\n        idx := dep.args[2].v[1];\n        rem := Drop(dep.args[2].v, 1);\n        [n, a] := TransposedMat(List([1.. idx.range], \n                i -> _CreateVirtualVars(depends(SubstVars(Copy(dep.args[1]), tab((idx.id) := V(i-1))), rem), str, csetable, opts)));\n        return [virtual_var(n, idx), a];\n    fi;\nend;\n\n_SimplifyLoop := function(c, to_be_unrolled, opts)\n    local free_vars, invars, l, v, assign_accs_init, assign_accs_final, x, accu_init, accu_acc, _DisableAccumulatorBound, \n          loop_var, accu_bound, virtual_free_vars, csetable, selectedaccus, allaccus, allincs, i, j, t;\n\n    if not(ObjId(c) in [loop,loopn]) then\n            Error(\"SimplifyLoop has to be called on a loop!\");\n    fi;\n\n    #Make sure the loop is not simplified again later!\n    #Note that this is *critical* : we do not do any dependence analysis and thus\n    #it is assumed that all free variables are loop independent which is not the case\n    #anymore after the loop has been processed\n    c.simplified := true;\n\n    #If the loop is not gonna be unrolled, we will convert it to an accumulator loop\n    #That is, we will use a while() loop instead of a for loop and this will allow us\n    # to manipulate the loop index aka do a loop with multiple indices that start at different\n    #values and increments differently\n    if not(to_be_unrolled) then\n        c := When(ObjId(c)=loopn,\n            SubstBottomUp(c, c.var, x->accu(V(0), V(1), V(c.range))),\n            SubstBottomUp(c, c.var, x->accu(V(0), V(1), V(Last(c.range)+1))));\n    fi;\n\n    #All free variables, params and values are assumed to be pure loop invariants (depends on nothing)\n    free_vars := Set(c.free());\n    c := SubstBottomUp(c, @(1, [param, Value], e -> not (ObjId(e.t) = TSym)), x->depends(x, Set([])));\n    c := SubstBottomUp(c, @(1,var, e-> e in free_vars ), x->depends(x, Set([])));\n\n    #Propagation of these pure loop invariants allow us to propagate inside the loop accumulators and\n    #Define them properly.\n    #NOTE: we could have add accumulators that actually depend on internal unrolled loops (as explained later) but then\n    #it would actually require as many accumulators as the internal loop range which would waste registers. Note that\n    #it's just a feeling, it wasn't tested.\n\n\n    #This is a bad HACK\n    #depends_memory exists because of the DGEMM assign_accs, but it\n    #also breaks the DFTs. So when there's no assign acc, we turn them off.\n    c := When(Length(Collect(c, assign_acc))>0, _ExpandInvars(c), _ExpandInvarsUnsafe(c));\n\n    #Loop indices that will be unrolled later are somehow loop invariant of the external loop without\n    #being loop invariants of the internal loop. As we want to hoist these variables anyhow, we introduce them as depends(exp, [idx])\n    virtual_free_vars := When(to_be_unrolled,\n        Set(List(Collect(c.cmd, loop), l -> l.var)),\n        Set(List(Collect(c.cmd, @@(0, loop,(e, cx) -> (IsBound(cx.unroll_cmd)) and (Length(cx.unroll_cmd)>0))), l -> l.var)));\n    c := SubstBottomUp(c, @(1,var, e-> e in virtual_free_vars ), x->depends(x, Set([x])));\n\n    #Propagation now extends dependent variables. Note that dependent variables do not mix with accu so this prevents \n    #dependent accumulators\n    #Again, the hack.\n    c := When(Length(Collect(c, assign_acc))>0, _ExpandInvars(c), _ExpandInvarsUnsafe(c));\n\n    #Kick out trivial invariants. e.g.: constant are always invariants, useless ones!\n    c := SubstBottomUp(c, [depends, @(1, [var, Value, param, tcast]), @], x->@(1).val);\n\n    #This rule speeds up processing. It is not necessary but it works well... usually\n    #Invariants that do not comprise params are probably constants so forget them!\n    c := SubstBottomUp(c, @(0, depends, e-> Length(Collect(e, param))=0), x->@(0).val.args[1]);\n\n    #As scalar increments are essentially free, we merge accumulators that have the same \n    #increment if the difference of their initial values is a scalar\n    allaccus := Set(Collect(c, accu));\n    allincs := Set(List(allaccus, x->x.args[2]));\n    for i in allincs do\n        selectedaccus := Filtered(allaccus, x-> x.args[2] = i);\n        for j in DropLast(selectedaccus,1) do\n            t := j.args[1]-Last(selectedaccus).args[1];\n            if ObjId(t)=Value then\n                j.substitute := add(Last(selectedaccus), t);\n            fi;\n        od;\n    od;\n    c := SubstBottomUp(c, @(1, accu, e ->IsBound(e.substitute)), e->e.substitute);\n\n    #If we are to transform in a while loop, we only really need one loop counter\n    #Therefore, we kick out all loop counters but one\n    if not(to_be_unrolled) then\n        x := true;\n        _DisableAccumulatorBound := function(e)\n            if x then\n                x:=false;\n                e.isLoopBound := true;\n                return e;\n            else\n                return accu(e.rChildren()[1], e.rChildren()[2], V(0));\n            fi;\n        end;\n        SubstBottomUp(c.cmd, accu, e -> _DisableAccumulatorBound(e));\n    fi;\n\n    #Create new variables for all invariants\n    csetable := CSE.init();\n    l := Set(Collect(c, depends));\n    [v, invars] := let(a := List(l, x->_CreateVirtualVars(x, \"ivr\", csetable, opts)), \n        When(Length(a)>0, TransposedMat(a), [[],[]]));\n    c := SubstBottomUp(c, @(1, depends), e->v[Position(l,e)]);\n    \n    #Same for all assign_accs!\n    l := Set(List(Collect(c, [assign_acc, depends_memory, @]), x->x.loc));\n    [v, assign_accs_init] := let(a := List(l, x->_CreateVirtualVars(x, \"acc\", false, opts)), \n        When(Length(a)>0, TransposedMat(a), [[],[]]));\n    assign_accs_final := SubstTopDownNR(Copy(assign_accs_init), assign, x->assign(x.exp, x.loc));\n    c := SubstBottomUp(c, @(1, depends_memory), e->v[Position(l,e)]);\n\n    #If the loop is to be unrolled then we're done\n    if to_be_unrolled then\n        return chain(invars, assign_accs_init, c, assign_accs_final);\n    else #if not, then we need to finish the transformation in a while loop\n\n        #drop the loop itself, we will replace it by a doloop later\n        c := c.cmd;\n\n        #Replace all accus by new vars\n        #retrieve the loop bound and set all bounds to V(0) so they can merge in the Set()\n        accu_bound := Copy(Collect(c, @(1, accu, x->IsBound(x.isLoopBound)))[1]);\n        [loop_var, accu_bound] := [accu(accu_bound.rChildren()[1], accu_bound.rChildren()[2], V(0)), \n            accu_bound.rChildren()[3]];\n        c := SubstBottomUp(c, [accu, @(1), @(2), @(3)], x->accu(@(1).val, @(2).val, V(0)));\n        l := Set(Collect(c, accu));\n        v := List(l, x->var.fresh_t(\"accu\", x.t));\n        accu_init := List([1..Length(l)], i->assign(v[i], l[i].rChildren()[1]));\n        #Copy here prevents aliasing with previous\n        accu_acc := List([1..Length(l)], i->assign_acc(Copy(v[i]), l[i].rChildren()[2]));  \n\n        loop_var := let(p:=FirstPosition(l, x->(x=loop_var)), v[p]);\n        c := SubstBottomUp(c, @(1, accu), e->v[Position(l,e)]);\n\n        #if we cross the unroll_cmd boundary, we need to flag the new variables as alive\n        #so copypropagation doesn't mess with it later\n        for x in Collect([assign_accs_init, invars, accu_init], assign) do x.loc.live_out := true ; od;\n\n        c := chain(unroll_cmd(chain(invars, assign_accs_init, accu_init)), \n             doloop(loop_var, accu_bound, chain(c, accu_acc)), unroll_cmd(chain(assign_accs_final)));\n        return c;\n    fi;\nend;\n\n\nSimplifyLoops := function(c, opts)\n    c := FlattenCode0(c); #Flatten chains, keep unroll_cmds\n    c := SReduce(c, opts); #Simplify index expressions\n\n    c := SubstTopDown(c, @.cond( #Remove all aliases!\n            e->IsRec(e) and IsBound(e.rChildren) and IsBound(e.from_rChildren)), \n        e -> e.from_rChildren(List(e.rChildren(), Copy)));\n\n    c := SubstTopDown(c, @(1, [loop,loopn], e->not(IsBound(e.simplified))), \n        (e, cx) -> _SimplifyLoop(e, (IsBound(cx.unroll_cmd)) and (Length(cx.unroll_cmd)>0), opts));\n    return c;\nend;\n\n", "meta": {"hexsha": "7bccb187b7851617a2b760384caba4d4e4cf7f62", "size": 12954, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/simpleloop.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/simpleloop.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/simpleloop.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 47.625, "max_line_length": 133, "alphanum_fraction": 0.5985023931, "num_tokens": 3838, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.42632159254749036, "lm_q2_score": 0.03732688372982708, "lm_q1q2_score": 0.01591325651653489}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(requiredFreeVars);\nDeclare(buildMap);\nDeclare(collectLoopVars);\nDeclare(buildGlobalList);\nDeclare(compareMatrices);\nDeclare(doAllPromotes);\nDeclare(permToData);\nDeclare(PadLeft);\nDeclare(PadRight);\nDeclare(isContainedInComposeDistsG);\nDeclare(isContainedInComposeDistsS);\n\n################################## CANDIDATES FOR REMOVAL -- BEGIN #########################3\nClass(ProducOutputSDGR, RuleSet);\nRewriteRules(ProducOutputSDGR, rec(\n\n));\n\nClass(RulesNoPull_Dist, RuleSet);\nRewriteRules(RulesNoPull_Dist, rec(\n\n    vtensor_nopulldist := Rule([@(1, VTensor), @(2, NoPull_Dist)],\n        e->NoPull_Dist(VTensor(@(2).val.children(), @(1).val.vlen))\n    )\n));\n\n#F Removes NoPull_Dist\nClass(RemoveNoPull_Dist, RuleSet);\nRewriteRules(RemoveNoPull_Dist, rec(\n    remove_sizedkernel := Rule(@(1, NoPull_Dist), e->@(1).val.child(1))\n));\n################################## CANDIDATES FOR REMOVAL -- END #########################3\n\n\n\n#F To convert DistSum(A)*DistSum(B)*... -> DistContainer(Seq(A,B,..))\nClass(RulesComposeDists, RuleSet);\nRewriteRules(RulesComposeDists, rec(\n    dist_to_seq := Rule(@(1, Compose, e->ForAll(e.children(), c->(ObjId(c)=DistSum or ObjId(c)=Comm_Cell))),\n        e -> ComposeDists(@(1).val.children()) )\n));\n\n#F DistSum|*|DistSum -> DistSum\nClass(RulesDistMerge, RuleSet);\nRewriteRules(RulesDistMerge, rec(\n    #NOTE: If these DistSums have ScatSend or GathRecv, this rule will do the wrong thing! \n    # Assuming this rule will only match DMP type DFT algos.\n    dist_merge := ARule(ComposeDists, [@(1,DistSum), @(2,DistSum)],\n      e -> let(a := @(1).val, b := @(2).val,\n          [ DistSum(a.P, a.var, a.domain, a.child(1) * b.child(1)) ])\n      ),\n\n    # Above rule produces DistSum(S * child1 * G * S * child2 * G).\n    # This rule gets rid of the G * S *\n\n    gathdist_scat_dist := ARule(Compose, [GathDist, ScatDist],\n      e -> [])\n));\n\n#F Removes Buf() so other rules can work!\nClass(RemoveBuf, RuleSet);\nRewriteRules(RemoveBuf, rec(\n    remove_buf := Rule(@(1, Buf), e->@(1).val.child(1))\n));\n\n\n\n#F Convert initial and final GathRecv/ScatSend to Dist (null)\nClass(CellDFTBlockCyclicLayoutHack, RuleSet);\nRewriteRules(CellDFTBlockCyclicLayoutHack, rec(\n\n    GathRecvDataLayout := Rule([@(1, GathRecv), @(2, [H, fTensor, fCompose, fId]), ...], \n        e->GathDist(@1.val.func.range(), @1.val.pkSize, @1.val.P, @1.val.i)),\n\n    ScatSendDataLayout := Rule([@(1, ScatSend), @(2, [H, fTensor, fCompose, fId]), ...], \n        e->ScatDist(@1.val.func.range(), @1.val.pkSize, @1.val.P, @1.val.i))\n\n));\n\n#F Blockcyclic layout hack\nCellDFTBlockCyclicLayoutHackWrap := function(sums, opts)\n    if not (IsBound(opts.doNotUseBlockCyclic) and opts.doNotUseBlockCyclic = true) then\n      return(CellDFTBlockCyclicLayoutHack(sums));\n    else\n      return(sums);\n    fi;\nend;\n\n\n# Terminate VRCs (VRC(Scat/Gath) -> Scat/Gath(pkSize*2..)\n# (Removed VRCL, VRCR from this mix Tue 09 Sep 2008 09:55:36 PM EDT)\nClass(CellVRCTerm, RuleSet);\nRewriteRules(CellVRCTerm, rec(\n    VRC_ScatDist_Term := Rule([@(1, [RC, VRC,VRCLR]), @(2, [ScatDist])], \n    e->ScatDist(@(2).val.N, @(2).val.pkSize*2, @(2).val.P, @(2).val.i)),\n\n    VRC_GathDist_Term := Rule([@(1, [RC, VRC,VRCLR]), @(2, [GathDist])], \n    e->GathDist(@(2).val.N, @(2).val.pkSize*2, @(2).val.P, @(2).val.i)),\n\n    VRC_ScatSend_Term := Rule([@(1, [RC, VRC,VRCLR]), @(2, [ScatSend])], \n    e->ScatSend(@(2).val.func, @(2).val.pkSize*2, @(2).val.P, @(2).val.i)),\n\n    VRC_GathRecv_Term := Rule([@(1, [RC, VRC,VRCLR]), @(2, [GathRecv])], \n    e->GathRecv(@(2).val.func, @(2).val.pkSize*2, @(2).val.P, @(2).val.i)),\n\n    VRC_Comm_Cell := Rule([@(1,[RC, VRC,VRCLR]), @(2,Comm_Cell)],\n    e->Comm_Cell(@(2).val.P, @(2).val.pkSize*2))\n\n));\n\n# VRC(DistSum.. -> DistSum(VRC...\nRewriteRules(RulesVRC, rec(\n    VRC_DistSum := Rule([@(1, [VRC,VRCL,VRCR,VRCLR]), @(2, [DistSum, DistSumLoop])],\n       e->let(s := @(2).val,\n       CopyFields(s, rec(_children := List(s.children(), c->ObjId(@(1).val)(c, @(1).val.v)),\n                  dimensions := @(1).val.dimensions))\n       ))\n));\n\nRewriteRules(RulesRC, rec(\n    RC_DistSum := Rule([RC, @(1, DistSum)],\n        e -> let(s:=@(1).val, DistSum(s.P, s.var, s.domain, RC(s.child(1))))),\n));\n\n# Pull Diag into DistSum (but not into Gath/Scat)\nRewriteRules(RulesDiag, rec(\n    CellPullInDiagRight := ARule(Compose,  [ @(1, [RCDiag, Diag, Prm, Scat]), @(2, DistSum) ],\n     e -> let(s:=@(2).val, [ DistSum(s.P, s.var, s.domain, @(1).val * s.child(1)) ])),\n\n    CellPullInDiagLeft := ARule(Compose, [ @(1, DistSum), @(2, [Prm, Gath, Diag, RCDiag]) ],\n     e -> let(s:=@(1).val, [ DistSum(s.P, s.var, s.domain, s.child(1) * @(2).val) ])),\n\n));\n\n# Pull Diag into SAG (D*SAG -> SDAG and SAG*D -> SADG)\nRewriteRules(RulesDiagStandalone, rec(\n # Gath * Diag\n CellCommuteGathDiag := ARule( Compose,\n       [ @(1, [ GathDist, GathRecv ]), @(2, Diag) ], # o 1-> 2->\n  e -> [ Diag(fCompose(@2.val.element, fTensor(@1.val.func, fId(@1.val.pkSize)))).attrs(@(2).val), @1.val ]),\n\n # Diag * Scat\n CellCommuteDiagScat := ARule( Compose,\n       [ @(1, Diag), @(2, [ScatDist, ScatSend]) ], # <-1 <-2 o\n  e -> [ @2.val, Diag(fCompose(@1.val.element, fTensor(@2.val.func, fId(@2.val.pkSize))  )).attrs(@(1).val) ]),\n\n # Gath * RCDiag\n CellCommuteGathRCDiag := ARule( Compose,\n       [ [@(1, [ GathDist, GathRecv ]), [@(0,fTensor), ..., [fId,@(2).cond(IsEvenInt)]]],\n      @(4, RCDiag) ],\n  e -> [ RCDiag(fCompose(@(4).val.element, @(0).val), @(4).val.post),\n         @(1).val ]),\n\n # RCDiag * Scat\n CellCommuteRCDiagScat := ARule( Compose,\n       [ @(4, RCDiag),\n     [@(1, [Scat, ScatDist, ScatSend]), [@(0,fTensor), ..., [fId,@(2).cond(IsEvenInt)]]] ],\n  e -> [ @(1).val,\n         RCDiag(fCompose(@(4).val.element, @(0).val), @(4).val.post) ]),\n\n));\n\n\n# Cell DMP: Fuse and remove PTensors that are next to Sigmas\nClass(PTensorRules, RuleSet);\nRewriteRules(PTensorRules, rec(\nPTensorFuseRight := ARule(Compose, [ @(1,DistSum), @(2,PTensor) ], \n    e -> [ DistSum( @(1).val.P, @(1).val.var, @(1).val.domain, Compose( @(1).val.child(1), @(2).val ) ) ] ),\n\nPTensorFuseLeft := ARule(Compose, [  @(2,PTensor), @(1,DistSum) ], \n    e -> [ DistSum( @(1).val.P, @(1).val.var, @(1).val.domain, Compose( @(2).val,  @(1).val.child(1) ) ) ] ),\n\nPTensorFlipRight := ARule(Compose, [ @(1,GathDist), @(2,PTensor) ],\n    e -> [ @(2).val.L, @(1).val ] ),\n\nPTensorFlipLeft := ARule(Compose, [ @(2,PTensor), @(1,ScatDist) ],\n    e -> [ @(1).val, @(2).val.L ] )\n));\n\n#i := Ind(P),\n# Cell DMP: Convert standalone PTensors to Sigmas\nClass(PTensorConvertRules, RuleSet);\nRewriteRules(PTensorConvertRules, rec(\nPTensorConvert := Rule( @(1,PTensor),\n    e -> let(P := @(1).val.P,\n             i := var(\"spuid\", TInt, P),\n             N := @(1).val.dims()[1],\n            DistSum(P, i, P, ScatDist(N, 1, P, i) * @(1).val.L * GathDist(N, 1, P, i))\n          )\n    )\n));\n\n#F Gets all the DistSums under a single Compose so we can deal with them effectively\n#F Mainly there because of VContainer\nClass(DistSumChains, RuleSet);\nRewriteRules(DistSumChains, rec(\n    ChainDistSumsLeft := ARule(Compose,  [ @(1,DistSum), @(2,VContainer, e->ForAny(e.rChildren()[1].rChildren(), i->ObjId(i)=DistSum)) ],\n     e -> let(ds:=@(1).val, vc:=@(2).val, [ VContainer(Compose(ds, vc.rChildren()), vc.isa)  ])),\n\n    ChainDistSumsRight := ARule(Compose,  [ @(2,VContainer,  e->ForAny(e.rChildren()[1].rChildren(), i->ObjId(i)=DistSum)), @(1,DistSum) ],\n     e -> let(ds:=@(1).val, vc:=@(2).val, [ VContainer(Compose(vc.rChildren(), ds), vc.isa)  ]))\n));\n\n#F Fuse output (SDGR*SS...) to just an SS\nClass(FixBorder, RuleSet);\nRewriteRules(FixBorder, rec(\n    FixLeftBorder := Rule( [@(1,ComposeDists), [DistSum, ..., [Compose, ScatDist, GathRecv]], ...],\n     e ->  let(c := @(1).val.rChildren(), ComposeDists(ListWithout(c,1))) )\n));\n\n#F Mark Cell Scat/Gaths as Inplace (ultimately, no-ops)\n#F GDs, SDs, and GRs are no-ops for the Cell (SS becomes explicit DMA - SCATSEND)\napplyCellInplace := function(sums, opts)\n    SubstBottomUp(sums, GathDist, e->Inplace(e));\n    SubstBottomUp(sums, GathRecv, e->Inplace(e));\n    SubstBottomUp(sums, ScatDist, e->Inplace(e));\n\n\n    # BB(Inplace()) -> Inplace() (So that a copy operation need not take place)\n    SubstBottomUp(sums, [BB, Inplace], e->e.rChildren()[1]);\n    return(sums);\nend;\n\n#NOTE: In the following padding functions, we previously produced pads with\n#maximum packet size so that they merged nicely with multibuffered scats and\n#gaths. But now, we don't do any merging between scats and gaths of the\n#distributed and multibuffer paradigms. So it's better to get these padding\n#functions to produce packet sizes that match the adjacent sigmaspl expressions.\n\n#F This produces an SDGR on the left\nPadLeft := function(e)\n    local ss, N, pkSize, P,i, GR, SD;\n    ss      := e.leftMostParScat();\n    N       := ss.func.range();\n    pkSize  := ss.pkSize;\n    P       := ss.P;\n    i       := var(\"spuid\", TInt, P);\n    GR      := GathRecv(fTensor(fBase(P, i), fId(N/P)), pkSize, P, i);\n    SD      := ScatDist(N, pkSize, P, i);\n    #SD     := ScatDist(P, (N*pkSize)/P, P, i); # Produce ScatDist with maximum packet size\n    return(ComposeDists(DistSum(P, i, P, SD*GR),   e.rChildren()));\nend;\n\n#F This produces an SDGR on the left\nPadLeftSep := function(e)\n    local ss, N, pkSize, P,i, GR, SD;\n    ss      := e.leftMostParScat();\n    N       := ss.func.range();\n    pkSize  := ss.pkSize;\n    P       := ss.P;\n    i       := var(\"spuid\", TInt, P);\n    GR      := GathRecv(fTensor(fBase(P, i), fId(N/P)), pkSize, P, i);\n    SD      := ScatDist(N, pkSize, P, i);\n    #SD     := ScatDist(P, (N*pkSize)/P, P, i); # Produce ScatDist with maximum packet size\n    return(ComposeDists(DistSum(P, i, P, SD*GR), e));\nend;\n\n#F This produces a SSGD on the right\nPadRight := function(e)\n   local gr, N, P, i, pkSize, SS, GD, di;\n   gr     := e.rightMostParGath();\n   N      := gr.func.range();\n   pkSize := gr.pkSize;\n   P      := gr.P;\n   i      := var(\"spuid\", TInt, P);\n   SS     := ScatSend(fAdd(N, N/P, i*(N/P)), pkSize, P, i);\n   GD     := GathDist(N, pkSize, P, i);\n   #GD     := GathDist(P, (N*pkSize)/P, P, i); # Produce GathDist with maximum packet size\n   return(ComposeDists(e.rChildren(), DistSum(P, i, P, SS*GD)));\nend;\n\n#F This produces a SSGD on the right\nPadRightSep := function(e)\n   local gr, N, P, i, pkSize, SS, GD, di;\n   gr     := e.rightMostParGath();\n   N      := gr.func.range();\n   pkSize := gr.pkSize;\n   P      := gr.P;\n   i      := var(\"spuid\", TInt, P);\n   SS     := ScatSend(fAdd(N, N/P, i*(N/P)), pkSize, P, i);\n   GD     := GathDist(N, pkSize, P, i);\n   #GD     := GathDist(P, (N*pkSize)/P, P, i); # Produce GathDist with maximum packet size\n   return(ComposeDists(e, DistSum(P, i, P, SS*GD)));\nend;\n\n\n# These are required only for the CellSMP model, but shouldn't affect DMP, since DMP doesn't inject any SSs or GRs.\n#F applyCellRules: \n#F Assumes:\n#F - There are no Buf()s in code\n#F - Composes within a parallel region have already been converted to ComposeDistss\napplyCellRules := function(sums, opts)\n    local sumsorig, ss, sdgr, gr, ssgd, border;\n\n#applyCellRules should not touch anything within a GT_ParStream. However, a\n#sums expression can contain a mixture of ParStream and StreamChip generated\n#expressions. We want to leave the former untouched, but want to act on the\n#latter. We do this by marking things to be left untouched, and unmarking them at the end. This has 2 PRORLBEMS:\n#\n# 1) We shouldn't run ComposeDists before applyCellRules, though we also need to. Fix this.\n# 2) If there's a GT_StreamPar rule, this whole thing falls apart.\n#\n# Essentially, we need a way of figuring out which were generated by StreamCore vs. StreamChip.\n# Another approach: we could fuse the par and mbuf loops together via StreamCore's breakdown rule.\n# In general, we could take care of StreamCore structures before we execute\n# applyCellRules -- we could run DistMBuf in sigmaspl earlier, for instance.\n\n\n\n\n    # Promote {Scat,Gath}Dist to ScatSend/GathRecv as needed\n    SubstTopDown(sums, [ComposeDists, DistSum, DistSum], doAllPromotes);\n\n    # Right-Pad DistSums that are standing by themselves (NOTE: cleanup this and the functions it calls)\n    # Left-padding will be taken care of by statement below\n    # NOTE: assumption here is, this is only for DFTxI.\n    if IsBound(opts.doNotUseBlockCyclic) and opts.doNotUseBlockCyclic = true then\n      SubstBottomUp(sums, @(1, DistSum, e->ObjId(e.rightMostParGath())=GathRecv), isContainedInComposeDistsG);\n      SubstBottomUp(sums, @(1, DistSum, e->ObjId(e.leftMostParScat())=ScatSend),  isContainedInComposeDistsS);\n    fi;\n\n    # I/O padding: Don't do any input/output padding if these might get cancelled as a part of the data format change\n    if IsBound(opts.doNotUseBlockCyclic) and opts.doNotUseBlockCyclic = true then\n        SubstTopDown(sums, @(1, ComposeDists, e->ObjId(e.leftMostParScat())=ScatSend),  e->PadLeft(e));\n        SubstTopDown(sums, @(1, ComposeDists, e->ObjId(e.rightMostParGath())=GathRecv),  e->PadRight(e));\n    fi;\n\n    #Error(\"BP\");\n\n    # NOTE: We shouldn't be doing this if we have a compose of multiple ParStream structures, for instance\n    # Create table to map ScatSend/GathRecv pairs, so DMA can be done\n\n    # NOTE: Why is this an else if structure? For StreamParChip, where we have\n    # multiple stream stages each of which contain parallelism, all these\n    # patterns could exist within the same sums expression.\n\n    SubstTopDown(sums, [ComposeDists, DistSum, DistSum], permToData);\n    SubstTopDown(sums, [ComposeDists, DistSum, DistSum, DistSum], permToData);\n    SubstTopDown(sums, [ComposeDists, DistSum, DistSum, DistSum, DistSum], permToData);\n\n\n    #if Length(Collect(sums, [ComposeDists, DistSum, DistSum])) = 1 then\n    #     SubstTopDown(sums, [ComposeDists, DistSum, DistSum], permToData);\n    #     else if Length(Collect(sums, [ComposeDists, DistSum, DistSum, DistSum])) = 1 then\n    #               SubstTopDown(sums, [ComposeDists, DistSum, DistSum, DistSum], permToData);\n    #     else if Length(Collect(sums, [ComposeDists, DistSum, DistSum, DistSum, DistSum])) = 1 then\n    #               SubstTopDown(sums, [ComposeDists, DistSum, DistSum, DistSum, DistSum], permToData);\n    #          fi;\n    #          fi;\n    #fi;\n\n    # Fuse output (SDGR*SS...) to just an SS\n    FixBorder(sums);\n\n    return(sums);\nend;\n\n\ndoAllPromotes := function(e, cx)\n   local gathrecv, gathdist, scatsend, scatdist, i;\n\n   # Assume: only one ScatSend and one GathRecv per DistSum.\n   i := 1;\n\n   # Check for GR/SD pair\n   gathrecv := Collect(e._children[i],   GathRecv);\n   scatdist := Collect(e._children[i+1], ScatDist);\n\n   #Error(\"BP-doAllPromotes\");\n\n   if (Length(gathrecv) = 1 and Length(scatdist) = 1) then\n     SubstTopDown(e, ScatDist, \n        gs-> let(pkf := gs.pkSize / gathrecv[1].pkSize,\n            ScatSend(fAdd(gs.N*pkf, gs.N*pkf/gs.P, gs.i*(gs.N*pkf/gs.P)), gs.pkSize/pkf, gs.P, gs.i))\n     );\n     return(e);\n   fi;\n\n   # Check for GD/SS pair\n   gathdist := Collect(e._children[i],   GathDist);\n   scatsend := Collect(e._children[i+1], ScatSend);\n\n   if (Length(gathdist) = 1 and Length(scatsend) = 1) then\n     SubstTopDown(e, GathDist,\n        gs-> let(pkf := gs.pkSize / scatsend[1].pkSize,\n            GathRecv(fAdd(gs.N, gs.N/gs.P, gs.i*(gs.N*pkf/gs.P)), gs.pkSize, gs.P, gs.i))\n            );\n     return(e);\n   fi;\n\n   return(e);\n\nend;\n\n\n\n#F permToData(e, cx) (e=expression, cx=context)\n#F converts an expressions's function to an FList/FData\npermToData := function(e, cx)\n#permToData := function(d1, d2, cx)\n   local gathrecv, scatsend, readMap, writeMap, loopnest, i;\n\n\n   #gathrecv := e.rChildren()[1].rChildren()[2].rChildren()[Length(e.rChildren()[1].rChildren()[2].rChildren())];\n   #scatsend := e.rChildren()[2].rChildren()[2].rChildren()[1];\n\n\n   # Assume: only one ScatSend and one GathRecv per DistSum (no nested parallelism)\n   for i in [1..(Length(Collect(e, DistSum))-1)] do\n      gathrecv := Collect(e._children[i], GathRecv)[1];\n      scatsend := Collect(e._children[i+1], ScatSend)[1];\n\n      #PrintLine(\"permToData working on: \", gathrecv, \" / \", scatsend);\n\n      if gathrecv.func.__name__ = \"FData\" or scatsend.func.__name__ = \"FData\" then\n         if gathrecv.func.__name__ = \"FData\" and scatsend.func.__name__ = \"FData\" then\n            Error(\"Both are already FData. Why?\\n\");\n         else\n            Error(\"One of these funcs is an FData, the other is not.\\n\");\n            #NOTE: Handle things correctly if both are already FDatas/FDataLists\n         fi;\n      fi;\n\n      #loopnest := Concat(collectLoopVars(e, cx), [e.rChildren()[i].var, e.rChildren()[i+1].var]);\n      loopnest := Concat(collectLoopVars(e, cx), [e._children[i].var, e._children[i+1].var]);\n\n      [readMap, writeMap] := buildGlobalList(gathrecv, scatsend, loopnest);\n\n      #NOTE: Use rSetChild or use .func directly here?\n      SubstTopDown(e._children[i], GathRecv, e->GathRecv(FData([0..Length(readMap)-1]), e.pkSize, e.P, e.i));\n      SubstTopDown(e._children[i+1], ScatSend, e->ScatSend(FData(readMap), e.pkSize, e.P, e.i));\n\n      # Since we're doing a Gather-side normalize for the cell (the scatter\n      # knows where to put an element, the gather is dumb), we write the\n      # normalized FData instead of the actual readMap here.\n\n   od;\n\n   #PrintLine(gathrecv, \"\\n\", scatsend, \"\\n\", readMap, writeMap, \"\\n--\\n\", scatsend, \"\\n------------------\\n\\n\");\n   return e;\nend;\n\n\n#F Goes through all parents of e as given in cx.parents, and creates a list of\n#F all parent loop variables in loop nest order.\ncollectLoopVars := function(e, cx)\n   local parent, retList;\n   retList := [];\n\n   for parent in cx.parents do\n      if (IsBound(parent.isSums) and parent.isSums = true) then\n         if IsBound(parent.var) then\n            retList := Concat(retList, [parent.var]);\n         fi;\n      fi;\n   od;\n\n   return retList;\nend;\n\n#F buildGlobalList(gathrecv, scatsend, loopnest)\n#F Returns the read and write maps (as lists) for a given gath/scat pair\n#F loopnest is a list of loop vars ordered by the gath/scat nesting\nbuildGlobalList := function(gathrecv, scatsend, loopnest)\n   local i, j, gathMap, scatMap, t, readMap, writeMap;\n\n   #NOTE: Need to add some error checking.\n\n   gathMap := buildMap(gathrecv, loopnest);\n   scatMap := buildMap(scatsend, loopnest);\n\n   if Length(gathMap) <> Length(scatMap) then\n      Error(\"buildGlobalList: packet sizes for scatter and gather don't match.\");\n   fi;\n\n   t       := List([1..Length(gathMap)], i->0);\n   readMap := List([1..Length(gathMap)], i->0);\n   writeMap:= List([1..Length(gathMap)], i->0);\n\n\n   for i in [1..Length(gathMap)] do\n      t[gathMap[i]] := i;\n   od;\n\n   for i in [1..Length(gathMap)] do\n      readMap[i] := t[scatMap[i]];\n   od;\n\n   for i in [1..Length(gathMap)] do\n      for j in [1..Length(gathMap)] do\n         if readMap[j] = i then\n            writeMap[i] := j;\n         fi;\n      od;\n   od;\n\n   #NOTE: assuming that element values will range from 0..(n-1).\n   readMap := List([1..Length(readMap)], i->readMap[i]-1);\n   writeMap := List([1..Length(writeMap)], i->writeMap[i]-1);\n\n\n   return [readMap, writeMap];\nend;\n\n#F buildMap(gathscat, loopnest)\n#F Fully unrolls a gath/scat's function to a list based on the loop nest ordering given by loopnest\n#F If loopnest has vars that the gathscat doesn't depend on, they will be ignored\nbuildMap := function(gathscat, loopnest)\n   local map, reqFreeVars, loopVar;\n\n   reqFreeVars := requiredFreeVars(loopnest, Flat(gathscat.free()));\n   map := gathscat.func.lambda().tolist();\n   for loopVar in reqFreeVars do\n       map := Flat( List([0..(loopVar.range)-1], i->SubstVars(Copy(map), rec((loopVar.id) := V(i)))) );\n   od;\n   map := List([1..Length(map)], i->(map[i].ev())+1);\n\n   return map;\nend;\n\n#F requiredFreeVars(loopnest, freevars)\n#F \nrequiredFreeVars := function(loopnest, freevars)\n   local returnList, i;\n   returnList := [];\n   for i in loopnest do\n      if i in freevars then\n         if not i in returnList then\n            returnList := Concat(returnList, [i]);\n         fi;\n      fi;\n   od;\n   return returnList;\nend;\n\n\nisContainedInComposeDistsG := function(e,cx)\n  local parent, foundComposeDist;\n  foundComposeDist := false;\n  for parent in cx.parents do\n     if ObjId(parent)=ComposeDists then foundComposeDist := true; fi;\n  od;\n\n  if foundComposeDist=true then\n     return(e);\n  else\n     return(PadRightSep(e));\n  fi;\nend;\n\nisContainedInComposeDistsS := function(e,cx)\n  local parent, foundComposeDist;\n  foundComposeDist := false;\n  for parent in cx.parents do\n     if ObjId(parent)=ComposeDists then foundComposeDist := true; fi;\n  od;\n\n  if foundComposeDist=true then\n     return(e);\n  else\n     return(PadLeftSep(e));\n  fi;\nend;\n\n\n", "meta": {"hexsha": "e14dc6780c5e59c3ccdb39dc1bbf2a385f02828e", "size": 20793, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/distributed/rewrite.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/distributed/rewrite.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/distributed/rewrite.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 36.415061296, "max_line_length": 139, "alphanum_fraction": 0.6325205598, "num_tokens": 6717, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4455295350395727, "lm_q2_score": 0.035678548826997496, "lm_q1q2_score": 0.015895847269778888}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_avxT := (t, opts) -> IsVecT(t) and IsBound(opts.vector) and let( isa := opts.vector.isa,\n    Cond( t.t = TReal and t.size = 4, isa=AVX_4x64f,\n          t.t = TReal and t.size = 8, isa=AVX_8x32f,\n          t.t = TInt  and t.size = 4, isa=AVX_4x64f,\n          t.t = TInt  and t.size = 8, isa=AVX_8x32f,\n          t.t in [T_Real(64), T_Int(64), T_UInt(64)] and t.size=4, true,\n          t.t in [T_Real(32), T_Int(32), T_UInt(32)] and t.size=8, true,\n          false));\n", "meta": {"hexsha": "e6b7ece3ec80cd6f22fccfe889affb4f9ddc87af", "size": 550, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/avx/misc.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/avx/misc.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/avx/misc.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 39.2857142857, "max_line_length": 89, "alphanum_fraction": 0.5818181818, "num_tokens": 209, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.37022539259558657, "lm_q2_score": 0.0427221935853065, "lm_q1q2_score": 0.01581684089266475}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\n_dim3 := d -> \"dim3(\"::d.id::\")\";\n\nClass(HIPUnparser, CudaUnparser, rec(\n    cu_call := (self, o, i, is) >>\n        Print(Blanks(i), \"hipLaunchKernelGGL(\",  \n                self.infix([o.func, _dim3(o.dim_grid), _dim3(o.dim_block), \"0\", \"0\"]::o.args, \", \"), \");\\n\"),\n));\n\n\nClass(FFTXHIPOpts, FFTXOpts, rec(\n    tags := [],\n    operations := rec(Print := s -> Print(\"<FFTX HIP options record>\")),    \n    max_threads := 1024\n));\n\n\ndoHIPify := function(opts)\n    opts.originalCudaOptsID := Copy(opts.operations.Print);\n    opts.operations := rec(Print := s -> Print(\"<FFTX HIPified CUDA options record>\"));\n    opts.unparser := HIPUnparser;\n    opts.includes := [\"\\\"hip/hip_runtime.h\\\"\"];\n#    opts.postProcessCode := (c, opts) -> FixUpHIP_Code(PingPong_3Stages(c, opts), opts);\n    opts.postProcessCode := (c, opts) -> FixUpHIP_Code(c, opts);\n\n    return opts;\nend;\n\nClass(FFTXHIPDefaultConf, rec(\n    __call__ := self >> self,\n    getOpts := (self, t) >> doHIPify(ParseOptsCUDA(FFTXCUDADeviceDefaultConf, t)),\n    operations := rec(Print := s -> Print(\"<FFTX FFTX HIPified CUDA Configuration>\")),\n    useHIP := true\n));\n\nhipConf := rec(\n    defaultName := \"defaultHIPConf\",\n    defaultOpts := (arg) >> FFTXHIPDefaultConf,\n    confHandler := doHIPify \n);\n\nfftx.FFTXGlobals.registerConf(hipConf);\n\n", "meta": {"hexsha": "e647c40a6f8dd0b8dbedcd8aee5fa4fdd5242d32", "size": 1383, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/hip/opts.gi", "max_stars_repo_name": "mikefranusich/spiral-package-fftx", "max_stars_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "platforms/hip/opts.gi", "max_issues_repo_name": "mikefranusich/spiral-package-fftx", "max_issues_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "platforms/hip/opts.gi", "max_forks_repo_name": "mikefranusich/spiral-package-fftx", "max_forks_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.4255319149, "max_line_length": 109, "alphanum_fraction": 0.6283441793, "num_tokens": 409, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.35220178204788966, "lm_q2_score": 0.044680870908698676, "lm_q1q2_score": 0.015736682357495386}}
{"text": "IsBound(a);\n# true\n\nUnbind(a);\n\nIsBound(a);\n# false\n", "meta": {"hexsha": "f5dccefcc5fc983257376ff573673be5f510055c", "size": 52, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Undefined-values/GAP/undefined-values.gap", "max_stars_repo_name": "mullikine/RosettaCodeData", "max_stars_repo_head_hexsha": "4f0027c6ce83daa36118ee8b67915a13cd23ab67", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Undefined-values/GAP/undefined-values.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Undefined-values/GAP/undefined-values.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 6.5, "max_line_length": 11, "alphanum_fraction": 0.6153846154, "num_tokens": 18, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.30735801686526387, "lm_q2_score": 0.051082733526088074, "lm_q1q2_score": 0.015700687672635157}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImport(paradigms.vector.breakdown, paradigms.vector.rewrite, paradigms.vector.sigmaspl);\n\nSwitchRulesName([IxLxI_kmn_n, IxLxI_kmn_km, IxLxI_IxLxI_up, IxLxI_IxLxI_down], false);\nSwitchRulesName([L_base, L_nv_n_vec, L_nv_v_vec, L_mn_m_vec, IxLxI_vtensor], true);\n\n# FF: if this is turned off, DP tries to measure TL and complex code using CR(.) dies. Why did I need it??\n#TL.doNotMeasure := false;\n\nFixDataType := function(c, opts)\n    local vars, v, srec;\n\n    # Vectors of vectors must be flattened\n#    c := SubstTopDown(c, @(1, TVect, e->ObjId(e.t)=TVect), e-> TVect(@(1).val.t.t, @(1).val.size*@(1).val.t.size));\n\n    if IsBound(opts.vector.isa.needScalarVarFix) and opts.vector.isa.needScalarVarFix then\n        vars := Collect(c, @(1, var, e->e.t=TVect(TReal, 2)));\n        srec := rec();\n\n        for v in vars do\n            srec.(v.id) := opts.vector.isa.scalarVar();\n        od;\n        SubstVars(c, srec);\n#        c := DeclareVars(c);\n    fi;\n    return c;\nend;\n\n\n# Populate this with default parameter values\nVectorDefaults := rec(\n    expandConstants := false,\n    dontRuntimeLocalize := false,\n);\n\nDEFAULT_UNROLL := 55;   # largest prime: 13, 4-way -> need 40 and 52 be unrolled\nUNROLL_LO := 16;\nUNROLL_HI := 64;\nVERBOSITY := 0;\nFAILTOL := false;\nHASH := false;\n\n_help := function()\n    PrintLine(\"\\nopts := SIMDGlobals.getOpts(<arch>, flags);\" );\n    PrintLine(\"dpopts := SIMDGlobals.getDPOpts(<arch>, opts); # for correct DP options\");\n    PrintLine(\"\\nsupported flags:\");\n    PrintLine(\"scalar DFT configuartion: CT, PFA, PFA_maxSize, PD, Rader, RealRader, Rader_maxSize, Bluestein, Bluestein_maxSize, minCost, splitRadix, PRDFT, URDFT\");\n    PrintLine(\"DFT format: interleavedComplex\");\n    PrintLine(\"tspl DFT configuartion: tsplCT, tsplPFA, tsplRader, tsplBluestein, bluesteinMinPrime, bluesteinExtraSizes, raderAvoidSizes\");\n    PrintLine(\"vectorization: svct, splitL, oddSizes, realVect, cplxVect, useConj, stdTTensor, flipIxA, pushTag\");\n    PrintLine(\"options: globalUnrolling, useArea, verify, verifyDP, verifyTolerance, verbosity, faultTolerant, mode, language, highPerf, propagateNth, useDeref\\n\");\nend;\n\n\nClass(SIMDGlobals, rec(\n    svct := True,\n    DPOpts := rec(\n        globalUnrolling := true,\n        globalUnrollingMin := 128,\n        globalUnrollingMax := 128,\n        defaultUnrolling := 128, # NOTE: THIS AFFECTS Rader.maxSize and other things. BAD IDEA.\n        verbosity := 0,\n        faultTolerant := false\n    ),\n\n    getDPOpts := meth(arg)\n        local self, isa, opts;\n        if Length(arg) = 1 then\n            _help();\n            return;\n        fi;\n        self := arg[1];\n        isa := arg[2];\n        opts := When(Length(arg) >=3, arg[3], rec());\n\n        return rec(\n            globalUnrolling := When(IsBound(opts.globalUnrolling) or (IsBound(opts.globalUnrollingMin) and IsBound(opts.globalUnrollingMax)), true, self.DPOpts.globalUnrolling),\n            globalUnrollingMin := Cond(IsBound(opts.globalUnrolling), opts.globalUnrolling, IsBound(opts.globalUnrollingMin), opts.globalUnrollingMin, self.DPOpts.globalUnrollingMin * isa.v),\n            globalUnrollingMax := Cond(IsBound(opts.globalUnrolling), opts.globalUnrolling, IsBound(opts.globalUnrollingMax), opts.globalUnrollingMax, self.DPOpts.globalUnrollingMax * isa.v),\n            verbosity := When(IsBound(opts.verbosity), opts.verbosity, self.DPOpts.verbosity),\n            timeBaseCases := true\n        );\n    end,\n\n#------------------------------------------\n    getOpts := meth(arg)\n\n         local self, isa, argrec, opts, profile_rec, arg3, bsizes, unr;\n\n        if Length(arg) = 1 then\n            _help();\n            return;\n        fi;\n        self := arg[1];\n        isa := arg[2];\n\n        #   some defaults\n        argrec := rec(\n            #   stride permutation configuration\n            stride := false,\n\n            #   DFT configuration\n            #   scalar algorithms\n            splitRadix := false,\n            SplitRadix_maxSize := SIMDGlobals.DPOpts.defaultUnrolling/2,\n            CT  := true,\n            CT_forcePrimeFactor := false,\n            PFA := true,\n            PFA_maxSize := SIMDGlobals.DPOpts.defaultUnrolling/2,\n            PD  := true,\n            Rader := false,\n            RealRader := true,\n            Rader_maxSize := SIMDGlobals.DPOpts.defaultUnrolling/2,\n            Rader_minSize := 3,\n            Bluestein := false,\n            Bluestein_maxSize := false,\n            minCost := false,\n            Mincost_maxSize := SIMDGlobals.DPOpts.defaultUnrolling/2,\n            PRDFT := false,\n            PRDFT_PF_maxSize := SIMDGlobals.DPOpts.defaultUnrolling,\n            URDFT := false,\n            URDFT_maxRadix := SIMDGlobals.DPOpts.defaultUnrolling/2,\n            #   vector algorithms -- preset for small sizes unrolled code.\n            svct := true,\n            splitL := false,    #   turn on for large sizes, as SVCT's payoff diminishes and complicates matters\n            useConj := false,   #   not supported right now\n            oddSizes := false,   #   only for unrolled code. turn off splitL as DP takes a wrong turn for small sizes\n            realVect := true,   #   use real-based vectorization\n            cplxVect := false,   #   use complex-based vectorization\n            pushTag := true,\n            flipIxA := true,\n            splitComplexTPrm := false, # used in SplitComplex DFTs and in DCTs\n            TRCDiag_VRCLR := false,\n            #   tSPL breakdown rules\n            tsplBluestein := true,\n            bluesteinMinPrime := 997,   # maybe level-based threshold? basically no automatic Bluestein applicability for now\n            bluesteinExtraSizes := [ 23, 46, 47, 49, 59, 67, 79, 83, 94, 103, 106, 107, 115 ],  #   for these sizes I needed Bluestein so far\n            raderAvoidSizes := [ 47, 59, 107 ], # avoid Rader for these sizes as codesize explodes for unrolled code\n            tsplRader := true,\n            tsplPFA := true,\n            stdTTensor := true,\n            tsplCT := true,\n            tsplVBase := true,\n            tsplCxVBase := true,\n            tsplCT_oddvloop := false,\n            loopOddSizes := false,\n            TRCbyDef := false,\n            #   other defaults\n            includeMath   := true,\n            faultTolerant := SIMDGlobals.DPOpts.faultTolerant,\n            language      := Cond(LocalConfig.cpuinfo.default_lang <> \"\", LocalConfig.cpuinfo.default_lang, SpiralDefaults.language),\n            verify        := false,\n            verifyDP := false,\n            verifyTolerance := 1E-3,\n            verbosity := 0,\n            interleavedComplex := true,\n            highPerf := true,\n            SIMD := LocalConfig.cpuinfo.SIMDname,\n            fracbits := When(IsBound(isa.fracbits), isa.fracbits, false),\n            useArea := false,\n            processIntTables := false,\n            propagateNth := false,\n            useDeref := true,\n            globalUnrolling := SIMDGlobals.DPOpts.defaultUnrolling,\n\n            fma := false,\n            cxfma := false,\n            splitVDiag := true,\n            finalSReduce := false,\n            fixUnalignedLoadStore := false\n        );\n\n        if Length(arg) = 3 then\n            arg3 := arg[3];\n            if IsBound(arg3.__name__)  then Unbind(arg3.__name__); fi;\n            if IsBound(arg3.__doc__)   then Unbind(arg3.__doc__); fi;\n            if IsBound(arg3.__bases__) then Unbind(arg3.__bases__); fi;\n            argrec := CopyFields(argrec, arg3);\n        fi;\n\n     profile_rec :=\n        When(IsBound(SpiralDefaults.profile),\n           rec(\n              profile := SpiralDefaults.profile,\n\t          measureFunction := SpiralDefaults.profile.meas\n           ),\n           rec()\n     );\n\n     bsizes := Filtered(argrec.bluesteinExtraSizes, i -> not IsInt(i/isa.v^2));\n\n     opts := CopyFields(When(argrec.highPerf, SpiralDefaults.highPerf(), SpiralDefaults), isa.getOpts(), profile_rec, rec(\n         baseHashes := When(argrec.svct or argrec.flipIxA, [SIMD_ISA_DB.getHash()], []),\n         breakdownRules := rec(\n             TTwiddle := [TTwiddle_Tw1],\n             DFT := Concat([DFT_Base],\n                When(argrec.realVect and argrec.tsplVBase,   [DFT_tSPL_VBase], []),\n                When(argrec.cplxVect and argrec.tsplCxVBase, [DFT_tSPL_CxVBase, DFT_tSPL_CxVBase2], []),\n                When(argrec.splitRadix, [CopyFields(DFT_SplitRadix, rec(maxSize := argrec.SplitRadix_maxSize)) ], []),\n                When(argrec.PD,         [DFT_PD], []),\n\n                When(argrec.Bluestein,  [CopyFields(DFT_Bluestein, rec(\n\t\t            maxSize := argrec.Bluestein_maxSize, switch := true))], []),\n\n                When(argrec.CT,         [CopyFields(DFT_CT, rec(forcePrimeFactor := argrec.CT_forcePrimeFactor))],\n\t\t            When(argrec.URDFT and not argrec.minCost, [CopyFields(DFT_CT, rec(maxSize := 4))], [])),\n\n                When(argrec.PFA,        [CopyFields(DFT_GoodThomas, rec(maxSize := argrec.PFA_maxSize))], []),\n                When(argrec.Rader,      [CopyFields(DFT_Rader,      rec(minSize := argrec.Rader_minSize, maxSize := argrec.Rader_maxSize))], []),\n                When(argrec.RealRader,  [CopyFields(DFT_RealRader,  rec(maxSize := argrec.Rader_maxSize))], []),\n                When(argrec.minCost,    [CopyFields(DFT_CT_Mincost, rec(maxSize := argrec.Mincost_maxSize))], []),\n                When(argrec.tsplCT,     [DFT_tSPL_CT], []),\n                When(argrec.tsplCT_oddvloop,[DFT_tSPL_CT_oddvloop], []),\n                When(argrec.tsplBluestein, [ CopyFields(DFT_tSPL_Bluestein, rec(\n                    applicableSizes := i -> (i in bsizes) or (not IsInt(i/isa.v^2)\n\t\t\t                    and ForAny(Factors(i), j -> j >= argrec.bluesteinMinPrime)),\n                    minRoundup := isa.v^2,\n                    customFilter := DetachFunc(Subst(i -> IsInt(i/$(isa.v^2)))))) ], []),\n\n                When(argrec.tsplPFA,    [DFT_tSPL_GoodThomas], []),\n\n                When(argrec.tsplRader,  [CopyFields(DFT_tSPL_Rader, rec(\n                    useSymmetricAlgorithm := true,\n                    avoidSizes := argrec.raderAvoidSizes)) ], []),\n\n                When(argrec.PRDFT,      [DFT_PRDFT], []),\n                When(argrec.URDFT,      [CopyFields(spiral.sym.DFT_URDFT_Decomp, rec(\n\t\t    forTransposition := true,\n\t\t    maxRadix := argrec.URDFT_maxRadix))], [])\n             ),\n             DFT3 := [ DFT3_Base, DFT3_CT ],\n             TDCT2 := [ DCT2_DCT4_tSPL ],\n             TDCT3 := [ DCT3_DCT4_tSPL ],\n             TDCT4 := [ DCT4_CT_tSPL ],\n             TDST2 := [ DST2_DST4_tSPL ],\n             TDST3 := [ DST3_DST4_tSPL ],\n             TDST4 := [ DST4_CT_tSPL ],\n             TMDCT := [TMDCT_DCT4_tSPL],\n             TIMDCT   := [TIMDCT_TMDCT_tSPL],\n             TRDFT    := [TRDFT_By_Def, TRDFT_By_Def_tr, TRDFT_DFT_NR_tSPL_New, TRDFT_CT_tSPL_New],\n             TRDFT2D  := [TRDFT2D_ColRow_tSPL],\n             TIRDFT2D := [TIRDFT2D_RowCol_tSPL],\n             TRConv2D := [TRConv2D_TRDFT2D_tSPL],\n             TDHT := [DHT_DFT_tSPL],\n             TS := [ TS_vect ],\n             TConjEven := [TConjEven_vec, TConjEven_vec_tr ],\n             TXMatDHT := [TXMatDHT_vec],\n             WHT := [ WHT_Base, WHT_BinSplit, WHT_tSPL_BinSplit, WHT_tSPL_Base ],\n             MDDFT := [ MDDFT_Base, MDDFT_RowCol, MDDFT_tSPL_RowCol ],\n             PrunedDFT := [ PrunedDFT_base, PrunedDFT_DFT, PrunedDFT_CT, PrunedDFT_tSPL_CT ],\n             IOPrunedDFT := [\n\t\t IOPrunedDFT_tSPL_CT, IOPrunedDFT_base, IOPrunedDFT__PrunedDFT,\n\t\t IOPrunedDFT__PrunedDFT_T, IOPrunedDFT__Gath_PrunedDFT, IOPrunedDFT__PrunedDFT_T_Scat, IOPrunedDFT_CT ],\n             InterpolateDFT := [ InterpolateDFT_tSPL_PrunedDFT ],\n             Downsample := [ Downsample_base, Downsample_tag ],\n             InterpolateSegmentDFT := [ InterpolateSegmentDFT_PrunedDFT, InterpolateSegmentDFT_tSPL_PrunedDFT ],\n\n             TTensor := Concat(When(argrec.stdTTensor, [ AxI_IxB, IxB_AxI], []),\n                        When(argrec.tsplPFA, [splitL_BxI__L_AxI, AxI_L__BxI_splitL], [L_BxI__L_AxI, AxI_L__BxI_L ])),\n\n             TTensorI := Concat([ IxA_base, AxI_base, IxA_L_base, L_IxA_base, AxI_vec ],\n                            When(argrec.pushTag, [ IxA_vec_push ], []),\n                            When(argrec.flipIxA, [ IxA_vec ], []),\n                            When(argrec.svct, [ IxA_L_vec, L_IxA_vec], []),\n                            When(argrec.splitL, [ IxA_L_split_vec, L_IxA_split_vec, IxA_split_vec ], []),\n                            When(argrec.oddSizes, [ AxI_svec ], []),\n                            When(argrec.loopOddSizes, [ TTensorI_oddvloop ], []),\n                            When(argrec.oddSizes and argrec.svct, [ IxA_L_svec ], []),\n                            When(argrec.useConj, [ IxA_conj_vec ], [])\n                            ),\n             TL := Concat(When(argrec.cplxVect, [L_cx_real], []),\n                        When(argrec.stride, [L_GV1_vtensor], []),#[L_base_vec, L_mn_m_vec, IxLxI_vtensor],\n                        When(argrec.svct or argrec.flipIxA, [ L_nv_n_vec, L_nv_v_vec, L_mn_m_vec, IxLxI_vtensor ], [])\n#                        When(argrec.splitL,[ L_base_vec, IxLxI_vtensor ], [])\n                    ),\n             TTensorInd := [ dsA_base_vec_push, L_dsA_L_base_vec, L_dsA_L_vec, L_dsA_L_base ],\n\n             TRC := Concat(\n                When(argrec.realVect, [TRC_vect], []),\n                When(argrec.cplxVect, [TRC_cplx, TRC_cplx_v2], []),\n\t\t        When(argrec.TRCbyDef, [CopyFields(TRC_By_Def, rec(maxSize := 2*isa.v))], []),\n                When(not(argrec.realVect) and argrec.cplxVect, [TRC_cplxvect], [])\n             ),\n\t     TMat    := [ TMat_Base, TMat_Vec],\n             TDiag   := [ TDiag_tag ],\n             TRCDiag := When(argrec.TRCDiag_VRCLR, [TRCDiag_VRCLR], [ TRCDiag_tag ]),\n             TGath   := [ TGath_base ],\n             TScat   := [ TScat_base ],\n             TRDiag  := [ TRDiag_Vec ],\n             TPrm    := When(argrec.splitComplexTPrm, [TPrm_format], [ TPrm_IJ_Vec, TPrm_IP_Base1, TPrm_J, TPrm_Jv ]),\n             TGrp    := [ TGrp_tag ],\n             TCompose   := [ TCompose_tag ],\n             TICompose  := [ TICompose_tag ],\n             TRaderMid  := [ Pad_vec ],\n             TDirectSum := [ A_dirsum_B_delayed ],\n\n             TConj   := [ TConj_perm ],\n             PRDFT   := [ PRDFT1_Base1, PRDFT1_Base2, PRDFT1_CT,\n\t\t CopyFields(PRDFT1_PF, rec(maxSize := argrec.PRDFT_PF_maxSize)), PRDFT_PD, PRDFT_Rader],\n             IPRDFT  := [ IPRDFT1_Base1, IPRDFT1_Base2, IPRDFT1_CT, IPRDFT_PD, IPRDFT_Rader],\n             IPRDFT2 := [ IPRDFT2_Base1, IPRDFT2_Base2, IPRDFT2_CT],\n             PRDFT3  := [ PRDFT3_Base1, PRDFT3_Base2, PRDFT3_CT, PRDFT3_OddToPRDFT1],\n             URDFT   := [ URDFT1_Base1, URDFT1_Base2, URDFT1_Base4, CopyFields(URDFT1_CT, rec(maxRadix := argrec.URDFT_maxRadix)) ],\n             GT     := [ CopyFields(GT_Base, rec(maxSize:=false)), GT_NthLoop, GT_Vec_AxI ],\n             InfoNt := [ Info_Base],\n             Filt   := [ spiral.transforms.filtering.Filt_Base, spiral.transforms.filtering.Filt_Blocking ],\n\n             # old DCT/DST rules without DFT/RDFT termination\n             DCT2   := [ DCT2_DCT2and4],\n             DCT3   := [ DCT3_Base2, DCT3_Base3, DCT3_Base5],\n             DCT4   := [ DCT4_Base2, DCT4_Base3, DCT4_DCT2andDST2, DCT4_DST4andDST2, DCT4_DCT2, DCT4_DCT2t],\n             DST2   := [ DST2_Base2, DST2_toDCT2],\n             DST4   := [ DST4_Base, DST4_toDCT4]\n         ),\n         formulaStrategies := rec(\n             sigmaSpl := VectorStrategySum,\n             postProcess := Concatenation(\n                VectorStrategySum,\n                VectorStrategyTerm,\n                VectorStrategySum,\n                VectorStrategySum,\n                VectorStrategyTerm2,\n                VectorStrategySum,\n                VectorStrategySum,\n                VectorStrategyRC,\n                VectorStrategyRC,\n                [RulesVRCTerm, s -> SubstBottomUp(s, VIxL, e->e.implement(isa))], # NOTE: WHY do I need to have these???\n                VectorStrategySum,\n                VectorStrategyRC,\n                VectorStrategySum,\n                [ BlockSumsOpts,\n                  (s, opts) -> Process_fPrecompute(s, opts)\n                   ],\n                fix_fAdd\n             ),\n             preRC := [MergedRuleSet(StandardSumsRules, RulesPropagate, JoinDirectSums),\n                       MergedRuleSet(StandardSumsRules, RulesPropagate, StretchRaderMid),\n                       MergedRuleSet(StandardSumsRules, RulesPropagate, RulesSplitComplex),\n                       TerminateDirectSums],\n             rc := []\n         ),\n\n         includes := Concatenation(\n            When(argrec.includeMath = false, \"\", [\"<math.h>\"]),\n            When(IsBound(isa.includes), isa.includes(), [])\n         ),\n\n         generateInitFunc := true,\n\n         XType := TPtr(isa.t.base_t()),\n         YType := TPtr(isa.t.base_t()),\n\n     # NOTE: use layering w/ CopyFields instead of When/IsBound\n     language := argrec.language,\n     faultTolerant := argrec.faultTolerant,\n     verify := argrec.verify,\n     verifyDP := argrec.verifyDP,\n     verifyTolerance := argrec.verifyTolerance,\n     verbosity := argrec.verbosity,\n     interleavedComplex := argrec.interleavedComplex,\n     useDeref := argrec.useDeref,\n     propagateNth := argrec.propagateNth,\n     unparser := When(IsBound(isa.unparser), isa.unparser, CMacroUnparserProg),\n     codegen := VectorCodegen,\n     compileStrategy := Concatenation(\n                            Cond( argrec.cxfma, IndicesCS_CXFMA,\n                                  argrec.fma,   IndicesCS_FMA,\n                                  # else\n                                  SpiralDefaults.compileStrategy),\n                            When( isa.isFixedPoint, [ c -> FixedPointCode(c, isa.bits, argrec.fracbits) ] ,[]),\n                            [(c,opts) -> opts.vector.isa.fixProblems(c, opts)],\n                            [HashConsts, FixDataType]),\n\n     simpIndicesInside := SpiralDefaults.simpIndicesInside :: isa.simpIndicesInside,\n\n     vector := CopyFields(VectorDefaults, rec(\n            vlen := isa.v,\n            isa := isa,\n            conf := argrec,\n            SIMD := argrec.SIMD\n        )),\n        tags := isa.getTags(),\n        cxtags := isa.getTagsCx()\n     ));\n\n     if IsBound(isa.countrec) then opts.countrec := isa.countrec; fi;\n\n     if IsBound(isa.useDeref) then opts.useDeref := isa.useDeref; fi;\n     if IsBound(isa.codegenStrat) then opts.codegenStrat := isa.codegenStrat; fi;\n     if IsBound(isa.compileStrategy) then opts.compileStrategy := isa.compileStrategy(); fi;\n\n     if IsBound(isa.declareConstants) then opts.declareConstants := isa.declareConstants; fi;\n     opts.scalarDataModifier := \"const\";\n     if IsBound(isa.expandVectorConstants) then opts.expandVectorConstants := isa.expandVectorConstants; fi;\n\n     if IsBound(isa.backendConfig) then\n        opts.profile := isa.backendConfig.profile;\n        opts.measureFunction := isa.backendConfig.measureFunction;\n     fi;\n\n     # vector has VRC to deal with complex code so whe turn off implicit RC business in SumsRuleTreeXXX()\n     opts.generateComplexCode := true;\n\n     if IsBound(isa.arrayBufModifier) then\n        opts.arrayBufModifier :=isa.arrayBufModifier;\n\t elif IsBound(isa.alignmentBytes) then\n\t     opts.arrayBufModifier := Concat(\"static \", LocalConfig.compilerinfo.alignmentSpecifier(isa.alignmentBytes));\n     else\n         opts.arrayBufModifier := Concat(\"static \", LocalConfig.compilerinfo.alignmentSpecifier());\n     fi;\n     if IsBound(isa.arrayDataModifier) then\n        opts.arrayDataModifier :=isa.arrayDataModifier;\n\t elif IsBound(isa.alignmentBytes) then\n\t     opts.arrayDataModifier := Concat(\"static \", LocalConfig.compilerinfo.alignmentSpecifier(isa.alignmentBytes));\n     else\n         opts.arrayDataModifier := Concat(\"static \", LocalConfig.compilerinfo.alignmentSpecifier());\n     fi;\n\n     if IsBound(argrec.globalUnrolling) then\n        # complex vectorization requires smaller global unrolling\n        opts.globalUnrolling := argrec.globalUnrolling * isa.v; # /When(argrec.cplxVect, 2, 1); #NOTE: bad problem when wrapping complex guys...\n     fi;\n     if argrec.useArea then\n        opts.globalUnrolling := 2 * opts.globalUnrolling; # * Log2Int(opts.globalUnrolling);\n        opts.markBlock := MarkBlocksAreaSums;\n     fi;\n\n     if argrec.splitVDiag then\n        opts.hack_vRC_VDiag := \"split\";\n     else\n        opts.hack_vRC_VDiag := \"compact\";\n     fi;\n     opts.finalSReduce := argrec.finalSReduce;\n     opts.fixUnalignedLoadStore := argrec.fixUnalignedLoadStore;\n\n#     # use Fred's magic flags to make the compiler behave -- hopefully\n#     opts.propagateNth:=false;\n#     opts.useDeref := true;\n#     opts.doScalarReplacement:=false;\n#     if argrec.safeMode then\n#         opts.useDeref:=false;\n#         opts.doScalarReplacement:=false;\n#     fi;\n\n      if argrec.processIntTables then\n          Append(opts.formulaStrategies.preRC, [compiler.MergeIntData]);\n      fi;\n\n     opts.operations := rec(Print := (s) -> Print(\"<Spiral SIMD options>\"));\n\n     if IsBound(argrec.measureFinal) then opts.measureFinal := argrec.measureFinal; fi;\n\n     return opts;\n\n    end\n));\n", "meta": {"hexsha": "ef66c3c7b6c93bae4d3312d4315f5ddc63ac7741", "size": 21280, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/initfuncs.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/initfuncs.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/initfuncs.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 46.1605206074, "max_line_length": 191, "alphanum_fraction": 0.5910714286, "num_tokens": 5782, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.48828339529583464, "lm_q2_score": 0.03210070660126248, "lm_q1q2_score": 0.015674242010659856}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nFFTXGlobals.confGPU := (arg) >> ApplyFunc(arg[1].defaultCUDADeviceConf, Drop(arg,1));\nspiral.LocalConfig.fftx := FFTXGlobals;\n", "meta": {"hexsha": "528789cfa9c43c7eea9b7bc5fe230a612d822eb1", "size": 212, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "knowledgebase/getopts.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "knowledgebase/getopts.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "knowledgebase/getopts.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 30.2857142857, "max_line_length": 85, "alphanum_fraction": 0.7405660377, "num_tokens": 64, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.28457600421652673, "lm_q2_score": 0.05500529216624422, "lm_q1q2_score": 0.0156531862554324}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(RulesSMP, RuleSet);\n\nRewriteRules(RulesSMP, rec(\n    PSD_SMPSumRight := ARule(Compose,  [ @(1, [RCDiag, Diag, Prm, Scat, FormatPrm]), @(2, SMPSum) ],\n     e -> let(s:=@(2).val, [ SMPSum(s.nthreads, s.tid, s.var, s.domain, @(1).val * s.child(1)) ])),\n\n    PGD_SMPSumLeft  := ARule(Compose, [ @(1, SMPSum), @(2, [Prm, Gath, Diag, RCDiag, FormatPrm]) ],\n     e -> let(s:=@(1).val, [ SMPSum(s.nthreads, s.tid, s.var, s.domain, s.child(1) * @(2).val) ])),\n\n\n    PSD_SMPBarrierRight := ARule(Compose,  [ @(1, [RCDiag, Diag, Prm, Scat, FormatPrm]), @(2, SMPBarrier) ],\n     e -> let(s:=@(2).val, [ SMPBarrier(s.nthreads, s.tid, @(1).val * s.child(1)) ])),\n\n    PGD_SMPBarrierLeft  := ARule(Compose, [ @(1, SMPBarrier), @(2, [Prm, Gath, Diag, RCDiag, FormatPrm]) ],\n     e -> let(s:=@(1).val, [ SMPBarrier(s.nthreads, s.tid, s.child(1) * @(2).val) ])),\n\n    Drop_GrpSPSum := Rule([Grp, @(1, SMPSum)], e -> @(1).val),\n    Drop_GrpISum := Rule([Grp, @(1, ISum)], e -> @(1).val),\n\n    SMP_ISum := Rule([SMP, @(1), @(2), @(3, ISum)], e ->\n        SMPSum(@(1).val, @(2).val, @(3).val.var, @(3).val.domain, @(3).val.child(1))),\n));\n\nRewriteRules(RulesRC, rec(\n    RC_SMPSum := Rule([RC, @(1, SMPSum)],\n        e -> let(s:=@(1).val, SMPSum(s.nthreads, s.tid, s.var, s.domain, RC(s.child(1))))),\n\n    RC_SMPBarrier := Rule([RC, @(1, SMPBarrier)],\n        e -> let(s:=@(1).val, SMPBarrier(s.nthreads, s.tid, RC(s.child(1))))),\n));\n", "meta": {"hexsha": "1c8d9f7891e572e4eabd1c56b7de304ab26aa148", "size": 1503, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/smp/rewrite.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/smp/rewrite.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/smp/rewrite.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.75, "max_line_length": 108, "alphanum_fraction": 0.5568862275, "num_tokens": 590, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45713671682749485, "lm_q2_score": 0.03410042448529082, "lm_q1q2_score": 0.015588556091629761}}
{"text": "# Copyright (c) 2018-2020, Carnegie Mellon University\n# See LICENSE for details\n\n\nUnparseQASM := function (spl)\n    PrintTo(\"./qspiralout\", spl);\n    Exec( \"./namespaces/packages/quantum/unparser/bin/unparser ./qspiralout\"); \nend;\n\n", "meta": {"hexsha": "b9f6d7d0e94f6a94204b2369f5e6a011a97855d4", "size": 232, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "unparse.gi", "max_stars_repo_name": "spiral-software/spiral-package-quantum", "max_stars_repo_head_hexsha": "dd2323983495adbbc6261c0cdf840320d19d099d", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "unparse.gi", "max_issues_repo_name": "spiral-software/spiral-package-quantum", "max_issues_repo_head_hexsha": "dd2323983495adbbc6261c0cdf840320d19d099d", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "unparse.gi", "max_forks_repo_name": "spiral-software/spiral-package-quantum", "max_forks_repo_head_hexsha": "dd2323983495adbbc6261c0cdf840320d19d099d", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.2, "max_line_length": 79, "alphanum_fraction": 0.7112068966, "num_tokens": 66, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.3486451217982255, "lm_q2_score": 0.044680875202026085, "lm_q1q2_score": 0.015577769176861697}}
{"text": "#\n# JupyterZMQ: UUID function\n#\n\n#! @Description\n#!   Create a new zero UUID\nInstallGlobalFunction(NewUUID,\nfunction()\n    local uuid;\n    uuid := rec( bits := BlistList([1..128], []));\n    return Objectify(UUIDType, uuid);\nend);\n\n#! @Description\n#!   Generate a random UUID according to RFC4122\nInstallGlobalFunction(RandomUUID,\nfunction()\n    local puuid, uuid;\n\n    puuid := HexStringInt(Random(0,2^128-1));\n    if Length(puuid) < 32 then\n        puuid := Concatenation(RepeatedString(\"0\", 32 - Length(puuid)), puuid);\n    fi;\n    uuid := BlistStringDecode(puuid);\n    # Set version to 4\n    uuid{[49..52]} := [false, true, false, false];\n    # Set variant to RFC4122\n    uuid{[70..72]} := [true, false, false];\n\n    return Objectify( UUIDType, rec( bits := uuid ) );\nend);\n\nInstallGlobalFunction(StringUUID,\nfunction(uuid)\n    local hex;\n    hex := LowercaseString(HexStringBlist(uuid!.bits));\n    return JoinStringsWithSeparator([\n                hex{[1..8]}, hex{[9..12]}, hex{[13..16]},\n                hex{[17..20]}, hex{[20..32]}],\n                \"-\");\nend);\n\nInstallGlobalFunction(HexStringUUID,\nuuid -> HexStringBlist(uuid!.bits));\n\nInstallMethod(ViewString, \"for UUID\", [IsUUID and IsUUIDBlistRep],\nuuid -> Concatenation(\"<uuid \", String(uuid), \">\"));\n\nInstallMethod(String, \"for UUID\", [IsUUID and IsUUIDBlistRep],\n    StringUUID);\n\n", "meta": {"hexsha": "8308696e1dbe7176d6e26c55659a7869fa5e099c", "size": 1347, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/uuid.gi", "max_stars_repo_name": "mtorpey/uuid", "max_stars_repo_head_hexsha": "9efd84176f116cac49d1e253aa82fe4b95c3cd13", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/uuid.gi", "max_issues_repo_name": "mtorpey/uuid", "max_issues_repo_head_hexsha": "9efd84176f116cac49d1e253aa82fe4b95c3cd13", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/uuid.gi", "max_forks_repo_name": "mtorpey/uuid", "max_forks_repo_head_hexsha": "9efd84176f116cac49d1e253aa82fe4b95c3cd13", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.9038461538, "max_line_length": 79, "alphanum_fraction": 0.6347438753, "num_tokens": 376, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45326184801538616, "lm_q2_score": 0.03410042669392811, "lm_q1q2_score": 0.015456422421403061}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(VWrapBase, rec(\n    opts := (self, t, opts) >> opts,\n));\n\nClass(VWrapId, VWrapBase, rec(\n    __call__ := self >> self,\n    wrap := (self,r,t,opts) >> r,\n    twrap := (self,t,opts) >> t\n));\n\nClass(DPWrapper, SumsBase, BaseContainer, rec(\n\n    _short_print := true,\n    \n    new := (self, spl, wrap) >> SPL(WithBases(self, rec(\n        _children  := [spl],\n        dimensions := spl.dimensions,\n        wrap       := wrap,\n        ))),\n\n    rChildren := self >> [self._children[1], self.wrap],\n\n    rSetChild := meth(self, n, newC)\n        if n=1 then self._children[1] := newC;\n        elif n=2 then self.wrap := newC;\n        else Error(\"<n> must be in [1..2]\");\n        fi;\n    end,\n\n    sums := self >> self._children[1].sums(),\n\n    print := (self, i, is) >> Cond(self._short_print,\n        Print(self.__name__, \"(\", self._children[1].print(i+is, is), \", \", self.wrap, \")\"),\n        Print(self.__name__, \"(\\n\", Blanks(i+is), \n\t    self._children[1].print(i+is, is), \",\\n\", Blanks(i+is), self.wrap, \"\\n\", Blanks(i), \")\")),\n\n    HashId := self >> let(h := [ When(IsBound(self._children[1].HashId), self._children[1].HashId(), self._children[1]) ],\n        When(IsBound(self.tags), Concatenation(h, self.tags), h)),\n\n    vcost := self >> self.child(1).vcost()\n));\n\n#F DPSWrapper - wrapper for stackable VWraps;\n#F all stackable wrappers applied to formula in _DPSPLRec, innermost first.\n\nClass(DPSWrapper, DPWrapper);\n\nClassSPL.setWrap := (self, wrap) >> DPWrapper(self, wrap).takeAobj(self);\nClassSPL.addWrap := (self, wrap) >> DPSWrapper(self, wrap).takeAobj(self);\n", "meta": {"hexsha": "467edaf5cbf161ce4fcd48128890b63f5c063177", "size": 1657, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/vwrap.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/vwrap.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/vwrap.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 30.1272727273, "max_line_length": 122, "alphanum_fraction": 0.5926372963, "num_tokens": 504, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.40733340004593016, "lm_q2_score": 0.0378924286667782, "lm_q1q2_score": 0.015434851804836638}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n\n# NOTE: a hack, because we essentially ignore doHashValues\n_constHashPat := @@(1, Value, (e, cx) -> \n    e.t.doHashValues and not IsIntT(e.t) and e.t<>TString and e.t<>TBool\n    and not Last(cx.parents) _is data\n    and not ForAny(cx.parents, p -> p _is Value)\n); \n\n# ^^ NOTE: strings remapped to vars cause trouble in make_env\n\n# Below could be done automatically in Value constructor (Value.new),\n# but HashTable object is not implemented efficiently, leading\n# to long runtimes when huge data(..) blocks were used (e.g., SAR)\n#\nHashConstantsCode := (code, hashtab, hashadd_func, pat) -> SubstTopDownRulesNR(code, rec(\n    hash_constant := Rule(pat, e -> hashadd_func(hashtab, e)\n)));\n\n#\n# Hash for constants\n#\nNewConstantHash := () -> HashTable( (key,size) -> key[1].t.hash(key[1].v, size) );\nGlobalConstantHash := NewConstantHash();\n\nHashedValue := function(conhash, val)\n    local hashed, h;\n    if not val.t.doHashValues then return val; fi;\n    hashed := HashLookup(conhash, [val, val.t]);\n    if hashed = false then\n        h := val;\n        HashAdd(conhash, [val,val.t], h);\n        return h;\n    else \n      return hashed;\n    fi;\nend;\n\n#\n# Hash for constants remapped to variables \n#\nNewConstantVarHash := () -> HashTable( (key,size) -> key[1].t.hash(key[1].v, size) );\nGlobalConstantVarHash := NewConstantVarHash(); \n\nVHashedValue := function(conhash, val)\n    local hashed, h;\n    if not val.t.doHashValues then return val; fi;\n    hashed := HashLookup(conhash, [val, val.t]);\n    if hashed = false then\n        h := var.fresh_t(\"C\", val.t);\n        h.value := val;\n        HashAdd(conhash, [val, val.t], h);\n        return h;\n    else \n      return hashed;\n    fi;\nend;\n\n# \n# Compiler interface\n# \nFlushConsts := function()\n    GlobalConstantHash    := NewConstantHash();\n    GlobalConstantVarHash := NewConstantVarHash(); \nend;\n\nHashConsts := function (c, opts)\n    if IsBound(opts.declareConstants) and opts.declareConstants then\n        c := HashConstantsCode(c, GlobalConstantVarHash, VHashedValue, _constHashPat);\n    else\n        c := HashConstantsCode(c, GlobalConstantHash, HashedValue, _constHashPat);\n    fi;\n    return c;\nend;\n\n#F DeclareConstantsHash(<c>, <htab>)\n#F\n_declareConstantsHash := function(c, htab)\n    local hh, h;\n    for hh in htab.entries do\n        for h in hh do\n\t    c := data(h.data, h.key[1], c);\n\tod;\n    od;\t\n    return c;\nend;\n\n#F DeclareConstantsCode(<c>, <opts>)\n#F\n#F Declares constants in the code as variables, without polluting the global hash.\n#F Constants are declared at the top level, without regard of placement.\n#F\n#F To better localize use DeclareConstantsCodeLocally(c, [func], opts)\n#F\nDeclareConstantsCode := function(c, opts)\n    local htab, hh, h;\n    htab := NewConstantVarHash();\n    c := HashConstantsCode(c, htab, VHashedValue, _constHashPat);\n    return _declareConstantsHash(c, htab);\nend;\n\n\n_localDeclareConstants := function(x, opts) \n    local ch, c;\n    ch := x.rChildren();\n    ch := List(ch, c -> Cond(not IsCommand(c), c, DeclareConstantsCode(c, opts)));\n    return x.from_rChildren(ch);\nend;\n\n#F DeclareConstantsCode(<c>, <patterns>, <opts>)\n#F \n#F Applies DeclareConstantsCode locally to each of the patterns.\n#F This function is non-recursive, i.e. if one of the patterns is matched, it won't \n#F go inside the body. So for best results all patterns should be mutually exclusive.\n#F \nDeclareConstantsCodeLocally := (c, patterns, opts) -> SubstTopDownRulesNR(\n    c, List(patterns, p -> Rule(p, _localDeclareConstants))\n);\n", "meta": {"hexsha": "4a32f146384f3d74a53babe2a28430156fa1f9ec", "size": 3589, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/conhash.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/conhash.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/conhash.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.1788617886, "max_line_length": 89, "alphanum_fraction": 0.6751184174, "num_tokens": 995, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.40733340004593027, "lm_q2_score": 0.037892427987721244, "lm_q1q2_score": 0.015434851528234062}}
{"text": "#\n#\n#\n\nRead(\"~/Workspace/Chevalley.gap/init.gi\");\n\nRead(Filename(home_dir,\"lib/rsys.gd\"));\nRead(Filename(home_dir,\"lib/rsys.gi\"));\n\nRead(Filename(home_dir,\"lib/chvadj.gd\"));\nRead(Filename(home_dir,\"lib/chvadj.gi\"));\n\nRead(Filename(home_dir,\"lib/nilchv.gd\"));\nRead(Filename(home_dir,\"lib/nilchv.gi\"));\n\nRead(Filename(home_dir,\"lib/algU.gd\"));\nRead(Filename(home_dir,\"lib/algU.gi\"));\n\n#\n# UipotentChv needs SolveRelations\n#\nRead(Filename(home_dir,\"lib/poly.gd\"));\nRead(Filename(home_dir,\"lib/poly.gi\"));\n\n#\n# Unialg needed\n#\nRead(Filename(home_dir,\"lib/unichv.gd\"));\nRead(Filename(home_dir,\"lib/witt.gd\"));\nRead(Filename(home_dir,\"lib/unialg.gd\"));\n\nRead(Filename(home_dir,\"lib/unichv.gi\"));\n", "meta": {"hexsha": "2baa6d192c015576aabd327360e2eab9e7f37093", "size": 690, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "test/unichv.test.init.gi", "max_stars_repo_name": "iuliansimion/Chevalley.gap", "max_stars_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/unichv.test.init.gi", "max_issues_repo_name": "iuliansimion/Chevalley.gap", "max_issues_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/unichv.test.init.gi", "max_forks_repo_name": "iuliansimion/Chevalley.gap", "max_forks_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.9090909091, "max_line_length": 42, "alphanum_fraction": 0.7144927536, "num_tokens": 215, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.35936415888237616, "lm_q2_score": 0.04272220105061521, "lm_q1q2_score": 0.015352827846158101}}
{"text": "#\n# francy: Interactive Discrete Mathematics in GAP\n#\n\n#############################################################################\n##\n#M  Callback( <callback type>, <trigger Type>,  <function>, <known args> ) . \n##  \n## triggers a callback with a list of known args.\n## Extra args, or required args, should be registered using:\n##      Callback!.add(CallbackRequiredArg)\n##\nInstallMethod(Callback,\n  \"a function, a list of known args\",\n  true,\n  [IsTriggerType,\n   IsFunction,\n   IsList],\n  0,\nfunction(triggerType, func, knownArgs)\n  local object;\n  object := Objectify(CallbackObjectType, rec(\n    id           := GenerateID(),\n    trigger      := triggerType!.value,\n    func         := func,\n    knownArgs    := knownArgs,\n    requiredArgs := rec()\n  ));\n  FrancyCallbacks!.(object!.id) := object;\n  return object;\nend);\n\nInstallOtherMethod(Callback,\n  \"a trigger type, a function\",\n  true,\n  [IsTriggerType,\n   IsFunction],\n  0,\nfunction(triggerType, func)\n  return Callback(triggerType, func, []);\nend);\n\nInstallOtherMethod(Callback,\n  \"a function, a list of knownArgs\",\n  true,\n  [IsFunction,\n   IsList],\n  0,\nfunction(func, knownArgs)\n  return Callback(TriggerType.CLICK, func, knownArgs);\nend);\n\nInstallOtherMethod(Callback,\n  \"a function\",\n  true,\n  [IsFunction],\n  0,\nfunction(func)\n  return Callback(TriggerType.CLICK, func, []);\nend);\n\n#############################################################################\n##\n#M  NoopCallback( )\n##\n## Creates an empty Callback object that does nothing\n##\nInstallMethod(NoopCallback,\n  \"\",\n  true,\n  [],\n  0,\nfunction()\n  return Objectify(CallbackObjectType, rec());\nend);\n\n#############################################################################\n##\n#M  RequiredArg( <callback arg type>, <title> )\n##\nInstallMethod(RequiredArg,\n  \"a callback arg type, a title\",\n  true,\n  [IsArgType,\n   IsString],\n  0,\nfunction(argType, title)\n  # FIXME might have to add a new property with order of the arg!\n  return Objectify(RequiredArgObjectType, rec(\n    id    := GenerateID(),\n    type  := argType!.value,\n    title := title,\n    value := \"\"\n  ));\nend);\n\n#############################################################################\n##\n#M  Add( <callback>, <required arg> ) . . . . . add objects to canvas\n##\nInstallOtherMethod(Add,\n  \"a callback, a required arg\",\n  true,\n  [IsCallback,\n   IsRequiredArg],\n  0,\nfunction(callback, arg)\n  callback!.requiredArgs!.(arg!.id) := arg;\n  return callback;\nend);\n\nInstallOtherMethod(Add,\n  \"a callback, a list of francy objects\",\n  true,\n  [IsCallback,\n   IsList],\n  0,\nfunction(callback, objects)\n  local object;\n  for object in objects do\n    Add(callback, object);\n  od;\n  return callback;\nend);\n\n#############################################################################\n##\n#M  Remove( <callback>, <required arg> ) . . . . . add objects to canvas\n##\nInstallOtherMethod(Remove,\n  \"a callback, a required arg\",\n  true,\n  [IsCallback,\n   IsRequiredArg],\n  0,\nfunction(callback, arg)\n  Unbind(callback!.requiredArgs!.(arg!.id));\n  return callback;\nend);\n\nInstallOtherMethod(Remove,\n  \"a callback, a list of francy objects\",\n  true,\n  [IsCallback,\n   IsList],\n  0,\nfunction(callback, objects)\n  local object;\n  for object in objects do\n    Remove(callback, object);\n  od;\n  return callback;\nend);\n\n#############################################################################\n##\n#M  Trigger( <a json string> ) . triggers a callback\n##\nInstallMethod(Trigger,\n  \"a json string\",\n  true,\n  [IsString],\n  0,\nfunction(json)\n  local callback, object, requiredArgs, arg;\n  object := JsonStringToGap(json);\n  # FIXME need to validate the callback!\n  #if not IsCallbackRep(object) then\n  #  Error(\"Not a valid Callback!\");\n  #fi;\n  callback := FrancyCallbacks!.(object!.id);\n  requiredArgs := [];\n  for arg in NamesOfComponents(object!.requiredArgs) do\n    Add(requiredArgs, object!.requiredArgs!.(arg)!.value);\n  od;\n  return CallFuncList(callback!.func, Concatenation(callback!.knownArgs, requiredArgs));\nend);\n", "meta": {"hexsha": "13f0c32a232ce0378f9afa55ed11a083097fcaf9", "size": 4000, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/callback.gi", "max_stars_repo_name": "LaGuer/francy", "max_stars_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2016-12-15T12:04:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-14T19:19:24.000Z", "max_issues_repo_path": "gap/callback.gi", "max_issues_repo_name": "LaGuer/francy", "max_issues_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 29, "max_issues_repo_issues_event_min_datetime": "2018-10-09T22:37:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:44:50.000Z", "max_forks_repo_path": "gap/callback.gi", "max_forks_repo_name": "LaGuer/francy", "max_forks_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-12-15T12:04:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-28T10:51:50.000Z", "avg_line_length": 22.4719101124, "max_line_length": 88, "alphanum_fraction": 0.5905, "num_tokens": 979, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.38121956625615, "lm_q2_score": 0.04023794118495175, "lm_q1q2_score": 0.01533949048556778}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_dbgPrintRuleName := rule -> Cond(\n    IsBound(rule.owner),   \n        Print(spiral._color(Blue, rule.name), \"   /  \", \n\t      spiral._color(DarkBlue, rule.owner), \"\\n\"),\n    Print(spiral._color(Blue, rule.name), \"\\n\")\n);\n\n_dbgRuleBelongsTo := (rule, rset) -> \n    IsBound(rule.owner) and (rule.owner in rset);\n\n#F DebugRewriting(<rsets.)\nDebugRewriting := function(rsets)\n    if rsets=true then\n        rewrite.RuleTrace := rule -> _dbgPrintRuleName(rule); \n        rewrite.RuleStatus := (rule, hd, str) -> Print(\n\t    spiral._color(Yellow, hd), ApplyFunc(Print, str));\n    elif rsets=false then\n        rewrite.RuleTrace := Ignore;\n        rewrite.RuleStatus := Ignore;\n    else\n\t\tif not IsList(rsets) then \n\t\t\trsets := [rsets];\n\t\tfi;\n        rewrite.RuleTrace := rule -> \n\t\t\tWhen(_dbgRuleBelongsTo(rule, rsets), _dbgPrintRuleName(rule));\n        rewrite.RuleStatus := (rule, hd, str) -> \n\t\t\tWhen(_dbgRuleBelongsTo(rule, rsets), \n\t\tPrint(spiral._color(Yellow, hd), ApplyFunc(Print, str)));\n    fi;\nend;\n\nDebugRuleStrategies := function(switch)\n    Constraint(IsBool(switch));\n    if switch then\n        rewrite.RuleTrace := rule -> _dbgPrintRuleName(rule); \n        rewrite.RuleStrategyTrace := (i, rset, expr) -> Print(\n\t\t\tspiral._color(Red, i), \n\t\t\tspiral._color(Red, \" ----------------\\n\"), \n\t\t\trset, \"\\n\",\n\t\t\tDoc(rset), \n\t\t\texpr, \"\\n\"); \n    else\n        rewrite.RuleTrace := Ignore;\n        rewrite.RuleStrategyTrace := Ignore;\n    fi;\nend;\n\n", "meta": {"hexsha": "11bda0f40687cf3f1f6a8abacb6ab2d6f93b20e7", "size": 1532, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/rewrite/debug.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/rewrite/debug.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/rewrite/debug.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.9056603774, "max_line_length": 65, "alphanum_fraction": 0.6207571802, "num_tokens": 434, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2909808785120009, "lm_q2_score": 0.052618959104614414, "lm_q1q2_score": 0.015311110946647749}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Option Records\n# ==============\n\n#F SPL Options Records\n#F -------------------\n\n#F An spl options record is used to collect options passed to the\n#F spl compiler by functions that communicate with the spl compiler,\n#F such as measure, verify, and search functions.\n#F\n#F There is a system wide options record, SpiralDefailts (set in config.g),\n#F which sets the default values.\n#F\n#F An spl options record is a record, which contains a subset of the \n#F following fields. Adding a new fields requires to change the\n#F functions PrintSpecSPLOptionsRecord, CheckSPLOptionsRecord, and\n#F MakeSPLCallSPLOptionsRecord.\n#F\n#F rec(\n#F   customDataType  = \"int_cplx\" | \"int_fpN\" | \"Ipp16sc\" (XScale) | \"Ipp32sc\" (XScale)\n#F                                     where N - number of fractional bits, i.e. int_fp8\n#F   zeroBits        = zero | <positive int>\n#F   dataType        = \"real\" | \"complex\",\n#F   precision       = \"single\" | \"double\" | \"extended\"\n#F   subName         = <string>\n#F   schedule        = <integer>\n#F   globalUnrolling = <positive int> | \"none\" | \"full\",\n#F   language        = \"fortran\" | \"c\"    # see config.g for languages\n#F   compiler        = not to be used\n#F   compflags       = <flags for compiler as string>\n#F   splflags        = <flags for spl compiler as string>\n#F )\n#F\n#F Note: switching language automatically switches compilers\n#F and flags.\n#F \n#F spl options records should be used as follows:\n#F - create your desired spl options record R\n#F - merge with defaults, R1 := MergeSPLOptionsRecord(R)\n#F - create spl prog for external operations with ProgSPL(SPL, R)\n#F\n\n\n#F CheckSPLOptionsRecord ( <spl-options-record> )\n#F   checks whether <spl-options-record> is a valid spl options record\n#F   with valid spl options set. If a field name or a field value\n#F   is invalid, then an error is signaled, otherwise true is\n#F   returned.\n#F\nCheckSPLOptionsRecord := function ( R )\n  local r;\n  if not IsRec(R) then Error(\"<R> must be an spl options record\"); fi;\n\n  for r in RecFields(R) do\n    Cond(r = \"dataType\",\n        Constraint(R.dataType in [\"no default\", \"real\", \"complex\"]),\n         r = \"customDataType\",\n        Constraint(IsString(R.customDataType)),\n         r = \"customReal\",\n        Constraint(IsString(R.customReal)),\n         r = \"customComplex\",\n        Constraint(IsString(R.customComplex)),\n     r = \"zeroBits\",\n        Constraint(IsInt(R.zeroBits) and R.zeroBits >= 0),\n         r = \"precision\",\n            Constraint(R.precision in  [\"single\", \"double\", \"extended\"]),\n         r = \"subName\",\n        Constraint(IsString(R.subName)),\n         r = \"file\",\n        Constraint(IsString(R.file)),\n         r = \"schedule\",\n        Constraint(IsInt(R.schedule) and R.schedule > 0),\n         r = \"globalUnrolling\",\n        Constraint(\n        (IsInt(R.globalUnrolling) and R.globalUnrolling > 0)\n        or R.globalUnrolling in [\"none\", \"full\"]),\n         r = \"compiler\",\n        Constraint(IsString(R.compiler)),\n         r = \"compflags\",\n        Constraint(IsString(R.compflags)),\n         r = \"dmpcompflags\",\n        Constraint(IsString(R.dmpcompflags)),\n       r = \"faultTolerant\", \n        Constraint(IsBool(R.faultTolerant)),\n     r = \"cgen\", \n        Constraint(IsFunc(R.cgen)),\n     r = \"x\" or IsSystemRecField(r), \n        Ignore(),\n     0); # do nothing if field is unrecognized\n  od;\n\n  return true;\nend;\n\n\n#F MergeSPLOptionsRecord ( <spl-options-record> )\n#F   returns the option record obtained by starting with SpiralDefaults\n#F   (config.g, set at installation) and merging or overwriting with the\n#F   spl options given by <spl-options-record>\n#F\nMergeSPLOptionsRecord := R -> Checked(CheckSPLOptionsRecord(R), \n    CopyFields(SpiralDefaults, R)\n);\n", "meta": {"hexsha": "2308bf35e2f5babcaacbacbad35b6772196e7a4d", "size": 3792, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/optrec.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/optrec.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/optrec.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.7889908257, "max_line_length": 88, "alphanum_fraction": 0.6395042194, "num_tokens": 1001, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3007455914759599, "lm_q2_score": 0.05033063081688277, "lm_q1q2_score": 0.015136715334381585}}
{"text": "\n# Copyright 2018-2019, Carnegie Mellon University\n# See LICENSE for details\n\nupdate_type := function(vars, newType)\n  vars.t := newType;\nend;\n\n\nUnique := (lst) -> \n       FoldL(lst, (b, a)->Concat( b, When(not a in b, [a], [])), []);\n\nSubstList:= function(expr, list_match, list_replace)\n   local new_expr, index;\n   new_expr := expr;\n   for index in [1..Length(list_match)] do\n     new_expr := SubstBottomUp(new_expr, @(2).cond(dc->dc=list_match[index]), x->list_replace[index]);\n   od;\n   return new_expr;\nend;\n\n\n\nClass(RulesStateHCOL, RuleSet, rec(inType := \"SigmaSPL\", outType := \"SigmaSPL\"));\nRewriteRules(RulesStateHCOL, rec(\n   Constant_PointWise := ARule(OLCompose, [@(1, PointWise, e->Length(Collect(e.op.expr, e.op.vars[1]))=0), @(2)], e->[@(1).val])\n));\n\n\nClass(RulesTerminateReductionHCOL, RuleSet, rec(inType := \"SigmaSPL\", outType := \"SigmaSPL\"));\nRewriteRules(RulesTerminateReductionHCOL, rec(\n     Reduction_GathH := ARule(OLCompose, [@(1, Reduction), @(2, GathH)], \n       e->[ let(o:= @(1).val, i:= Ind(o.N), \n        ISumReduction(i, o.N, o.op, o.idval, o.isSaturated, eT(@(2).val.N, add(i*@(2).val.stride, @(2).val.base)))) ]),\n\n    Reduction_terminate := Rule(@(1, Reduction), e->let(o:= @(1).val, i := Ind(o.N), \n        ISumReduction(i, o.N, o.op, o.idval, o.isSaturated, eT(o.N, i)))),  \n\n\tScat1Union_Gath1 := ARule(OLCompose, [@(1, ScatHUnion, e1->e1.n=1), @(2, GathH, e2->e2.n=1)], \n\t\te->[ let(\n\t\tPrint(\"Scat1Union_Gath1: \", @(1).val.N, \" \", @(1).val.base, \" \", @(2).val.N, \" \", @(2).val.base,\"\\n\"),\n\t\tOLCompose(\n\t\t  eUnion(@(1).val.N, @(1).val.base),\n\t      eT(@(2).val.N, @(2).val.base)\n\t\t)\n\t)]),\n\t\t\n    ScatHUnion_GathH := ARule(OLCompose, [@(1, ScatHUnion), @(2, GathH)], \n        e->[let( i:= Ind(@(1).val.n),\t\n\t  ISumUnion(i, @(1).val.n,\n\t    OLCompose(\n\t      eUnion(@(1).val.n, @(1).val.base+@(1).val.stride*i),\n\t      eT(@(2).val.n, @(2).val.base+@(2).val.stride*i)\n\t    )\n\t  )\n\t)]),\n\n    GathH0_terminate := Rule(@(1, GathH, e->e.n=0), e->eT(0, -1)),\n    GathH1_terminate := Rule(@(1, GathH, e->e.n=1), e->eT(@(1).val.N, @(1).val.base)),\n    GathHN_terminate := Rule(@(1, GathH, e->e.n>1), \n        e-> let(i := Ind(@(1).val.n), \n\t    \t  ISumUnion(i, @(1).val.n, \n\t\t    OLCompose(\n\t\t\teUnion(@(1).val.n, i), \n\t\t\teT(@(1).val.N, @(1).val.base+@(1).val.stride*i))))),  \n\n    ScatHUnion0_terminate := Rule(@(1, ScatHUnion, e->e.n=0), e->eUnion(0,-1)),   #eUnion(@(1).val.N, @(1).val.base)),\n    ScatHUnion1_terminate := Rule(@(1, ScatHUnion, e->e.n<=1), e->eUnion(@(1).val.N, @(1).val.base)),\n    ScatHUnionN_terminate := Rule(@(1, ScatHUnion, e->e.n>1), \n        e-> let(i := Ind(@(1).val.n), \n\t       ISumUnion(i, @(1).val.n, \n \t         OLCompose(\n\t\t\teUnion(@(1).val.N, @(1).val.base+@(1).val.stride*i), \n\t\t\teT(@(1).val.n, i)\n\t         )\n               ))\n    ) ));\n\n\nClass(RulesSumsHCOLv2a, RuleSet, rec(inType := \"SigmaSPL\", outType := \"SigmaSPL\"));\nRewriteRules(RulesSumsHCOLv2a, rec(\n    OLCompose_Assoc := ARule(OLCompose, [ @(1,OLCompose) ],  e -> @(1).val.children() ),\n    OLCompose_PointWise_PointWise := ARule(OLCompose, [ @(1, PointWise), @(2, PointWise) ],\n        e -> [ PointWise(@(1).val.N, Lambda(@(2).val.op.vars, SubstVars(Copy(@(1).val.op.expr),\n         rec((@(1).val.op.vars[2].id) := @(2).val.op.vars[2], (@(1).val.op.vars[1].id) := @(2).val.op.expr)))) ]),\n    GathH_GathH := ARule(OLCompose, [@(1, GathH), @(2, GathH)],\n        e -> [GathH(@(2).val.N, @(1).val.n, @(1).val.base+@(2).val.base, @(1).val.stride*@(2).val.stride)]),\n    Reduction_ScatHUnion := ARule(OLCompose, [ @(1, Reduction), @(2, ScatHUnion, e->e.n=1) ], e->[]),\n    PointWise_BinOp := ARule(OLCompose, [@(1, PointWise, e->e.N=1), @(2, BinOp, e->e.N=1)],\n        e -> [BinOp(1,Lambda(@(2).val.op.vars, @(1).val.op.at(@(2).val.op.expr, V(0))))]),    \n    PointWise_ISumUnion :=  ARule(OLCompose, [ @(1, PointWise), @(2, ISumUnion) ],\n        e -> [ CopyFields(@(2).val, rec(\n            _children :=  List(@(2).val._children, c -> OLCompose(@(1).val, c)),\n            dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n    PointWise_ScatHUnion := ARule(OLCompose, [@(1,PointWise), @(2, ScatHUnion)],\n        e -> let(i := Ind(@(2).val.dims()[2]), [@(2).val, PointWise(@(2).val.dims()[2], \n            Lambda([@(1).val.op.vars[1], i], SubstVars(@(1).val.op.expr, rec((@(1).val.op.vars[2].id) := i*@(2).val.stride+@(2).val.base))))])),\n    ISumXXX_YYY := ARule(OLCompose, [ @(1, [ISumUnion, ISumReduction]), @(2, [GathH, PointWise, Induction, eT]) ],\n        e -> [ CopyFields(@(1).val, rec(\n            _children :=  List(@(1).val._children, c -> OLCompose(c, @(2).val)),\n            dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n    SUMUnion_GathH := ARule(OLCompose, [@(1, SUMUnion), @(2, GathH)], \n       e ->[SUMUnion(List(@(1).val._children, c->OLCompose(c, @(2).val)))] ),\n    ScatHUnion_SUMUnion := ARule(OLCompose, [ @(1, ScatHUnion), @(2, SUMUnion) ],    \n        e -> [SUMUnion(List(@(2).val._children, c->OLCompose(@(1).val,c)))] ),\n    ScatHUnion_ISumUnion := ARule(OLCompose, [@(1, ScatHUnion), @(2, ISumUnion)], \n        e -> [ISumUnion(@(2).val.var, @(2).val.domain, OLCompose(@(1).val, @(2).val._children[1]))]),\n    ScatHUnion_ScatHUnion := ARule(OLCompose, [@(1, ScatHUnion), @(2, ScatHUnion)], \n        e -> [ScatHUnion(@1.val.N, @(2).val.n, @(1).val.base+@(2).val.base, @(2).val.stride)] ),\n    SUMUnion_Assoc := ARule(SUMUnion, [@(1, SUMUnion) ], e->@(1).val.children())\n));\n\nClass(RulesSumsHCOLv2b, RuleSet, rec(inType := \"SigmaSPL\", outType := \"SigmaSPL\"));\nRewriteRules(RulesSumsHCOLv2b, rec(\n    OLCompose_Assoc := ARule(OLCompose, [ @(1,OLCompose) ],  e -> @(1).val.children() ),\n    OLCompose_PointWise_PointWise := ARule(OLCompose, [ @(1, PointWise), @(2, PointWise) ],\n        e -> [ PointWise(@(1).val.N, Lambda(@(2).val.op.vars, SubstVars(Copy(@(1).val.op.expr),\n         rec((@(1).val.op.vars[2].id) := @(2).val.op.vars[2], (@(1).val.op.vars[1].id) := @(2).val.op.expr)))) ]),\n    GathH_GathH := ARule(OLCompose, [@(1, GathH), @(2, GathH)],\n        e -> [GathH(@(2).val.N, @(1).val.n, @(1).val.base+@(2).val.base, @(1).val.stride*@(2).val.stride)]),\n    ISumReduction_PointWise := ARule(OLCompose, [ @(1, ISumReduction), @(2, PointWise) ],\n        e -> [ ISumReduction(@(1).val.var, @(1).val.domain, @(1).val.op, @(1).val.idval, @(1).val.isSaturated,\n                OLCompose(@(1).val._children[1], @(2).val))]),\n\n    eT_Pointwise := ARule(OLCompose, [@(1, eT, e->IsVar(e.base)), @(2, PointWise)],      \n         e -> let(i := Ind(1),\n\t     [PointWise(1, Lambda(\n                SubstVars(Copy(@(2).val.op.vars), rec((@(2).val.op.vars[2].id):=i)),\n                SubstVars(Copy(@(2).val.op.expr), rec((@(2).val.op.vars[2].id):=@(1).val.base)))), @(1).val])),\n    ISumXXX_YYY := ARule(OLCompose, [ @(1, [ISumUnion, ISumReduction]), @(2, [GathH, PointWise, Induction, eT]) ],\n        e -> [ CopyFields(@(1).val, rec(\n            _children :=  List(@(1).val._children, c -> OLCompose(c, @(2).val)),\n            dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n    eT_ISumUnion := ARule(OLCompose, [ @(1, eT), @(2, ISumUnion, e->ObjId(e._children[1]._children[1])=eUnion)],\n        e -> [ Drop(SubstVars(Copy(@(2).val._children[1]._children), rec((@(2).val.var.id) := (@(1).val.base)) ), 1)]),\n    eT_Induction := ARule(OLCompose, [@(1, eT), @(2, Induction)],\n        e -> [Inductor(@(2).val.N, @(1).val.base, @(2).val.op, @(2).val.initval)]),\n  PointWise_ISumUnion :=  ARule(OLCompose, [ @(1, PointWise), @(2, ISumUnion) ],\n        e -> [ CopyFields(@(2).val, rec(\n            _children :=  List(@(2).val._children, c -> OLCompose(@(1).val, c)),\n            dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n   PointWise := ARule(OLCompose, [@(1, PointWise, e->Length(Collect(e.op.expr, e.op.vars[1]))=0), ...],\n       e -> [@(1).val])\n));\n\n\n\n\n\nClass(RulesSumsHCOL, RuleSet, rec(inType := \"SigmaSPL\", outType := \"SigmaSPL\"));\nRewriteRules(RulesSumsHCOL, rec(\n    OLCompose_Assoc := ARule(OLCompose, [ @(1,OLCompose) ],  e -> @(1).val.children() ),\n    OLCompose_PointWise_PointWise := ARule(OLCompose, [ @(1, PointWise), @(2, PointWise) ], \n        e -> [ PointWise(@(1).val.N, Lambda(@(2).val.op.vars, SubstVars(Copy(@(1).val.op.expr), \n         rec((@(1).val.op.vars[2].id) := @(2).val.op.vars[2], (@(1).val.op.vars[1].id) := @(2).val.op.expr)))) ]),\n    PointWise_ISumUnion :=  ARule(OLCompose, [ @(1, PointWise), @(2, ISumUnion) ],\n        e -> [ CopyFields(@(2).val, rec(\n            _children :=  List(@(2).val._children, c -> OLCompose(@(1).val, c)),\n            dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n    PointWise_ScatHUnion := ARule(OLCompose, [@(1,PointWise), @(2, ScatHUnion)],\n        e -> let(i := Ind(@(2).val.dims()[2]), [@(2).val, PointWise(@(2).val.dims()[2], \n            Lambda([@(1).val.op.vars[1], i], SubstVars(@(1).val.op.expr, rec((@(1).val.op.vars[2].id) := i*@(2).val.stride+@(2).val.base))))])),\n    Reduction_ISumReduction :=  ARule(OLCompose, [ @(1, Reduction), @(2, ISumUnion) ],\n        e -> [ ISumReduction(@(2).val.var, @(2).val.domain, @(1).val.op, @(1).val.idval, @(1).val.isSaturated,\n               OLCompose(@(1).val, @(2).val._children[1]))]),\n    Reduction_ScatHUnion := ARule(OLCompose, [ @(1, Reduction), @(2, ScatHUnion, e->e.n=1) ], e->[]),\n    ISumReduction_PointWise := ARule(OLCompose, [ @(1, ISumReduction), @(2, PointWise) ],\n        e -> [ ISumReduction(@(1).val.var, @(1).val.domain, @(1).val.op, @(1).val.idval, @(1).val.isSaturated,\n                OLCompose(@(1).val._children[1], @(2).val))]),\n    eT_Pointwise := ARule(OLCompose, [@(1, eT, e->IsVar(e.base)), @(2, PointWise)], \n        e -> let(i := Ind(1), \n            [PointWise(1, Lambda(\n                SubstVars(Copy(@(2).val.op.vars), rec((@(2).val.op.vars[2].id):=i)),\n                SubstVars(Copy(@(2).val.op.expr), rec((@(2).val.op.vars[2].id):=@(1).val.base)))), @(1).val])),\n    ISumXXX_YYY := ARule(OLCompose, [ @(1, [ISumUnion, ISumReduction]), @(2, [GathH, PointWise, Induction, eT]) ],\n        e -> [ CopyFields(@(1).val, rec(\n            _children :=  List(@(1).val._children, c -> OLCompose(c, @(2).val)),\n            dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n    GathH_GathH := ARule(OLCompose, [@(1, GathH), @(2, GathH)],\n        e -> [GathH(@(2).val.N, @(1).val.n, @(1).val.base+@(2).val.base, @(1).val.stride*@(2).val.stride)]),\n    PointWise_BinOp := ARule(OLCompose, [@(1, PointWise, e->e.N=1), @(2, BinOp, e->e.N=1)],\n        e -> [BinOp(1,Lambda(@(2).val.op.vars, @(1).val.op.at(@(2).val.op.expr, V(0))))]),\n    eT_Induction := ARule(OLCompose, [@(1, eT), @(2, Induction)],\n        e -> [Inductor(@(2).val.N, @(1).val.base, @(2).val.op, @(2).val.initval)]),\n    ScatHUnion_ScatHUnion := ARule(OLCompose, [@(1, ScatHUnion), @(2, ScatHUnion)], \n        e -> [ScatHUnion(@1.val.N, @(2).val.n, @(1).val.base+@(2).val.base, @(2).val.stride)] )\n));\n\nClass(ToVectors, HierarchicalVisitor, rec(\n    __call__ := meth(arg)\n    local res;\n        res := ApplyFunc(arg[1].visit, arg{[2..Length(arg)]});\n       return res;\n    end,\n    PointWise := (self, o, opts) >> let(\n      new_i := Ind(4), new_var := var.fresh_t(\"r\", TReal), times := (o.N - Mod(o.N, 4))/4,\n      DirectSum(\n        List([0..times-1], i->PointWise(4, Lambda([new_var, new_i], new_var*i)) ),\n\tPointWise(Mod(o.N, 4), o.op)\n      ) \n    )\n));\n\nmax_value := var(\"max_val\", TReal);\nmax_err := var(\"max_err\", TReal);\nClass(RulesErrorHCOL, RuleSet, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesErrorHCOL, rec(\n  assign_const := Rule([@(1, assign), @(2, var), @(3, Value, v->v<>0)], \n\t\t\t\t\te->assign(@(2).val, @(3).val+@(3).val*max_err) ),\n  assign_nth := Rule([@(1, assign), @(2, var), @(3, nth)], \n\t\t\t\t\te->assign(@(2).val, max_value+max_value*max_err) )\n));\n\n\nClass(RulesCodeHCOL, RuleSet, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesCodeHCOL, rec(\n#only assignments to state but state is not used\n\n\tsimplify_state := Rule(@@(1, decl, (e, cx)->(\n\t  let(\n\t  Length(Collect(e.cmd, decl))=0 and \n\t  IsBound(cx.opts.state) and\t  \n\t  Length(Collect(e.cmd, @(1,nth).cond(j->IsVar(j.loc) and j.loc.id=cx.opts.state.id))) > 0 and \n\t  Length(Collect(e.cmd, @(1,nth).cond(j->IsVar(j.loc) and j.loc.id=cx.opts.state.id)))=Length(Collect(e.cmd, @(1, assign).cond(i->ObjId(i.loc)=nth and i.loc.loc.id = cx.opts.state.id))) ))),\n\t  (e, cx)-> let(Print(\"Remove State:\\n\", @@(1).val, \"\\n\"), SubstTopDown(@@(1).val, [@(2, assign), @(3, nth).cond(i->i.loc.id=cx.opts.state.id), @(4)], j->skip()))),\t\n\n    chain_chain := Rule(@(1, chain, e->ObjId(e.cmds[1])=chain),   \n        e -> let(chain(Concat(@(1).val.cmds[1].cmds, Drop(@(1).val.cmds, 1))))),\n\n\t#replaces TArray of length one with a scalar variable\n    scalarize1 := Rule(@(1, decl, e->Length(Filtered(e.vars, i->ObjId(i.t)=TArray and i.t.size=1))>=1),\n        e->let(\t\t\t\t\t\t\t\n\t\t\toldvar := Filtered(e.vars, i->ObjId(i.t)=TArray and i.t.size=1)[1], \n\t\t\tPrint(\"Scalarizing \", oldvar, \"\\n\"),\n\t\t\n\t\t\ttmp := Collect(@(1).val, [@(5, assign), @(6).cond(ee->IsNth(ee) and ee.loc.id=oldvar.id), @(7)]),\n\t\t\tnewType := UnifyTypes(List(tmp, i->i.exp.t)),\n\t\t\tnewvar := var.fresh_t(\"s\", newType),\n\t\t\tPrint(\"Scalarizing \", oldvar, \" with \", newvar, \" of type: \", newType, \"\\n\"),\n\t\t\t\n\t\t\n            decl(\n                SubstVars(@(1).val.vars, rec((oldvar.id):=newvar)),\n                SubstTopDown(@(1).val.cmd, [@(2, nth), @(3).cond(e->IsVar(e) and e.id=oldvar.id), @(4).cond(e->IsValue(e) and e.v = 0)],\n                    i->newvar)  \n            ))),\n\n\t#replace each fixed index array reference (i.e. nth(X, i), where i is a constant value) with a variable\n\t#This can only be done if there are no array references to X that is variable (this is to prevent potential aliasing)\n    scalarize_const := Rule(@(1, decl, e->Length(Filtered(Filtered(e.vars, j->IsArray(j.t)), k->ForAll(Collect(e.cmd, [@(2, nth), @(3, var, u->u.id=k.id), @(4)]), j->IsValue(j.idx))))>=1),\n        e->let(\n\t\t\toldvar := Filtered(Filtered(e.vars, j->IsArray(j.t)),   #find all array variables\n\t           k->ForAll(Collect(e.cmd, [@(2, nth), @(3, var, u->u.id=k.id), @(4)]), j->IsValue(j.idx)))[1],   #make sure only const index\n\t\t\t \t\t\t\n            newvars := List([1..oldvar.t.size], j->var.fresh_t(\"q\", oldvar.t.t)), \n            cmmd := @(1).val.cmd,\n            lst := List([0..Length(newvars)-1], i->[i, newvars[i+1]]),\n            f := (c,l)->SubstTopDown(c, [@(2, nth), @(3).cond(k->IsVar(k) and k.id=oldvar.id), @(4).cond(j->IsValue(j) and j.v = l[1])], i->l[2]),\n            Print(\"Scalarize_const: \",oldvar,\":: \", newvars, \"\\n\"),\n            decl(Concat(Filtered(@(1).val.vars, j->j.id <> oldvar.id), newvars), FoldL(lst, f, cmmd))\n        )),\n\t\t\n    chain_xyz_chain := ARule(chain, [@(1), @(2, chain)], \n        e->[chain(Concat([@(1).val], @(2).val.cmds))]),\n    chain_chain_xyz := ARule(chain, [@(1, chain), @(2)], \n        e->[chain(Concat(@(1).val.cmds), [@(2).val])]),\n\n    chain_creturn := ARule(chain, [@(1, creturn), @(2)], \n        e->[chain(Concat([@(2).val], [@(1).val]))] ),\n\n    loop_pull_cond_1 := Rule([@(1, loop), @(2), @(3), [@(4, chain),  [@(5, assign), @(6,var), \n            [@(7,cond), @(8,eq, e->e.args[1]=@(2).val and e.args[2].v=0), @(9), @(10)]],...]],\n        e->let(\n\t   chain(assign(@(6).val, @(9).val), loop(@(1).val.var, @(1).val.range, chain([assign(@(6).val, @(10).val)]::Drop(@(4).val.cmds,1)))))),\n\n\t   copyprop_var_val := Rule(@(1, decl, e->let(\n\t\t   #only propagate values if the variable is SSA and only if it is within a basic block\n\t\t   cnds := Collect(e.cmd, [assign, @(2, var, ee->ee in e.vars), @(3, Value)]),\n\t\t   actual_cnds := Filtered(cnds, i->Length(Collect(e.cmd, [assign, @(8, var, ee->ee.id = i.loc.id), @(9)]))=1),\n\t\t   #Print(\"CopyProp: \", cnds, \"\\n\\n\", e.cmd, \"\\n\\n\", actual_cnds, \"\\n\"),\n\t\t   Length(actual_cnds) >= 1 and Length(Collect(e.cmd, [assign, @(4, var, ee->ee.id = actual_cnds[1].loc.id), @(5)]))=1)),\n\t\te->let(\t\t\t\n\t\t\tall_assigned_value := Collect(@(1).val.cmd, [assign, @(6, var, ee->ee in e.vars), @(7, Value)]),\n\t\t\tassigned_var_value := Filtered(all_assigned_value, i->Length(Collect(@(1).val.cmd, [assign, @(8, var, ee->ee.id = i.loc.id), @(9)]))=1)[1],\n\t\t   #Print(\"CopyProp_value: \", assigned_var_value, \"\\n\"),\n\t\t\tdecl(Filtered(@(1).val.vars, j->j.id<>assigned_var_value.loc.id), \n\t\t\t\t SubstVars(@(1).val.cmd, rec((assigned_var_value.loc.id) := assigned_var_value.exp)))\n\t\t)\n       ),\n\n\t   copyprop_var_var := Rule(@(1, decl, e->let(\n\t\t   #only propagate var if the assigned variable is SSA\n           cnds := Collect(e.cmd, [assign, @(2, var, ee->ee in e.vars), @(3, var, e->e.id<>@(2).val.id)]),\n           Length(cnds)>=1 and cnds[1].loc in e.vars and Length(Collect(e.cmd, [assign, @(4, var, ee->ee.id=cnds[1].loc.id), @(5)]))=1)), \n        e->let(\t\t\t\t\n\t\t\t   acnds := Collect(@(1).val.cmd, [assign, @(7, var, ee->ee in e.vars), @(8, var, e->e.id<>@(7).val.id)]), \n\t\t\t   atests := Collect(e.cmd, [assign, @(9, var, ee->ee.id=acnds[1].loc.id), @(5)]),\n\t\t\t   a := atests[1],\n\t\t\t   decl(Filtered(@(1).val.vars, j->j <>a.loc), SubstVars(@(1).val.cmd, rec((a.loc.id) := a.exp))))),\n\n    drop_selfassign_var := ARule(chain, [@(1, assign, e->IsVar(e.loc) and IsVar(e.exp) and e.exp=e.loc), @(2)], \n        e->let(\n\t\t[@(2).val])), \n\t\n    drop_selfassign2 := ARule(chain, [@(1, assign, e->e.exp=e.loc), @(2)], \n        e->[@(2).val]), \n\n\t\n\t#this drops unused variables i.e. variables that are declared but not used.\n    drop_unused_var := Rule(@(1, decl, e-> let(v := Collect(e.cmd, var), Filtered(e.vars, k->not k in v))<> []),\n        e->let(v := Collect(@(1).val.cmd, var), \n            decl(Filtered(@(1).val.vars, k->k in v), @(1).val.cmd))),\n\n\tdrop_unused_assign := Rule(@(1, decl, e->\n\t\t\tFiltered(List(e.vars, v->Collect(e.cmd, v)), l->Length(l)=1)<>[]) , \n\te->let(\n      unused := Filtered(List(e.vars, v->Collect(e.cmd, v)), l->Length(l)=1)[1],\n\t  empty_list := List([1..Length(unused)], i->skip()),\n\t  target_list := Filtered(Collect(@(1).val.cmd, assign), a->a.loc in unused),\n\t  Print(\"Unused assignements:\\n\", target_list, \"\\n\\n\"),\t  \n\t  decl(Filtered(@(1).val.vars, k->not k in unused), SubstList(@(1).val.cmd, target_list, empty_list))\n\t)),\t\t\t\n\t\t\t\n    loop_decl := Rule(@(1, loop, e->ObjId(e.cmd)=decl and Length(Collect(e.cmd, decl))=1 and Length(Collect(e.cmd, chain))<=1), \n        e -> decl(@(1).val.cmd.vars, loop(@(1).val.var, @(1).val.range, @(1).val.cmd.cmd))),\n\n    chain_xyz_decl := ARule(chain, [@(1), @(2, decl)], \n        e->[decl(@(2).val.vars, chain(@(1).val, @(2).val.cmd))]),\n\n    chain_decl := Rule(@(1, chain, e->ObjId(e.cmds[1])=decl), \n        e -> decl(@(1).val.cmds[1].vars, chain(Concat([@(1).val.cmds[1].cmd], Drop(@(1).val.cmds, 1))))),\n    decl_decl := Rule(@(1, decl, e->ObjId(e.cmd)=decl), \n        e -> decl(Set(Concat(@(1).val.vars, @(1).val.cmd.vars)), @(1).val.cmd.cmd)),\n));\n\n\nClass(RulesHCOLnoAbsMax, RuleSet, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesHCOLnoAbsMax, rec(\n    abs_cond := Rule([@(1, assign), @(2), @(3, abs)], \n        e->let(s := var.fresh_t(\"w\", @(3).val.t), decl(s, chain(assign(s, @(3).val.args[1]), assign(@(1).val.loc, cond(geq(s, V(0)), s, neg(s))))))),\n    max_cond := Rule(@(1, max), \n        e->cond(geq(@(1).val.args[1], @(1).val.args[2]), @(1).val.args[1], @(1).val.args[2])),\n));\n\nClass(RulesUnrollHCOL, RuleSet, RulesStrengthReduce, RulesCodeHCOL, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesUnrollHCOL, rec(\n    unroll_wo_decl := Rule(@@(1, [loopn, loop], \n       (e, cx) -> Length(Collect(e.cmd, loop))=0 and\n                  Length(Collect(e.cmd, decl))=0 and\n\t          e.var.range <= When(IsBound(cx.opts) and IsBound(cx.opts.globalUnrolling),\n\t\t       \t                                           cx.opts.globalUnrolling,\n                                              5)),\n       (e,cx)->let(i := @@(1).val.var, \n\t               rng := @@(1).val.range, \n\t\t       vvars := Filtered(Collect(@@(1).val.cmd, var), j->j.t in [TReal, TDouble]),\n\n           chain(\t      \n\t      List(rng, j->let( \n\t\t    ssvars := FoldL([[i, V(j)]], (b, a)->CopyFields(rec((a[1].id):= a[2]), b), rec()),\n\t\t    new_cmd := SubstVars(Copy(@@(1).val.cmd), ssvars),\n \t\t    new_cmd )) \n    ))) ,\t\t\t       \n    unroll_w_decl := Rule(@@(1, [loop, loopn], \n           (e,cx)->Length(Collect(e.cmd, loop))=0 and \n\t\t\t\t   Length(Collect(e.cmd, decl))=1 and\n\t           e.var.range <= When(IsBound(cx.opts) and IsBound(cx.opts.globalUnrolling),\n           \t                                          cx.opts.globalUnrolling,\n                                              5)),\n           (e,cx)->let(i := @@(1).val.var, \n\t               rng := @@(1).val.range, \n\t\t       vvars := Filtered(Collect(@@(1).val.cmd, var), j->j.t in [TReal, TDouble]),\n\t\t       \n\t\t       localvar := Collect(@@(1).val.cmd, decl)[1].vars,  \n\n           chain(\t      \n\t      List(rng, j->let( \n\n\t      \t\t        nvars :=FoldL(localvar, (b,a)->Concat([[a, var.fresh_t(\"u\", a.t)]], b), [[i, V(j)]] ),\n\t      \t\t        ssvars := FoldL(nvars, (b, a)->CopyFields(rec((a[1].id):= a[2]) , b), rec()),\n\t\t\t\t\t\tsvars := FoldL(nvars, (b, a)->Concat( When(IsVar(a[2]) or a[2] in b, [a[2]], []), b), []),\n\n\t\t\t\tnew_cmd := SubstVars(Copy(@@(1).val.cmd.cmd), ssvars),\n\n\t\t\t\tdecl(svars, new_cmd) )\n\n                                #decl(svars, new_cmd ) )\n             ))\n\t  )\n   )\t\n));\n\nRewriteRules(RulesStrengthReduce, rec(\n\taddsub00 := Rule([@(1, addsub_2x64f), @(2).cond(e->Cond(IsValue(e), isValueZero(e), e=0)), _0], \n\t\te->@(2).val)\n));\n\nClass(RulesUnifyType, RuleSet, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesUnifyType, rec(\n    unify_value := Rule(@(1,assign, e-> IsValue(e.exp) and IsVar(e.loc) and e.loc.t <> e.exp.t),\n                        e->let(\n                            newtype := UnifyTypes([@(1).val.exp.t, e.loc.t]),\n                            Print(\"Unifying Type from a value to \", newtype,\"\\n\"),\n                            #if the newtype is the same as the loc, then need to cast the value\n                            #else error, upcast the type of the variable since we are losing info.\n                            Cond(newtype=e.loc.t, \n                            assign(@(1).val.loc, tcast(newtype, @(1).val.exp)),\n                            let(\n                            update_type(@(1).val.loc, newtype),\n                            assign(@(1).val.loc, @(1).val.exp)\n                            ))\n                        )),\n\tunify_vartype := Rule(@(1,assign,e->IsVar(e.loc) and not IsValue(e.exp) and e.loc.t <> e.exp.computeType()),\n\t   e->let(\n\t\t  oldtype := @(1).val.exp.t,\n\t\t  newtype := @(1).val.exp.computeType(),\n\t\t  Print(\"Unifying Type from \", oldtype, \" to \", newtype,\"\\n\"),\n\t\t  update_type(@(1).val.loc, newtype),\n\t\t  assign(@(1).val.loc, @(1).val.exp)\n\t   )),\n));\nRulesTypeHCOL := CopyFields(MergedRuleSet(RulesUnifyType), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\n\n\nRulesOrigCodeUnrollHCOL := CopyFields(MergedRuleSet(RulesUnrollHCOL, RulesStrengthReduce, RulesCodeHCOL, RulesHCOLnoAbsMax), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\n\nRulesCodeUnrollHCOL := CopyFields(MergedRuleSet( RulesUnrollHCOL, RulesStrengthReduce,  RulesCodeHCOL, RulesHCOLnoAbsMax), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\n\nRulesCodeNoUnrollHCOL := CopyFields(MergedRuleSet(RulesStrengthReduce, RulesCodeHCOL, RulesHCOLnoAbsMax), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\n#changes behaviour so that Spiral outputs abs(a) and max(a,b) C-code instead of \"(a >= b) ? a : b\"\nRulesCodeUnrollHCOLuseAbsMaxSR := CopyFields(MergedRuleSet(RulesUnrollHCOL, RulesStrengthReduce, RulesCodeHCOL), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\n", "meta": {"hexsha": "6b5c1fd06dd8e0a44214f42eb890206305b862d7", "size": 23665, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "rewrite.gi", "max_stars_repo_name": "spiral-software/spiral-package-hcol", "max_stars_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "rewrite.gi", "max_issues_repo_name": "spiral-software/spiral-package-hcol", "max_issues_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "rewrite.gi", "max_forks_repo_name": "spiral-software/spiral-package-hcol", "max_forks_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-26T05:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T05:21:02.000Z", "avg_line_length": 53.5407239819, "max_line_length": 191, "alphanum_fraction": 0.544897528, "num_tokens": 8085, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.44552953503957277, "lm_q2_score": 0.033589508431438486, "lm_q1q2_score": 0.014965118073666598}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Higher-order functions support\n#\n\n# Functional expression base class\nClass(FuncExp, Exp, rec(\n    isFuncExp := true,\n\n    at := arg >> let(\n\tself := arg[1],\n\tCond(Length(arg)=2 and IsList(arg[2]), \n\t     ApplyFunc(fcall, [self] :: arg[2]),\n\t     ApplyFunc(fcall, arg))),\n\n    mkVars := self >> \n        List(DropLast(self.computeType().params, 1), x->var.fresh_t(\"q\", x)),\n\n    getRankType := (self, r) >> let(\n\tt := self.computeType(),\n\trank := Length(t.params)-2,\n\tCond(r > rank,\n\t         TDummy, \n\t     t.params[ Length(t.params) - 1 - r ])\n    )\n));\n\nFunction.mkVars      := FuncExp.mkVars;\nFunction.getRankType := FuncExp.getRankType;\n\nSymbolic.mkVars      := FuncExp.mkVars;\nSymbolic.getRankType := FuncExp.getRankType;\n\nIsFuncExp := o -> IsRec(o) and \n    ((IsBound(o.isFuncExp) and o.isFuncExp) or (IsBound(o.t) and ObjId(o.t)=TFunc));\n\n# Same as IsFuncExp(<o>) but returns false for param's with t = TFunc \n# (these are considered 'trivial')\nIsNonTrivFuncExp := o -> IsRec(o) and (IsBound(o.isFuncExp) and o.isFuncExp);\n\n\n# !!! Below is no longer needed/used, autolib handles this via Parametrizer\n# These are hacks for dealing with types which are integers like 2\n# these really mean the range of an integer variable\n# _convType converts 2 to TInt not to confuse other parts of the system\n#\n\n# !!! Below is no longer needed/used, autolib handles this via Parametrizer\n#_convType := t -> Cond(IsSymbolic(t) or IsInt(t) or IsValue(t), TInt,                        \n#    SubstBottomUp(Copy(t), TFunc, \n#        e -> ApplyFunc(TFunc, List(e.params, p -> When(IsInt(p) or IsSymbolic(p) or IsValue(p), TInt, p)))));\n_convType := t->t; \n\n# !!! Below is no longer needed/used, autolib handles this via Parametrizer\n#_convTypeExp := t -> \n#    SubstBottomUp(Copy(t), TFunc, \n#        e -> ApplyFunc(TFunc, List(e.params, p -> When(IsInt(p) or IsSymbolic(p) or IsValue(p), TInt, p))));\n_convTypeExp := t->t;\n\n\n#F fcurry(<func>, <pos>, <arg>) - symbolic representation of function currying\n#F     Given a function with n arguments returns a functino with n-1 arguments\n#F     where <arg> is plugged into position <pos> \n#F\n#F Example: p := param(TFunc(TInt, 4, TComplex), \"p\");  # ie. rank-1 4-elt diagonal func\n#F          i1 := Ind(4);\n#F          fcurry(p, 1, i1).t; \n#F            => TFunc(4, TComplex);\n#F\nClass(fcurry, FuncExp, rec(\n    computeType := self >> let(\n        n := self.args[2],\n        ct := self.args[1].computeType(), \n        Checked(IsValue(n), ObjId(ct)=TFunc, n.v < Length(ct.params),\n            ApplyFunc(TFunc, ListWithout(ct.params, n.v)))),\n\n    eval := self >> let(\n        torig := self.args[1].t.params, \n        tcurried := self.t.params,\n        n := self.args[2].v,\n        vars := List([1..Length(tcurried)-1], i -> var.fresh_t(\"q\", tcurried[i])),\n        plugin := List([1..Length(torig)-1], i -> Cond(i<n, vars[i], i=n, self.args[3],vars[i-1])),\n        Lambda(vars, ApplyFunc(fcall, Concatenation([self.args[1].eval()], plugin)))),\n\n    at := (self, i) >> self.eval().at(i)\n));\n\n#F flift(<func>, <t>) - symbolic representation of function \"lifting\"\n#F\n#F  Given a function with n arguments returns a function with n+1 arguments,\n#F  extra argument is of type <t> and is the \"one but last\" argument of new function.\n#F  It is the ignored when computing the value of the function.\n#F\n#F  The purpose of flift is to increase the rank of functions. It implicitly creates\n#F  a new inner loop, which loop variable is ignored. This is needed for rewrite rules\n#F  like GT(T, ..) * Gath(f) -> GT(T*Gath(f), ...), where f is pulled into the loop.\n#F\nClass(flift, FuncExp, rec(\n    computeType := self >> let(ct := self.args[1].computeType(), Checked(\n        ObjId(ct)=TFunc, IsType(self.args[2]),\n        let(tt := ct.params, n := Length(tt), \n        ApplyFunc(TFunc, Concatenation(tt{[1..n-2]}, [self.args[2]], tt{[n-1..n]}))))), \n\n    # NOTE: define what exactly .lambda() does in these cases\n    lambda := self >> self.eval(),\n\n    eval := self >> let(vars := List(DropLast(self.t.params,1), x->var.fresh_t(\"q\", x)), n := Length(vars),\n        Lambda(vars, ApplyFunc(fcall, Concatenation([self.args[1].eval()], ListWithout(vars, n-1)))))\n));\n\n#F fsplit(<func>, <loopid>, <inner_its>, <outer_its>)\nClass(fsplit, FuncExp, rec(\n    computeType := self >> let(ct := self.args[1].computeType(), Checked(\n        ObjId(ct)=TFunc, IsValue(self.args[2]), self.args[2].t=TInt, \n        let(tt := ct.params, loopid := self.args[2].v, pos := Length(tt)-1-loopid,\n            ApplyFunc(TFunc, Concatenation(tt{[1..pos-1]}, [tt[pos], tt[pos]], tt{[pos+1..Length(tt)]}))))),\n\n    # NOTE: define what exactly .lambda() does in these cases\n    lambda := self >> self.eval(),\n\n    eval := self >> let(\n        vars      := List(DropLast(self.computeType().params, 1), x->var.fresh_t(\"q\", x)),\n        loopid    := self.args[2].v,\n        inner_its := self.args[3], \n        pos       := Length(vars)-loopid,\n        callargs  := vars{[1..pos-2]} :: \n\t             Cond(vars[pos].t=TDummy, [0], [inner_its * vars[pos-1] + vars[pos]]) ::\n                     vars{[pos+1..Length(vars)]},\n        Lambda(vars, ApplyFunc(fcall, Concatenation([self.args[1].eval()], callargs))))\n));\n\n#F frotate(<func>, <n>)\n#F   switch the order of loops (=ranks), by making <n>-th loop innermost\nClass(frotate, FuncExp, rec(\n    computeType := self >> let(ct := self.args[1].computeType(), nn := self.args[2], Checked(\n        ObjId(ct)=TFunc, IsValue(nn), nn.t=TInt, \n\tlet(tt := ct.params, rank := Length(tt)-2, n := nn.v, pos := rank+1-n, \n            Cond(rank=0 or (rank=1 and n=1), ct,\n\t\t n > rank,  \n\t\t            ApplyFunc(TFunc, tt{[1..rank]} :: [TDummy] :: [tt[rank+1], tt[rank+2]]),\n\t\t # else \n                            ApplyFunc(TFunc, tt{[1..pos-1]} :: tt{[pos+1..rank]} :: [tt[pos], tt[rank+1], tt[rank+2]]))))),\n\n    # NOTE: define what exactly .lambda() does in these cases\n    lambda := self >> self.eval(),\n\n    eval := self >> let(f := self.args[1], rank := f.rank(), n := self.args[2].v, pos := rank+1-n, \n\tCond(rank=0 or (rank=1 and n=1), f,\n\t     n > rank, \n             let(vars := List(DropLast(self.computeType().params, 1), x->var.fresh_t(\"q\", x)),\n\t\t Lambda(vars, ApplyFunc(fcall, [f] :: vars{[Length(vars)-1-rank..Length(vars)-2]} :: [Last(vars)]))),\n\t     # else\n             let(vars := List(DropLast(self.computeType().params, 1), x->var.fresh_t(\"q\", x)),\n\t\t Lambda(vars, ApplyFunc(fcall, [f] :: vars{[1..pos-1]} :: [vars[rank]] :: vars{[pos..rank-1]} :: [vars[rank+1]])))\n\t))\n));\n\n\n## Ranked functions support\n## Ranked functions == functions with implicit dependencies on loop variables\n##\n## These are used in paradigms.common.GT and autolib.*\n##\n## NOTE: get rid of _, these functions are not private, but public exports\n##\n_rankManip := (obj, newfunc) >> \n    SubstTopDownNR(Copy(obj), @.cond(e->IsFunction(e) or IsFuncExp(e)), e -> newfunc(e));\n\n_rank     := o -> Cond(\n    IsList(o), Maximum0(List(o, _rank)),\n    not IsRec(o) or not IsBound(o.rank), 0, o.rank());\n_upRank   := o -> Cond(\n    IsList(o), List(o, _upRank),\n    not IsRec(o) or not IsBound(o.upRank), o, o.upRank());\n_upRankNeq0   := o -> Cond(\n    IsList(o), List(o, _upRankNeq0),\n    not IsRec(o) or not IsBound(o.upRank) or o.rank()=0, o, o.upRank());\n_upRankBy := (o,n) -> Cond(IsList(o), # NOTE: =0 ??\n    List(o, x->_upRankBy(x,n)),\n    not IsRec(o) or not IsBound(o.upRankBy) or o.rank()=0, o, o.upRankBy(n));\n_downRank := (o,loopid,ind) -> Cond(\n    IsList(o), List(o, x->_downRank(x, loopid, ind)),\n    not IsRec(o) or not IsBound(o.downRank), o, o.downRank(loopid, ind));\n_downRankFull := (o,inds) -> Cond(\n    IsList(o), List(o, x->_downRankFull(x, inds)),\n    not IsRec(o) or not IsBound(o.downRankFull), o, o.downRankFull(inds));\n_split := (o, loopid, iits, oits) -> Cond(\n    IsList(o), List(o, x->_split(x, loopid, iits, oits)), \n    not IsRec(o) or not IsBound(o.split), o, o.split(loopid, iits, oits));\n_rotate := (o, n) -> Cond(\n    IsList(o), List(o, x->_rotate(x, n)), \n    not IsRec(o) or not IsBound(o.rotate), o, o.rotate(n)); \n\n\n_rch_rank      := self >> Maximum0(List(self.rChildren(), _rank));\n_rch_upRank    := self >> self.from_rChildren(List(self.rChildren(), _upRank));\n_rch_upRankBy  := (self, n) >>  self.from_rChildren(List(self.rChildren(), c->_upRankBy(c,n)));\n_rch_downRank  := (self, loopid, ind) >> \n    self.from_rChildren(List(self.rChildren(), c->_downRank(c,loopid,ind)));\n_rch_downRankFull := (self, inds) >> \n    self.from_rChildren(List(self.rChildren(), c->_downRankFull(c,inds)));\n_rch_split     := (self, loopid, iits, oits) >>  \n    self.from_rChildren(List(self.rChildren(), c->_split(c,loopid, iits, oits)));\n_rch_rotate    := (self, n) >> \n    self.from_rChildren(List(self.rChildren(), c->_rotate(c, n))); \n\n\nSymbolic.domain := self >> Checked(ObjId(self.t)=TFunc, Length(self.t.params) > 1, \n    self.computeType().params[Length(self.t.params)-1]);\n\nSymbolic.range := self >> Checked(ObjId(self.t)=TFunc, Length(self.t.params) > 1,\n    self.computeType().params[Length(self.t.params)]);\n    \nSymbolic.rank := self >> Cond(ObjId(self.t)=TFunc and Length(self.t.params) > 1,\n    Length(self.t.params) - 2, \n    _rch_rank(self));\n\nSymbolic.at := (self, vars) >> Checked(ObjId(self.t)=TFunc, self.lambda().at(vars));\n\nSymbolic.lambda := self >> Checked(ObjId(self.t)=TFunc, let(\n    selft := self.computeType(), \n    vars := List([1..self.rank()+1], x -> let(t:=selft.params[x], \n            Cond(IsType(t), var.fresh_t(\"w\", t), var.fresh(\"w\", TInt, t)))),\n    Lambda(vars, ApplyFunc(fcall, Concatenation([self], vars)))));\n\nSymbolic.upRank := self >> Cond(ObjId(self.t)<>TFunc, _rch_upRank(self), flift(self, TDummy));\n\nSymbolic.upRankBy := (self, n) >> Cond(\n    ObjId(self.t)<>TFunc, _rch_upRankBy(self,n), \n    Checked(IsPosInt0(n), FoldL([1..n], (f, i) -> f.upRank(), self)));\n\nSymbolic.downRankFull := (self, inds) >> Cond(\n    ObjId(self.t)<>TFunc, _rch_downRankFull(self, inds), \n    FoldL(Reversed([1..Minimum(self.rank(), Length(inds))]), (f, i) -> f.downRank(i, inds[i]), self));\n\nSymbolic.downRank := (self, loopid, ind) >> let(rank := self.rank(), Cond(\n    loopid > rank, self, \n    ObjId(self.t)<>TFunc, _rch_downRank(self, loopid, ind),\n    fcurry(self, rank+1-loopid, ind)));  # !! loop variables are ordered with decreasing rank, highest-rank (outermost) is first var\n\nSymbolic.split := (self, loopid, inner_its, outer_its) >> Cond(\n    loopid > self.rank(), self, \n    ObjId(self.t)<>TFunc, _rch_split(self, loopid, inner_its, outer_its),\n    fsplit(self, loopid, inner_its, outer_its));\n\nSymbolic.rotate := (self, n) >> Cond(\n    self.rank() <= 1 and n <= 1, self, \n    ObjId(self.t)<>TFunc, _rch_rotate(self, n), \n    frotate(self, n)); \n\n\n# NOTE: below is really a hack, since the first argument might also have ranked\n# things, although this is not obvious at first glance, an example of such first\n# argument would be fcurry(func, lambdaWrap(rank-n function))\n\nfcall.rank := self >> Cond(ObjId(self.t)=TFunc and Length(self.t.params) > 1,\n    Length(self.t.params) - 2, \n    _rank(Drop(self.args, 1)));\n\nfcall.upRank := self >> Cond(ObjId(self.t)<>TFunc, \n    ApplyFunc(fcall, [self.args[1]] :: _upRank(Drop(self.args, 1))), \n    flift(self, TDummy));\n\nfcall.upRankBy := (self, n) >> Cond(ObjId(self.t)<>TFunc, \n    ApplyFunc(fcall, [self.args[1]] :: _upRankBy(Drop(self.args, 1), n)),\n    Checked(IsPosInt0(n), FoldL([1..n], (f, i) -> f.upRank(), self)));\n\nfcall.downRankFull := (self, inds) >> Cond(ObjId(self.t)<>TFunc, \n    ApplyFunc(fcall, [self.args[1]] :: _downRankFull(Drop(self.args, 1), inds)),\n    FoldL(Reversed([1..Minimum(self.rank(), Length(inds))]), (f, i) -> f.downRank(i, inds[i]), self));\n\nfcall.downRank := (self, loopid, ind) >> let(rank := self.rank(), Cond(\n    loopid > rank, self, \n    ObjId(self.t) <> TFunc, \n        ApplyFunc(fcall, [self.args[1]] :: _downRank(Drop(self.args, 1), loopid, ind)), \n    # else\n    fcurry(self, rank+1-loopid, ind)));  # !! loop variables are ordered with decreasing rank, highest-rank (outermost) is first var\n\nfcall.split := (self, loopid, inner_its, outer_its) >> Cond(\n    loopid > self.rank(), self, \n    ObjId(self.t) <> TFunc, \n        ApplyFunc(fcall, [self.args[1]] :: _split(Drop(self.args, 1), loopid, inner_its, outer_its)),\n    fsplit(self, loopid, inner_its, outer_its));\n\nfcall.rotate := (self, n) >> Cond(\n    self.rank() <= 1 and n <= 1, self,\n    ObjId(self.t) <> TFunc, \n        ApplyFunc(fcall, [self.args[1]] :: _rotate(Drop(self.args, 1), n)),\n    frotate(self, n)); \n\n\nFunction.rank      := _rch_rank;\nFunction.upRank    := _rch_upRank;\nFunction.upRankBy  := _rch_upRankBy;\nFunction.downRank  := _rch_downRank;\nFunction.downRankFull := _rch_downRankFull;\nFunction.split     := _rch_split;\nFunction.rotate    := _rch_rotate;\nFunction.computeType := self >> self.lambda().t;\n\nLambda.rank      := Symbolic.rank; \nLambda.upRank    := Symbolic.upRank;\nLambda.upRankBy  := Symbolic.upRankBy;\n#Lambda.downRank  := Symbolic.downRank;  downRank now defined in lambda.gi\nLambda.downRankFull := Symbolic.downRankFull;\nLambda.split     := Symbolic.split;\nLambda.rotate    := Symbolic.rotate;\n\n# ind(<range>, <n>) - \"nameless\" reference to a loop index of n-th inner most loop\n#            (eg. ind(1) is inner most, ind(n) is outermost in n-loop nest)\n#            loop counter runs from 0..range-1\nClass(ind, Loc, rec(\n    __call__ := (self, range, n) >> Checked(IsInt(n),\n\tWithBases(self, rec(operations := ExpOps, range:=range, n:=n))),\n    print := self >> Print(self.name, \"(\", self.range, \", \", self.n, \")\"),\n    rChildren := self >> [self.range, self.n],\n    rSetChild := rSetChildFields(\"range\", \"n\"),\n    t := TInt,\n    eval := self >> self,\n    can_fold := False,\n    \n    upRank := self >> ObjId(self)(self.range, self.n+1),\n\n    split := (self, loopid, inner_its, outer_its) >> \n        Cond( loopid > self.n, self, \n              loopid < self.n, ObjId(self)(self.range, self.n+1), \n              ObjId(self)(inner_its, self.n) + inner_its*ObjId(self)(outer_its, self.n+1)),\n    rotate := (self, n) >> \n        Cond( n < self.n, self, \n              n > self.n, ObjId(self)(self.range, self.n+1), \n              ObjId(self)(self.range, 1)),\n\n));\n\n\n# NOTE: ind.downRank might be a hack\nind.downRankFull := (self, inds) >> inds[self.n];\nind.downRank := (self, loopid, ind) >> Cond(loopid=self.n, ind, self);\nind.rank := self >> self.n;\n\n\n_hofnew := true;\n# ExpMarkActiveRank(<s>)\n#   performs a recursive walk over <s> and sets ._expMarkActiveRank attribute to the \"active rank\"\n#   of each subexpression.\n#\n#   Active rank of an expression denotes the maximum implicit loop id that the expression refers to.\n#   Implicit loop id's are introduced by objects such as GT and Lambda.\n#\nExpMarkActiveRank := function(s)\n    local c, rch, rank;\n    rch := Cond(IsRec(s) and IsBound(s.rChildren), s.rChildren(), IsList(s) and not IsString(s), s, []);\n    if ObjId(s) = ind then\n        rank := s.n;\n    else\n\tif _hofnew then\n\t    rank := _rank(s); \n\t    DoForAll(rch, ExpMarkActiveRank);\n\telse\n# this was invalid (fcurry, fcall, etc) -> \n\t    rank := Maximum(_rank(s), Maximum0(List(rch, ExpMarkActiveRank))); \n\tfi;\n    fi;\n\n    if IsRec(s) and IsSymbolic(s) then s._expMarkActiveRank := rank; fi;\n    return rank;\nend;\n\n_ExpMarkPassiveRank := function(s, parent_rank) \n    local c, rch, rank, my_rank;\n    rch := Cond(IsRec(s) and IsBound(s.rChildren), s.rChildren(), IsList(s) and not IsString(s), s, []);\n    my_rank := _rank(s);\n\n    # NOTE: this is a terrible hack! WHAT ABOUT Lambda?\n    if spiral.paradigms.common.IsGT(s)        then rank := my_rank + parent_rank;\n    elif ObjId(s)=ind then rank := Maximum(parent_rank, s.n);\n    else                   rank := Maximum(parent_rank, my_rank);\n    fi;\n    if IsRec(s) and (IsSymbolic(s) or IsFuncExp(s)) then s._expMarkPassiveRank := rank; fi;\n\n    DoForAll(rch, x -> _ExpMarkPassiveRank(x, rank)); \n    return rank;\nend;\n# ExpMarkPassiveRank(<s>)\n#   performs a recursive walk over <s> and sets ._expMarkPassiveRank attribute to the \"passive rank\"\n#   of each subexpression.\n#\n#   Passive rank of an expression denotes the maximum implicit loop id that is defined in the expression.\n#   Regardless of whether expression refers to it or now. In contracst, an \"active rank\" is the loop id\n#   that is actually referred to.\n#\n#   Implicit loop id's are introduced by objects such as GT and Lambda.\n#\nExpMarkPassiveRank := s -> _ExpMarkPassiveRank(s, 0);\n\n\nClass(lambdaWrap, Exp, rec(\n    computeType := self >> Checked(ObjId(self.args[1].t) = TFunc, Last(self.args[1].t.params))\n));\n", "meta": {"hexsha": "59aab908b4300843aab88cdca901ae2118199ed4", "size": 16674, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/hof.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/hof.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/hof.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.3746898263, "max_line_length": 132, "alphanum_fraction": 0.6240854024, "num_tokens": 5104, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4455295350395727, "lm_q2_score": 0.03358950698030741, "lm_q1q2_score": 0.014965117427144842}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F threadId() \n#F \nClass(threadId, Exp, rec(\n    computeType := self >> TInt\n));\n\n#F barrier(<nthreads>, <tid>, <barrier-name>)\n#F\n#F Example of mapping from SMPBarrier object <o>: \n#F    barrier(o.nthreads, o.tid, \"&GLOBAL_BARRIER\")\n#F\nClass(barrier, call, rec(\n    visitAs := call\n));\n\n#F smp_fork(<nthreads>, <cmd>)\n#F NOTE: this should take in thread id 'tid' for consistency, but it doesn't!\n#F\nClass(smp_fork, Command, rec(\n    rChildren := self >> [self.nthreads, self.cmd],\n    rSetChild := rSetChildFields(\"nthreads\", \"cmd\"),\n\n    __call__ := (self, nthreads, cmd) >> WithBases(self,\n       rec(operations := CmdOps,\n           nthreads   := Checked(IsInt(nthreads) or IsScalar(nthreads), nthreads),\n           cmd        := Checked(IsCommand(cmd), cmd))),\n\n    print := (self,i,is) >> Print(\n         self.__name__, \"(\", self.nthreads, \",\\n\",\n         Blanks(i+is), self.cmd.print(i+is, is), \"\\n\",\n         Blanks(i), \")\"\n    )\n));\n\n#F smp_loop(<nthreads>, <tidvar>, <tidexp>, <loopvar>, <range>, <cmd>)\n#F\n#F nthreads - # of threads\n#F tidvar - thread id variable (will be set to tid value), necessary for nested parallelism\n#F tidexp - thread id value \n#F\nClass(smp_loop, loop_base, rec(\n   __call__ := meth(self, nthreads, tidvar, tidexp, loopvar, range, cmd) \n       local result;\n       Constraint(IsVar(loopvar)); \n       Constraint(IsCommand(cmd)); \n       range := toRange(range);\n       if range = 0 then\n           return skip();      \n       else \n           loopvar.setRange(range);\n           loopvar.isLoopIndex := true;\n           return WithBases(self, rec(\n                   operations := CmdOps, \n                   nthreads := nthreads, \n                   cmd := cmd, \n                   var := loopvar, \n                   tidvar := Checked(IsLoc(tidvar), tidvar),\n                   tidexp := toExpArg(tidexp),\n                   range := range));\n       fi;\n   end,\n\n   rChildren := self >> [self.nthreads, self.tidvar, self.tidexp, self.var, self.range, self.cmd],\n   rSetChild := rSetChildFields(\"nthreads\", \"tidvar\", \"tidexp\", \"var\", \"range\", \"cmd\"),\n\n   print := (self, i, is) >> Print(self.name, \"(\", self.nthreads, \", \", \n       self.tidvar, \", \", self.tidexp, \", \", self.var, \", \", \n       self.range, \",\\n\", Blanks(i+is),\n       self.cmd.print(i+is, is),\n       Print(\"\\n\", Blanks(i), \")\")),\n\n   DContainer := (self, o, y, x, opts) >> self(o.child(1), y, x, opts),\n\n   free := self >> Difference(self.cmd.free(), [self.var, self.tidvar])\n));\n\n# Class(smp_chain, chain, rec(\n#    __call__ := meth(arg)\n#        local self, nthreads, cmds;\n#        [self, nthreads, cmds] := [arg[1], arg[2], Flat(Drop(arg, 2))];\n#        return WithBases(self, rec(\n#                nthreads   := nthreads,\n#                operations := CmdOps,\n#                cmds       := Checked(ForAll(cmds, IsCommand), cmds)));\n#    end,\n\n#    print := (self,i,is) >> When(Length(self.cmds)=0,\n#        Print(self.name, \"(\", self.nthreads, \")\"),\n#        Print(self.name, \"(\", self.nthreads, \",\\n\", self.printCmds(i+is, is), Blanks(i), \")\"))\n# ));\n\nClass(SMPCodegenMixin, Codegen, rec(\n    SMPBarrier := (self, o, y, x, opts) >> chain(\n        self(o.child(1), y, x, opts), \n        barrier(o.nthreads, o.tid, \"&GLOBAL_BARRIER\")),\n\n    SMPSum := (self, o, y, x, opts) >> let(\n        outer_tid     := When(IsBound(opts._tid), opts._tid, 0),\n        outer_num_thr := When(IsBound(opts._tid), opts._tid.range, 1),\n        tid := var.fresh(\"tid\", TInt, o.nthreads * outer_num_thr),\n        smp_loop(o.nthreads, tid, (outer_tid * outer_num_thr) + o.tid,\n                 o.var, o.domain, \n                 self(o.child(1), y, x, CopyFields(opts, rec(_tid := tid))))\n    )\n));\n\n\n_PullBuffersSMP := function(expr, type_predicate, nthreads, tid)\n    local ch, i, t, data, pullv, stayv;\n    if ObjId(expr)=assign then return [[], expr];\n    else\n        # Implemented as a recursive tree walk\n\tdata := [];\n\n        if ObjId(expr)=decl then\n            [pullv, stayv] := SplitBy(expr.vars, x->type_predicate(x.t));\n            data := List(pullv, x->[x, nthreads, tid]);\n            expr := decl(stayv, expr.cmd);\n        elif ObjId(expr)=smp_loop then \n            nthreads := nthreads * expr.nthreads; \n            tid := expr.tidvar;\n        fi;\n\n        ch := _children(expr);\n        for i in [1..Length(ch)] do\n            t := _PullBuffersSMP(ch[i], type_predicate, nthreads, tid);\n            Append(data, t[1]);\n            _setChild(expr, i, t[2]);\n        od;\n        return [data, expr];\n    fi;\nend;\n\n#F PullBuffersSMP(code, type_predicate)\n#F\n#F  Pulls out declarations (from decl(..)) that satisfy type_predicate,\n#F  and return declared variables as triplets [var, nthreads, tid]\n#F\n#F  This function handled nested parallelism, thats why the implementation is\n#F  not so straightforward. \n#F\nPullBuffersSMP := (code, type_predicate) -> _PullBuffersSMP(code, type_predicate, 1, 0);\n\n\n \n", "meta": {"hexsha": "28dc6a4d324def6f4eda1e524a9ac094856fb645", "size": 4991, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/smp/code.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/smp/code.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/smp/code.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.0529801325, "max_line_length": 98, "alphanum_fraction": 0.5656181126, "num_tokens": 1428, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2658804614657028, "lm_q2_score": 0.055823136029551815, "lm_q1q2_score": 0.014842281167999937}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x64f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x64f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x64f) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x64f) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x64f) ]) ),\n      origtree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x64f) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x64i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x64i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x64i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x64i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x64i) ]) ),\n      origtree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x64i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(SSE_2x32f) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x32f) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x32f) ]) ),\n      origtree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(SSE_2x32f) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 2).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 12.4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_4x32f) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_4x32f) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 1, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 1, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 2).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 1, 1).withTags([ AVecReg(SSE_4x32f) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 1, 1).withTags([ AVecReg(SSE_4x32f) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 2).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(SSE_4x32f) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(SSE_4x32f) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32f) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32f) ]) ) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 1).withTags([ AVecReg(SSE_4x32f) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 1, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 1, 1).withTags([ AVecReg(SSE_4x32f) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 2).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 12.4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_4x32i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_4x32i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 1, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 1, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 2).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 1, 1).withTags([ AVecReg(SSE_4x32i) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 1, 1).withTags([ AVecReg(SSE_4x32i) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 2).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(SSE_4x32i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(SSE_4x32i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_4x32i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_4x32i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 1).withTags([ AVecReg(SSE_4x32i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 1, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 1, 1).withTags([ AVecReg(SSE_4x32i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(32, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases2( TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(32, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases2( TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 24,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 0.90000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 8, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 8, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 8, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 24.800000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 32, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(64, 32, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(64, 32, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 3.6000000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 4, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 4, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          IxLxI_kmn_km( TL(32, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_kmn_n( TL(16, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n              SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 4, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          IxLxI_kmn_km( TL(32, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_kmn_n( TL(16, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n              SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ) ) ),\n      measured := 30.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases2( TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases2( TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 2, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 2, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 2, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(32, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 2, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(32, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 22.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 8, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 8, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 8, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 24.800000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 2, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 22.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 8, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 8, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 8, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 39.200000000000003,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 9.8000000000000007,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(16, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(16, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 4, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 2, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(16, 8, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases2( TL(16, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases2( TL(16, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      measured := 24,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 1, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 5.5999999999999996,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 16, 1, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 16, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 16, 1, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(SSE_8x16i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 4).withTags([ AVecReg(SSE_8x16i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 12.4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(16, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(16, 2, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ),\n      measured := 14.4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 4, 1).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 1).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 22.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 1, 2).withTags([ AVecReg(SSE_8x16i) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 4).withTags([ AVecReg(SSE_8x16i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_8x16i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_km( TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 22.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 16, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 16, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 16, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 99.200000000000003,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 28.800000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 44.799999999999997,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 24,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 5.5999999999999996,\n      globalUnrolling := 64 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 2, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(16, 4, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 2, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(16, 4, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 18.600000000000001,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 2, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 78.400000000000006,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 44.799999999999997,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 48,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 16, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 16, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 16, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 48,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(32, 4, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_IxLxI_down( TL(32, 4, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 6,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 39.200000000000003,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases2( TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases2( TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 24,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 64, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(128, 64, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_km( TL(128, 64, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 64, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(128, 64, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(128, 64, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(32, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(32, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_IxLxI_down( TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 48,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(16, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(32, 2, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 4, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_IxLxI_down( TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_IxLxI_down( TL(32, 2, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 4, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_IxLxI_down( TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 2, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 44.799999999999997,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(32, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(32, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 8, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(32, 2, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_IxLxI_down( TL(32, 2, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 64,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 8, 4, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 8, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 8, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 48,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(16, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(16, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 49.600000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_kmn_km( TL(32, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(16, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_kmn_km( TL(32, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(16, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 30.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(256, 128, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(256, 128, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_km( TL(256, 128, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 16, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 2, 16, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(16, 4, 16, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 2, 16, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_IxLxI_down( TL(16, 4, 16, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 148.80000000000001,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 2,\n      globalUnrolling := 64 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 2,\n      globalUnrolling := 64 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 32,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 32, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 32, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 32, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 32,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(256, 64, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(256, 64, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(128, 64, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(128, 64, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(256, 64, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(128, 64, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(128, 64, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 32,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 16, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 49.600000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(256, 32, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(256, 32, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(128, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                  IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n                  IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n            IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(256, 32, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(128, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(64, 32, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(16, 8, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n                  IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n                  IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n            IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n          IxLxI_kmn_km( TL(64, 32, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 48,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 16, 4, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 16, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 16, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(256, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(256, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(128, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n                SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                  IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                  IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n            IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(256, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(128, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(64, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(32, 16, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n                SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                  IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                  IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n            IxLxI_kmn_km( TL(32, 16, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 64,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(8, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 44.799999999999997,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(256, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(256, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(128, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n                SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(256, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(128, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n                SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 16, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 97.599999999999994,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 24.800000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 22.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 4, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 48,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 24.800000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(16, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(16, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(32, 16, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(4, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 9.8000000000000007,\n      globalUnrolling := 64 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(64, 32, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 16, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 16, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 16, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 49.600000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 4, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(32, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 16, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(32, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(32, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(32, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 4, 4, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 4, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 4, 4, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(32, 4, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 64,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(64, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(64, 32, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 8, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 8, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 8, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 48,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 14.4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(4, 2, 16, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 22.399999999999999,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 2, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(16, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(8, 4, 1, 32).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 64).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_n( TL(16, 2, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(4, 2, 32, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ) ) ),\n      measured := 60.799999999999997,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(16, 4, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n            IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 32,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 4, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_km( TL(8, 4, 4, 8).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n          IxLxI_IxLxI_down( TL(16, 4, 8, 2).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 48,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 64 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n      measured := 3.6000000000000001,\n      globalUnrolling := 64 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(16, 4, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(16, 4, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(16, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 12.4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_IxLxI_down( TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_IxLxI_down( TL(32, 8, 1, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(32, 16, 1, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(16, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases2( TL(16, 4, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 16).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 8, 1, 2).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(64, 8, 1, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases2( TL(32, 8, 1, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n            IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 8, 2).withTags([ AVecReg(SSE_16x8i) ]) ) ),\n      measured := 48,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(128, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(128, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(128, 8, 2, 1).withTags([ AVecReg(SSE_16x8i) ]),\n          IxLxI_kmn_n( TL(32, 8, 2, 4).withTags([ AVecReg(SSE_16x8i) ]),\n            IxLxI_kmn_km( TL(16, 8, 2, 8).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(4, 2, 8, 8).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_kmn_km( TL(8, 4, 2, 16).withTags([ AVecReg(SSE_16x8i) ]),\n                IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ),\n                IxLxI_vtensor( TL(4, 2, 2, 32).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n            IxLxI_kmn_km( TL(16, 8, 4, 4).withTags([ AVecReg(SSE_16x8i) ]),\n              SIMD_ISA_Bases1( TL(8, 4, 8, 4).withTags([ AVecReg(SSE_16x8i) ]) ),\n              IxLxI_vtensor( TL(4, 2, 4, 16).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n          IxLxI_IxLxI_down( TL(32, 8, 8, 1).withTags([ AVecReg(SSE_16x8i) ]),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ),\n            SIMD_ISA_Bases1( TL(32, 16, 8, 1).withTags([ AVecReg(SSE_16x8i) ]) ) ) ),\n      measured := 64,\n      globalUnrolling := 10000 ) ]);\n", "meta": {"hexsha": "67b22f73d49e2e21d033761f9ec74e1e7ecea1ed", "size": 154905, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/_sse_generated1.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/_sse_generated1.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/_sse_generated1.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 70.0610583446, "max_line_length": 90, "alphanum_fraction": 0.5811110035, "num_tokens": 72760, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4882833952958347, "lm_q2_score": 0.030214585757507465, "lm_q1q2_score": 0.014753280521132915}}
{"text": "# Copyright (c) 2018-2020, Carnegie Mellon University\n# See LICENSE for details\n\nFFTE_copyright := \n\"/*\\n\"::\n\"\\n\"::\n\"     FFTE: A FAST FOURIER TRANSFORM PACKAGE\\n\"::\n\"\\n\"::\n\"     (C) COPYRIGHT SOFTWARE, 2000-2004, 2008-2014, ALL RIGHTS RESERVED\\n\"::\n\"                BY\\n\"::\n\"         DAISUKE TAKAHASHI\\n\"::\n\"         FACULTY OF ENGINEERING, INFORMATION AND SYSTEMS\\n\"::\n\"         UNIVERSITY OF TSUKUBA\\n\"::\n\"         1-1-1 TENNODAI, TSUKUBA, IBARAKI 305-8573, JAPAN\\n\"::\n\"         E-MAIL: daisuke@cs.tsukuba.ac.jp\\n\"::\n\"\\n\"::\n\"\\n\"::\n\"     WRITTEN BY DAISUKE TAKAHASHI\\n\\n\"::\n\"     THIS KERNEL WAS GENERATED BY SPIRAL \"::Version()::\"\\n\"::\n\"*/\\n\\n\";\n", "meta": {"hexsha": "bb95012a9f580c777a8b1f49a2441afbf3436217", "size": 649, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "copyright.gi", "max_stars_repo_name": "spiral-software/spiral-package-ffte", "max_stars_repo_head_hexsha": "19f751776c117e28bdbcc3d2530c895ad554d855", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "copyright.gi", "max_issues_repo_name": "spiral-software/spiral-package-ffte", "max_issues_repo_head_hexsha": "19f751776c117e28bdbcc3d2530c895ad554d855", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "copyright.gi", "max_forks_repo_name": "spiral-software/spiral-package-ffte", "max_forks_repo_head_hexsha": "19f751776c117e28bdbcc3d2530c895ad554d855", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-15T12:41:51.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:41:51.000Z", "avg_line_length": 30.9047619048, "max_line_length": 76, "alphanum_fraction": 0.5839753467, "num_tokens": 235, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.37754066879814546, "lm_q2_score": 0.03904829384451455, "lm_q1q2_score": 0.014742318973484532}}
{"text": "#############################################################################\n##\n#W  scilab.gi               automgrp package                   Yevgen Muntyan\n#W                                                             Dmytro Savchuk\n##\n#Y  Copyright (C) 2003 - 2018 Yevgen Muntyan, Dmytro Savchuk\n##\n\n\nInstallGlobalFunction(PlotSpectraPermsInScilab,\nfunction(perms, deg, opts)\n  local mats, i, j,\n  temp_dir, temp_file, temp_file_name, sci_temp_file, sci_temp_file_name,\n  plot_spectra_func_file, exec_string,\n  round, stacksize, output_filename, title;\n\n  if IsBound(opts.round) then round := opts.round; else round := 7; fi;\n  if IsBound(opts.stacksize) then stacksize := opts.stacksize; else stacksize := AG_Globals.scilab_stacksize; fi;\n  if IsBound(opts.output) then output_filename := opts.output; else output_filename := \"\"; fi;\n  if IsBound(opts.title) then title := opts.title; else title := \"\"; fi;\n\n  plot_spectra_func_file := Filename(DirectoriesPackageLibrary(\"automgrp\",\"scilab\"),\n                                     \"PlotSpectraPermsInScilab.sci\");\n  if plot_spectra_func_file = fail then\n    Print(\"error in PlotSpectraPermsInScilab:\\n  scilab file not found\\n\");\n    return fail;\n  fi;\n\n  temp_dir := DirectoryTemporary();\n  temp_file_name := Filename(temp_dir, \"pass\");\n  temp_file := OutputTextFile(temp_file_name, false);\n  if temp_file = fail then\n    Print(\"error in PlotSpectraPermsInScilab:\\n  could not create temp file\\n\");\n    return fail;\n  fi;\n\n  for i in [1..deg] do\n    for j in [1..Length(perms)] do\n      AppendTo(temp_file, i, \"\\t\", i^perms[j], \"\\t\");\n    od;\n    AppendTo(temp_file, \"\\n\");\n  od;\n  CloseStream(temp_file);\n\n  sci_temp_file_name := Filename(temp_dir, \"commands_for_scilab\");\n  sci_temp_file := OutputTextFile(sci_temp_file_name, false);\n\n  if sci_temp_file = fail then\n    Print(\"error in PlotSpectraPermsInScilab:\\n\",\n          \"  Could not create temp file for scilab script\\n\");\n    return fail;\n  fi;\n\n  SetPrintFormattingStatus(sci_temp_file, false);\n\n  PrintTo(sci_temp_file, \"getf(\\\"\", plot_spectra_func_file, \"\\\");\\n\");\n  PrintTo(sci_temp_file, \"PlotSpectraPermsInScilab(\",\n                         \"\\\"\", temp_file_name, \"\\\", \",\n                         Length(perms), \", \",\n                         deg, \", \",\n                         round, \", \",\n                         stacksize, \", \",\n                         \"\\\"\", output_filename, \"\\\", \",\n                         \"\\\"\", title, \"\\\");\\n\");\n\n  if output_filename <> \"\" then\n    PrintTo(sci_temp_file, \"exit\\n\");\n  fi;\n\n  CloseStream(sci_temp_file);\n\n  exec_string := Concatenation(#\"cat \", sci_temp_file_name, \"; \",\n                               \"xterm -e scilab -nw -f \",\n                               sci_temp_file_name);\n\n  if output_filename = \"\" then\n    Append(exec_string, \" &\");\n  fi;\n\n  Exec(exec_string);\nend);\n\n\n#############################################################################\n##\n##  PlotSpectraInScilab(<list>, <level>[, <opts>])\n##\nInstallMethod(PlotSpectraInScilab,\n              [IsList and IsTreeAutomorphismCollection, IsPosInt],\nfunction(gens, level)\n  PlotSpectraPermsInScilab(List(gens, g -> PermOnLevel(g, level)),\n                           DegreeOfTree(gens[1])^level, rec());\nend);\n\nInstallMethod(PlotSpectraInScilab,\n              [IsList and IsTreeAutomorphismCollection, IsPosInt, IsRecord],\nfunction(gens, level, opts)\n  PlotSpectraPermsInScilab(List(gens, g -> PermOnLevel(g, level)),\n                           DegreeOfTree(gens[1])^level, opts);\nend);\n\nInstallMethod(PlotSpectraInScilab,\n              [IsTreeAutomorphismGroup, IsPosInt],\nfunction(G, level)\n  PlotSpectraInScilab(GeneratorsOfGroup(G), level, rec());\nend);\n\nInstallMethod(PlotSpectraInScilab,\n              [IsTreeAutomorphismGroup, IsPosInt, IsRecord],\nfunction(G, level, opts)\n  PlotSpectraInScilab(GeneratorsOfGroup(G), level, opts);\nend);\n\n\n# InstallOtherMethod(PlotAutomatonSpectraInScilab, [IsList, IsInt, IsInt, IsInt],\n# function(list, iter_num, round, stacksize)\n#   local mats, i, j,\n#   temp_dir, temp_file, temp_file_name, sci_temp_file, sci_temp_file_name,\n#   plot_spectra_func_file, exec_string;\n#\n#   plot_spectra_func_file := \"/home/muntyan/math/automata/scilab/plot_spectra.sci\";\n#\n#   ## TODO: input checking\n#\n#   mats := PermMatrices(list, iter_num);\n#\n#   temp_dir := DirectoryTemporary();\n#   temp_file_name := Filename(temp_dir, \"pass\");\n#   temp_file := OutputTextFile(temp_file_name, false);\n#   if temp_file = fail then\n#     Error(\"Could not create temp file\\n\");\n#   fi;\n#\n#   for i in [1..2^iter_num] do\n#     for j in [1..Length(list)] do\n#       AppendTo(temp_file, mats[j][i][1], \"\\t\", mats[j][i][2], \"\\t\");\n#     od;\n#     AppendTo(temp_file, \"\\n\");\n#   od;\n#   CloseStream(temp_file);\n#\n#   sci_temp_file_name := Filename(temp_dir, \"pass_sci\");\n#   sci_temp_file := OutputTextFile(sci_temp_file_name, false);\n#   if sci_temp_file = fail then\n#     Error(\"Could not create temp file for scilab script\\n\");\n#   fi;\n#\n#   AppendTo(sci_temp_file, \"getf(\\\"\", plot_spectra_func_file, \"\\\");\\n\");\n#   AppendTo(sci_temp_file, \"plot_spectra(\\\"\", temp_file_name, \"\\\", \", Length(list), \", \", iter_num, \", \", round, \", \", stacksize, \");\\n\");\n# #  AppendTo(sci_temp_file, \"exit\\n\");\n#   CloseStream(sci_temp_file);\n#\n#   exec_string := Concatenation(\"xterm -e scilab -nw -f \", sci_temp_file_name, \" > /dev/null\");\n#   Exec(exec_string);\n# end);\n#\n#\n# InstallMethod(PlotAutomatonSpectraInScilab, [IsList, IsInt, IsInt],\n# function(list, iter_num, round)\n#   PlotAutomatonSpectraInScilab(list, iter_num, round, 10000000);\n# end);\n#\n#\n# InstallOtherMethod(PlotAutomatonSpectraInScilab, [IsList, IsInt],\n# function(list, iter_num)\n#   PlotAutomatonSpectraInScilab(list, iter_num, 7, 10000000);\n# end);\n", "meta": {"hexsha": "a8e39e867b04c5964542d066a8245421c35ca658", "size": 5749, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/scilab.gi", "max_stars_repo_name": "gap-packages/automgrp", "max_stars_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-02T15:00:11.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-02T15:00:11.000Z", "max_issues_repo_path": "gap/scilab.gi", "max_issues_repo_name": "gap-packages/automgrp", "max_issues_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2019-09-21T22:10:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-26T23:51:41.000Z", "max_forks_repo_path": "gap/scilab.gi", "max_forks_repo_name": "gap-packages/automgrp", "max_forks_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.2202380952, "max_line_length": 139, "alphanum_fraction": 0.6228909376, "num_tokens": 1614, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.44552953503957277, "lm_q2_score": 0.033085979938003426, "lm_q1q2_score": 0.014740781258107299}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nClass(BarrierScratchUnparserProg, CScratchUnparserProg, rec(\n    barrier_cmd := (self,o,i,is) >> Print(Blanks(i), self.opts.barrierCMD(self.opts), self.pinfix(o.args, \", \"), \";\\n\"),\n    nop_cmd := (self,o,i,is) >> Print(\"\"),\n\tregister := (self,o,i,is) >> Print(Blanks(i), \"if(count == 0) \", self.opts.register(self.opts), self.pinfix(o.args, \", \"), \";\\n\"),\n    initialization := (self, o, i, is) >> Print(Blanks(i), self.opts.initialization(self.opts), self.pinfix(o.args, \", \"), \";\\n\"),\n\tpar_exec := (self,o,i,is) >> Print(Blanks(i), \"parallel((void*)&sub_cpu) \\n\",\n                              Blanks(i), \"{\\n\", self(o.cmds[1],i+is,is),\n                              Blanks(i),\"}\\n\"),\n));\n", "meta": {"hexsha": "b75edd677155b7fca318e318e1956302a8698585", "size": 774, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/scratch_x86/unparser.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/scratch_x86/unparser.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/scratch_x86/unparser.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 55.2857142857, "max_line_length": 131, "alphanum_fraction": 0.5736434109, "num_tokens": 230, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.33458942798284697, "lm_q2_score": 0.044018649079126525, "lm_q1q2_score": 0.014728174615962618}}
{"text": "# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_unTspl := (c, info) -> When(spiral.paradigms.common.IsTSPL(c), SumsSPL(c.toSpl(), info.opts), c);\n\nSumsRuleTreeStep := function ( rtwrap, info )\n  local S, rt, t, tag, tags, processed_tags;\n  rt := rtwrap.rt;\n  info.rsteps := info.rsteps + 1;\n\n  tags := When(IsBound(rt.node.getTags), rt.node.getTags(), []);\n\n  if IsBound(rt.node.noCodelet) then\n      S := SumsSPL(_SPLRuleTree(rt), info.opts);\n\n  else\n      processed_tags := Union(info.processed_tags, List(tags, x->x.kind()));\n      S := ApplyRuleTreeStep(rt, c -> Cond(\n          not IsRuleTree(c) and IsBound(c.noCodelet) and c.noCodelet, \n\t      _unTspl(c, info), \n\t  not IsRuleTree(c), \t\t  \n\t      RecursStep(_unTspl(c, info)).setA(processed_tags => processed_tags),\n          IsBound(c.node.noCodelet) and c.node.noCodelet, \n\t      _SPLRuleTree(c),\n\t  # else\n              RecursStep(RTWrap(c)).setA(processed_tags => processed_tags)\n      ));\n      S := SumsSPL(S, info.opts);\n      S.root := rt.node;\n  fi;\n\n  # tags may inject container objects\n  for tag in Reversed(tags) do\n      if IsBound(tag.container) and not (tag.kind() in info.processed_tags) then\n          S := tag.container(S); \n      fi;\n  od;\n  return S;\nend;\n\nSumsRecursStep := function ( rstep, info )\n  local rsteps;\n  rsteps := info.rsteps;\n  info.processed_tags := When(IsBound(rstep.a.processed_tags), rstep.a.processed_tags, []);\n  rstep := SubstTopDownNR(rstep, RTWrap, e -> SumsRuleTreeStep(e, info));\n  if rsteps = info.rsteps then # nothing has changed\n      return rstep;\n  else\n      rstep := ApplyStrategy(rstep, info.strategy, UntilDone, info.opts);\n      return rstep.child(1); # strip outer RecursStep container\n  fi;\nend;\n\nRecurse := function(sums,info)\n    local rt;\n    if IsRuleTree(sums) then\n\trt := sums;\n\t# keep track of tags that were converted into containers, via an attribute\n\t# this mechanism does not work well, and more VContainers will be created\n\t# than neeeded, however this is safe, because redundant ones are eliminated\n\t# by rewrite rules.\n        return Recurse(RecursStep(RTWrap(rt)).setA(processed_tags=>[]), info);\n\n    else\n        return SubstTopDownNR(sums, RecursStep, x -> SumsRecursStep(x,info));\n    fi;\nend;\n\nSumsRuleTreeStrategy := function ( rt, strategy, opts )\n    local info;\n    info := rec(rsteps := 0, strategy := strategy, opts := opts); #, cutoff := cutoff_func);\n    rt := Recurse(rt, info);\n    while info.rsteps > 0 do info.rsteps := 0; rt := Recurse(rt, info); od;\n    return rt;\nend;\n\n#F SumsRuleTree(<rt>, <opts>)\n#F\n#F <opts> flags used:\n#F   opts.formulaStrategies.sigmaSpl    Sigma-SPL rewriting strategy\n#F   opts.formulaStrategies.rc          RC(.) rewriting strategy\n#F   opts.generateComplexCode == bool   if set to false, then RC rewriting strategy is applied\n#F\nSumsRuleTree := function(rt, opts)\n        local sums, rsums, t, tag;\n        if IsNonTerminal(rt) then rt := RandomRuleTree(rt,opts); fi;\n        sums := SumsRuleTreeStrategy(rt, [], opts);\n        sums := ApplyStrategy(sums, opts.formulaStrategies.sigmaSpl, UntilDone, opts);\n        sums := ApplyStrategy(sums, opts.formulaStrategies.preRC, UntilDone, opts);\n        if (not opts.generateComplexCode) and (not rt.node.isReal()) then # NOTE: when t_in/t_out available check them instead of isReal\n            rsums := ApplyStrategy(RC(sums), opts.formulaStrategies.rc, UntilDone, opts);\n        else\n            rsums := sums;\n        fi;\n        rsums := ApplyStrategy(rsums, opts.formulaStrategies.postProcess, UntilDone, opts);\n        rsums := SumsUnification(rsums, opts);\n        rsums.ruletree := rt;\n     \n        return rsums;\nend;\n\n#F See SumsRuleTree\n#F\nSumsRuleTreeOpts := SumsRuleTree;\n\nRecurseOpts := function(rt, opts)\n    local sums, rsums;\n    if IsNonTerminal(rt) then rt := RandomRuleTree(rt,opts); fi;\n    sums := Recurse(rt, rec(strategy:=opts.formulaStrategies.sigmaSpl, rsteps:=0, opts := opts));\n    return sums;\n    #return ApplyStrategy(sums, opts.formulaStrategies.postProcess, UntilDone, opts);\nend;\n\n######\nSumsVerifyRulesForSPL := (S,opts) -> VerifyRules(S,\n    (rt, s) -> InfinityNormMat(MatSPL(SumsRuleTree(rt,opts)) - MatSPL(s)) < 1e-11,\n    opts);", "meta": {"hexsha": "7808b5f78c79ab7455d4f138ad59836a481a3201", "size": 4228, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/sigma/sums_ruletree.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/sigma/sums_ruletree.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/sigma/sums_ruletree.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 35.8305084746, "max_line_length": 136, "alphanum_fraction": 0.6624881741, "num_tokens": 1213, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4378234844434673, "lm_q2_score": 0.03358950492453849, "lm_q1q2_score": 0.014706274086792445}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Top-Level Functions for SPIRAL\n# ==============================\n# BWS, MP, from 02/15/00\n\n\n#F Creating Transforms\n#F -------------------\n#F\n\n#F Transforms\n#F   the list of symbols for valid transforms, e.g., \"DFT\".\n#F\nTransforms := NonTerminalListSPL;\n\n#F Transform ( <symbol>, <parameters> )\n#F   alias for SPLNonTerminal, returns the transform defined by \n#F   <symbol> and <parameters>, e.g. Transform( \"DFT\", 8 ).\n#F\n#Transform := SPLNonTerminal;\n\n#F Info ( <symbol> )\n#F   prints information on how to create the transform <symbol>\n#F\nInfo := Doc;\n\n#F toSPL( <obj> )\n#F   Converts ruletree or nonterminal (using random ruletree) into an SPL,\n#F   If <obj> is an SPL it is returned as is.\ntoSPL := x -> \n    Cond(IsNonTerminal(x), SPLRuleTree(RandomRuleTree(x)),\n\t IsSPL(x), x,\n\t IsRuleTree(x), SPLRuleTree(x),\n\t Error(\"<x> must be an SPL or a RuleTree\"));\n", "meta": {"hexsha": "2a99464b96dfe6dbcbcaf154be94f56a82cc4e23", "size": 946, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/implement.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/implement.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/implement.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 24.2564102564, "max_line_length": 74, "alphanum_fraction": 0.6469344609, "num_tokens": 283, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.39606818053136394, "lm_q2_score": 0.03676946765888317, "lm_q1q2_score": 0.014563216154760687}}
{"text": "\n# Copyright 2018-2019, Carnegie Mellon University\n# See LICENSE for details\n\nClass(FloatMixin, rec(\n    XType := TPtr(T_Real(32)), precision := \"single\", TRealCtype := \"float\")\n);\n\nClass(DoubleMixin, rec(\n    XType := TPtr(T_Real(64)), precision := \"double\", TRealCtype := \"double\")\n);\n\n\nClass(CoSynthesizeStrategies, rec(\n    C_opt := [ (t, opts) -> RandomRuleTree(t, opts), \n        (rt, opts) -> SPLRuleTree(rt),\n        (s, opts) -> SumsSPL(s, opts),\n        (s, opts) -> Rewrite(s, [RulesSumsHCOL, RulesTerminateReductionHCOL, RulesSumsHCOL], opts),\n        (s, opts) -> HCOLProof_Codegen(s, opts),\n        (c, opts) -> Rewrite(c, RulesCodeUnrollHCOL, opts),\n\t\t(c, opts) -> Rewrite(c, RulesTypeHCOL, opts)\t\t],\n    C_opt_useAbsMax := [ (t, opts) -> RandomRuleTree(t, opts),\n\t\t(rt, opts) -> SPLRuleTree(rt),\n\t\t(s, opts) -> SumsSPL(s, opts),\n\t\t(s, opts) -> Rewrite(s, [RulesSumsHCOL], opts),\n\t\t(s, opts) -> Rewrite(s, [RulesSumsHCOL, RulesTerminateReductionHCOL, RulesSumsHCOL], opts),\n\t\t(s, opts) -> HCOLProof_Codegen(s, opts),\n\t\t(c, opts) -> Rewrite(c, RulesCodeUnrollHCOLuseAbsMaxSR, opts) ],\n    C_raw := [ (t, opts) -> RandomRuleTree(t, opts), \n        (rt, opts) -> SPLRuleTree(rt),\n        (s, opts) -> SumsSPL(s, opts),\n        (s, opts) -> Rewrite(s, [RulesSumsHCOL, RulesTerminateReductionHCOL, RulesSumsHCOL], opts),\n        (s, opts) -> HCOLProof_Codegen(s, opts) ],\n    C_sim := [        (s, opts) -> SumsSPL(s, opts),\n        (s, opts) -> Rewrite(s, [RulesSumsHCOL, RulesTerminateReductionHCOL, RulesSumsHCOL], opts),\n        (s, opts) -> HCOLProof_Codegen(s, opts),\n\t(c, opts) -> Rewrite(c, RulesCodeUnrollHCOL, opts) ],\n\tno_opt := [ (t, opts) -> RandomRuleTree(t, opts), \n        (rt, opts) -> SPLRuleTree(rt),\n        (s, opts) -> SumsSPL(s, opts),\n        (s, opts) -> Rewrite(s, [RulesSumsHCOL, RulesTerminateReductionHCOL, RulesSumsHCOL], opts),\n        (s, opts) -> HCOLProof_Codegen(s, opts) ]\n));\n    \n\nClass(HCOLopts, rec(\n    getOpts := meth(arg)\n        local opts;\n       \n        opts := CopyFields(SpiralDefaults, \n            rec(\n                codegen := HCOLCodegen, \n                sumsgen := HCOLSumsGen, \n                params := [],\n                includes := [], \n                unparser := HCOLUnparser,\n                operations := rec(Print := (s) -> Print(\"<HCOL options\"::When(Length(arg)>1 and IsBound(arg[2].name), \", \"::arg[2].name, \"\")::\">\")),\n                funcgen := HCOLFuncGen,\n                useCReturn := false, \n\t\t\t\terrorCheck := false,\n                YType := TPtr(TInt),\n                csStrategy := CoSynthesizeStrategies.C_opt\n            ), \n            When(Length(arg)=2, arg[2]));\n        return opts;\n    end\n));\n\n\n", "meta": {"hexsha": "4209ee25b44c7b044e690a0ee7eb31be27a085c7", "size": 2692, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "opts.gi", "max_stars_repo_name": "spiral-software/spiral-package-hcol", "max_stars_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "opts.gi", "max_issues_repo_name": "spiral-software/spiral-package-hcol", "max_issues_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "opts.gi", "max_forks_repo_name": "spiral-software/spiral-package-hcol", "max_forks_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-26T05:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T05:21:02.000Z", "avg_line_length": 38.4571428571, "max_line_length": 148, "alphanum_fraction": 0.5661218425, "num_tokens": 826, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3775406687981454, "lm_q2_score": 0.0384661929828236, "lm_q1q2_score": 0.014522552224853748}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nDeclare(ScatPtr);\n\nClass(GathPtr, Gath, rec(\n    rChildren := self >> [self.ptr, self.func],\n    rSetChild := rSetChildFields(\"ptr\", \"func\"),\n    new := (self, ptr, func) >> SPL(WithBases(self, rec(\n        ptr := ptr,\n      \tfunc := Checked(IsFunction(func) or IsFuncExp(func), func)))).setDims()\n));\n\nClass(ScatPtr, Scat, rec(\n    rChildren := self >> [self.ptr, self.func],\n    rSetChild := rSetChildFields(\"ptr\", \"func\"),\n    new := (self, ptr, func) >> SPL(WithBases(self, rec(\n        ptr := ptr,\n\t    func := Checked(IsFunction(func) or IsFuncExp(func), func)))).setDims()\n));\n\nClass(OO, O);\n", "meta": {"hexsha": "d8f6d1872ea7b0aa90bf03f18d2d1208bfbb8531", "size": 685, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "sigma/spl.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "sigma/spl.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "sigma/spl.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 28.5416666667, "max_line_length": 78, "alphanum_fraction": 0.6131386861, "num_tokens": 206, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4571367020358429, "lm_q2_score": 0.031618765671739144, "lm_q1q2_score": 0.014454098261622954}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(CScratchUnparserProg, CUnparser, rec(\n    dma_signal := (self,o,i,is) >> Print(Blanks(i), self.opts.dmaSignal(self.opts), self.pinfix(o.args, \", \"), \";\\n\"),\n    dma_wait := (self,o,i,is) >> Print(Blanks(i), self.opts.dmaWait(self.opts), \"\", self.pinfix(o.args, \", \"), \";\\n\"),\n\n    cpu_signal := (self,o,i,is) >> Print(Blanks(i), self.opts.cpuSignal(self.opts), self.pinfix(o.args, \", \"), \";\\n\"),\n    cpu_wait := (self,o,i,is) >> Print(Blanks(i), self.opts.cpuWait(self.opts), \"\", self.pinfix(o.args, \", \"), \";\\n\"),\n\n    dma_fence := (self,o,i,is) >> Print(Blanks(i), self.opts.dmaFence(self.opts), \"();\\n\"),\n\n    dma_load := (self,o,i,is) >> Print(Blanks(i), self.opts.dmaLoad(self.opts),\n        \"(\", self(o.loc,i,is), \", \", self(o.exp,i,is), \", \", self(o.size,i,is), \");\\n\"),\n\n    dma_store := (self,o,i,is) >> Print(Blanks(i), self.opts.dmaStore(self.opts),\n        \"(\", self(o.loc,i,is), \", \", self(o.exp,i,is), \", \", self(o.size,i,is), \");\\n\"),\n\n    par_exec := (self,o,i,is) >> Print(Blanks(i), \"parallel {\\n\", DoForAll(o.cmds, c -> self(c, i+is, is)), Blanks(i), \"}\\n\"),\n\n    decl := meth(self,o,i,is)\n        local arrays, memarrays, scratcharrays, romarrays, other, l, arri, myMem;\n        [arrays, other] := SplitBy(o.vars, x->IsArray(x.t));\n        [memarrays, arrays] := SplitBy(arrays, i->IsBound(i.t.qualifiers) and self.opts.memModifier in i.t.qualifiers);\n        [scratcharrays, arrays] := SplitBy(arrays, i->IsBound(i.t.qualifiers) and self.opts.scratchModifier in i.t.qualifiers);\n        [romarrays, arrays] := SplitBy(arrays, i->IsBound(i.t.qualifiers) and self.opts.romModifier in i.t.qualifiers);\n\n        if Length(arrays) > 0 then\n            DoForAll(arrays, v -> Print(Blanks(i), self.opts.arrayBufModifier, \" \", self.declare(v.t, v, i, is), \";\\n\"));\n        fi;\n        if Length(memarrays) > 0 then\n            DoForAll(memarrays, v -> Print(Blanks(i), self.opts.arrayBufModifier, \" \", self.opts.memModifier, \" \", self.declare(v.t, v, i, is), \";\\n\"));\n        fi;\n        if Length(scratcharrays) > 0 then\n            DoForAll(scratcharrays, v -> Print(Blanks(i), self.opts.arrayBufModifier, \" \", self.opts.scratchModifier, \" \", self.declare(v.t, v, i, is),\";\\n\"));\n        fi;\n        if Length(romarrays) > 0 then\n            DoForAll(romarrays, v -> Print(Blanks(i), self.opts.arrayBufModifier, \" \", self.opts.romModifier, \" \", self.declare(v.t, v, i, is), \";\\n\"));\n        fi;\n\n        if (Length(other)>0) then\n            other:=SortRecordList(other,x->x.t);\n            for l in other do\n               Sort(l, (a,b)->a.id < b.id);\n               Print(Blanks(i), self.declare(l[1].t, l, i, is), \";\\n\");\n            od;\n        fi;\n\n        self(o.cmd, i, is);\n\n        #Pop arena for this decl\n        if IsBound(self.opts.useMemoryArena) and self.opts.useMemoryArena and Length(arrays) > 0 and arrays[1].id[1] <> 'D' then\n          myMem := 0;\n          for arri in arrays do\n             # Account for vector allocations in memory arena (which is scalar)\n             myMem := myMem + (arri.t.size * When(IsBound(arri.t.t) and ObjId(arri.t.t)=TVect, arri.t.t.size, 1));\n          od;\n          if ObjId(myMem) = Value then myMem := myMem.v; fi;\n          Print(Blanks(i));\n          Print(\"arenalevel += \", myMem, \";\\n\" );\n        fi;\n    end,\n\n    swp_loop := (self, o, i, is) >> let(v := o.var, lo := o.range[1], hi := Last(o.range),\n        Print(When(IsBound(self.opts.looppragma), self.opts.looppragma(o,i,is)),\n          Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"++) { // SWP loop\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")),\n));\n", "meta": {"hexsha": "31d2790b0fe50ef7201e7aeff171d5a822481519", "size": 3710, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 51.5277777778, "max_line_length": 159, "alphanum_fraction": 0.5598382749, "num_tokens": 1123, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3629691917376783, "lm_q2_score": 0.03963883626471278, "lm_q1q2_score": 0.01438767636042497}}
{"text": "SplitString(\"Hello,How,Are,You,Today\", \",\");\n# [ \"Hello\", \"How\", \"Are\", \"You\", \"Today\" ]\n\nJoinStringsWithSeparator(last, \".\");\n# \"Hello.How.Are.You.Today\"\n", "meta": {"hexsha": "db866482ee3813991b37cc7993e7416dd0f38966", "size": 155, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Tokenize-a-string/GAP/tokenize-a-string.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Tokenize-a-string/GAP/tokenize-a-string.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Tokenize-a-string/GAP/tokenize-a-string.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 25.8333333333, "max_line_length": 44, "alphanum_fraction": 0.6193548387, "num_tokens": 47, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.29098086621490676, "lm_q2_score": 0.04885778243074538, "lm_q1q2_score": 0.014216679853037744}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n################################################\n#   propagate VTensor into products and sums\n_VConsRightBlk := [BlockVPerm, VPerm, VDiag_x_I, VDiag, VRCDiag, RCVDiagSplit, RCVDiag, VGath, VGath_u, VGath_sv, VGath_pc, IxVGath_pc, VGath_dup, VPrm_x_I, Conj, ConjL, ConjR, ConjLR, RCVGath_sv, FormatPrm];\n_VConsLeftBlk  := [BlockVPerm, VPerm, VDiag_x_I, VDiag, VRCDiag, RCVDiagSplit, RCVDiag, VScat, VScatAcc, VScatAcc_u, VScat_u, VScat_sv, VScat_svAcc, VScat_pc, IxVScat_pc, VScat_pcAcc, VPrm_x_I, Conj, ConjL, ConjR, ConjLR, RCVScat_sv, FormatPrm];\n\n# !!!! do not put VPerm in here - VPerms CANNOT be pulled into ISums!!!!\n_VConsDiag := [ VDiag_x_I, VDiag, VRCDiag, RCVDiag, RCVDiagSplit ];\n\n_VConsRightNoDiag := [VGath, VGath_u, VGath_sv, VPrm_x_I];\n_VConsLeftNoDiag  := [VScat, VScat_u, VScat_sv, VPrm_x_I, VScatAcc, VScatAcc_u, VScat_svAcc, VScat_pcAcc, VDiag_x_I];\n\n_VConsRight := _VConsRightNoDiag :: _VConsDiag :: [IxVGath_pc ];\n_VConsLeft  := _VConsLeftNoDiag :: _VConsDiag :: [IxVScat_pc ];\n\n# things to not pull into Vcontainer:\n_VContDontPullIn := [VContainer, Cross, Cvt, TCvt, RC, BB, ISum, SUM, RecursStep];\n\n_PullInLeft  := [RecursStep, Grp, BB, SUM, Buf, ISum, Data, COND, NeedInterleavedComplex];\n_PullInRight := _PullInLeft :: [SUMAcc, ISumAcc];\n\nClass(RulesPropagate, RuleSet);\nRewriteRules(RulesPropagate, rec(\n\n VecPullInLeft := ARule( Compose, [ @(1, _VConsLeft), @(2, _PullInLeft :: [NoDiagPullinRight]) ],\n  e -> [ CopyFields(@(2).val, rec(\n             _children :=  List(@(2).val._children, c -> @(1).val * c),\n             dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n VecPullInRight := ARule( Compose, [ @(1, _PullInRight :: [NoDiagPullinLeft]), @(2, _VConsRight) ],\n     e -> [ CopyFields(@(1).val, rec(\n                _children := List(@(1).val._children, c -> c * @(2).val),\n                dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n VecPullInLeftNoDiag := ARule( Compose, [ @(1, _VConsLeftNoDiag), @(2, [NoDiagPullinLeft, NoDiagPullin]) ],\n  e -> [ CopyFields(@(2).val, rec(\n             _children :=  List(@(2).val._children, c -> @(1).val * c),\n             dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n VecPullInRightNoDiag := ARule( Compose, [ @(1, [NoDiagPullinRight, NoDiagPullin]), @(2, _VConsRightNoDiag) ],\n     e -> [ CopyFields(@(1).val, rec(\n                _children := List(@(1).val._children, c -> c * @(2).val),\n                dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n#######################################\n    VTensorXXX := Rule([@(1, VTensor), @(2, [SUM, SUMAcc, Compose, BB, Buf, Inplace, RecursStep, ISum, ISumAcc, ISumLS, Data, NeedInterleavedComplex, SMPBarrier, SMPSum])],\n    e -> let(s := @(2).val, CopyFields(s,\n         rec(_children := List(s.children(), c->VTensor(c, @(1).val.vlen)),\n             dimensions := @(1).val.dimensions)))),\n\n    VTensorIndXXX := Rule([@(1, VTensorInd), @(2, [SUM, SUMAcc, Compose, BB, Buf, Inplace, RecursStep, ISum, ISumAcc, ISumLS, Data, NeedInterleavedComplex, SMPBarrier, SMPSum]), @(3)],\n    e -> let(s := @(2).val, CopyFields(s,\n         rec(_children := List(s.children(), c->VTensorInd(c, @(3).val)),\n             dimensions := @(1).val.dimensions)))),\n\n    # Free variables in breakdown rules seems to be broken...\n    VTensorInd_VTensor := Rule([@(1, VTensorInd), @(2).cond(e->ObjId(e)<>RTWrap), @(3).cond(e->not(e in @(2).val.free()))],\n        e -> VTensor(@(2).val, @(3).val.range)),\n\n#(s) -> SubstTopDownNR(RulesRC(s), @@(1, RCDiag, (x, cx) -> IsBound(cx.VRCLR) and cx.VRCLR <> [  ] or x.element.range() = TComplex), (x) -> x.toloop().sums())\n\n    # NOTE (handle xofs and yofs correctly)\n    MergeRS := ARule(Compose, [@(1,RecursStep), @(2,RecursStep)],\n    e -> [ RecursStep(0,0,@(1).val.child(1)*@(2).val.child(1)) ]),\n\n    # NOTE (handle xofs and yofs correctly)\n    # V * OP(a) -> OP(V*a), including the case V=BlockVPerm\n    XXX_VConsBlk := ARule(Compose, [@(1,[RecursStep, Buf, Inplace, BB, NeedInterleavedComplex]), @(2,_VConsRightBlk)],\n    e -> [ ObjId(@(1).val)(@(1).val.child(1)*@(2).val) ]),\n    XXX_VConsBlk_VCont := ARule(Compose, [@(1,[RecursStep, Buf, Inplace, BB, NeedInterleavedComplex]), [@(2, VContainer), @(3,_VConsRightBlk)]],\n    e -> [ ObjId(@(1).val)(@(1).val.child(1)*@(2).val) ]),\n\n    VConsBlk_XXX := ARule(Compose, [@(1,_VConsLeftBlk), @(2, [RecursStep, Buf, Inplace, BB, NeedInterleavedComplex])],\n    e -> [ ObjId(@(2).val)(@(1).val*@(2).val.child(1)) ]),\n    VConsBlk_VCont_XXX := ARule(Compose, [[@(1, VContainer), @(3,_VConsLeftBlk)], @(2, [RecursStep, Buf, Inplace, BB, NeedInterleavedComplex])],\n    e -> [ ObjId(@(2).val)(@(1).val*@(2).val.child(1)) ]),\n\n\n    VConsBlk_XXX := ARule(Compose, [@(1,_VConsLeftBlk), @(2, [RecursStep, Buf, Inplace, BB, NeedInterleavedComplex])],\n    e -> [ ObjId(@(2).val)(@(1).val*@(2).val.child(1)) ]),\n\n    VContainer_XXX := ARule(Compose, [@(1,VContainer), @(2).cond(x -> not (ObjId(x) in _VContDontPullIn))],\n        e -> [ ObjId(@(1).val)(@(1).val.child(1)*@(2).val, @(1).val.isa) ]),\n\n    XXX_VContainer := ARule(Compose, [@(1).cond(x -> not (ObjId(x) in _VContDontPullIn)), @(2, VContainer)],\n        e -> [ ObjId(@(2).val)(@(1).val*@(2).val.child(1), @(2).val.isa) ]),\n\n    Compose_VContainers := ARule(Compose, [ @(1, VContainer), @(2, VContainer, x -> x.isa=@(1).val.isa and x.isa.isCplx()=@(1).val.isa.isCplx())],\n        e -> [VContainer(@(1).val.child(1) * @(2).val.child(1), @(1).val.isa)]),\n\n    ISum_VContainer := Rule( [ISum, [@(1, VContainer), @(2)]],\n        e -> VContainer(ISum(e.var, e.domain, @(2).val), @(1).val.isa)),\n    IParSeq_VContainer := Rule( [IParSeq, [@(1, VContainer), @(2)]],\n        e -> VContainer(IParSeq(e.var, e.domain, e.fb_cnt, @(2).val), @(1).val.isa)),\n    SUM_VContainer := Rule( [@(1, SUM), @(2, VContainer, x -> ForAll(@(1).val.children(), a -> ObjId(a)=VContainer)), ...],\n        e -> VContainer( ApplyFunc(SUM, List(e.children(), l -> l.child(1))), @(2).val.isa)),\n    VContainer_PullFrom := Rule( [@(1, [NoDiagPullin, NoDiagPullinLeft, NoDiagPullinRight, CR, SymSPL]), @(2, VContainer)],\n        e -> VContainer( ObjId(@(1).val)(@(2).val.child(1)), @(2).val.isa )),\n    BlockVPerm_VContainer := Rule( [BlockVPerm, @(1, VContainer)],\n        e -> VContainer( BlockVPerm(e.n, e.vlen, @(2).val.child(1), e.perm), @(1).val.isa )),\n    # WrappedVCons_XXX and XXX_WrappedVCons rules duplicate VCons_XXX and XXX_VCons to suck\n    # Vconstructs wrapped into VContainer.\n    # V * SUM(a,b,...) -> SUM(V*a, V*b, ...), do not suck in BlockVPerm\n    WrappedVCons_XXX := ARule(Compose, [ [@(1, VContainer), @(0, _VConsLeft)], @(2, [SUM, SMPSum, SMPBarrier, ISum, Data]) ], e -> let(s:=@(2).val,\n    [ CopyFields(s, rec(_children := List(s.children(), c -> @(1).val * c ),\n                    dimensions := [@(1).val.dimensions[1], @(2).val.dimensions[2]])) ])),\n\n    XXX_WrappedVCons := ARule(Compose, [ @(1, [SUM, SUMAcc, SMPSum, SMPBarrier, ISum, Data]), [@(2, VContainer), @(0, _VConsRight)]], e -> let(s:=@(1).val,\n    [ CopyFields(s, rec(_children := List(s.children(), c -> c * @(2).val ),\n                    dimensions := [@(1).val.dimensions[1], @(2).val.dimensions[2]])) ])),\n\n    # V * SUM(a,b,...) -> SUM(V*a, V*b, ...), do not suck in BlockVPerm\n    VCons_XXX := ARule(Compose, [ @(1, _VConsLeft), @(2, [SUM, SMPSum, SMPBarrier, ISum, Data]) ], e -> let(s:=@(2).val,\n    [ CopyFields(s, rec(_children := List(s.children(), c -> @(1).val * c ),\n                    dimensions := [@(1).val.dimensions[1], @(2).val.dimensions[2]])) ])),\n\n    XXX_VCons := ARule(Compose, [ @(1, [SUM, SUMAcc, SMPSum, SMPBarrier, ISum, Data]), @(2, _VConsRight)], e -> let(s:=@(1).val,\n    [ CopyFields(s, rec(_children := List(s.children(), c -> c * @(2).val ),\n                    dimensions := [@(1).val.dimensions[1], @(2).val.dimensions[2]])) ])),\n\n    COND_VCons := ARule(Compose, [@(1, COND), @(2, _VConsRight)],\n        e -> [COND(@(1).val.cond, @(1).val.child(1)*@(2).val, @(1).val.child(2)*@(2).val)]),\n\n    VCons_COND := ARule(Compose, [@(1, _VConsLeft), @(2, COND)],\n        e -> [COND(@(2).val.cond, @(1).val*@(2).val.child(1), @(1).val*@(2).val.child(2))]),\n\n    # BlockVPerm * ISumLS\n    BlockVPermISum := ARule(Compose,  [ @(1, BlockVPerm), @(2, ISumLS) ],\n         e -> [ ISum(@(2).val.var, @(2).val.domain, @(1).val * @(2).val.child(1)) ]),\n\n    ISumBlockVPerm  := ARule(Compose, [ @(1, ISumLS), @(2, BlockVPerm) ],\n        e -> [ ISum(@(1).val.var, @(1).val.domain, @(1).val.child(1) * @(2).val) ]),\n\n    # Replace by vector constructs\n    VectGath := Rule([@(1, VTensor), @(2, Gath), ...], e->VGath(@(2).val.func, @(1).val.vlen)),\n    VectScat := Rule([@(1, VTensor), @(2, Scat), ...], e->VScat(@(2).val.func, @(1).val.vlen)),\n    VectScatAcc := Rule([@(1, VTensor), @(2, ScatAcc), ...], e->VScatAcc(@(2).val.func, @(1).val.vlen)),\n\n    # ----------------------\n    # Combine Gath/Scat\n    #\n    ComposeVGathVGath := ARule(Compose, [ @(1, VGath), @(2, [VGath, VGath_u, VGath_dup], e->@(1).val.v=e.v) ], # o 1-> 2->\n        e -> [ ObjId(@(2).val)(fCompose(@(2).val.func, @(1).val.func), @(1).val.v) ]),\n    # there is a copy of the rule below in autolib, why?\n    ComposeVGath_dup_Gath := ARule(Compose, [@(1, VGath_dup), @(2, [Gath, Prm])],\n    e -> [ VGath_dup(fCompose(Cond(ObjId(@2.val)=Prm,@(2).val.func,@(2).val.func), @(1).val.func), @(1).val.v) ]),\n\n    ComposeVScatVScat := ARule(Compose, [ @(1, [VScat_u, VScat, VScatAcc, VScatAcc_u]), @(2, VScat, e->@(1).val.v=e.v) ], # <-1 <-2 o\n        e -> [ ObjId(@(1).val)(fCompose(@(1).val.func, @(2).val.func), @(1).val.v) ]),\n\n    ComposeVScatVScatAcc := ARule(Compose, [ @(1, [VScat_u, VScat, VScatAcc, VScatAcc_u]), @(2, VScatAcc, e->@(1).val.v=e.v) ], # <-1 <-2 o\n        e -> let(scat := Cond(@(1).val _is VScat,   VScatAcc,\n\t\t              @(1).val _is VScat_u, VScatAcc_u,\n\t\t\t      @(1).val),\n\t    [ scat(fCompose(@(1).val.func, @(2).val.func), @(1).val.v) ])),\n\n    ComposeVScatPrm  := ARule(Compose, [@(1, [VScat, VScat_u, VScatAcc, VScatAcc_u]),   @(2, VPrm_x_I)], # 1-> <-2 o\n        e -> [ ObjId(@(1).val)(fCompose(@(1).val.func, @(2).val.func.transpose()), @(1).val.v) ]),\n    ComposeVGathPrm  := ARule(Compose, [ @(1, VGath), @(2, VPrm_x_I) ], # o 1-> 2->\n        e -> [ VGath(fCompose(@(2).val.func, @(1).val.func), @(1).val.v) ]),\n    ComposePrmVScat  := ARule(Compose, [ @(1, VPrm_x_I), @(2, [VScat, VScatAcc]) ], # 1-> <-2 o\n        e -> [ ObjId(@(2).val)(fCompose(@(1).val.func.transpose(), @(2).val.func), @(2).val.v) ]),\n    ComposePrmVGath  := ARule(Compose, [ @(1, VPrm_x_I), @(2, [VGath, VGath_u])], # o 1-> 2->\n        e -> [ ObjId(@(2).val)(fCompose(@(2).val.func, @(1).val.func), @(2).val.v) ]),\n\n    ComposeVTensorPrm  := ARule(Compose, [@(1, VTensor),   @(2, Prm)],\n        e -> [ @(1).val, VGath_sv(@(2).val.func, @(1).val.vlen, 1) ]),\n    ComposePrmVTensor  := ARule(Compose, [ @(1, Prm), @(2, VTensor) ],\n        e -> [  VScat_sv(@(1).val.func.transpose(), @(2).val.vlen, 1), @(2).val ]),\n\n## NOTE: These rules seem broken. There seems to be an assumption on the size of the Scatter. look at Compose_IxVGath_pc__Gath which was fixed for BG/Q 3D FFT\n    ComposeIxVGath_pc__Prm  := ARule(Compose, [ @(1, IxVGath_pc), @(2, [Prm, DelayedPrm])], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(@(2).val.func, g.k, g.v) ])),\n    Compose_IxVGath_pc__Gath  := ARule(Compose, [ @(1, IxVGath_pc), @(2, Gath)], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(fCompose(@(2).val.func, fTensor(fId(g.k), fAdd(g.N, g.n, g.ofs))), g.k, g.v) ])),\n    Compose_IxVGath_pc__VGath_sv  := ARule(Compose, [ @(1, IxVGath_pc), @(2, VGath_sv)], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(fTensor(@(2).val.func, fId(@(2).val.sv)), g.k, g.v) ])),\n    Compose_IxVGath_pc__VGath  := ARule(Compose, [ @(1, IxVGath_pc), @(2, VGath)], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(fTensor(@(2).val.func, fId(g.v)), g.k, g.v) ])),\n    Compose_IxRCVGath_pc__RCGath  := ARule(Compose, [ @(1, IxRCVGath_pc), @(2, VGath_sv, e->e.sv=2)], # o 1-> 2->\n        e -> let(g:=@(1).val, [ RCVStretchGath(@(2).val.func, g.k, g.v) ])),\n\n    Compose_VGath__IxVGath_pc := ARule(Compose, [ @(1, VGath, e->e.func.domain()<=2), @(2, IxVGath_pc, e->e.n <= e.v)],\n        e -> let(g := @(1).val, gpc := @(2).val,\n            Cond(g.func.domain()=1,\n                [ VGath_pc(gpc.k*gpc.N, gpc.n, fCompose(fTensor(fId(gpc.k), fAdd(gpc.N, gpc.n, gpc.ofs)), fTensor(g.func, fId(gpc.n))).at(0), gpc.v) ],\n                [ SUM(\n                    VScat(fBase(V(2),V(0)), g.v) * VGath_pc(gpc.k*gpc.N, gpc.n, fCompose(fTensor(fId(gpc.k), fAdd(gpc.N, gpc.n, gpc.ofs)), fTensor(fCompose(g.func, fBase(V(2),V(0))), fId(gpc.n))).at(0), gpc.v),\n                    VScat(fBase(V(2),V(1)), g.v) * VGath_pc(gpc.k*gpc.N, gpc.n, fCompose(fTensor(fId(gpc.k), fAdd(gpc.N, gpc.n, gpc.ofs)), fTensor(fCompose(g.func, fBase(V(2),V(1))), fId(gpc.n))).at(0), gpc.v))\n                ]\n        ))),\n\n## NOTE: These rules seem broken. There seems to be an assumption on the size of the Scatter. look at Compose_IxVGath_pc__Gath which was fixed for BG/Q 3D FFT\n    ComposePrmIxVScat_pc  := ARule(Compose, [ @(1, [Prm, DelayedPrm]), @(2, IxVScat_pc) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(@(1).val.func.transpose(), s.k, s.v) ])),\n    Compose_Scat__IxVScat_pc  := ARule(Compose, [ @(1, Scat), @(2, IxVScat_pc) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(fCompose(@(1).val.func, fTensor(fId(s.k), fAdd(s.N, s.n, s.ofs))), s.k, s.v) ])),\n    Compose_VScat_sv__IxVScat_pc  := ARule(Compose, [ @(1, VScat_sv), @(2, IxVScat_pc) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(fTensor(@(1).val.func, fId(@(1).val.sv)), s.k, s.v) ])),\n    Compose_VScat__IxVScat_pc  := ARule(Compose, [ @(1, VScat), @(2, IxVScat_pc) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(fTensor(@(1).val.func, fId(s.v)), s.k, s.v) ])),\n    Compose_RCScat__IxRCVScat_pc  := ARule(Compose, [ @(1, VScat_sv, e->e.sv=2), @(2, IxRCVScat_pc) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ RCVStretchScat(@(1).val.func, s.k, s.v) ])),\n\n    Compose_IxVScat_pc__VScat := ARule(Compose, [ @(1, IxVScat_pc, e->e.n <= e.v), @(2, VScat, e->e.func.domain()<=2)],\n        e -> let(s := @(2).val, spc := @(1).val,\n            Cond(s.func.domain()=1,\n                [ VScat_pc(spc.k*spc.N, spc.n, fCompose(fTensor(fId(spc.k), fAdd(spc.N, spc.n, spc.ofs)), fTensor(s.func, fId(spc.n))).at(0), spc.v) ],\n                [ SUM(\n                    VScat_pc(spc.k*spc.N, spc.n, fCompose(fTensor(fId(spc.k), fAdd(spc.N, spc.n, spc.ofs)), fTensor(fCompose(s.func, fBase(V(2),V(0))), fId(spc.n))).at(0), spc.v) * VGath(fBase(V(2),V(0)), s.v),\n                    VScat_pc(spc.k*spc.N, spc.n, fCompose(fTensor(fId(spc.k), fAdd(spc.N, spc.n, spc.ofs)), fTensor(fCompose(s.func, fBase(V(2),V(1))), fId(spc.n))).at(0), spc.v) * VGath(fBase(V(2),V(1)), s.v))\n                ]\n        ))),\n\n    ComposeVStretchGath__Prm  := ARule(Compose, [ @(1, VStretchGath), @(2, [Prm,DelayedPrm])], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(fCompose(@(2).val.func, g.func), g.part, g.v) ])),\n    Compose_VStretchGath__Gath  := ARule(Compose, [ @(1, VStretchGath), @(2, Gath)], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(fCompose(@(2).val.func, g.func), g.part, g.v) ])),\n    Compose_VStretchGath__VGath  := ARule(Compose, [ @(1, VStretchGath), @(2, VGath)], # o 1-> 2->\n        e -> let(g:=@(1).val, [ VStretchGath(fCompose(fTensor(@(2).val.func, fId(g.v)), g.func), g.part, g.v) ])),\n\n    ComposePrmVStretchScat  := ARule(Compose, [ @(1, [Prm,DelayedPrm]), @(2, VStretchScat) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(fCompose(@(1).val.func.transpose(), s.func), s.part, s.v) ])),\n    Compose_Scat__VStretchScat  := ARule(Compose, [ @(1, Scat), @(2, VStretchScat) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(fCompose(@(1).val.func, s.func), s.part, s.v) ])),\n    Compose_VScat__VStretchScat  := ARule(Compose, [ @(1, VScat), @(2, VStretchScat) ], # 1-> <-2 o\n        e -> let(s:=@(2).val, [ VStretchScat(fCompose(fTensor(@(1).val.func, fId(s.v)), s.func), s.part, s.v) ])),\n\n    Drop_GathScat := ARule(Compose, [ @(1), @(2, VGath),  @(3, VScat, x -> x.transpose()=@(2).val), @(4)],\n        e -> [@(1).val, @(4).val]),\n# uncombinable gather/scatter CANNOT be pulled in!!!\n# NOTE: only pull till BB(), then stop -> new rewriting stage _after_ MarkBB\n#    XXX_ISum := ARule(Compose,  [ @(1, [IxVScat_pc, IxRCVScat_pc, VStretchScat, RCVStretchScat]), @(2, ISum) ],\n#         e -> [ ObjId(@(2).val)(@(2).val.var, @(2).val.domain, @(1).val * @(2).val.child(1)).attrs(@(2).val) ]),\n#\n#    ISum_XXX  := ARule(Compose, [ @(1, [ISum, ISumAcc]), @(2, [IxVGath_pc, IxRCVGath_pc, VStretchGath, RCVStretchGath]) ],\n#        e -> [ ObjId(@(1).val)(@(1).val.var, @(1).val.domain, @(1).val.child(1) * @(2).val).attrs(@(1).val) ]),\n\n\n# uncombinable gather/scatter CANNOT be pulled in!!!\n# NOTE: only pull till BB(), then stop -> new rewriting stage _after_ MarkBB\n#    VScatSUM := ARule(Compose, [ @(1, [IxVScat_pc, IxRCVScat_pc, VStretchScat, RCVStretchScat]), @(2, SUM) ],\n#     e -> [ ApplyFunc(ObjId(@(2).val),\n#                  List(@(2).val.children(), c -> @(1).val * c)) ]),\n#\n#    VGathSUM  := ARule(Compose, [ @(1, SUM), @(2, [IxVGath_pc, IxRCVGath_pc, VStretchGath, RCVStretchGath])],\n#     e -> [ ApplyFunc(ObjId(@(1).val),\n#                  List(@(1).val.children(), c -> c * @(2).val)) ]),\n\n################################################\n# NOTE!!!!!!!!!!!!!!!!!!\n# GUARD MISSING: gather/scatter must be f x fId(v^2)\n#    ComposeBlockVPermVScat := ARule(Compose,[ @(1, BlockVPerm), @(2, VScat)],\n#        e->[@2.val, BlockVPerm(@2.val.dimensions[2]/@1.val.child(1).dims()[1], @1.val.vlen, @1.val.child(1), @1.val.perm)]\n#    ),\n#    ComposeVGathBlockVPerm := ARule(Compose,[ @(1, VGath), @(2, BlockVPerm)],\n#        e->[BlockVPerm(@1.val.dimensions[1]/@2.val.child(1).dims()[2], @2.val.vlen, @2.val.child(1), @2.val.perm), @1.val ]\n#    ),\n\n    ScatH_VScat_pc := ARule(Compose, [ [ @(1, [Scat,ScatAcc]), fId ], @(2, [VScat_pc, VScat_pcAcc]) ],\n\te -> let(s   := @(2).val,\n\t         oid := Cond((@(1).val _is Scat) and (@(2).val _is VScat_pc), VScat_pc, VScat_pcAcc),\n\t         [ oid(s.N, s.n, s.ofs, s.v) ])),\n\n    ScatId_VScat_pc := ARule(Compose, [ [ @(1, [Scat,ScatAcc]), [ @(2,H), @, @, @, 1 ] ], @(3, [VScat_pc, VScat_pcAcc]) ],\n\te -> let(h   := @(2).val,\n\t         s   := @(3).val,\n\t         oid := Cond((@(1).val _is Scat) and (@(3).val _is VScat_pc), VScat_pc, VScat_pcAcc),\n\t         [ oid(h.params[1], s.n, s.ofs + h.params[3], s.v) ])),\n\n    VGath_pc__toVGath := Rule(@(1, VGath_pc, e->let(v := e.v, (e.N mod v = 0) and (e.n mod v = 0) and (e.ofs mod v = 0))),\n        e->let(g := @(1).val, v := g.v, VGath(fAdd(g.N/v, g.n/v, g.ofs/v), v))),\n\n    VScat_pc__toVScat := Rule(@(1, VScat_pc, e->let(v := e.v, (e.N mod v = 0) and (e.n mod v = 0) and (e.ofs mod v = 0))),\n        e->let(s := @(1).val, v := s.v, VScat(fAdd(s.N/v, s.n/v, s.ofs/v), v))),\n\n    VScat_pcAcc__toVScatAcc := Rule(@(1, VScat_pcAcc, e->let(v := e.v, (e.N mod v = 0) and (e.n mod v = 0) and (e.ofs mod v = 0))),\n        e->let(s := @(1).val, v := s.v, VScatAcc(fAdd(s.N/v, s.n/v, s.ofs/v), v)))\n\n));\n\n\nClass(RulesTerm, RuleSet);\nRewriteRules(RulesTerm, rec(\n    ISumLS_Term := Rule(@(1,ISumLS), e->ISum(@(1).val.var, @(1).val.domain, @(1).val.child(1)).attrs(@(1).val)),\n    BlockVPerm_Term := Rule(@(1,[BlockVPerm, BlockVPerm2]), e-> Tensor(I(@1.val.n), @1.val._children[1]).sums()),\n#   BROKEN RULES; to be redone for loop code\n#    IxVGath_pc_term := Rule(@(1,IxVGath_pc, e->e.k>1),\n#        e->let(i := Ind(), k:= @1.val.k, v:=@1.val.v,\n#            ISum(i, k,\n#                VScat(fTensor(fBase(k,i), fId(@1.val.nv/v)), v) *\n#                IxVGath_pc(1, k*@1.val.N, @1.val.n, add(mul(i,k), @1.val.ofs), v)\n#            ))),\n#    IxVScat_pc_term := Rule(@(1,IxVScat_pc, e->e.k>1),\n#        e->let(i := Ind(), k:= @1.val.k, v:=@1.val.v,\n#            ISum(i, k,\n#                IxVScat_pc(1, k*@1.val.N, @1.val.n, add(mul(i,k), @1.val.ofs), v) *\n#                VGath(fTensor(fBase(k,i), fId(@1.val.nv/v)), v)\n#            ))),\n#\n    term_PushLR := Rule(@(1, PushLR), e->e.child(1).sums()),\n\n\n));\n\n\nClass(RulesTermGrp, RuleSet);\nRewriteRules(RulesTermGrp, rec(\n    Grp_Term := Rule(@(1,Grp), e-> @1.val._children[1])\n));\n\n\nClass(RulesKickout, RuleSet);\nRewriteRules(RulesKickout, rec(\n    IxVGath_pc__IxVScat_pc_kickout := ARule(Compose, [@(1, IxVGath_pc), @(2, IxVScat_pc, g->let(s:=@(1).val, s.k=g.k and s.n=g.n and s.N=g.N and s.ofs=g.ofs and s.v=g.v))],\n            e->let(g:=@(1).val, [VGath(fId(Rows(g)/g.v), g.v), VScat(fId(Rows(g)/g.v), g.v)])),\n\n    IxVScat_VScat_kickout := Rule(@(1,IxVScat_pc, s-> IsInt(s.n/s.v) and IsInt(s.N/s.v) and IsInt(s.ofs/s.v)),\n            e->let(s:=@(1).val, v:=s.v, VScat(fTensor(fId(s.k), fAdd(s.N/v, s.n/v, s.ofs/v)), v))),\n\n    IxVGath_VGath_kickout := Rule(@(1,IxVGath_pc, s-> IsInt(s.n/s.v) and IsInt(s.N/s.v) and IsInt(s.ofs/s.v)),\n            e->let(s:=@(1).val, v:=s.v, VGath(fTensor(fId(s.k), fAdd(s.N/v, s.n/v, s.ofs/v)), v))),\n));\n\n\nClass(TerminateSymSPL, RuleSet);\nRewriteRules(TerminateSymSPL, rec(\n    terminateSymSPL := Rule(@(1, SymSPL), e->@(1).val.child(1))\n));\n\nClass(TerminateDPrm, RuleSet);\nRewriteRules(TerminateSymSPL, rec(\n    terminateDPrm := Rule(@(1, DelayedPrm), e->Prm(@(1).val.func))\n));\n", "meta": {"hexsha": "29f8129126cf49bb73e15b44cdf4547f7c9bcc6d", "size": 21497, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/rewrite/propagate.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/rewrite/propagate.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/rewrite/propagate.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 63.412979351, "max_line_length": 245, "alphanum_fraction": 0.558729125, "num_tokens": 8176, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.42250462027098473, "lm_q2_score": 0.0335895062547419, "lm_q1q2_score": 0.014191721585249593}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nsort_1 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_2 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 1, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 1, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_9_8_7_6_5_4_3_2\");\n\nend;\n\nsort_3 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_3_2_7_1_1_1_1_1\");\n\nend;\n\nsort_4 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 16, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_16_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 16, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_16_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_9_4_7_3_5_2_3_1\");\n\nend;\n\nsort_5 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_3_2_1_1_1_1_1_1\");\n\nend;\n\nsort_6 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 32, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_32_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 32, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_32_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_3_4_7_2_5_2_1_1\");\n\nend;\n\nsort_7 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_3_1_1_1_1_1_1_1\");\n\nend;\n\nsort_8 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 64, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_64_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 64, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_64_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_3_2_7_2_5_1_1_1\");\n\nend;\n\nsort_9 := function()\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(512, 128, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_512_128_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(512, 128, [1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_512_128_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_10 := function()\n\tHDLSynthesize_no_brams(sortAlg4(512, 128, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_512_128_1\");\n\tHDLSynthesize_no_brams(sortAlg4(512, 128, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_512_128_3\");\n\tHDLSynthesize_no_brams(sortAlg4(512, 128, 9), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_512_128_9\");\n\tHDLSynthesize_no_brams(sortAlg4(512, 128, 27), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_512_128_27\");\n\tHDLSynthesize_no_brams(sortAlg4(512, 128, 81), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_512_128_81\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 1), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_1\");\n\tHDLSynthesize_no_brams(sortAlg1(1024, 2), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_2\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 2), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_2\");\n\tHDLSynthesize_no_brams(sortAlg1(1024, 4), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_4\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 4), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_4\");\n\nend;\n\nsort_11 := function()\n\tHDLSynthesize_no_brams(sortAlg1(1024, 8), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_8\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 8), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_8\");\n\tHDLSynthesize_no_brams(sortAlg1(1024, 16), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_16\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 16), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_16\");\n\tHDLSynthesize_no_brams(sortAlg1(1024, 32), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_32\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 32), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_32\");\n\tHDLSynthesize_no_brams(sortAlg1(1024, 64), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_64\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 64), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_64\");\n\tHDLSynthesize_no_brams(sortAlg1(1024, 128), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_1024_128\");\n\tHDLSynthesize_no_brams(sortAlg6(1024, 128), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_1024_128\");\n\nend;\n\nsort_12 := function()\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_2_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_13 := function()\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 1, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 1, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_1_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_14 := function()\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_2_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_15 := function()\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 2, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_2_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 2, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_2_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_16 := function()\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_2_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_17 := function()\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_4_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_4_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_18 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 16, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_16_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 16, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_16_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 16, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_16_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 16, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_16_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 16, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_16_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_5_3_4_7_2_5_2_1_1\");\n\nend;\n\nsort_19 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_2_3_1_1_1_1_1_1_1\");\n\nend;\n\nsort_20 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 32, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_32_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 32, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_32_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_5_3_4_7_2_5_2_1_1\");\n\nend;\n\nsort_21 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_2_3_1_1_1_1_1_1_1\");\n\nend;\n\nsort_22 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 64, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_64_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 64, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_64_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_5_3_4_7_2_5_2_1_1\");\n\nend;\n\nsort_23 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_2_3_1_1_1_1_1_1_1\");\n\nend;\n\nsort_24 := function()\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(1024, 128, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_1024_128_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(1024, 128, [1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_1024_128_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_1\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_2\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 5), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_5\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 10), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_10\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 20), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_20\");\n\nend;\n\nsort_25 := function()\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 50), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_50\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 16, 100), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_16_100\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_1\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_2\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 5), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_5\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 10), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_10\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 20), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_20\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 50), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_50\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 32, 100), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_32_100\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_1\");\n\nend;\n\nsort_26 := function()\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_2\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 5), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_5\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 10), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_10\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 20), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_20\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 50), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_50\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 64, 100), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_64_100\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_1\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_2\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 5), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_5\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 10), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_10\");\n\nend;\n\nsort_27 := function()\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 20), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_20\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 50), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_50\");\n\tHDLSynthesize_no_brams(sortAlg4(1024, 128, 100), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_1024_128_100\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 16, [11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_16_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 16, [11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_16_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 16, [11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_16_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 16, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_16_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 16, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_16_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_10_9_8_7_6_5_4_3_2\");\n\nend;\n\nsort_28 := function()\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_2_3_2_7_1_1_1_1_1\");\n\nend;\n\nsort_29 := function()\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 32, [11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_32_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 32, [11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_32_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 128, [11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_128_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 128, [11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_128_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 128, [11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_128_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_11_2_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_30 := function()\n\tHDLSynthesize_no_brams(sortAlg5(2048, 128, [11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_128_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 128, [11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_128_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(2048, 128, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_2048_128_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(2048, 128, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_2048_128_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg4(2048, 1, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_1_1\");\n\tHDLSynthesize_no_brams(sortAlg4(2048, 1, 11), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_1_11\");\n\tHDLSynthesize_no_brams(sortAlg4(2048, 1, 121), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_1_121\");\n\tHDLSynthesize_no_brams(sortAlg4(2048, 2, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_2_1\");\n\nend;\n\nsort_31 := function()\n\tHDLSynthesize_no_brams(sortAlg4(2048, 2, 11), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_2_11\");\n\tHDLSynthesize_no_brams(sortAlg4(2048, 2, 121), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_2_121\");\n\tHDLSynthesize_no_brams(sortAlg4(2048, 4, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_2048_4_1\");\n\tHDLSynthesize_no_brams(sortAlg6(4096, 8), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_4096_8\");\n\tHDLSynthesize_no_brams(sortAlg1(4096, 16), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_4096_16\");\n\tHDLSynthesize_no_brams(sortAlg6(4096, 16), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_4096_16\");\n\tHDLSynthesize_no_brams(sortAlg1(4096, 32), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_4096_32\");\n\tHDLSynthesize_no_brams(sortAlg6(4096, 32), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_4096_32\");\n\tHDLSynthesize_no_brams(sortAlg1(4096, 64), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_4096_64\");\n\tHDLSynthesize_no_brams(sortAlg6(4096, 64), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_4096_64\");\n\nend;\n\nsort_32 := function()\n\tHDLSynthesize_no_brams(sortAlg1(4096, 128), 1, 0, 16, 350, 1,\"sortAlg1_noBRAMs_4096_128\");\n\tHDLSynthesize_no_brams(sortAlg6(4096, 128), 1, 0, 16, 350, 1,\"sortAlg6_noBRAMs_4096_128\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_3_11_5_3_2_7_2_5_1_1_1\");\n\nend;\n\nsort_33 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_2_11_2_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_34 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 1, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_1_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 1, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_1_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_6_11_5_9_4_7_3_5_2_3_1\");\n\nend;\n\nsort_35 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_2_11_2_3_2_1_1_1_1_1_1\");\n\nend;\n\nsort_36 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 2, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_2_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 2, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_2_1_1_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_37 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_3_11_2_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_38 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_2_11_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_39 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_4_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 4, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_4_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_4_11_5_3_4_7_2_5_2_1_1\");\n\nend;\n\nsort_40 := function()\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 8, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_8_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 8, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_8_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_12_11_10_9_8_7_6_5_4_3_2\");\n\nend;\n\nsort_41 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_2_11_2_3_2_7_1_1_1_1_1\");\n\nend;\n\nsort_42 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_2_1_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_43 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 16, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_16_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 16, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_16_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_3_11_5_3_2_7_2_5_1_1_1\");\n\nend;\n\nsort_44 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_2_11_2_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_45 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 32, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_32_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 32, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_32_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_6_11_5_9_4_7_3_5_2_3_1\");\n\nend;\n\nsort_46 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_2_11_2_3_2_1_1_1_1_1_1\");\n\nend;\n\nsort_47 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 64, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_64_1_1_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_48 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 64, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_64_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_12_11_10_9_8_7_6_5_4_3_2\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [6, 11, 5, 9, 4, 7, 3, 5, 2, 3, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_6_11_5_9_4_7_3_5_2_3_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [4, 11, 5, 3, 4, 7, 2, 5, 2, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_4_11_5_3_4_7_2_5_2_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [3, 11, 5, 3, 2, 7, 2, 5, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_3_11_5_3_2_7_2_5_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_3_11_2_3_2_7_2_1_1_1_1\");\n\nend;\n\nsort_49 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [3, 11, 2, 3, 2, 7, 2, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_3_11_2_3_2_7_2_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [2, 11, 2, 3, 2, 7, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_2_11_2_3_2_7_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [2, 11, 2, 3, 2, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_2_11_2_3_2_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [2, 11, 2, 3, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_2_11_2_3_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [2, 11, 2, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_2_11_2_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [2, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_2_11_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_2_1_1_1_1_1_1_1_1_1_1\");\n\nend;\n\nsort_50 := function()\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_2_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg2(4096, 128, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg2_noBRAMs_4096_128_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg5(4096, 128, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 1, 0, 16, 350, 1,\"sortAlg5_noBRAMs_4096_128_1_1_1_1_1_1_1_1_1_1_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_24\");\n\nend;\n\nsort_51 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 1, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_1_144\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_12\");\n\nend;\n\nsort_52 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 2, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_2_144\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_6\");\n\nend;\n\nsort_53 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 4, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_4_144\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_4\");\n\nend;\n\nsort_54 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 8, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_8_144\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_3\");\n\nend;\n\nsort_55 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 16, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_16_144\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_2\");\n\nend;\n\nsort_56 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 32, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_32_144\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_1\");\n\nend;\n\nsort_57 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 64, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_64_144\");\n\nend;\n\nsort_58 := function()\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 1), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_1\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 2), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_2\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 3), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_3\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 4), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_4\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 6), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_6\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 12), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_12\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 24), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_24\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 36), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_36\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 48), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_48\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 72), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_72\");\n\tHDLSynthesize_no_brams(sortAlg4(4096, 128, 144), 1, 0, 16, 350, 1,\"sortAlg4_noBRAMs_4096_128_144\");\nend;\n", "meta": {"hexsha": "f7f737666ac24f0c45e9d78af4ae7ee259d6092f", "size": 76549, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/stream/sort_explore.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/stream/sort_explore.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/stream/sort_explore.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 93.8100490196, "max_line_length": 154, "alphanum_fraction": 0.7010542267, "num_tokens": 48493, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.40356685373537454, "lm_q2_score": 0.035144844505941936, "lm_q1q2_score": 0.01418329432228195}}
{"text": "#############################################################################\n##\n#W  automgroup.gi             automgrp package                 Yevgen Muntyan\n#W                                                             Dmytro Savchuk\n##\n#Y  Copyright (C) 2003 - 2018 Yevgen Muntyan, Dmytro Savchuk\n##\n\n\n###############################################################################\n##\n#M  AutomatonGroup(<list>)\n##\nInstallMethod(AutomatonGroup, \"for [IsList]\", [IsList],\nfunction(list)\n  return AutomatonGroup(list, false);\nend);\n\n\n###############################################################################\n##\n#M  AutomatonGroup(<list>, <bind_vars>)\n##\nInstallMethod(AutomatonGroup, \"for [IsList, IsBool]\", [IsList, IsBool],\nfunction(list, bind_vars)\n  if not AG_IsCorrectAutomatonList(list, true) then\n    Error(\"in AutomatonGroup(IsList, IsBool):\\n\",\n          \"  given list is not a correct list representing automaton\\n\");\n  fi;\n\n  return GroupOfAutomFamily(AutomFamily(list, bind_vars));\nend);\n\n\n###############################################################################\n##\n#M  AutomatonGroup(<list>, <names>)\n##\nInstallMethod(AutomatonGroup, \"for [IsList, IsList]\", [IsList, IsList],\nfunction(list, names)\n  return AutomatonGroup(list, names, AG_Globals.bind_vars_autom_family);\nend);\n\n\n###############################################################################\n##\n#M  AutomatonGroup(<list>, <names>, <bind_vars>)\n##\nInstallMethod(AutomatonGroup,\n              \"for [IsList, IsList, IsBool]\", [IsList, IsList, IsBool],\nfunction(list, names, bind_vars)\n  if not AG_IsCorrectAutomatonList(list, true) then\n    Error(\"error in AutomatonGroup(IsList, IsList, IsBool):\\n\",\n          \"  given list is not a correct list representing automaton\\n\");\n  fi;\n\n  return GroupOfAutomFamily(AutomFamily(list, names, bind_vars));\nend);\n\n\n###############################################################################\n##\n#M  AutomatonGroup(<string>)\n#M  AutomatonGroup(<string>, <bind_vars>)\n##\nInstallMethod(AutomatonGroup, \"for [IsString]\", [IsString],\nfunction(string)\n  return AutomatonGroup(string, AG_Globals.bind_vars_autom_family);\nend);\n\nInstallMethod(AutomatonGroup, \"for [IsString, IsBool]\", [IsString, IsBool],\nfunction(string, bind_vars)\n  local s;\n  s := AG_ParseAutomatonString(string);\n  return AutomatonGroup(s[2], s[1], bind_vars);\nend);\n\n\nInstallMethod(AutomatonGroup, \"for [IsMealyAutomaton]\", [IsMealyAutomaton],\nfunction(A)\n  if not IsInvertible(A) then\n    Error(\"Automaton <A> is not invertible\");\n  fi;\n  return AutomatonGroup(AutomatonList(A), A!.states);\nend);\n\nInstallMethod(AutomatonGroup, \"for [IsMealyAutomaton, IsBool]\", [IsMealyAutomaton, IsBool],\nfunction(A, bind_vars)\n  if not IsInvertible(A) then\n    Error(\"Automaton <A> is not invertible\");\n  fi;\n  return AutomatonGroup(AutomatonList(A), A!.states, bind_vars);\nend);\n\n\n###############################################################################\n##\n#M  GroupOfAutomFamily(<G>)\n##\nInstallMethod(GroupOfAutomFamily, \"for [IsAutomGroup]\",\n                   [IsAutomGroup],\nfunction(G)\n  return GroupOfAutomFamily(UnderlyingAutomFamily(G));\nend);\n\n\n###############################################################################\n##\n#M  IsGroupOfAutomFamily(<G>)\n##\nInstallMethod(IsGroupOfAutomFamily, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  return G = GroupOfAutomFamily(G);\nend);\n\n\n###############################################################################\n##\n#M  UseSubsetRelation(<G>)\n##\nInstallMethod(UseSubsetRelation,\n              \"for [IsAutomGroup, IsAutomGroup]\",\n              [IsAutomGroup, IsAutomGroup],\nfunction(super, sub)\n  ## the full group is self similar, so if <super> is smaller than the full\n  ##  group then sub is smaller either\n  if HasIsGroupOfAutomFamily(super) then\n    if not IsGroupOfAutomFamily(super) then\n      SetIsGroupOfAutomFamily(sub, false); fi; fi;\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  __AG_SubgroupOnLevel(<G>, <gens>, <level>)\n##\nInstallMethod(__AG_SubgroupOnLevel, [IsAutomGroup,\n                                    IsList and IsTreeAutomorphismCollection,\n                                    IsPosInt],\nfunction(G, gens, level)\n  local overgroup;\n\n  if IsEmpty(gens) or (Length(gens) = 1 and IsOne(gens[1])) then\n    return TrivialSubgroup(G);\n  fi;\n\n  if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n    overgroup := G;\n  else\n    overgroup := GroupOfAutomFamily(UnderlyingAutomFamily(G));\n  fi;\n\n  return SubgroupNC(overgroup, gens);\nend);\n\nInstallOtherMethod(__AG_SubgroupOnLevel, [IsAutomGroup, IsList and IsEmpty, IsPosInt],\nfunction(G, gens, level)\n  return TrivialSubgroup(G);\nend);\n\nInstallMethod(__AG_SubgroupOnLevel, [IsTreeAutomorphismGroup,\n                                    IsList and IsInvertibleAutomCollection,\n                                    IsPosInt],\nfunction(G, gens, level)\n  local overgroup;\n\n  overgroup := GroupOfAutomFamily(FamilyObj(gens[1]));\n\n  if Length(gens) = 1 and IsOne(gens[1]) then\n    return TrivialSubgroup(overgroup);\n  fi;\n\n  return SubgroupNC(overgroup, gens);\nend);\n\nInstallMethod(__AG_SimplifyGroupGenerators, [IsList and IsInvertibleAutomCollection],\nfunction(gens)\n  local words, fam;\n\n  if IsEmpty(gens) then\n    return [];\n  fi;\n\n  fam := FamilyObj(gens[1]);\n  words := FreeGeneratorsOfGroup(Group(List(gens, a -> a!.word)));\n\n  if fam!.use_rws and not IsEmpty(words) then\n    words := AG_ReducedForm(fam!.rws, words);\n    if not IsEmpty(words) then\n      words := FreeGeneratorsOfGroup(Group(words));\n    fi;\n  fi;\n\n  if IsEmpty(words) then\n    return [];\n  fi;\n\n  return List(words, w -> Autom(w, fam));\nend);\n\n###############################################################################\n##\n#M  PrintObj(<G>)\n##\nInstallMethod(PrintObj, \"for [IsAutomatonGroup]\",\n              [IsAutomatonGroup],\nfunction(G)\n  Print(\"AutomatonGroup(\\\"\", String(G), \"\\\")\");\nend);\n\n\n###############################################################################\n##\n#M  Display(<G>)\n##\nInstallMethod(Display, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  local i, gens, printone;\n\n  printone := function(a)\n    Print(a, \" = \", Decompose(a));\n  end;\n\n  gens := GeneratorsOfGroup(G);\n  if gens = [] then Print(\"< >\"); fi;\n  if Length(gens) = 1 then\n    Print(\"< \"); printone(gens[1]); Print(\" >\");\n  else\n    Print(\"< \"); printone(gens[1]); Print(\", \\n\");\n    for i in [2..Length(gens)-1] do\n      Print(\"  \"); printone(gens[i]); Print(\", \\n\");\n    od;\n    Print(\"  \"); printone(gens[Length(gens)]); Print(\" >\");\n  fi;\nend);\n\n\n#############################################################################\n##\n#M  String(<G>)\n##\nInstallMethod(String, \"for [IsAutomGroup]\", [IsAutomGroup],\nfunction(G)\n  local i, gens, formatone, s;\n\n  formatone := function(a)\n    return Concatenation(String(a), \" = \", String(Decompose(a)));\n  end;\n\n  gens := GeneratorsOfGroup(G);\n\n  s := \"\";\n  for i in [1..Length(gens)] do\n    Append(s, formatone(gens[i]));\n    if i <> Length(gens) then\n      Append(s, \", \");\n    fi;\n  od;\n\n  return s;\nend);\n\n###############################################################################\n##\n#M  ViewObj(<G>)\n##\nInstallMethod(ViewObj, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  local i, gens;\n  gens := List(GeneratorsOfGroup(G), g -> Word(g));\n  if gens = [] then Print(\"< >\"); fi;\n  Print(\"< \");\n  for i in [1..Length(gens)-1] do\n    if IsOne(gens[i]) then\n      Print(AG_Globals.identity_symbol, \", \");\n    else\n      Print(gens[i], \", \");\n    fi;\n  od;\n  if IsOne(gens[Length(gens)]) then\n    Print(AG_Globals.identity_symbol, \" >\");\n  else\n    Print(gens[Length(gens)], \" >\");\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  MihailovaSystem(G)\n##\n##  TODO XXX test it\n##\nInstallMethod(MihailovaSystem, \"for [IsAutomatonGroup]\", [IsAutomatonGroup],\nfunction (G)\n  local gens, mih, mih_gens, i;\n\n  if not IsActingOnBinaryTree(G) then\n    Error(\"MihailovaSystem(IsAutomGroup):\\n  sorry, group is not acting on binary tree\\n\");\n  fi;\n  if not IsFractalByWords(G) then\n    Info(InfoAutomGrp, 1, \"given group is not IsFractalByWords\");\n    return fail;\n  fi;\n\n  gens := GeneratorsOfGroup(StabilizerOfFirstLevel(G));\n  mih := AG_ComputeMihailovaSystemPairs(List(gens, a -> StatesWords(a)));\n\n  if mih = fail then\n    return fail;\n  elif not mih[3] then\n    return gens;\n  fi;\n\n  mih_gens := [];\n  for i in [1..Length(gens)] do\n    mih_gens[i] := AG_CalculateWord(mih[2][i], gens);\n  od;\n  return mih_gens;\nend);\n\n\n###############################################################################\n##\n#M  IsFractalByWords(G)\n##\nInstallMethod(IsFractalByWords, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction (G)\n  local freegens, stab, i, sym, f;\n\n  sym := GroupWithGenerators(List(GeneratorsOfGroup(G), g -> Perm(g)));\n  if not IsTransitive(sym, [1..DegreeOfTree(G)]) then\n    Info(InfoAutomGrp, 1, \"group is not transitive on first level\");\n    return false;\n  fi;\n\n  f := GroupWithGenerators(List(GeneratorsOfGroup(G), g -> Word(g)));\n  stab := StabilizerOfFirstLevel(G);\n  stab := List(GeneratorsOfGroup(stab), a -> StatesWords(a));\n\n  for i in [1..DegreeOfTree(G)] do\n    if f <> GroupWithGenerators(List(stab, s -> s[i])) then\n      return false;\n    fi;\n  od;\n  return true;\nend);\n\n\n###############################################################################\n##\n#M  Size(G)\n##\nInstallMethod(Size, \"for [IsAutomGroup]\", [IsAutomGroup],\nfunction (G)\n  local f, A, lev;\n  if IsTrivial(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): 1, G is trivial\");\n    return 1;\n  fi;\n\n  if CanEasilyTestSphericalTransitivity(G) and IsSphericallyTransitive(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): infinity, G is spherically transitive\");\n    return infinity;\n  fi;\n\n  if IsFractalByWords(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): infinity, G is fractal by words\");\n    return infinity;\n  fi;\n\n  if HasIsFractal(G) and IsFractal(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): infinity, G is fractal\");\n    return infinity;\n  fi;\n\n\n  if IsAutomatonGroup(G) then\n    A:=MealyAutomaton(AutomatonList(G));\n    if IsMDTrivial(A) then\n      Info(InfoAutomGrp, 3, \"Size(G): automaton generating G is MD-trivial\");\n      lev:=LevelOfFaithfulAction(G,infinity);\n      return Size(G);\n    elif (DegreeOfTree(G)=2 or NumberOfStates(A)=2) and IsIRAutomaton(A) then\n      Info(InfoAutomGrp, 3, \"Size(G): infinity, G is generated by 2-letter or 2-state not MD-trivial IR-automaton \");\n      return infinity;\n    fi;\n  fi;\n\n  if IsAutomatonGroup(G) and LevelOfFaithfulAction(G,8)<>fail then\n    return Size(G);\n  fi;\n\n  f := FindElementOfInfiniteOrder(G,10,10);\n\n  if HasSize(G) or f <> fail then\n    return Size(G);\n  fi;\n\n  Info(InfoAutomGrp, 1, \"You can try to use IsomorphismPermGroup(<G>) or\\n\",\n                        \"   FindElementOfInfiniteOrder(<G>,<length>,<depth>) with bigger bounds\");\n  TryNextMethod();\nend);\n\n\nInstallOtherMethod(LevelOfFaithfulAction, \"for [IsAutomGroup and IsSelfSimilar]\",\n              [IsAutomGroup and IsSelfSimilar,IsCyclotomic],\nfunction(G,max_lev)\n  local s,s_next,lev;\n  if HasIsFinite(G) and not IsFinite(G) then return fail; fi;\n  if HasLevelOfFaithfulAction(G) then return LevelOfFaithfulAction(G); fi;\n  lev := 0; s := 1; s_next := Size(PermGroupOnLevel(G,1));\n  while s<s_next and lev<max_lev do\n    lev := lev+1;\n    s := s_next;\n    s_next := Size(PermGroupOnLevel(G,lev+1));\n  od;\n  if s = s_next then\n    SetSize(G,s);\n    SetLevelOfFaithfulAction(G,lev);\n    return lev;\n  else\n    return fail;\n  fi;\nend);\n\n\nInstallMethod(LevelOfFaithfulAction, \"for [IsAutomGroup and IsSelfSimilar]\",\n              [IsAutomGroup and IsSelfSimilar],\nfunction(G)\n  return LevelOfFaithfulAction(G,infinity);\nend);\n\n\nInstallOtherMethod(IsomorphismPermGroup, \"for [IsAutomGroup and IsSelfSimilar,IsCyclotomic]\",\n                   [IsAutomGroup and IsSelfSimilar, IsCyclotomic],\nfunction (G, n)\n  local H, lev;\n  lev := LevelOfFaithfulAction(G, n);\n  if lev <> fail then\n    H := PermGroupOnLevel(G,LevelOfFaithfulAction(G));\n    return AG_GroupHomomorphismByImagesNC(G, H, GeneratorsOfGroup(G), GeneratorsOfGroup(H));\n  fi;\n  return fail;\nend);\n\n\n\nInstallMethod(IsomorphismPermGroup, \"for [IsAutomGroup]\",\n              [IsAutomGroup], SUM_FLAGS,\nfunction (G)\n  local H;\n  H := AG_FiniteGroupId(G);\n  return AG_GroupHomomorphismByImagesNC(G, H, GeneratorsOfGroup(G), GeneratorsOfGroup(H));\nend);\n\n\n\nBindGlobal(\"TestSelfSimilarity\",\nfunction(G)\n  if CanEasilyTestSelfSimilarity(G) then\n    IsSelfSimilar(G);\n    return true;\n  fi;\n\n  if IsTrivial(G) then\n    SetIsSelfSimilar(G, true);\n    return true;\n  fi;\n\n  if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n    SetIsSelfSimilar(G, true);\n    return true;\n  fi;\n\n  if Set(GeneratorsOfGroup(G)) = Set(GeneratorsOfGroup(GroupOfAutomFamily(UnderlyingAutomFamily(G)))) then\n    SetIsSelfSimilar(G, true);\n    return true;\n  fi;\n\n  return false;\nend);\n\n\n###############################################################################\n##\n#M  IsSphericallyTransitive(G)\n##\nInstallMethod(IsSphericallyTransitive, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction (G)\n  local x, rat_gens, abel_hom, lev;\n\n  if DegreeOfTree(G)=1 then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n    Info(InfoAutomGrp, 3, \"  G acts on 1-ary tree\");\n    return true;\n  fi;\n\n\n  if IsFractalByWords(G) then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n    Info(InfoAutomGrp, 3, \"  G is fractal\");\n    return true;\n  fi;\n\n  if IsTrivial(G) then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): false\");\n    Info(InfoAutomGrp, 3, \"  G is trivial: G = \", G);\n    return false;\n  fi;\n\n  if HasIsFinite(G) and IsFinite(G) then\n    Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): false\");\n    Info(InfoAutomGrp, 3, \"  IsFinite(G): G = \", G);\n    return false;\n  fi;\n\n  if DegreeOfTree(G) = 2 and TestSelfSimilarity(G) and IsSelfSimilar(G) then\n    if HasIsFinite(G) and IsFinite(G) = false then\n      Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n      Info(InfoAutomGrp, 3, \"  <G> is infinite self-similar acting on binary tree\");\n      return true;\n    fi;\n    if PermGroupOnLevel(G,2) = Group((1,4,2,3)) then\n      Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): true\");\n      Info(InfoAutomGrp, 3, \"  any element which acts transitively on the first level acts spherically transitively\");\n      return true;\n    fi;\n  fi;\n\n  for lev in [1..8] do\n    if not IsTransitiveOnLevel(G,lev) then\n      Info(InfoAutomGrp, 3, \"IsSphericallyTransitive(G): false\");\n      Info(InfoAutomGrp, 3, \"  the group does not act transitively on level \", lev);\n      return false;\n    fi;\n  od;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  DiagonalPower(<G>, <n>)\n##\nInstallOtherMethod( DiagonalPower,\n                    \"for [IsAutomGroup and IsGroupOfAutomFamily, IsPosInt]\",\n                    [IsAutomGroup and IsGroupOfAutomFamily, IsPosInt],\nfunction(G, n)\n  return DiagonalPower(UnderlyingAutomFamily(G), n);\nend);\n\n\n###############################################################################\n##\n#M  MultAutomAlphabet(<G>, <n>)\n##\nInstallOtherMethod( MultAutomAlphabet,\n                    \"for [IsAutomGroup and IsGroupOfAutomFamily, IsPosInt]\",\n                    [IsAutomGroup and IsGroupOfAutomFamily, IsPosInt],\nfunction(G, n)\n  return MultAutomAlphabet(UnderlyingAutomFamily(G), n);\nend);\n\n\n###############################################################################\n##\n#M  \\= (<G>, <H>)\n##\nInstallMethod(\\=, \"for [IsAutomGroup, IsAutomGroup]\",\n              IsIdenticalObj, [IsAutomGroup, IsAutomGroup],\nfunction(G, H)\n  local fgens1, fgens2, fam;\n\n  if HasIsGroupOfAutomFamily(G) and HasIsGroupOfAutomFamily(H) then\n    if IsGroupOfAutomFamily(G) <> IsGroupOfAutomFamily(H) then\n      Info(InfoAutomGrp, 3, \"G = H: false, exactly one is GroupOfAutomFamily\");\n      return false;\n    fi;\n    if IsGroupOfAutomFamily(G) then\n      Info(InfoAutomGrp, 3, \"G = H: true, both are GroupOfAutomFamily\");\n      return true;\n    fi;\n  fi;\n\n  fgens1 := List(GeneratorsOfGroup(G), g -> Word(g));\n  fgens2 := List(GeneratorsOfGroup(H), g -> Word(g));\n  fam := UnderlyingAutomFamily(G);\n\n  if fam!.rws <> fail then\n    fgens1 := AG_ReducedForm(fam!.rws, fgens1);\n    fgens2 := AG_ReducedForm(fam!.rws, fgens2);\n  fi;\n\n  if IsEmpty(fgens1) then\n    return ForAll(fgens2, IsOne);\n  elif IsEmpty(fgens2) then\n    return ForAll(fgens1, IsOne);\n  fi;\n\n  if GroupWithGenerators(fgens1) = GroupWithGenerators(fgens2) then\n    Info(InfoAutomGrp, 3, \"G = H: true, by subgroups of free group\");\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  IsSubset (<G>, <H>)\n##\nInstallMethod(IsSubset, \"for [IsAutomGroup, IsAutomGroup]\",\n              IsIdenticalObj, [IsAutomGroup, IsAutomGroup],\nfunction(G, H)\n  local h, fam, fgens1, fgens2;\n\n  if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n    Info(InfoAutomGrp, 3, \"IsSubgroup(G, H): true\");\n    Info(InfoAutomGrp, 3, \"  G is GroupOfAutomFamily\");\n    return true;\n  fi;\n\n  fgens1 := List(GeneratorsOfGroup(G), g -> Word(g));\n  fgens2 := List(GeneratorsOfGroup(H), g -> Word(g));\n  fam := UnderlyingAutomFamily(G);\n\n  if fam!.rws <> fail then\n    fgens1 := AG_ReducedForm(fam!.rws, fgens1);\n    fgens2 := AG_ReducedForm(fam!.rws, fgens2);\n  fi;\n\n  if IsSubgroup(GroupWithGenerators(fgens1), GroupWithGenerators(fgens2)) then\n    Info(InfoAutomGrp, 3, \"IsSubgroup(G, H): true\");\n    Info(InfoAutomGrp, 3, \"  by subgroups of free group\");\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  <g> in <G>\n##\nInstallMethod(\\in, \"for [IsAutom, IsAutomGroup]\",\n              [IsAutom, IsAutomGroup],\nfunction(g, G)\n  local fam, fgens, w;\n\n  if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n    return true;\n  fi;\n\n  fgens := List(GeneratorsOfGroup(G), g -> Word(g));\n  w := Word(g);\n\n  fam := UnderlyingAutomFamily(G);\n\n  if fam!.rws <> fail then\n    fgens := AG_ReducedForm(fam!.rws, fgens);\n    if IsEmpty(fgens) then\n      return IsOne(g);\n    fi;\n    w := AG_ReducedForm(fam!.rws, w);\n  fi;\n\n  if w in GroupWithGenerators(fgens) then\n    Info(InfoAutomGrp, 3, \"g in G: true\");\n    Info(InfoAutomGrp, 3, \"  by elements of free group\");\n    Info(InfoAutomGrp, 3, \"  g = \", g, \"; G = \", G);\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  Random(<G>)\n##\nInstallMethodWithRandomSource(Random, \"for a random source and [IsAutomGroup]\",\n              [IsRandomSource, IsAutomGroup],\nfunction(rs, G)\n  local F, gens, pi;\n\n  if IsTrivial(G) then\n    return One(G);\n  elif IsAutomatonGroup(G) then\n    return Autom(Random(rs, UnderlyingFreeGroup(G)), UnderlyingAutomFamily(G));\n  else\n    gens := GeneratorsOfGroup(G);\n    F := FreeGroup(Length(gens));\n    pi := GroupHomomorphismByImagesNC(F, G,  GeneratorsOfGroup(F), gens);\n    return Random(rs, F)^pi;\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeSubgroup(<G>)\n##\nInstallMethod(UnderlyingFreeSubgroup, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  local f;\n  if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n    return UnderlyingFreeGroup(G);\n  fi;\n  f := Subgroup(UnderlyingFreeGroup(G), UnderlyingFreeGenerators(G));\n  if f = UnderlyingFreeGroup(G) then\n    SetIsGroupOfAutomFamily(G, true);\n  fi;\n  return f;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeGenerators(<G>)\n##\nInstallMethod(UnderlyingFreeGenerators, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  return List(GeneratorsOfGroup(G), g -> Word(g));\nend);\n\n\n###############################################################################\n##\n#M  TrivialSubmagmaWithOne(<G>)\n##\nInstallMethod(TrivialSubmagmaWithOne, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  return Subgroup(G, [One(G)]);\nend);\n\n\n###############################################################################\n##\n#M  IsAutomatonGroup(<G>)\n##\nInstallImmediateMethod(IsAutomatonGroup, IsAutomGroup, 0,\nfunction(G)\n  local fam;\n  fam := UnderlyingAutomFamily(G);\n  return fam!.numstates = 0 or\n         GeneratorsOfGroup(G) = fam!.automgens{[1..fam!.numstates]};\nend);\n\n\n###############################################################################\n##\n#M  AutomatonList(<G>)\n##\nInstallMethod(AutomatonList, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  if IsAutomatonGroup(G) then\n    return AutomatonList(GroupOfAutomFamily(UnderlyingAutomFamily(G)));\n  else\n    Error(\"Group <G> is not necessarily generated by automaton,\");\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  IsSelfSimilar(<G>)\n##\nInstallMethod(IsSelfSimilar, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  local g, i, res;\n  res := true;\n  for g in GeneratorsOfGroup(G) do\n    for i in [1..UnderlyingAutomFamily(G)!.deg] do\n      res := Section(g, i) in G;\n      if res = fail then\n        TryNextMethod();\n      elif not res then\n        return false;\n      fi;\n    od;\n  od;\n  return true;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingAutomFamily(<G>)\n##\nInstallMethod(UnderlyingAutomFamily, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  return FamilyObj(GeneratorsOfGroup(G)[1]);\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingAutomaton(<G>)\n##\nInstallMethod(UnderlyingAutomaton, \"for [IsAutomGroup]\",\n              [IsAutomGroup],\nfunction(G)\n  local fam;\n  fam := UnderlyingAutomFamily(G);\n  return MealyAutomaton(AG_AddInversesList(fam!.automatonlist){[1..fam!.numstates+1]});\nend);\n\n\n#E\n", "meta": {"hexsha": "fd7f7a6d315067417288c8288f755ddd612d883f", "size": 22205, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/automgroup.gi", "max_stars_repo_name": "gap-packages/automgrp", "max_stars_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-02T15:00:11.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-02T15:00:11.000Z", "max_issues_repo_path": "gap/automgroup.gi", "max_issues_repo_name": "gap-packages/automgrp", "max_issues_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2019-09-21T22:10:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-26T23:51:41.000Z", "max_forks_repo_path": "gap/automgroup.gi", "max_forks_repo_name": "gap-packages/automgrp", "max_forks_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.8500604595, "max_line_length": 118, "alphanum_fraction": 0.5841477145, "num_tokens": 5957, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4339814501625211, "lm_q2_score": 0.0325897417123343, "lm_q1q2_score": 0.014143343368740844}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#\n# SSE conversion bridges\n#\n\n# simple cases - signed<->unsigned \n\nClass(_cvt_int_uint_saturated, ISA_Bridge_I, rec(\n    props := [\"saturation\"],\n    code  := (self, y, x, opts) >> \n        assign( self._y(y,0), tcast(self.isa_to.t, bin_and(self._x(x,0), mask_gt(self._x(x,0), self.isa_from.t.zero()))) )\n));\n\nISA_Bridge.add(Class(CVT_SSE_4x32ui_4x32i_wrap, ISA_Bridge_tcast, rec(\n    isa_from := SSE_4x32f(T_Int(32)),   isa_to := SSE_4x32f(T_UInt(32)), \n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32ui_4x32i_sat, _cvt_int_uint_saturated, rec(\n    isa_from := SSE_4x32f(T_Int(32)),   isa_to := SSE_4x32f(T_UInt(32))\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_4x32ui_wrap, ISA_Bridge_tcast, rec(\n    isa_from := SSE_4x32f(T_UInt(32)),  isa_to := SSE_4x32f(T_Int(32)),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16ui_8x16i_wrap, ISA_Bridge_tcast, rec(\n    isa_from := SSE_8x16i(T_Int(16)),   isa_to := SSE_8x16i(T_UInt(16)),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16ui_8x16i_sat, _cvt_int_uint_saturated, rec(\n    isa_from := SSE_8x16i(T_Int(16)),   isa_to := SSE_8x16i(T_UInt(16))\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16i_8x16ui_wrap, ISA_Bridge_tcast, rec(\n    isa_from := SSE_8x16i(T_UInt(16)),  isa_to := SSE_8x16i(T_Int(16)),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_16x8ui_16x8i_wrap, ISA_Bridge_tcast, rec(\n    isa_from := SSE_16x8i(T_Int(8)),    isa_to := SSE_16x8i(T_UInt(8)),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_16x8ui_16x8i_sat, _cvt_int_uint_saturated, rec(\n    isa_from := SSE_16x8i(T_Int(8)),    isa_to := SSE_16x8i(T_UInt(8)),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_16x8i_16x8ui_wrap, ISA_Bridge_tcast, rec(\n    isa_from := SSE_16x8i(T_UInt(8)),   isa_to := SSE_16x8i(T_Int(8)),\n)));\n\n# more complex cases\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_4x32f_trunc, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Real(32)),\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [\"trunc\"],\n    code := (self, y, x, opts) >> assign( self._y(y,0), vcvtt_4x32_f2i(self._x(x,0)) ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_4x32f_round, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Real(32)),\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [\"round\"],\n    code := (self, y, x, opts) >> assign( self._y(y,0), vcvt_4x32_f2i(self._x(x,0)) ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32f_clip32i, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Real(32)),\n    isa_to      := SSE_4x32f(T_Real(32)),\n    props       := [\"saturation\"],\n    range       := (self) >> RangeT(self.clip.min, self.clip.max, T_Real(32).range().eps),\n    clip        := rec( min := T_Int(32).range().min, max := T_Int(32).range().max ),\n    code := (self, y, x, opts) >> assign( self._y(y,0), min(max(self._x(x,0), self.isa_from.t.value(self.clip.min)), self.isa_from.t.value(self.clip.max)) ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32f_clip32ui, CVT_SSE_4x32f_4x32f_clip32i, rec(\n    clip        := rec( min := T_UInt(32).range().min, max := T_UInt(32).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32f_clip16i, CVT_SSE_4x32f_4x32f_clip32i, rec(\n    clip        := rec( min := T_Int(16).range().min,  max := T_Int(16).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32f_clip16ui, CVT_SSE_4x32f_4x32f_clip32i, rec(\n    clip        := rec( min := T_UInt(16).range().min, max := T_UInt(16).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32f_clip8i, CVT_SSE_4x32f_4x32f_clip32i, rec(\n    clip        := rec( min := T_Int(8).range().min,  max := T_Int(8).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32f_clip8ui, CVT_SSE_4x32f_4x32f_clip32i, rec(\n    clip        := rec( min := T_UInt(8).range().min, max := T_UInt(8).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16i_4x32i_sat, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Int(32)),\n    isa_to      := SSE_8x16i(T_Int(16)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> assign( self._y(y,0), vpacks_4x32i(self._x(x,0), self._x(x,1)) )\n)));\n\n# saturated SSE_4x32i to SSE_8x16ui \nISA_Bridge.add(Class(CVT_SSE_8x16ui_4x32i_sat, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Int(32)),\n    isa_to      := SSE_8x16i(T_UInt(16)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> let(\n                c1 := self.isa_from.t.value(32768),\n                c2 := self.isa_to.t.value(32768),\n                u1 := var.fresh_t(\"U\", self.isa_from.t),\n                u2 := var.fresh_t(\"U\", self.isa_from.t),\n                m1 := var.fresh_t(\"U\", self.isa_from.t),\n                m2 := var.fresh_t(\"U\", self.isa_from.t),\n                decl([u1, u2, m1, m2], chain(\n                    assign( u1, self._x(x,0) ),\n                    assign( u2, self._x(x,1) ),\n                    assign( m1, sub(bin_and(u1, mask_lt(u1.t.zero(), u1)), c1)),\n                    assign( m2, sub(bin_and(u2, mask_lt(u1.t.zero(), u2)), c1)),\n                    assign( self._y(y,0), add(tcast(self.isa_to.t, vpacks_4x32i(m1, m2)), c2) )\n                ))\n            ),\n)));\n\n# saturated SSE_4x32ui to SSE_8x16ui \nISA_Bridge.add(Class(CVT_SSE_8x16ui_4x32ui_sat, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_UInt(32)),\n    isa_to      := SSE_8x16i(T_UInt(16)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> let(\n                c1 := self.isa_from.t.value(32768),\n                c2 := self.isa_to.t.value(32768),\n                m1 := var.fresh_t(\"U\", self.isa_from.t),\n                m2 := var.fresh_t(\"U\", self.isa_from.t),\n                decl([m1, m2], chain(\n                    assign( m1, sub(self._x(x,0), c1)),\n                    assign( m2, sub(self._x(x,1), c1)),\n                    assign( self._y(y,0), add(tcast(self.isa_to.t, vpacks_4x32i(m1, m2)), c2) )\n                ))\n            ),\n)));\n\n# SSE_4x32i to SSE_8x16ui without saturation by throwing out high word. \nISA_Bridge.add(Class(CVT_SSE_8x16ui_4x32i_wrap, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Int(32)),\n    isa_to      := SSE_8x16i(T_UInt(16)),\n    props       := [\"wraparound\"],\n    code := (self, y, x, opts) >> let(\n                u1 := var.fresh_t(\"U\", self.isa_to.t),\n                u2 := var.fresh_t(\"U\", self.isa_to.t),\n                m1 := var.fresh_t(\"U\", self.isa_to.t),\n                m2 := var.fresh_t(\"U\", self.isa_to.t),\n                m3 := var.fresh_t(\"U\", self.isa_to.t),\n                m4 := var.fresh_t(\"U\", self.isa_to.t),\n                decl([u1, u2, m1, m2, m3, m4], chain(\n                    assign( u1, tcast(u1.t, self._x(x,0)) ),\n                    assign( u2, tcast(u2.t, self._x(x,1)) ),\n                    assign( m1, vunpacklo_8x16i(u1, u2) ),\n                    assign( m2, vunpackhi_8x16i(u1, u2) ),\n                    assign( m3, vunpacklo_8x16i(m1, m2) ),\n                    assign( m4, vunpackhi_8x16i(m1, m2) ),\n                    assign( self._y(y,0), vunpacklo_8x16i(m3, m4) )\n                ))\n            ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_16x8i_8x16i_sat, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_Int(16)),\n    isa_to      := SSE_16x8i(T_Int(8)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> assign( self._y(y,0), vpacks_8x16i(self._x(x,0), self._x(x,1)) )\n)));\n\nISA_Bridge.add(Class(CVT_SSE_16x8ui_8x16i_sat, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_Int(16)),\n    isa_to      := SSE_16x8i(T_UInt(8)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> assign( self._y(y,0), vpackus_8x16i(self._x(x,0), self._x(x,1)) )\n)));\n\n\nISA_Bridge.add(Class(CVT_SSE_16x8ui_8x16ui_sat_as, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_UInt(16)),\n    isa_to      := SSE_16x8i(T_UInt(8)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> let(\n                t  := TVect(T_Int(16), 8),\n                a1 := var.fresh_t(\"U\", t),\n                a2 := var.fresh_t(\"U\", t),\n                m1 := var.fresh_t(\"U\", self.isa_to.t),\n                m2 := var.fresh_t(\"U\", self.isa_to.t),\n                decl([a1,a2,m1,m2], chain(\n                    assign( a1, arith_shr(tcast(t, self._x(x,0)), 15) ),\n                    assign( a2, arith_shr(tcast(t, self._x(x,1)), 15) ),\n                    assign( m1, vpacks_8x16i(a1, a2) ),\n                    assign( m2, vpackus_8x16i(self._x(x,0), self._x(x,1)) ),\n                    assign( self._y(y,0), bin_or(m1,m2) )\n                ))\n            ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_16x8ui_8x16ui_sat_gt, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_UInt(16)),\n    isa_to      := SSE_16x8i(T_UInt(8)),\n    props       := [\"saturation\"],\n    code := (self, y, x, opts) >> let(\n                t  := TVect(T_Int(16), 8),\n                a1 := var.fresh_t(\"U\", t),\n                a2 := var.fresh_t(\"U\", t),\n                m1 := var.fresh_t(\"U\", self.isa_to.t),\n                m2 := var.fresh_t(\"U\", self.isa_to.t),\n                decl([a1,a2,m1,m2], chain(\n                    assign( a1, gt(t.zero(), tcast(t, self._x(x,0))) ),\n                    assign( a2, gt(t.zero(), tcast(t, self._x(x,1))) ),\n                    assign( m1, vpacks_8x16i(a1, a2) ),\n                    assign( m2, vpackus_8x16i(self._x(x,0), self._x(x,1)) ),\n                    assign( self._y(y,0), bin_or(m1,m2) )\n                ))\n            ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16i_16x8i_gt, ISA_Bridge_I, rec(\n    isa_from    := SSE_16x8i(T_Int(8)),\n    isa_to      := SSE_8x16i(T_Int(16)),\n    props       := [],\n    code := (self, y, x, opts) >> let(\n                sign := var.fresh_t(\"U\", self.isa_from.t),\n                decl( [sign], chain(\n                    assign(sign, gt(self.isa_from.t.zero(), self._x(x,0))),\n                    assign(self._y(y,0), tcast( self.isa_to.t, vunpacklo_16x8i(self._x(x,0), sign)) ),\n                    assign(self._y(y,1), tcast( self.isa_to.t, vunpackhi_16x8i(self._x(x,0), sign)) )\n                ))\n            ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16i_16x8i_as, ISA_Bridge_I, rec(\n    isa_from    := SSE_16x8i(T_Int(8)),\n    isa_to      := SSE_8x16i(T_Int(16)),\n    props       := [],\n    code := (self, y, x, opts) >> chain(\n                    assign(self._y(y,0), arith_shr(tcast( self.isa_to.t, vunpacklo_16x8i(self._x(x,0), self._x(x,0))), 8) ),\n                    assign(self._y(y,1), arith_shr(tcast( self.isa_to.t, vunpackhi_16x8i(self._x(x,0), self._x(x,0))), 8) )\n                ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_8x16i_16x8ui, ISA_Bridge_I, rec(\n    isa_from    := SSE_16x8i(T_UInt(8)),\n    isa_to      := SSE_8x16i(T_Int(16)),\n    props       := [],\n    code := (self, y, x, opts) >> chain(\n                    assign(self._y(y,0), vcastizxlo(self._x(x,0)) ),\n                    assign(self._y(y,1), vcastizxhi(self._x(x,0)) )\n                )\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_8x16i_gt, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_Int(16)),\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [],\n    code := (self, y, x, opts) >> let(\n                sign := var.fresh_t(\"U\", self.isa_from.t),\n                decl( [sign], chain(\n                    assign(sign, gt(self.isa_from.t.zero(), self._x(x,0))),\n                    assign(self._y(y,0), tcast( self.isa_to.t, vunpacklo_8x16i(self._x(x,0), sign)) ),\n                    assign(self._y(y,1), tcast( self.isa_to.t, vunpackhi_8x16i(self._x(x,0), sign)) )\n                ))\n            ),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_8x16i_as, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_Int(16)),\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [],\n    code := (self, y, x, opts) >> chain(\n                    assign(self._y(y,0), arith_shr(tcast( self.isa_to.t, vunpacklo_8x16i(self._x(x,0), self._x(x,0))), 16) ),\n                    assign(self._y(y,1), arith_shr(tcast( self.isa_to.t, vunpackhi_8x16i(self._x(x,0), self._x(x,0))), 16) )\n                )\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_8x16ui, ISA_Bridge_I, rec(\n    isa_from    := SSE_8x16i(T_UInt(16)),\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [],\n    code := (self, y, x, opts) >> chain(\n                    assign(self._y(y,0), tcast( self.isa_to.t, vunpacklo_8x16i(self._x(x,0), self.isa_from.t.zero())) ),\n                    assign(self._y(y,1), tcast( self.isa_to.t, vunpackhi_8x16i(self._x(x,0), self.isa_from.t.zero())) )\n                )\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_4x32i, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Int(32)),\n    isa_to      := SSE_4x32f(T_Real(32)),\n    props       := [],\n    code := (self, y, x, opts) >> assign(self._y(y,0), vcvt_4x32_i2f(self._x(x,0)))\n)));\n\n", "meta": {"hexsha": "75136716b0bd13d811fd74db432a4f4b5793cd63", "size": 12629, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/sse/cvt.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/sse/cvt.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/sse/cvt.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 42.0966666667, "max_line_length": 157, "alphanum_fraction": 0.554359015, "num_tokens": 4499, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.48828339529583464, "lm_q2_score": 0.028870909557472294, "lm_q1q2_score": 0.014097185744001534}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(TPrmMulti,CodeBlock);\nIsTwoPower := i >> 2 ^ Log2Int(i) = i;\n\nget_l_power := function(t,exp)\n  local p;\n  if (exp=0) then\n    p := L(2^t,1);\n  else\n    p:= L(2^t,2^(t-exp));\n  fi;\n  return p;   \nend;\n\n# Declaration of SortBase, a 2x2 sorter.\nClass(SortBase, BaseMat, rec(\n   abbrevs   := [()-> []],\n   new       := (self) >> SPL( WithBases(self, rec()) ).setDims(),\n   dims      := self >> [ 2, 2 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [],\n   rSetChild := rSetChildFields(),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\n# Declaration of SortBase, a 1x1 sorter.\nClass(SortBase_w1, BaseMat, rec(\n   abbrevs   := [(a)-> [a]],\n   new       := (self, a) >> SPL( WithBases(self, rec(dimensions:=[1,1], a := a))),\n   print := (self, i, is) >> Print(self.name, \"(\", self.a, \")\"),\n   dims      := self >> [ 1, 1 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [self.a],\n   rSetChild := rSetChildFields(\"a\"),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\nClass(SortConfigBase_w1, BaseMat, rec(\n   abbrevs   := [(a)-> [a] , (b)-> [b]],\n   new       := (self, a, b) >> SPL( WithBases(self, rec(dimensions:=[1,1], a := a, b:=b))),\n   print := (self, i, is) >> Print(self.name, \"(\", self.a, \",\", self.b, \")\"),\n   dims      := self >> [ 1, 1 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [self.a, self.b],\n   rSetChild := rSetChildFields(\"a\",\"b\"),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\n# Declaration of SortConfigBase, a 2x2 Configurable sorter.\nClass(SortConfigBase, BaseMat, rec(\n   abbrevs   := [(a)-> [a]],\n   new       := (self, a) >> SPL( WithBases(self, rec(dimensions:=[2,2], a := a))),\n   print := (self, i, is) >> Print(self.name, \"(\", self.a, \")\"),\n   dims      := self >> [ 2, 2 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [self.a],\n   rSetChild := rSetChildFields(\"a\"),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\n# Declaration of SortLinearBase, used for linear sorter with w = 1\nClass(LinearSortBase, BaseMat, rec(\n   abbrevs   := [()-> []],\n   new       := (self) >> SPL( WithBases(self, rec()) ).setDims(),\n   dims      := self >> [ 2, 2 ],\n   isReal    := True,\n   sums     := self >> self,\n   rChildren := self >> [],\n   rSetChild := rSetChildFields(),\n   toAMat := self >> Error(\"not supported\"),\n   transpose := self >> self,\n));\n\n\n\n#taken from: .../spiral/compiler/dag.gi\nregassign.op_in  := self >> ConcatList(self.loc.rChildren(), ArgsExp) :: ArgsExp(self.exp);\nregassign.op_out := self >> [self.loc];\nregassign.op_inout := self >> [];\nregassign.getNoScalar := self >> When(IsBound(self.exp.getNoScalar), self.exp.getNoScalar(), []);\n\n# This tells Spiral how to translate 'SortBase' into code.\nHDLCodegen.SortBase := (self, o, y, x, opts) >>\n    chain(\n\tassign(nth(y,0), cond(leq(nth(x,0), nth(x,1)), nth(x,0), nth(x,1))), \n\tassign(nth(y,1), cond(leq(nth(x,0), nth(x,1)), nth(x,1), nth(x,0)))\n    ); \n\nHDLCodegen.SortBase_w1 := (self, o, y, x, opts) >>\n   let(\n     t0 := TempVar(x.t.t),\n     t1 := TempVar(x.t.t),\n     t3 := TempVar(x.t.t),\n     t5 := TempVar(x.t.t),\n     t6 := TempVar(x.t.t),\n\n     chain(\n\tassign(t3, imod(o.a, 2)),\n\tregassign(t0, cond(t3, t0, nth(x,0))),\n\tassign(t5, cond(leq(t0, nth(x,0)), nth(x,0), t0)),\n\tassign(t6, cond(leq(t0, nth(x,0)), t0, nth(x,0))),\n\tregassign(t1, cond(t3, t5, t1)),\n\tassign(nth(y,0), cond(t3, t6, t1))\n     )\n    );\n\nHDLCodegen.SortConfigBase_w1 := (self, o, y, x, opts) >>\n   let(\n     t0 := TempVar(x.t.t),\n     t1 := TempVar(x.t.t),\n     t3 := TempVar(x.t.t),\n     t5 := TempVar(x.t.t),\n     t6 := TempVar(x.t.t),\n     t7 := TempVar(x.t.t),\n     t8 := TempVar(x.t.t),\n     t9 := TempVar(x.t.t),\n     t10 := TempVar(x.t.t),\n     t2 := TempVar(x.t.t),\n\n     chain(\n\tassign(t3, imod(o.a, 2)),\n\tregassign(t0, cond(t3, t0, nth(x,0))),\n\tassign(t7, eq(o.b,0)),\n\tassign(t8, eq(o.b,1)),\n\t\t\n\tassign(t2, leq(t0, nth(x,0))),\n\tassign(t9, cond(t2, t0, nth(x,0))),\n\tassign(t10, cond(t2, nth(x,0), t0)),\n\tassign(t5, cond(t7, nth(x,0) , t8, t9, t10)),\n\tassign(t6, cond(t7, t0 , t8, t10, t9)),\n\t\n\tregassign(t1, cond(t3, t5, t1)),\n\tassign(nth(y,0), cond(t3, t6, t1))\n     )\n    );\n\nHDLCodegen.LinearSortBase := (self, o, y, x, opts) >>\n   let(\n     #x[1] indicates the start of a new list. When x[1] equals 1, y[0] \n     #is set to the value of the register t0, and t0 is set to the value of x[0]\n\n     t0 := TempVar(x.t.t),\n     t1 := TempVar(x.t.t),\n     t2 := TempVar(x.t.t),\n     t3 := TempVar(x.t.t),\n     t4 := TempVar(x.t.t),\n     t5 := TempVar(x.t.t),\n     r0 := TempVar(x.t.t),\n     x0 := TempVar(x.t.t),\n     x1 := TempVar(x.t.t),\n       \n     chain(\n\n\t assign(x0, nth(x,0)),\n\t assign(x1, nth(x,1)),\n\t assign(t3, eq(x1, 1)),\n\t regassign(r0, cond(t3, x0, t1)),\n\t #regassign(r0, t0),\n\t assign(t4, leq(r0, x0)),\n\t assign(t1, cond(t4, x0, r0)),\n\t assign(t2, cond(t4, r0, x0)),\n\t assign(nth(y, 0), cond(t3, r0, t2)),\n\t #regassign(t5, x1),\n\t assign(nth(y, 1), x1)\n     )\n    );\n\n# HDLCodegen.LinearSortBase := (self, o, y, x, opts) >>\n#    let(\n#      t0 := TempVar(x.t.t),\n#      #x[1] indicates the start of a new list. When x[1] equals 1, y[0] \n#      #is set to the value of the register t0, and t0 is set to the value of x[0]\n#      chain(\n# \tassign(nth(y,0),cond(eq(nth(x,1),1),t0,leq(t0, nth(x,0)),t0,nth(x,0))),\n# \tregassign(t0,cond(eq(nth(x,1),1),nth(x,0),leq(t0, nth(x,0)),nth(x,0),t0)),\n# \tassign(nth(y,1),nth(x,1))\n#      )\n#     );\n\nHDLCodegen.SortConfigBase := (self, o, y, x, opts) >>\n    let(\n\tt0 := TempVar(x.t.t),\n\tt1 := TempVar(x.t.t),\n\tt2 := TempVar(x.t.t),\n\tt3 := TempVar(x.t.t),\n\tchain(\n\t    assign(t2, nth(x,0)),\n\t    assign(t3, nth(x,1)),\n\t    assign(t0, cond(leq(t2, t3), t2, t3)), \n\t    assign(t1, cond(leq(t2, t3), t3, t2)),\t    \n\t    assign(nth(y,0), cond(eq(o.a,0), t2, eq(o.a,1), t1, t0)),\n\t    assign(nth(y,1), cond(eq(o.a,0), t3, eq(o.a,1), t0, t1))\n\t)\n    ); \n\n\n# Declaration of a sorter of size n\nClass(Sort, TaggedNonTerminal, rec(\n    abbrevs := [\n    (n)       -> Checked(IsPosIntSym(n), [_unwrap(n)]),\n    ],\n\n    hashAs := self >> ObjId(self)(self.params[1]).withTags(self.getTags()),\n\n    dims := self >> [ self.params[1], self.params[1] ],\n\n    terminate := self >> Error(\"not supported\"), # we could probably support this\n));\n\n\n# SortIJPerm(n): DirectSum(I(n/2), J(n/2))\n# We do this so we can define a .permBits() function.\n# This will let us easily generate large-size hardware implementations.\n\n# (If we do not do this, the perm tool will have to manually compute the \n# bit matrix representation, which will include making an n-times-n matrix.\nClass(SortIJPerm, PermClass, rec(\n    def := (n) -> Checked(\n        IsPosIntSym(n),\n        rec(size := n)),\n\n    lambda := self >> let(\n        n := self.params[1],\n\tfDirsum(fId(n/2), J(n/2)).lambda()\n    ),\n\n    transpose := self >> self,\n    isSymmetric := self >> true,\n\n    permBits := meth(self)\n        local n, k, a, b, tmp, i;\n\tn := self.params[1];\n\tk := LogInt(n, 2);\n\ta := [List([1..k], i->0)];\n\tfor i in [1 .. k-1] do\t    \n\t    tmp := Concatenation([1], List([1..k-1], i->0));\n\t    Append(a, [tmp]);\n        od;\n\ta := a * GF(2).one;\n\tb := MatSPL(I(k))*GF(2).one;\n\t\n\treturn (a+b);\n    end,   \n));\n\n\n\n\n# Rule to breakdown Sort(n), where n is a power of two.\nNewRulesFor(Sort, rec(\n    Sort_Stream := rec(\n        info         := \"Streaming sorting network\",\n\n        applicable   := nt -> Length(nt.params) = 1 and IsTwoPower(nt.params[1]),\n\n        children := (self, nt) >> let(\n\n\t    tag_w_tmp := nt.tags[1],\n\t    tag_w := tag_w_tmp.bs,\n\t    t := Log2Int(nt.params[1]),\n\t    p := Ind(2^t),\n\t    get_bb := w -> Cond(w=1, TTensorInd(SortBase_w1(p), p, APar, APar),TTensorI(SortBase(), 2^(t-1), APar, APar)),\n\n\t    [[ TCompose(\n\t           [TCompose(List([1..t-1], i ->\n\t               TCompose([\n\t\t           #TTensorI(SortBase(), 2^(t-1), APar, APar),  \n\t\t           get_bb(tag_w), \n\t\t           TCompose(List([2..(t-i+1)], j -> \n\t\t               TCompose([\n\t\t\t           TTensorI(TPrm(Tensor(I(2), L(2^(j-1), 2^(j-2))) * L(2^j,2)), 2^(t-j), APar, APar),\n\t\t\t           get_bb(tag_w)\n\t\t\t           #TTensorI(SortBase(), 2^(t-1), APar, APar)\n\t\t\t       ])\n\t\t           )),\n\t\t        #   TTensorI(TPrm(L(2^(t-i+1), 2^(t-i)) * DirectSum(I(2^(t-i)), J(2^(t-i)))  ), 2^(i-1), APar, APar) \n\t\t\t   TTensorI(TPrm(L(2^(t-i+1), 2^(t-i)) * SortIJPerm(2^(t-i+1))), 2^(i-1), APar, APar)\n\t\t       ])\n\t            )),\t\t\n\t\t    get_bb(tag_w)] \n\t\t    #TTensorI(SortBase(), 2^(t-1), APar, APar)] \n                ).withTags(nt.getTags())\n            ]]\n\t),\n\n        apply        := (nt, c, cnt) -> c[1],\n\n    ),\n    \n   Sort_Stream6 := rec(\n        info         := \"Version of Sort_Stream (sortAlg1) removing J permutations and with configurable 2-input sorters\",\n\n        applicable   := nt -> Length(nt.params) = 1 and IsTwoPower(nt.params[1]),\n\n        children := (self, nt) >> let(\n\t    t := Log2Int(nt.params[1]),\n            k := Ind(2^(t-1)),\n            z := (s) >> t-s,\n\n            c1 := (s) >> logic_and(eq(bit_sel(k, z(s)), 1), neq(s, 1)),\n            access_f := (s) >> cond(c1(s), 1, 2),\n\n\t    [[ TCompose(\n\t           [TCompose(List([1..t-1], i ->\n\t               TCompose([\n\t\t\t   TTensorInd(SortConfigBase(access_f(i)), k, APar, APar),\n\t\t           TCompose(List([2..(t-i+1)], j -> \n\t\t               TCompose([\n\t\t\t           TTensorI(TPrm(Tensor(I(2), L(2^(j-1), 2^(j-2))) * L(2^j,2)), 2^(t-j), APar, APar),\n\t\t\t           TTensorInd(SortConfigBase(access_f(i)), k, APar, APar)\n\t\t\t       ])\n\t\t           )),\n\t\t           TTensorI(TPrm(L(2^(t-i+1), 2^(t-i))), 2^(i-1), APar, APar) \n\t\t       ])\n\t            )),\t\t\n\t\t    TTensorInd(SortConfigBase(access_f(t)), k, APar, APar)]\n\t\t    #TTensorI(SortBase(), 2^(t-1), APar, APar)] #what is this line?\n                ).withTags(nt.getTags())\n            ]]\n\t),\n\n        apply        := (nt, c, cnt) -> c[1],\n\n    ),\n\n   Sort_Stream_Iter := rec(\n        info         := \"Stream/Iter sorting network\",\n\n\tdepth_params := [],\n\n        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n\t                              Length(self.depth_params) = Log2Int(nt.params[1])-1 and\t\t\t      \n\t\t\t\t      let(\n\t\t\t\t\t  t := Log2Int(nt.params[1]),\n\t\t\t\t\t  d := self.depth_params,\n\t\t\t\t      ForAll(List([1..t-1], i -> IsInt((t-i+1)/d[i])), j -> j)\n\t\t\t\t      ),\n\n\n        children := (self, nt) >> let(\n   \t    t := Log2Int(nt.params[1]),\n\n\t    tag_w_tmp := nt.tags[1],\n\t    tag_w := tag_w_tmp.bs,\n\t    p := Ind(2^t),\n\n\t    get_bb := w -> Cond(w=1, TTensorInd(SortBase_w1(p), p, APar, APar),TTensorI(SortBase(), 2^(t-1), APar, APar)),\n\n\t    stage := i >> TCompose([\n\t\t\t     get_bb(tag_w),\n\t\t\t     #TTensorI(SortBase(), 2^(t-1), APar, APar),\n\t\t\t     TTensorI(TPrm(L(2^(t-i+1), 2^(t-i))) , 2^(i-1), APar, APar)\n\t\t\t  ]),\n\n\t    full_stage := i >> TCompose(List([1..self.depth_params[i]], j2 -> stage(i))), \n\n  \t    [[ TCompose(\n\t           [TCompose(List([1..t-1], i -> let(\n\t\t       j := Ind(t-i+1),\n\t\t       d := self.depth_params[i],\n\t\t       j1 := Ind(d),\n\t\t       j2 := Ind((t-i+1)/d),\n\t               TCompose([\n\t\t\t   Cond(d = ((t-i+1)),\n                               full_stage(i), \n\t\t\t\tTCompose(List([1..d],j1 -> \n\t\t\t\tTICompose(j2, (t-i+1)/d, stage(i))\n\t\t\t\t)) \n\t\t\t   ),\n\t\t       \t   #TTensorI(TPrm(DirectSum(I(2^(t-i)), J(2^(t-i)))), 2^(i-1), APar, APar)\n\t\t       \t   TTensorI(TPrm(SortIJPerm(2^(t-i+1))), 2^(i-1), APar, APar)\n\t\t       ])\n\t            ))),\n\t\t    get_bb(tag_w)] #last iterations left outside of TCompose\n\t\t    #TTensorI(SortBase(), 2^(t-1), APar, APar)] #last iterations left outside of TCompose\n               ).withTags(nt.getTags())\n            ]]\n\t),\n\n        apply        := (nt, c, cnt) -> c[1],\n\n   ),\n   \n   #old version -works-\n#      Sort_Stream_Iter := rec(\n#        info         := \"Stream/Iter sorting network\",\n#\n#\tdepth_params := [],\n#\n#        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n#\t                              Length(self.depth_params) = Log2Int(nt.params[1])-1 and\t\t\t      \n#\t\t\t\t      let(\n#\t\t\t\t\t  t := Log2Int(nt.params[1]),\n#\t\t\t\t\t  d := self.depth_params,\n#\t\t\t\t      ForAll(List([1..t-1], i -> IsInt((t-i+1)/d[i])), j -> j)\n#\t\t\t\t      ),\n#\n#\n#        children := (self, nt) >> let(\n#   \t    t := Log2Int(nt.params[1]),\n#\n#\t    stage := i >> TCompose([\n#\t\t\t     TTensorI(SortBase(), 2^(t-1), APar, APar),\n#\t\t\t     TTensorI(TPrm(L(2^(t-i+1), 2^(t-i))) , 2^(i-1), APar, APar)\n#\t\t\t  ]),\n#\n#\t    full_stage := i >> TCompose(List([1..self.depth_params[i]], j2 -> stage(i))),\n#\n#\n#  \t    [[ TCompose(\n#\t           [TCompose(List([1..t-1], i -> let(\n#\t\t       j := Ind(t-i+1),\n#\t\t       d := self.depth_params[i],\n#\t\t       j1 := Ind((t-i+1)/d),\n#\t               TCompose([\n#\t\t\t   Cond(j1.range = 1,\n#\t\t\t       full_stage(i),\n#\t\t\t       TICompose(j1, (t-i+1)/d, full_stage(i))\n#\t\t\t   ),\n#\t\t       \t   TTensorI(TPrm(DirectSum(I(2^(t-i)), J(2^(t-i)))), 2^(i-1), APar, APar)\n#\t\t       ])\n#\t            ))),\n#\t\t    TTensorI(SortBase(), 2^(t-1), APar, APar)]\n#               ).withTags(nt.getTags())\n#            ]]\n#\t),\n#\n#        apply        := (nt, c, cnt) -> c[1],\n#\n#   ),\n   \n   Sort_Stream5 := rec(\n        info         := \"Version of Sort_Stream_Iter (sortAlg2) removing J permutations and with configurable 2-input sorters\",\n\n\tdepth_params := [],\n\n        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n\t                              Length(self.depth_params) = Log2Int(nt.params[1])-1 and\t\t\t      \n\t\t\t\t      let(\n\t\t\t\t\t  t := Log2Int(nt.params[1]),\n\t\t\t\t\t  d := self.depth_params,\n\t\t\t\t      ForAll(List([1..t-1], i -> IsInt((t-i+1)/d[i])), j -> j)\n\t\t\t\t      ),\n\n\n        children := (self, nt) >> let(\n   \t    t := Log2Int(nt.params[1]),\n\t    k := Ind(2^(t-1)),\n\t    z := (s) >> t-s,\n\n\t    c1 := (s) >> logic_and(eq(bit_sel(k, z(s)), 1), neq(s, 1)),\n\t    access_f := (s) >> cond(c1(s), 1, 2),\n\t    \n\t    stage := i >> TCompose([\n\t\t\t     TTensorInd(SortConfigBase(access_f(i)), k, APar, APar),\n\t\t\t     TTensorI(TPrm(L(2^(t-i+1), 2^(t-i))) , 2^(i-1), APar, APar)\n\t\t\t  ]),\n\n\t    full_stage := i >> TCompose(List([1..self.depth_params[i]], j2 -> stage(i))), \n\n  \t    [[ TCompose(\n\t           [TCompose(List([1..t-1], i -> let(\n\t\t       j := Ind(t-i+1),\n\t\t       d := self.depth_params[i],\n\t\t       j1 := Ind(d),\n\t\t       j2 := Ind((t-i+1)/d),\n\t\t       Cond(d = ((t-i+1)),\n                                full_stage(i), \n\t\t\t\tTCompose(List([1..d],j1 -> \n\t\t\t\tTICompose(j2, (t-i+1)/d, stage(i))\n\t\t\t\t)) \n\t\t\t       #unroll this change to TCompose\n\t\t\t)\n\t            ))),\n\t\t    TTensorInd(SortConfigBase(access_f(t)), k, APar, APar)] #last iterations left outside of TCompose\n               ).withTags(nt.getTags())\n            ]]\n\t),\n\n        apply        := (nt, c, cnt) -> c[1],\n\n   ),\n\n  Sort_Stream3 := rec(\n        info         := \"\",\n\t\n\tdepth_out := 1,\n        depth_in := [],\n\n        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n\t\t\t     \t      Length(self.depth_in) = Log2Int(nt.params[1])-1  and\n\t\t\t\t      let(\n                                          t := Log2Int(nt.params[1]), d_out := self.depth_out,\n                                          d_in := self.depth_in, IsInt(t/d_out) and ((d_out=1) or ((d_out=t) and \n                                      \t  (ForAll(List([1..t-1], i -> IsInt((t-i+1)/d_in[i])), j -> j))))\n                                      ),\n\n        children := (self, nt) >> let(\n\t    d_out := self.depth_out, \n\t    d_in := self.depth_in,\n            t := Log2Int(nt.params[1]),\n\t    k := Ind(2^(t-1)),\n\t    iter_d1 := Ind(t),\n\n            z := (lp, jp) >> (t-1)-(lp+jp),\n            c2 := (lp, jp) >> logic_and(eq(bit_sel(k, z(lp, jp)), 1), neq(lp, 0)),\n            access_f := (lp, jp) >> cond(c2(lp, jp), 1, 2),\n            stage := (lp, jp) >> TCompose([\n                       TTensorInd(SortConfigBase(access_f(lp, jp)), k, APar, APar),\n                       TPrm(L(2^t, 2^(t-1)))\n                   ]),\n\t    full_stage := i >> TCompose(List([0..d_in[i+1]-1], j -> stage(i,j))),\n\t    [[ Cond(d_out=1,\n\t\t\tTICompose(iter_d1,t,let(\n\t\t\t\titer_d2 := Ind(t-iter_d1),\n\t    \t\t\tp_list := List([0..t-1], i-> get_l_power(t,i)),\n\t\t\t\tTCompose([\n\t\t\t\t\tTICompose(iter_d2,t-iter_d1, stage(iter_d1,iter_d2)),\n\t\t  \t \t\tTPrmMulti(p_list,iter_d1)\n\t\t\t\t])\t\n\t\t\t)).withTags(nt.getTags()),\n\t\t    d_out=t,\n\t\t\tTCompose([\n\t\t\t\tTCompose(List([0..t-2], iter_d3 -> let(\n\t\t\t\t  d_stage := d_in[iter_d3+1],\t\n            \t\t\t  iter_d5 := Ind((t-iter_d3)/d_stage),\n\t\t\t\t  TCompose([\n\t\t\t\t\tCond(d_stage=(t-iter_d3),\n\t\t\t\t\t\tfull_stage(iter_d3),\n\t\t\t\t\t\tTCompose(List([0..d_stage-1],iter_d4 ->\n\t\t\t\t\t\t  TICompose(iter_d5,(t-iter_d3)/d_stage,stage(iter_d3,iter_d4*iter_d5))))\n\t\t\t\t\t),\n\t\t\t\t\tget_l_power(t,iter_d3)\n\t\t\t\t  ])\n\t\t\t\t))),\n\t\t\t\tstage(t-1,0),\n\t\t\t\tget_l_power(t,t-1)\n\t\t\t]).withTags(nt.getTags())\t\n\t    )]]\n\t\t\n\t),\n        apply        := (nt, c, cnt) -> c[1],\n   ),\n\n   Sort_Stream4 := rec(\n        info         := \"\",\n\n\tdepth := 1,\n\n        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n\t                              let (d := self.depth, t := Log2Int(nt.params[1]), IsInt(t*t/self.depth) and\n\t\t\t\t      (IsInt(d/t) or IsInt(t/d))),\n\n        children := (self, nt) >> let(\n   \t    t := Log2Int(nt.params[1]),\n\t    d := self.depth,\n\t    d1 := cond(leq(d,t), d, t).ev(),\n\t    d2 := cond(leq(d,t), 1, d/t).ev(), \n\n\t    k := Ind(2^(t-1)),\n\t    j := Ind(t),\n\t    l := Ind(t),\n\t    n := Ind(t/d2),\n\t    v := Ind(t/d1),\n\t    \n            d_tmp := cond(leq(d,t), t/d, 0).ev(),\n            d2_tmp := cond(leq(t,d), d/t, 0).ev(),\n\t    s_tmp := ((t*t)/d),\n            m2 := Ind(d_tmp),\n\t    s2 := Ind(s_tmp),\n\t    v2 := Ind(d2_tmp),\n\t    n2 := Ind(d),\n\t    n3 := Ind(d),\n\t    l2 := Ind(t),\n\t   \n\t    tag_w_tmp := nt.tags[1],\n\t    tag_w := tag_w_tmp.bs,\n\t    p := Ind(2^t),\n\n \n\t    c1 := (lp, jp) >> lt((t-1), (lp+jp)),\n\t    z := (lp, jp) >> (t-1)-(lp+jp),\n\t    z_w1 := (lp, jp) >> (t-1)-(lp+jp)+1,\n\t    c2 := (lp, jp) >> logic_and(eq(bit_sel(k, z(lp, jp)), 1), neq(lp, 0)),\n\t    c2_w1 := (lp, jp) >> logic_and(eq(bit_sel(p, z_w1(lp, jp)), 1), neq(lp, 0)),\n\t    \t    \n\t    access_f := (lp, jp) >> cond(c1(lp, jp), 0, c2(lp, jp), 1, 2),\n\t    access_f_w1 := (lp, jp) >> cond(c1(lp, jp), 0, c2_w1(lp, jp), 1, 2),\n\t    \n\t    get_bb := (lp,jp) -> Cond(tag_w=1, TTensorInd(SortConfigBase_w1(p,access_f_w1(lp,jp)), p, APar, APar),TTensorInd(SortConfigBase(access_f(lp, jp)), k, APar, APar)),\n\n\t    stage := (lp, jp) >> TCompose([\n\t\t       get_bb(lp, jp),\n\t\t       #TTensorInd(SortConfigBase(access_f(lp, jp)), k, APar, APar),\n\t\t       TPrm(L(2^t, 2^(t-1)))\n\t           ]),\n\n\t    full_stage := np_1 >> TCompose(List([0..t-1], m_1 -> TCompose(List([0..t-1], j_1 -> stage(m_1, j_1))))),\n\t    full_stage1 := np >> TCompose(List([0..d2-1], m -> TCompose(List([0..t-1], j -> stage(d2*np+m, j))))),\n\t    full_stage2 := vp >> TCompose(List([0..d1-1], s -> stage(l, vp+s))),\n            full_stage1b := np2 >> TICompose(m2,d_tmp, TICompose(j,t, stage((t/d)*np2+m2, j))),\n\n             # Old: problem is that it's assuming the l2 above, which is an unassigned iterator.  \n\t     # There is also a problem with the vp2+s2 parameter: you need to multiply vp2 by the number of iterations.\n             # full_stage2b := (vp2) >> TICompose(s2,s_tmp, stage(l2, vp2+s2)),\n            full_stage2b := (vp2, l3) >> TICompose(s2,s_tmp, stage(l3, vp2*s_tmp+s2)),\n\t\n  \t    [[ Cond(d=t*t, full_stage(0).withTags(nt.getTags()),\t\t\n\t\t    d<t, TCompose(List([0..d-1], n2 -> full_stage1b(n2))).withTags(nt.getTags()),\n                    d=t, TCompose(List([0..d-1], n3 -> full_stage1b(n3))).withTags(nt.getTags()),\n                    d>t, TCompose(List([0..t-1], l3 -> TCompose(List([0..d2_tmp-1], v2 -> full_stage2b(v2, l3))))).withTags(nt.getTags())) #the problem seems to be the outer most TCompose works if it was TICompose\t\t    \n\t\t    #d>t, TICompose(n, t/d2, full_stage1(n)).withTags(nt.getTags())) #old one but will leave it as new one does not work yet\n\t        ]]\n\t),\n\t\n#\tOld version -works-\n#\t   Sort_Stream4 := rec(\n#        info         := \"\",\n#\n#\tdepth := 1,\n#\n#        applicable   := (self, nt) >> Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and\n#\t                              let (d := self.depth, t := Log2Int(nt.params[1]), IsInt(t*t/self.depth) and\n#\t\t\t\t      (IsInt(d/t) or IsInt(t/d))),\n#\n#\n#        children := (self, nt) >> let(\n#   \t    t := Log2Int(nt.params[1]),\n#\t    d := self.depth,\n#\t    d1 := cond(leq(d,t), d, t).ev(),\n#\t    d2 := cond(leq(d,t), 1, d/t).ev(), \n#\n#\t    k := Ind(2^(t-1)),\n#\t    j := Ind(t),\n#\t    l := Ind(t),\n#\t    n := Ind(t/d2),\n#\t    v := Ind(t/d1),\n#\t    \n#\t    \n#\t    c1 := (lp, jp) >> lt((t-1), (lp+jp)),\n#\t    z := (lp, jp) >> (t-1)-(lp+jp),\n#\t    c2 := (lp, jp) >> logic_and(eq(bit_sel(k, z(lp, jp)), 1), neq(lp, 0)),\n#\t    \t    \n#\t    access_f := (lp, jp) >> cond(c1(lp, jp), 0, c2(lp, jp), 1, 2),\n#\t    \n#\t    stage := (lp, jp) >> TCompose([\n#\t\t       TTensorInd(SortConfigBase(access_f(lp, jp)), k, APar, APar),\n#\t\t       TPrm(L(2^t, 2^(t-1)))\n#\t           ]),\n#\n#\t    full_stage1 := np >> TCompose(List([0..d2-1], m -> TCompose(List([0..t-1], j -> stage(d2*np+m, j))))),\n#\t    full_stage2 := vp >> TCompose(List([0..d1-1], s -> stage(l, vp+s))),\n#\n#  \t    [[ Cond(d=t*t, full_stage1(0).withTags(nt.getTags()),\t\t\n#\t\t    d>t, TICompose(n, t/d2, full_stage1(n)).withTags(nt.getTags()),\n#\t\t    d<t, TICompose(l, t, TICompose(v, t/d1, full_stage2(d1*v))).withTags(nt.getTags()),\n#\t\t    d=t, TICompose(l, t, full_stage2(0)).withTags(nt.getTags()))\n#\t        ]]\n#\t),\n#\t\n#        apply        := (nt, c, cnt) -> c[1],\n#   ),\n\n\t# this works, but only for d=1.\n#         children := (self, nt) >> let(\n#    \t    t := Log2Int(nt.params[1]),\n# \t    k := Ind(2^(t-1)),\n# \t    l := Ind(t),\n# \t    j := Ind(t),\n\t    \n# \t    c1 := lt((t-1), (l+j)),\n# \t    z := (t-1)-(l+j),\n# \t    c2 := logic_and(eq(bit_sel(k, z), 1), neq(l, 0)),\n\t    \t    \n# \t    access_f := cond(c1, 0, c2, 1, 2),\n\t    \n# \t    d1 := cond(leq(d,t), d, t),\n# \t    d2 := cond(leq(d,t), 1, d/t), \n\t    \n# \t    c1 := lt((t-1), (l+j)),\n# \t    z := (t-1)-(l+j),\n# \t    c2 := logic_and(eq(bit_sel(k, z), 1), neq(l, 0)),\n\t    \t    \n# \t    access_f := cond(c1, 0, c2, 1, 2),\n\t    \n# \t    d1 := cond(leq(d,t), d, t),\n# \t    d2 := cond(leq(d,t), 1, d/t), \n\n#   \t    [[ TICompose(l, t, \n# \t\t   TICompose(j, t, TCompose([\n# \t\t       TTensorInd(SortConfigBase(access_f), k, APar, APar),\n# \t\t       TPrm(TL(2^t, 2^(t-1), 1, 1))\n# \t           ]))).withTags(nt.getTags())\n#             ]]\n# \t),\n\n        apply        := (nt, c, cnt) -> c[1],\n\n   ),\n\n  Linear_Sort := rec(\n        info         := \"\",\n\t\n        applicable   := (self, nt) >> IsTwoPower(nt.params[1]),\n\n        children := (self, nt) >> let(\n            t := Log2Int(nt.params[1]),\n\t    [[ TCompose(List([1..2^t], i -> \n\t\tTTensorI(LinearSortBase(), nt.params[1], APar, APar)\n\t\t\t)).withTags(nt.getTags()),\n\t    ]]\n\t\t\n\t),\n        apply        := (nt, c, cnt) -> c[1],\n   ),\n\n));\t        \n\n\n\n#---------------------------------------------------------------------\n#---------------------------------------------------------------------\n#---------------------------------------------------------------------\n# Old stuff, not used now\n\n\n#     Sort_Stream_old := rec(\n#         info         := \"Streaming sorting network\",\n\n#         switch       := true,\n#         applicable   := nt ->\n#             Length(nt.params) = 1 and IsTwoPower(nt.params[1]),\n\n#         children := (self, nt) >> let(\n# \t    t := Log2Int(nt.params[1]),\n# \t    [[ TCompose(List([1..t], i ->\n# \t \tTCompose([\n# \t\t    TTensorI(BitonicSort(2^(t-i+1)), 2^(i-1), APar, APar),\n# \t\t    TTensorI(TPrm(DirectSum(I(2^(t-i)), J(2^(t-i)))), 2^(i-1), APar, APar)\n# \t\t])\n#             )).withTags(nt.getTags())]]\n#         ),\n\n#         apply        := (nt, c, cnt) -> c[1],\n\n#     ),\n\n# Declaration of a bitonic sorter of size n\n# Class(BitonicSort, TaggedNonTerminal, rec(\n#     abbrevs := [\n#     (n)       -> Checked(IsPosIntSym(n), [_unwrap(n)]),\n#     ],\n\n#     hashAs := self >> ObjId(self)(self.params[1]).withTags(self.getTags()),\n\n#     dims := self >> [ self.params[1], self.params[1] ],\n\n#     terminate := self >> Error(\"not supported\"), # we could probably support this\n# ));\n\n\n\n# Old stuff, not used now.\t\t       \n# # Rules to break-down BitonicSort()\n# NewRulesFor(BitonicSort, rec(\n#     BitonicSort_Stream := rec(\n#         info         := \"Streaming Bitonic sorting network\",\n\n#         switch       := true,\n#         applicable   := nt ->\n#             Length(nt.params) = 1 and IsTwoPower(nt.params[1]) and nt.params[1] > 2,\n\n#         children := (self, nt) >> let(\n# \t    k := Log2Int(nt.params[1]),\n# \t    [[ TCompose([ TTensorI(SortBase(), 2^(k-1), APar, APar),\n# \t\t  TCompose(List([2..k], j -> TCompose([\n# \t\t      TTensorI(TPrm(Tensor(I(2), L(2^(j-1), 2^(j-2))) * L(2^j, 2)), 2^(k-j), APar, APar),\n# \t\t      TTensorI(SortBase(), 2^(k-1), APar, APar)\n# \t\t  ]))),\n# \t\t  TPrm(L(2^k, 2^(k-1)))\n# \t       ]).withTags(nt.getTags())\n# \t    ]]\n#         ),\n\n#         apply        := (nt, c, cnt) -> c[1],\n#     ),\n\n#     BitonicSort_Base := rec(\n# \tinfo := \"Bitonic soring network base rule\",\n# \tapplicable := nt -> nt.params[1] = 2,\n# \tchldren := (self, nt) >> [[ ]],\n# \tapply := (nt, c, cnt) -> SortBase()\n#     )\n\n# ));\t        \n", "meta": {"hexsha": "853ea381761c4f9dcfb59da089a32c265540a5e6", "size": 25488, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/stream/sort.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/stream/sort.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/stream/sort.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.5445544554, "max_line_length": 219, "alphanum_fraction": 0.4808929692, "num_tokens": 8666, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4571367316191468, "lm_q2_score": 0.03067579860909325, "lm_q1q2_score": 0.014023034315968057}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nX := var(\"X\", TPtr(TReal));\nY := var(\"Y\", TPtr(TReal));\nX1 := var(\"X1\", TPtr(TReal));\nY1 := var(\"Y1\", TPtr(TReal));\nXY1 := var(\"XY1\", TPtr(TReal));\n\n# defined in cgstrat.gi\nDeclare(ApplyCodegenStrat);\n\nRemoveAssignAcc := code -> SubstTopDownRulesNR(code, rec(\n    assign_acc_toassign := Rule(assign_acc, e -> assign(Copy(e.loc), e.loc+e.exp)),\n    assign_donothing := Rule(assign, e -> e), \n));\n\n\n#F CodeSums(<sums>, <opts>)\n#F    Creates code for Sigma-SPL <sums>.\n#F    Sigma-SPL rewrite rules are not applied.\n#F    Compilation proceeds according to <opts>.compileStrategy\n#F\n\nCodeSums := function(sums, opts)\n    local X, Y, code;\n\n        if IsList(sums.dims()[2]) then\n            X := List([1..Length(sums.dims()[2])],\n                x -> var(Concatenation(\"X\",String(x)), TPtr(TReal)));\n        else\n            X := Cond(IsBound(opts.X), opts.X, var(\"X\", TPtr(TReal)));\n        fi;\n\n        if IsList(sums.dims()[1]) then\n            Y := List([1..Length(sums.dims()[1])],\n                x -> var(Concatenation(\"Y\",String(x)), TPtr(TReal)));\n        else\n            Y := Cond(\n                opts.inplace, X,\n                IsBound(opts.Y), opts.Y, \n                var(\"Y\", TPtr(TReal)));\n        fi;\n    \n        code := opts.codegen(Formula(sums), Y, X, opts);\n        code.ruletree := Cond(IsBound(sums.ruletree), sums.ruletree, rec());\n        return code;\nend;\n\n#F See CodeSums\n#F\nCodeSumsOpts := CodeSums;\n\n\n#F CodeRuleTree(<rt>, <opts>)\n#F\n#F <opts> flags used:\n#F   opts.formulaStrategies.sigmaSpl    Sigma-SPL rewriting strategy\n#F   opts.formulaStrategies.rc          RC(.) rewriting strategy\n#F   opts.generateComplexCode == bool   if set to false, then RC rewriting strategy is applied\n#F\nCodeRuleTree := function(rt, opts)\n    local sums, code;\n    sums := SumsRuleTree(rt, opts);\n    code := CodeSums(sums, opts);\n    return code;\nend;\n\n#F See CodeRuleTree\n#F\nCodeRuleTreeOpts := CodeRuleTree;\n\n#F RealSums(<sums>)\n#F    Convert complex Sigma-SPL formula to a real formula.\n#F\nRealSums := sums -> StandardSumsRules(RC(sums));\n\n\n#F CodeSPL(<unroll>, <spl>, opts)\n#F\nCodeSPL := function(spl, opts)\n    local sums;\n    sums := SumsSPL(spl, opts);\n    sums := ApplyStrategy(sums, opts.formulaStrategies.sigmaSpl, UntilDone, opts);\n    sums := ApplyStrategy(sums, opts.formulaStrategies.preRC, UntilDone, opts);\n    if not spl.isReal() and not opts.generateComplexCode then\n        sums := ApplyStrategy(RC(sums), opts.formulaStrategies.rc, UntilDone, opts); fi;\n    sums := ApplyStrategy(sums, opts.formulaStrategies.postProcess, UntilDone, opts);\n    return CodeSums(sums, opts);\nend;\n\n\n#F PrintCode(<funcname>, <code>, <opts>)\n#F    Prints the code using opts.unparser\n#F\nPrintCode := (funcname, code, opts) -> opts.unparser.gen(funcname, code, opts);\n\n_ExportCodeRuleTree := function(ruletree, file, funcname, opts)\n    local code;\n    Constraint(IsRuleTree(ruletree));\n    if opts.verbosity > 0 then Print(\"Generating code...\\n\"); fi;\n    code := CodeRuleTree(ruletree, opts);\n    PrintTo(file, opts.unparser.gen(funcname, code, opts));\nend;\n\n#F ExportCodeRuleTree(<ruletree>, <funcname>, <opts>)\n#F    Generates and exports C code to a file for <ruletree>.\n#F    The C transform function will have the name <funcname>.\n#F    Code will be saved in <funcname>.c\n#F\nExportCodeRuleTree := (ruletree, funcname, opts) ->\n    _ExportCodeRuleTree(ruletree, Concat(funcname, \".c\"), funcname, opts);\n\n#F PrintCodeRuleTree(<ruletree>, <opts>)\n#F    Generates C code and prints it out.\n#F\nPrintCodeRuleTree := (ruletree, opts) ->\n    _ExportCodeRuleTree(ruletree, \"*stdout*\", \"sub\", opts);\n\n#F ImplementRuleTree(<ruletree>, <file>, <opts>)\n#F\nImplementRuleTree := (ruletree, file, opts) ->\n    _ExportCodeRuleTree(ruletree, file,\n    When(IsBound(opts.subName), opts.subName, ruletree.node.name), opts);\n\n#F VerifyMatrixRuleTree(<ruletree>, <opts>)\n#F\nVerifyMatrixRuleTree := function(ruletree, opts)\n    local code, mat;\n    Constraint(IsRuleTree(ruletree));\n    if opts.verbosity > 0 then Print(\"Generating code...\\n\"); fi;\n    code := CodeRuleTree(ruletree, opts);\n    if opts.verbosity > 0 then Print(\"Computing reference matrix...\\n\"); fi;\n    mat := When(ruletree.node.isReal() or opts.dataType = \"complex\" or opts.generateComplexCode,\n            MatSPL(ruletree.node),\n        RCMatCyc(MatSPL(ruletree.node)));\n    if opts.verbosity > 0 then Print(\"Running code and computing the norm...\\n\"); fi;\n    return InfinityNormMat(CMatrix(code, opts) - mat);\nend;\n\n#F VerifyMatrixCode(<code>, <definition-matrix>, <opts>)\n#F\nVerifyMatrixCode := (code, def_matrix, opts) -> Checked(IsCommand(code),\n    InfinityNormMat(CMatrix(code, opts) - def_matrix)\n);\n\n\nFailedTrees := [];\nInaccurateTrees := [];\n\nCMeasureRuleTree := function(rt, opts)\n    local res, c, mfunc, tol;\n\n    c := CodeRuleTree(rt, opts);\n\n    mfunc := When(IsBound(opts.profile) and IsBound(opts.profile.meas), opts.profile.meas, CMeasure);\n\n    if opts.faultTolerant then\n\t\tres := Try(mfunc(c, opts));\n    else\n\t\tres := [true, mfunc(c, opts)];\n    fi;\n\n    if res[1]=false then\n        Add(FailedTrees, rt);\n        return 1e20;\n    else\n        if IsBound(opts.verifyDP) and opts.verifyDP then\n            tol := VerifyMatrixRuleTree(rt, opts);\n            if tol > opts.verifyTolerance then\n                Add(InaccurateTrees, rec(rt:=rt, opts := opts, tol :=tol));\n            fi;\n        fi;\n        return res[2];\n    fi;\nend;\n", "meta": {"hexsha": "7fdc05ca6a7da897e1c13221ce5001d98853a895", "size": 5501, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/top.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/top.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/top.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 30.7318435754, "max_line_length": 101, "alphanum_fraction": 0.6435193601, "num_tokens": 1563, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4148988457967689, "lm_q2_score": 0.03358950214320427, "lm_q1q2_score": 0.013936245670103545}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\n# get \u201csystem default\u201d as defined by SPIRAL startup scripts\nLocalConfig.defaultConf();\n\n# pick from a number of default configs\nLocalConfig.supportedConfs.confGPU();\nLocalConfig.supportedConfs.confMultiGPU();\nLocalConfig.supportedConfs.confSclarCPU();\nLocalConfig.supportedConfs.confOMPVMX();\n\u2026\n\n# guru interface by configuring confs\nLocalConfig.defaultConf(rec(useCPU := true, useGPU := false, useP9 := true, useOpenMP := true));\nLocalConfig.defaultConf(rec(useCPU := false, useGPU := true, useMultiGPU := false));\nLocalConfig.supportedConfs.confOMPVMX(rec(threads := 4, OMPver := \u201c4.1.2\u201d));\n", "meta": {"hexsha": "35f4ce0412f490a257da2f6bc0473d63859424f7", "size": 679, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "knowledgebase/conf.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "knowledgebase/conf.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "knowledgebase/conf.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 35.7368421053, "max_line_length": 96, "alphanum_fraction": 0.764359352, "num_tokens": 180, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.2422056287253594, "lm_q2_score": 0.05749328041530818, "lm_q1q2_score": 0.013925196130473109}}
{"text": "#############################################################################\n##\n#W  automsg.gi               automgrp package                  Yevgen Muntyan\n#W                                                             Dmytro Savchuk\n##\n#Y  Copyright (C) 2003 - 2018 Yevgen Muntyan, Dmytro Savchuk\n##\n\n\n###############################################################################\n##\n#M  AutomatonSemigroup(<list>)\n##\nInstallMethod(AutomatonSemigroup, \"for [IsList]\", [IsList],\nfunction (list)\n  return AutomatonSemigroup(list, false);\nend);\n\n\n###############################################################################\n##\n#M  AutomatonSemigroup(<list>, <bind_vars>)\n##\nInstallMethod(AutomatonSemigroup, \"for [IsList, IsBool]\", [IsList, IsBool],\nfunction (list, bind_vars)\n  if not AG_IsCorrectAutomatonList(list, false) then\n    Error(\"in AutomatonSemigroup(IsList):\\n\",\n          \"  given list is not a correct list representing automaton\\n\");\n  fi;\n\n  # XXX\n  return SemigroupOfAutomFamily(AutomFamily(list, bind_vars));\nend);\n\n\n###############################################################################\n##\n#M  AutomatonSemigroup(<list>, <names>)\n##\nInstallMethod(AutomatonSemigroup, \"for [IsList, IsList]\", [IsList, IsList],\nfunction (list, names)\n  if not AG_IsCorrectAutomatonList(list, false) then\n    Error(\"error in AutomatonSemigroup(IsList, IsList):\\n\",\n          \"  given list is not a correct list representing automaton\\n\");\n  fi;\n\n  # XXX\n  return SemigroupOfAutomFamily(AutomFamily(list, names));\nend);\n\n\n###############################################################################\n##\n#M  AutomatonSemigroup(<list>, <names>, <bind_vars>)\n##\nInstallMethod(AutomatonSemigroup, \"for [IsList, IsList, IsBool]\",\n              [IsList, IsList, IsBool],\nfunction (list, names, bind_vars)\n  if not AG_IsCorrectAutomatonList(list, false) then\n    Error(\"error in AutomatonSemigroup(IsList):\\n\",\n          \"  given list is not a correct list representing automaton\\n\");\n  fi;\n\n  #XXX\n  return SemigroupOfAutomFamily(AutomFamily(list, names, bind_vars));\nend);\n\n\n###############################################################################\n##\n#M  AutomatonSemigroup(<string>)\n#M  AutomatonSemigroup(<string>, <bind_vars>)\n##\nInstallMethod(AutomatonSemigroup, \"for [IsString]\", [IsString],\nfunction(string)\n    return AutomatonSemigroup(string, AG_Globals.bind_vars_autom_family);\nend);\nInstallMethod(AutomatonSemigroup, \"AutomatonSemigroup(IsString, IsBool]\", [IsString, IsBool],\nfunction(string, bind_vars)\n    local s;\n    s := AG_ParseAutomatonString(string);\n    return AutomatonSemigroup(s[2], s[1], bind_vars);\nend);\n\n\n###############################################################################\n##\n#M  AutomatonSemigroup(<A>)\n#M  AutomatonSemigroup(<A>, <bind_vars>)\n##\nInstallMethod(AutomatonSemigroup, \"for [IsMealyAutomaton]\", [IsMealyAutomaton],\nfunction(A)\n  return AutomatonSemigroup(AutomatonList(A), A!.states);\nend);\n\nInstallMethod(AutomatonSemigroup, \"for [IsMealyAutomaton, IsBool]\", [IsMealyAutomaton, IsBool],\nfunction(A, bind_vars)\n  return AutomatonSemigroup(AutomatonList(A), A!.states, bind_vars);\nend);\n\n\n###############################################################################\n##\n#M  IsSelfSimilar(<G>)\n##\nInstallMethod(IsSelfSimilar, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  local g, i, res;\n  res := true;\n  for g in GeneratorsOfSemigroup(G) do\n    for i in [1..UnderlyingAutomFamily(G)!.deg] do\n      res := Section(g, i) in G;\n      if res = fail then\n        TryNextMethod();\n      elif not res then\n        return false;\n      fi;\n    od;\n  od;\n  return true;\nend);\n\n###############################################################################\n##\n#M  UnderlyingAutomFamily(<G>)\n##\nInstallMethod(UnderlyingAutomFamily, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return FamilyObj(GeneratorsOfSemigroup(G)[1]);\nend);\n\n\n# ###############################################################################\n# ##\n# #M  UseSubsetRelation(<G>)\n# ##\n# InstallMethod(UseSubsetRelation,\n#               \"for [IsAutomSemigroup, IsAutomSemigroup]\",\n#               [IsAutomSemigroup, IsAutomSemigroup],\n# function(super, sub)\n#   ## the full group is self similar, so if <super> is smaller than the full\n#   ##  group then sub is smaller either\n#   if HasIsGroupOfAutomFamily(super) then\n#     if not IsGroupOfAutomFamily(super) then\n#       SetIsGroupOfAutomFamily(sub, false); fi; fi;\n#   TryNextMethod();\n# end);\n\n\n# ###############################################################################\n# ##\n# #M  __AG_SubgroupOnLevel(<G>, <gens>, <level>)\n# ##\n# InstallMethod(__AG_SubgroupOnLevel, [IsAutomGroup,\n#                                  IsList and IsTreeAutomorphismCollection,\n#                                  IsPosInt],\n# function(G, gens, level)\n#   local overgroup;\n#\n#   if IsEmpty(gens) or (Length(gens) = 1 and IsOne(gens[1])) then\n#     return TrivialSubgroup(G);\n#   fi;\n#\n#   if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n#     overgroup := G;\n#   else\n#     overgroup := GroupOfAutomFamily(UnderlyingAutomFamily(G));\n#   fi;\n#\n#   return SubgroupNC(overgroup, gens);\n# end);\n#\n# InstallOtherMethod(__AG_SubgroupOnLevel, [IsAutomGroup, IsList and IsEmpty, IsPosInt],\n# function(G, gens, level)\n#   return TrivialSubgroup(G);\n# end);\n#\n# InstallMethod(__AG_SubgroupOnLevel, [IsTreeAutomorphismGroup,\n#                                  IsList and IsAutomCollection,\n#                                  IsPosInt],\n# function(G, gens, level)\n#   local overgroup;\n#\n#   overgroup := GroupOfAutomFamily(FamilyObj(gens[1]));\n#\n#   if Length(gens) = 1 and IsOne(gens[1]) then\n#     return TrivialSubgroup(overgroup);\n#   fi;\n#\n#   return SubgroupNC(overgroup, gens);\n# end);\n#\n# InstallMethod(__AG_SimplifyGroupGenerators, [IsList and IsAutomCollection],\n# function(gens)\n#   local words, fam;\n#\n#   if IsEmpty(gens) then\n#     return [];\n#   fi;\n#\n#   fam := FamilyObj(gens[1]);\n#   words := FreeGeneratorsOfGroup(Group(List(gens, a -> a!.word)));\n#\n#   if fam!.use_rws and not IsEmpty(words) then\n#     words := AG_ReducedForm(fam!.rws, words);\n#     words := FreeGeneratorsOfGroup(Group(words));\n#   fi;\n#\n#   return List(words, w -> Autom(w, fam));\n# end);\n\n\n###############################################################################\n##\n#M  DegreeOfTree(<G>)\n##\nInstallMethod(DegreeOfTree, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return DegreeOfTree(UnderlyingAutomFamily(G));\nend);\n\nInstallMethod(TopDegreeOfTree, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return DegreeOfTree(UnderlyingAutomFamily(G));\nend);\n\n\n###############################################################################\n##\n#M  PrintObj(<G>)\n##\nInstallMethod(PrintObj, \"for [IsAutomatonSemigroup]\",\n              [IsAutomatonSemigroup],\nfunction(G)\n  Print(\"AutomatonSemigroup(\\\"\", String(G), \"\\\")\");\nend);\n\n\n#############################################################################\n##\n#M  String(<G>)\n##\nInstallMethod(String, \"for [IsAutomSemigroup]\", [IsAutomSemigroup],\nfunction(G)\n  local i, gens, formatone, s;\n\n  formatone := function(a)\n    return Concatenation(String(a), \" = \", String(Decompose(a)));\n  end;\n\n  if IsMonoid(G) then\n    gens := GeneratorsOfMonoid(G);\n  else\n    gens := GeneratorsOfSemigroup(G);\n  fi;\n\n  s := \"\";\n  for i in [1..Length(gens)] do\n    Append(s, formatone(gens[i]));\n    if i <> Length(gens) then\n      Append(s, \", \");\n    fi;\n  od;\n\n  return s;\nend);\n\n\n###############################################################################\n##\n#M  Display(<G>)\n##\nInstallMethod(Display, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  local i, gens, printone;\n\n  printone := function(a)\n    Print(a, \" = \", Decompose(a));\n  end;\n\n  gens := GeneratorsOfSemigroup(G);\n  if gens = [] then Print(\"< >\"); fi;\n  if Length(gens) = 1 then\n    Print(\"< \"); printone(gens[1]); Print(\" >\");\n  else\n    Print(\"< \"); printone(gens[1]); Print(\", \\n\");\n    for i in [2..Length(gens)-1] do\n      Print(\"  \"); printone(gens[i]); Print(\", \\n\");\n    od;\n    Print(\"  \"); printone(gens[Length(gens)]); Print(\" >\");\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  ViewObj(<G>)\n##\nInstallMethod(ViewObj, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  local i, gens;\n  gens := List(GeneratorsOfSemigroup(G), g -> Word(g));\n  if gens = [] then Print(\"< >\"); fi;\n  Print(\"< \");\n  for i in [1..Length(gens)-1] do\n    if IsOne(gens[i]) then\n      Print(AG_Globals.identity_symbol, \", \");\n    else\n      Print(gens[i], \", \");\n    fi;\n  od;\n  if IsOne(gens[Length(gens)]) then\n    Print(AG_Globals.identity_symbol, \" >\");\n  else\n    Print(gens[Length(gens)], \" >\");\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  IsTrivial(G)\n##\nInstallMethod(IsTrivial, \"for [IsAutomSemigroup]\", [IsAutomSemigroup],\nfunction (G)\n  local g;\n  for g in GeneratorsOfSemigroup(G) do\n    if not IsOne(g) then return false; fi;\n  od;\n  return true;\nend);\n\n\n\n###############################################################################\n##\n#M  Size(G)\n##\nInstallMethod(Size, \"for [IsAutomSemigroup]\", [IsAutomSemigroup],\nfunction (G)\n  local g;\n  if IsTrivial(G) then\n    Info(InfoAutomGrp, 3, \"Size(G): 1, G is trivial\");\n    return 1;\n  fi;\n\n  for g in Iterator(G) do od;\n\n  return Size(G);\n#  TryNextMethod();\nend);\n\n\n# ###############################################################################\n# ##\n# #M  \\= (<G>, <H>)\n# ##\n# InstallMethod(\\=, \"for [IsAutomGroup, IsAutomGroup]\",\n#               IsIdenticalObj, [IsAutomGroup, IsAutomGroup],\n# function(G, H)\n#   local fgens1, fgens2, fam;\n#\n#   if HasIsGroupOfAutomFamily(G) and HasIsGroupOfAutomFamily(H) then\n#     if IsGroupOfAutomFamily(G) <> IsGroupOfAutomFamily(H) then\n#       Info(InfoAutomGrp, 3, \"G = H: false, exactly one is GroupOfAutomFamily\");\n#       return false;\n#     fi;\n#     if IsGroupOfAutomFamily(G) then\n#       Info(InfoAutomGrp, 3, \"G = H: true, both are GroupOfAutomFamily\");\n#       return true;\n#     fi;\n#   fi;\n#\n#   fgens1 := List(GeneratorsOfGroup(G), g -> Word(g));\n#   fgens2 := List(GeneratorsOfGroup(H), g -> Word(g));\n#   fam := UnderlyingAutomFamily(G);\n#\n#   if fam!.rws <> fail then\n#     fgens1 := AsSet(AG_ReducedForm(fam!.rws, fgens1));\n#     fgens2 := AsSet(AG_ReducedForm(fam!.rws, fgens2));\n#   fi;\n#\n#   if GroupWithGenerators(fgens1) = GroupWithGenerators(fgens2) then\n#     Info(InfoAutomGrp, 3, \"G = H: true, by subgroups of free group\");\n#     return true;\n#   fi;\n#\n#   TryNextMethod();\n# end);\n\n\n# ###############################################################################\n# ##\n# #M  IsSubset (<G>, <H>)\n# ##\n# InstallMethod(IsSubset, \"for [IsAutomGroup, IsAutomGroup]\",\n#               IsIdenticalObj, [IsAutomGroup, IsAutomGroup],\n# function(G, H)\n#   local h, fam, fgens1, fgens2;\n#\n#   if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n#     Info(InfoAutomGrp, 3, \"IsSubgroup(G, H): true\");\n#     Info(InfoAutomGrp, 3, \"  G is GroupOfAutomFamily\");\n#     return true;\n#   fi;\n#\n#   fgens1 := List(GeneratorsOfGroup(G), g -> Word(g));\n#   fgens2 := List(GeneratorsOfGroup(H), g -> Word(g));\n#   fam := UnderlyingAutomFamily(G);\n#\n#   if fam!.rws <> fail then\n#     fgens1 := AsSet(AG_ReducedForm(fam!.rws, fgens1));\n#     fgens2 := AsSet(AG_ReducedForm(fam!.rws, fgens2));\n#   fi;\n#\n#   if IsSubgroup(GroupWithGenerators(fgens1), GroupWithGenerators(fgens2)) then\n#     Info(InfoAutomGrp, 3, \"IsSubgroup(G, H): true\");\n#     Info(InfoAutomGrp, 3, \"  by subgroups of free group\");\n#     return true;\n#   fi;\n#\n#   TryNextMethod();\n# end);\n\n\n###############################################################################\n##\n#M  <g> in <G>\n##\nInstallMethod(\\in, \"for [IsAutom, IsAutomGroup]\",\n              [IsAutom, IsAutomSemigroup],\nfunction(g, G)\n  local fam, fgens, w;\n\n  if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n    return true;\n  fi;\n\n  fgens := List(GeneratorsOfSemigroup(G), g -> Word(g));\n  w := Word(g);\n\n  fam := UnderlyingAutomFamily(G);\n\n  if fam!.rws <> fail then\n    fgens := AsSet(AG_ReducedForm(fam!.rws, fgens));\n    w := AG_ReducedForm(fam!.rws, w);\n  fi;\n\n  if w in SemigroupByGenerators(fgens) then\n    Info(InfoAutomGrp, 3, \"g in G: true\");\n    Info(InfoAutomGrp, 3, \"  by elements of free group\");\n    Info(InfoAutomGrp, 3, \"  g = \", g, \"; G = \", G);\n    return true;\n  fi;\n\n  TryNextMethod();\nend);\n\n\n###############################################################################\n##\n#M  Random(<G>)\n##\nInstallMethodWithRandomSource(Random, \"for a random source and [IsAutomSemigroup]\",\n              [IsRandomSource, IsAutomSemigroup],\nfunction(rs, G)\n  local w, monoid, F, gens, pi;\n\n  if IsAutomatonSemigroup(G) then\n    monoid := UnderlyingFreeMonoid(G);\n\n    if IsTrivial(monoid) then\n      w := One(monoid);\n    else\n      while true do\n        w := Random(rs, monoid);\n        if not IsOne(w) then\n          break;\n        fi;\n      od;\n    fi;\n    return Autom(w, UnderlyingAutomFamily(G));\n  else\n    gens := GeneratorsOfSemigroup(G);\n    F := FreeGroup(Length(gens));\n    pi := GroupHomomorphismByImagesNC(F,                      UnderlyingFreeGroup(G),\n                                      GeneratorsOfGroup(F),   List(gens, Word)        );\n    return Autom( Random( rs, SemigroupByGenerators( GeneratorsOfGroup(F)))^pi, UnderlyingAutomFamily(G));\n  fi;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeMonoid( <G> )\n##\nInstallMethod(UnderlyingFreeMonoid, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return UnderlyingFreeMonoid(UnderlyingAutomFamily(G));\nend);\n\n###############################################################################\n##\n#M  UnderlyingFreeGroup( <G> )\n##\nInstallMethod(UnderlyingFreeGroup, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return UnderlyingFreeGroup(UnderlyingAutomFamily(G));\nend);\n\n###############################################################################\n##\n#M  UnderlyingFreeGenerators( <G> )\n##\nInstallMethod(UnderlyingFreeGenerators, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return List(GeneratorsOfSemigroup(G), g -> Word(g));\nend);\n\n\n# ###############################################################################\n# ##\n# #M  UnderlyingFreeSubgroup(<G>)\n# ##\n# InstallMethod(UnderlyingFreeSubgroup, \"for [IsAutomGroup]\",\n#               [IsAutomGroup],\n# function(G)\n#   local f;\n#   if HasIsGroupOfAutomFamily(G) and IsGroupOfAutomFamily(G) then\n#     return UnderlyingFreeGroup(G);\n#   fi;\n#   f := Subgroup(UnderlyingFreeGroup(G), UnderlyingFreeGenerators(G));\n#   if f = UnderlyingFreeGroup(G) then\n#     SetIsGroupOfAutomFamily(G, true);\n#   fi;\n#   return f;\n# end);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeGroup( <G> )\n##\nInstallMethod(UnderlyingFreeGroup, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return UnderlyingAutomFamily(G)!.freegroup;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingFreeGenerators( <G> )\n##\nInstallMethod(UnderlyingFreeGenerators, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  return List(GeneratorsOfSemigroup(G), g -> Word(g));\nend);\n\n\nInstallMethod(SphericalIndex, \"for IsAutomSemigroup\",\n              [IsAutomSemigroup],\nfunction(G)\n  return SphericalIndex(GeneratorsOfSemigroup(G)[1]);\nend);\nInstallMethod(DegreeOfTree, \"for IsAutomSemigroup\",\n              [IsAutomSemigroup],\nfunction(G)\n  return UnderlyingAutomFamily(G)!.deg;\nend);\nInstallMethod(TopDegreeOfTree, \"for IsAutomSemigroup\",\n              [IsAutomSemigroup],\nfunction(G)\n  return UnderlyingAutomFamily(G)!.deg;\nend);\n\n\n###############################################################################\n##\n#M  UnderlyingAutomaton(<G>)\n##\nInstallMethod(UnderlyingAutomaton, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  local fam, numstates, automatonlist, d, i, j;\n  fam := UnderlyingAutomFamily(G);\n  numstates := fam!.numstates;\n# if you do the next 2 operations in one \"List\", it will remove unbinded spaces\n  automatonlist := List(fam!.automatonlist);\n  Apply(automatonlist, x -> ShallowCopy(x));\n  d := fam!.deg;\n\n# in case we have 1 in the list we move it to the numstates+1 postion\n  if Length(automatonlist)=2*numstates+1 then\n    for i in [1..numstates] do\n      for j in [1..d] do\n        if automatonlist[i][j]=2*numstates+1 then automatonlist[i][j] := numstates+1; fi;\n      od;\n    od;\n    automatonlist[numstates+1] := List([1..d], x -> numstates+1);\n    Add(automatonlist[numstates+1], automatonlist[2*numstates+1][d+1]);\n    numstates := numstates+1;\n  fi;\n  return MealyAutomaton(automatonlist{[1..numstates]});\nend);\n\n\n###############################################################################\n##\n#M  IsAutomatonSemigroup(<G>)\n##\nInstallMethod(IsAutomatonSemigroup, \"for [IsAutomSemigroup]\",\n              [IsAutomSemigroup],\nfunction(G)\n  if not HasIsAutomatonSemigroup(G) then return false; fi;\nend);\n\n\n###############################################################################\n##\n#M  SemigroupOfAutomFamily(<G>)\n##\nInstallMethod(SemigroupOfAutomFamily, \"for [IsAutomSemigroup]\",\n                   [IsAutomSemigroup],\nfunction(G)\n  return SemigroupOfAutomFamily(UnderlyingAutomFamily(G));\nend);\n\n\n#E\n", "meta": {"hexsha": "6911625bed030a017ccd5b8a3e988b705892e47c", "size": 17673, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/automsg.gi", "max_stars_repo_name": "gap-packages/automgrp", "max_stars_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-10-02T15:00:11.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-02T15:00:11.000Z", "max_issues_repo_path": "gap/automsg.gi", "max_issues_repo_name": "gap-packages/automgrp", "max_issues_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 9, "max_issues_repo_issues_event_min_datetime": "2019-09-21T22:10:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-26T23:51:41.000Z", "max_forks_repo_path": "gap/automsg.gi", "max_forks_repo_name": "gap-packages/automgrp", "max_forks_repo_head_hexsha": "1beb0cbc96c9748cf912433c27c661e1f87ef5dc", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.5709828393, "max_line_length": 106, "alphanum_fraction": 0.5547445255, "num_tokens": 4572, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.43782349911420193, "lm_q2_score": 0.0316187706905879, "lm_q1q2_score": 0.013843440821442765}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#---------------------------------------------------------------------------------------\n#   SPU vector instructions\n#---------------------------------------------------------------------------------------\n\nClass(vbinop_8x16i_spu, vbinop_spu, rec( v := self >> 8));\nClass(vbinop_4x32f_spu, vbinop_spu, rec( v := self >> 4));\nClass(vbinop_2x64f_spu, vbinop_spu, rec( v := self >> 2));\n\nClass(exp_8x16i, rec(v := 8, computeType := self >> TVect(TInt,    8))); \nClass(exp_4x32f, rec(v := 4, computeType := self >> TVect(TDouble, 4))); \nClass(exp_2x64f, rec(v := 2, computeType := self >> TVect(TDouble, 2))); \n\nClass(cmd_8x16i, rec(v := 8, computeType := self >> TVect(TInt,    8))); \nClass(cmd_4x32f, rec(v := 4, computeType := self >> TVect(TDouble, 4))); \nClass(cmd_2x64f, rec(v := 2, computeType := self >> TVect(TDouble, 2))); \n\n# Load -----------------------------\nClass(vloadu8_spu8x16i, vloadop_new, exp_8x16i, rec(numargs := 1));\nClass(vloadu4_spu4x32f, vloadop_new, exp_4x32f, rec(numargs := 1));\n\n# Store ----------------------------\n\n# Zero -----------------------------\nClass(vzero_8x16i, vop_new, exp_8x16i, rec(numargs := 0));\nClass(vzero_4x32f, vop_new, exp_4x32f, rec(numargs := 0));\nClass(vzero_2x64f, vop_new, exp_2x64f, rec(numargs := 0));\n\n# Subvec ---------------------------\nClass(promote_spu8x16i, vbinop_new, exp_8x16i);\nClass(promote_spu4x32f, vbinop_new, exp_4x32f);\nClass(promote_spu2x64f, vbinop_new, exp_2x64f);\n\nClass(extract_spu8x16i, vbinop_new, exp_8x16i, rec(computeType := self >> TInt));\nClass(extract_spu4x32f, vbinop_new, exp_4x32f, rec(computeType := self >> TReal));\nClass(extract_spu2x64f, vbinop_new, exp_2x64f, rec(computeType := self >> TReal));\n\nClass(insert_spu8x16i, vop_new, exp_8x16i, rec(numargs := 3));\nClass(insert_spu4x32f, vop_new, exp_4x32f, rec(numargs := 3));\nClass(insert_spu2x64f, vop_new, exp_2x64f, rec(numargs := 3));\n\nClass(vsplat_8x16i, vloadop_new, exp_8x16i, rec(numargs := 1));\nClass(vsplat_4x32f, vloadop_new, exp_4x32f, rec(numargs := 1));\nClass(vsplat_2x64f, vloadop_new, exp_2x64f, rec(numargs := 1));\n\n# Binary ---------------------------\n# VA: This breaks bin_or, looks like something unfinished so commented out.\n# Class(bin_or, vbinop_new, exp_8x16i);\n# Class(bin_or, vbinop_new, exp_4x32f);\n# Class(bin_or, vbinop_new, exp_2x64f);\n\n# Rotates ---------------------------\nClass(slqwbyte_spu4x32f, vop_new, exp_4x32f, rec(numargs := 1));\n\nClass(rlmaskqwbyte_spu4x32f, vop_new, exp_4x32f, rec(numargs := 1));\n\n# Binary shuffle -------------------\n#NOTE: What are sparams, params, semantic, and permparams?\n#NOTE: Can we combine all these perms into the same thing somehow?\nClass(vperm_8x16i_spu, vbinop_8x16i_spu, rec(\n    semantic := (in1, in2, p) -> vpermop(in1, in2, p, 8),\n    params := self >> sparams(8, 16),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], rch[3].p]),\n    permparams := aperm\n));\n\nClass(vperm_4x32f_spu, vbinop_4x32f_spu, rec(\n    semantic := (in1, in2, p) -> vpermop(in1, in2, p, 4),\n    params := self >> sparams(4, 8),\n\n    #HACK: small hack: it'd be nice to not define from_rChildren explicitly\n    #here. We have to do it though, because the last param is a perm\n    #(vparam_spu) type, but the object must be created with a List, and not a\n    #vparam_spu.\n\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], rch[3].p]),\n    permparams := aperm\n));\n\nClass(vperm_2x64f_spu, vbinop_2x64f_spu, rec(\n    semantic := (in1, in2, p) -> vpermop(in1, in2, p, 2),\n    params := self >> sparams(2, 4),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2], rch[3].p]),\n    permparams := aperm\n));\n\n# Unary shuffle --------------------\nClass(vuperm_8x16i_spu, vunbinop_spu, \n    rec(binop := vperm_8x16i_spu,\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2].p])\n));\n\nClass(vuperm_4x32f_spu, vunbinop_spu, \n    rec(binop := vperm_8x16i_spu,\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2].p])\n));\n\nClass(vuperm_2x64f_spu, vunbinop_spu, \n    rec(binop := vperm_8x16i_spu,\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [rch[1], rch[2].p])\n));\n", "meta": {"hexsha": "7c344bc2fed5b488735c79673a03008804a3a1ee", "size": 4256, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/cellSPU/code.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/cellSPU/code.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/cellSPU/code.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 40.1509433962, "max_line_length": 88, "alphanum_fraction": 0.6247650376, "num_tokens": 1545, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4687906266262437, "lm_q2_score": 0.0293122296913986, "lm_q1q2_score": 0.013741298524843137}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# NOTE: too slow\nPackCode := function(c)\n     local pulled, decls, datas, dims;\n     if IsBound(c.dimensions) then dims := c.dimensions; fi;\n     pulled := PullBU(Copy(c), decl, e -> e.cmd, e -> e.vars);\n     decls := Set(Concatenation(pulled[1]));\n     c := pulled[2];\n\n     pulled := Pull(Copy(c), data, e -> e.cmd, e -> [e.var, e.value]);\n     datas := pulled[1];\n     c := pulled[2];\n\n     c := SubstBottomUp(c, chain, e -> e.flatten());\n     c := FoldL(datas, (cod,d) -> data(d[1], d[2], cod), decl(decls, c));\n     if IsBound(dims) then c.dimensions := dims; fi;\n     return c;\nend;\n\nFoldIf := c -> SubstTopDown(c,\n    @(1).target(IF).cond(e->IsValue(e.cond)),\n    e -> When(e.cond.v=0, e.else_cmd, e.then_cmd));\n\nDeclareHidden := function(code)\n    local free, v, dims;\n    free := code.free();\n    if IsBound(code.dimensions) then dims := code.dimensions; fi;\n    for v in free do\n        if IsBound(v.value) then code := data(v, v.value, code); fi;\n    od;\n    if IsBound(dims) then code.dimensions := dims; fi;\n    return code;\nend;\n\n# This eliminates aliasing between subexpressions of different commands\n# (ie pointers can alias, and this is bad)\nUntangleChain := c -> SubstTopDownNR(c, chain, e -> chain(List(e.cmds, Copy)));\n\n# reduce complex constants with im(c)=0 to float\n_prepConst := e -> Cond(\n    e.t <> TComplex, e,\n    IsCyc(e.v) and Im(e.v)=0, TDouble.value(e.v),\n    IsComplex(e.v) and ImComplex(e.v) = 0, TDouble.value(ReComplex(e.v)),\n    e);\n\nClass(_dropTRealInRefs, RuleSet);\nRewriteRules(_dropTRealInRefs, rec(\n    TReal_left  := ARule(ListClass, [ [@(1, TPtr), @(2, AtomicTyp, x->x=TReal), ...], \n        [@(3, TPtr, x->x.alignment=@(1).val.alignment), T_Real, ...]],\n        e -> [@(3).val]),\n    TReal_right := ARule(ListClass, [ [@(1, TPtr), T_Real, ...], \n        [@(2, TPtr), @(3, AtomicTyp, x->x=TReal and @(1).val.alignment=@(2).val.alignment), ...]],\n        e -> [@(1).val]),\n    TVect_TReal_left  := ARule(ListClass, [ [@(1, TPtr), [TVect, @(2, AtomicTyp, x->x=TReal), @(3)], ...], \n        [@(4, TPtr), [TVect, T_Real, @(5).cond(x->x=@(3).val and @(1).val.alignment=@(4).val.alignment)], ...]], \n        e -> [@(4).val]),\n    TVect_TReal_right := ARule(ListClass, [ [@(1, TPtr), [TVect, T_Real, @(2)], ...],\n        [@(3, TPtr), [TVect, @(4, AtomicTyp, x->x=TReal), @(5).cond(x->x=@(2).val and @(1).val.alignment=@(3).val.alignment)], ...]], \n        e -> [@(1).val]),\n));\n\n#F Compile(<code>)\n#F\n#F Fully unroll and optimize <code>\n#F\nClass(Compile, rec(\n    datas := 0,\n    decls := 0,\n    refs := 0,\n\n    status := Ignore,\n    timingStatus := Ignore,\n\n    pullDataDeclsRefs := meth(self, code)\n        local pulled, c, d, p, id, typecasts, tcast, ref, loopvars, doNotScalarize;\n        self.free := code.free();\n        pulled := PullBU(code, @(1, [decl, data, nth, deref]),\n            e -> When(IsBound(e.cmd), e.cmd, e), e -> e);\n\n        self.decls := Set([]);\n        self.datas := tab();\n        self.refs  := tab();\n\n        loopvars := Pull(code, @@(1).cond( (x, cx)->IsLoop(x) ),\n            e -> e, (cx, e) -> e.var)[1];\n\n        doNotScalarize := (ref) -> ref=false or Collect(ref, @(1, [var, param], x -> (IsLoopIndex(x) and not(x in loopvars)) or x _is param))<>[];\n\n        for p in pulled[1] do\n            if   ObjId(p)=decl then UniteSet(self.decls, p.vars);\n            elif ObjId(p)=data then self.datas.(p.var.id) := p.value; if IsArrayT(p.var.t) then p.var.value := p.value; fi;\n            # nth, deref\n            elif IsVar(p.loc) then\n                id := p.loc.id;\n                if not IsBound(self.refs.(id)) then self.refs.(id) := Set([]); fi;\n                AddSet(self.refs.(id), TPtr(p.t));\n                if doNotScalarize(p) then # prevent scalarization when there is a dependency on outer loop variable or param\n                    AddSet(self.refs.(id), TPtr(TVoid));\n                fi;\n            fi;\n        od;\n\n        # Pull out type casts and figure out granularity of accesses to given variable\n        # the complicated condition tries to figure out <..what?..>\n        typecasts := Pull(code,\n            @@(1,var, (e,cx) -> IsVar(e) and IsArrayT(e.t) and IsBound(cx.tcast) and\n                                cx.tcast<>[] and Last(cx.tcast).args[2].t in [e.t, e.t.toPtrType()] ),\n            e -> e,\n            (cx, e) -> [e, Last(cx.tcast), Cond(IsBound(cx.nth) and Length(cx.nth)>0, Last(cx.nth), false)])[1];\n\n        for p in typecasts do\n            [id, tcast, ref] := [p[1].id, p[2], p[3]];\n            if not IsBound(self.refs.(id)) then self.refs.(id) := Set([]); fi;\n            AddSet(self.refs.(id), tcast.args[1]);\n            # below prevents scalarization if pointer arithmetic was used or\n            # if there is dependency on outer loop variable or param\n            if not IsVar(tcast.args[2]) or doNotScalarize(ref) then \n                AddSet(self.refs.(id), TPtr(TVoid));\n            fi;\n        od;\n        # TReal pops up in diffrent places\n        for id in UserNSFields(self.refs) do\n            self.refs.(id) := _dropTRealInRefs(self.refs.(id));\n        od;\n        # plugs in data definitions into code, this process could be recursive, since one datavar can depend on another\n        return SubstTopDown(pulled[2], @(1,var,e->IsBound(self.datas.(e.id))), e->self.datas.(e.id));\n    end,\n    \n    scalarizationBarriers := [call, fcall],\n\n    fastScalarize := meth(self,code)\n        local d,len,tentry, barriers, typecasts, newlen, newt, newscal;\n        barriers := Collect(code, @(1, self.scalarizationBarriers));\n        self.doNotScalarize := Union(\n            # do not scalarize arrays from barriers (like from function calls)\n            Union(List(barriers, c->Collect(c, @(1,var,x->IsArrayT(x.t))))),\n            # arrays with vector accesses of different granularity\n            Set(Filtered(self.decls, v -> not IsBound(self.refs.(v.id)) or\n                    (IsBound(self.refs.(v.id)) and (Length(self.refs.(v.id)) > 1 or ForAny(self.refs.(v.id), IsUnalignedPtrT))) or\n                    (IsBound(v.doNotScalarize) and v.doNotScalarize)))\n        );\n\n        self.scalarized := Set([]);\n        newscal := [];\n        for d in Difference(self.decls, self.doNotScalarize) do\n            newt := self.refs.(d.id)[1];\n            if IsArrayT(d.t) and IsPtrT(newt) then\n                newt := newt.t; # base type of ptr\n                newlen := d.t.size * When(IsVecT(d.t.t), d.t.t.size, 1) / When(IsVecT(newt), newt.size, 1);\n                if IsSymbolic(newlen) or IsValue(newlen) then newlen := newlen.ev(); fi;\n                tentry := List([0..newlen-1], i -> var.fresh_t(\"scal\", newt));\n                Append(newscal, tentry);\n                d.value := Value(TArray(newt, newlen), tentry);\n            fi;\n        od;\n        self.scalarized := Set(newscal);\n\n        return code;\n    end,\n\n    # NOTE: make this more general, in particular, if variable does not appear\n    # on the left-hand side of the assignment it won't be declared, scalar\n    # variables won't be declared if they are only used inside call() (pathological case)\n    # Vectors can in fact be only used inside call, so this situtation is handled correctly.\n    declareVars := meth(self, code)\n        local vars, vects;\n        vars  := Filtered(Set(ConcatList(Collect(code, @.cond(e->IsCommand(e) and IsBound(e.op_out))), e->e.op_out())), IsVar);\n        vects := Filtered(code.free(), x -> IsArray(x.t));\n\n        IntersectSet(vects, self.decls);\n\tSubtractSet(vects, self.free);\n\tSubtractSet(vars,  self.free);\n\t\n        if Length(vars) > 0 then code := decl(vars, code); fi;\n        if Length(vects) > 0 then code := decl(vects, code); fi;\n        return code;\n    end,\n\n    # Old and slow scalarizer no longer works, but old scalarizer did not make an \n    # assumption of \"constant geomery code\" and the current scalarizer does make that\n    # assumption. It is becoming a limitation for certain applications, so we might need\n    # to redesign our current fast scalarizer to be more like the old one.\n    #\n    #D scalarize := (self, c) >> Scalarize(c, self.decls),\n\n    showTimes := meth(self)\n        local i;\n        Print(\"times := [\\n\");\n        for i in [1..Length(self.times)] do\n\t    PrintEval(\"$1,  $2,\\n\", i, StringDouble(\"%.3g\", self.times[i]));\n\tod;\n        Print(\"];\\n\");\n    end,\n\t    \n    __call__ := meth(self, c, opts)\n        local dims, root, stage, compileStrategy, t, i;\n\n        if IsBound(c.dimensions) then dims := c.dimensions; fi;\n        if IsBound(c.root) then root := c.root; fi;\n\n        if opts.printWebMeasure then Print(\"web:measure\\n\"); fi;\n        self.curcode := [Copy(c)];\n\n        # self.times keeps compilation time information to be used for profiling\n        if not IsBound(self.times) or Length(self.times)<>Length(opts.compileStrategy) then \n            self.times := Replicate(Length(opts.compileStrategy), 0.0); fi;\n\n        for i in [1..Length(opts.compileStrategy)] do\n            stage := opts.compileStrategy[i];\n            if IsMeth(stage) and IsCallableN(stage, 2) then \n                [c,t] := UTimedAction(stage(self, c, opts));\n            elif IsMeth(stage) then \n                [c,t] := UTimedAction(stage(self, c));\n            elif IsCallableN(stage, 2) then \n                [c,t] := UTimedAction(stage(c, opts));\n            else \n                [c,t] := UTimedAction(stage(c));\n            fi;\n            Add(self.curcode, Copy(c));\n            self.times[i] := self.times[i] + t;\n\t    self.timingStatus(i, stage, t); # print timing info\n\n            if opts.printWebMeasure then Print(\"web:measure\\n\"); fi;\n        od;\n\n        if IsBound(dims) then c.dimensions := dims; fi;\n        if IsBound(root) then c.root := root; fi;\n        return c;\n    end\n));\n", "meta": {"hexsha": "96144983eb071c0ec18e9fe7cf1e3b7c99237fb1", "size": 9834, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/compile.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/compile.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/compile.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.8468085106, "max_line_length": 146, "alphanum_fraction": 0.56731747, "num_tokens": 2764, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2751297357103299, "lm_q2_score": 0.04958902509090481, "lm_q1q2_score": 0.013643415367393559}}
{"text": "# GAP is case sensitive\nThreeDogs := function()\n\tlocal dog, Dog, DOG;\n\tdog := \"Benjamin\";\n\tDog := \"Samba\";\n\tDOG := \"Bernie\";\n\tif dog = DOG then\n\t\tPrint(\"There is just one dog named \", dog, \"\\n\");\n\telse\n\t\tPrint(\"The three dogs are named \", dog, \", \", Dog, \" and \", DOG, \"\\n\");\n\tfi;\nend;\n\nThreeDogs();\n# The three dogs are named Benjamin, Samba and Bernie\n", "meta": {"hexsha": "7e954c451366d653e98a3dedacb47cd60d8c9073", "size": 354, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Case-sensitivity-of-identifiers/GAP/case-sensitivity-of-identifiers.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Case-sensitivity-of-identifiers/GAP/case-sensitivity-of-identifiers.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Case-sensitivity-of-identifiers/GAP/case-sensitivity-of-identifiers.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 22.125, "max_line_length": 73, "alphanum_fraction": 0.615819209, "num_tokens": 110, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.19193278644723683, "lm_q2_score": 0.07055958983528422, "lm_q1q2_score": 0.01354269868766023}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImport(search);\n\n#   These functions merge multiple hashtables into a single one\nAllHashEntries := function(table)\n    local e, i, res;\n    res := [];\n    for e in Filtered(table.entries, IsList) do\n        for i in e do\n            if i.data <> [] then Add(res, i); fi;\n        od;\n    od;\n    return res;\nend;\n\n\nAddMergedHashTables := function(target, newhashs)\n    local e, v, h, i;\n    for e in Flat(List(newhashs, i->AllHashEntries(i))) do\n        v := [];\n        for h in newhashs do\n            Add(v, HashLookup(h, e.key));\n        od;\n        v := Filtered(v, i -> i <> [] and i <> false);\n        if v <> [] then\n            Sort(v, (j,k) -> j[1].measured < k[1].measured);\n            HashAdd(target, e.key, v[1]);\n        fi;\n    od;\nend;\n\n#   Build all base cases for a given SIMD ISA.\n#   Currently only L(2v, 2), L(2v, v), L(v^2, v)\n#\nSIMD_ISA_DB.buildBases := meth(self, isa)\n    local rebind, t, v, tags, cxtags, t1, t2, rt, brules, common, rset1, rset2, tab1, tab2, e, h;\n\n    if self.verbose then Print(\"Building bases for \", isa, \"\\n\"); fi;\n    self.hash_rebuilt := true;\n    v := isa.v;\n    tags := isa.getTags();\n    cxtags := isa.getTagsCx();\n\n    # == do TL base cases======================================\n    # TL usually is not measured in DP\n    rebind := IsBound(TL.doNotMeasure) and TL.doNotMeasure;\n    if rebind then \n        TL.doNotMeasure := false; \n    fi;\n\n    brules := paradigms.tSPL_Globals.getDPOpts().breakdownRules;\n    common := [ SIMD_ISA_Bases1, SIMD_ISA_Bases2, IxLxI_kmn_n, IxLxI_kmn_km, paradigms.vector.breakdown.IxLxI_vtensor ];\n\n    rset1 := CopyFields(brules, rec(TL := Concat(common, [IxLxI_IxLxI_up])));\n    rset2 := CopyFields(brules, rec(TL := Concat(common, [IxLxI_IxLxI_down])));\n\n    tab1 := HashTableDP();\n    for t in SIMD_ISA_DB.getBases(isa) do\n#    [ TL(2*v,v,1,1).withTags(tags), TL(2*v,2,1,1).withTags(tags), TL(v*v,v,1,1).withTags(tags), TL(v*v/4,v/2,1,2).withTags(tags) ]\n        t1 := DP(t, rec(measureFunction := VCost, verbosity := 0, hashTable := tab1, globalUnrolling := true),\n                CopyFields(isa.splopts, rec(breakdownRules := rset1, dataType := \"no default\", baseHashes := [], globalUnrolling := 10000)));\n    od;\n\n    tab2 := HashTableDP();\n    for t in SIMD_ISA_DB.getBases(isa) do\n#    [ TL(2*v,v,1,1).withTags(tags), TL(2*v,2,1,1).withTags(tags), TL(v*v,v,1,1).withTags(tags), TL(v*v/4,v/2,1,2).withTags(tags) ]\n        t2 := DP(t, rec(measureFunction := VCost, verbosity := 0, hashTable := tab2, globalUnrolling := false),\n                CopyFields(isa.splopts, rec(breakdownRules := rset2, dataType := \"no default\", baseHashes := [], globalUnrolling := 10000)));\n    od;\n    AddMergedHashTables(self.hash, [tab1, tab2]);\n    # restore TL\n    if rebind then\n        TL.doNotMeasure:=true;\n    fi;\n\n    # == do other base cases===================================\n    # do other base cases\n    #\n    # none here yet :(\n    #\n\n    # == final check - did all work? ==========================\n    for e in self.getBases(isa) do\n        h := HashLookup(self.hash, e);\n        if  h=false or h=[] then Print(e, \" could not be built\\n\"); fi;\n    od;\nend;\n", "meta": {"hexsha": "fc14c97c168a045435f1792ee1948b1dd1c0ef67", "size": 3225, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/bases/isa_db.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/bases/isa_db.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/bases/isa_db.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 35.0543478261, "max_line_length": 141, "alphanum_fraction": 0.5792248062, "num_tokens": 1017, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.396068180531364, "lm_q2_score": 0.03410042203124954, "lm_q1q2_score": 0.013506092109268647}}
{"text": "IsChar('a');\n# true\nIsString(\"abc\");\n# true\nIsString('a');\n# false\nIsChar(\"a\");\n# false\n", "meta": {"hexsha": "dd1b56359b4a041af4bba038cde77e8408fa2644", "size": 88, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Literals-String/GAP/literals-string.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Literals-String/GAP/literals-string.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Literals-String/GAP/literals-string.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 9.7777777778, "max_line_length": 16, "alphanum_fraction": 0.5909090909, "num_tokens": 32, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.27202456289736326, "lm_q2_score": 0.04958902719777796, "lm_q1q2_score": 0.013489433447981009}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(TTensorI_OL);\nDeclare(TTensorI_OL_Vectorize_AVecLast);\n\n#Class(RewriteBarrier,RewritableObject);\n#Class(RewriteBarrier,DFT);\n#RewriteBarrier.numops:=self>>1;\n\nDropVectorTag:=function(nt)\n    return nt.withoutTag(AVecReg); \n#D    return SetTag(nt,Filtered(GetTags(nt),t->ObjId(t)<>AVecReg));\nend;\n\nDropParTag:=function(nt)\n   return nt.withoutTag(AParSMP);\n#D    return SetTag(nt,Filtered(GetTags(nt),t->ObjId(t)<>AParSMP));\nend;\n\nDevectorize:=function(l,vlen)\n  return List(l,e->\n      Cond(\n          ObjId(e)=TArray and e.t=TUnknown, TArray(e.t,e.size*vlen),\n          ObjId(e)=TArray and ObjId(e.t)=TVect, TArray(e.t.t,e.size*e.t.size),\n          ObjId(e)=TVect, TArray(e.t,e.size),\n          e)\n  );\nend;\n\nClass(VTensor_OL, Tensor, rec(\n    new := (self, L) >> SPL(WithBases(self, rec(\n        _children := [L[1]],\n        vlen := L[2]))),\n    print := (self,i,is) >> Print(self.name, \"(\",\n        self.child(1).print(i+is,is), \", \", self.vlen,\")\"),\n    sums := self >> Inherit(self, rec(_children := [self.child(1).sums()])),\n    isPermutation := False,\n    rng := meth(self)         #FULL HACK\n       return Devectorize(self.child(1).rng(),self.vlen);\n    end,\n    dmn := meth(self)         #FULL HACK\n       return Devectorize(self.child(1).dmn(),self.vlen);\n    end,\n    dims := meth(self)\n       if (IsBound(self.rng)and IsBound(self.dmn)) then\n          return [StripList(List(self.rng(),l->l.size)),\n                  StripList(List(self.dmn(),l->l.size))];\n       fi;\n    end,\n));\n\n#VTensor.dmn:=  meth(self)         #FULL HACK\n#  local x; \n#  x:=self.child(1).dmn()[1];\n#  if ObjId(x)=TArray and x.t=TUnknown then         \n#      return [TArray(TUnknown,x.size*self.vlen)];\n#  else\n#      return Devectorize(self.child(1).dmn());\n#  fi;\n#end;\n#VTensor.rng:=  meth(self)         #FULL HACK\n#  local x; \n#  x:=self.child(1).rng()[1];\n#  if ObjId(x)=TArray and x.t=TUnknown then         \n#      return [TArray(TUnknown,x.size*self.vlen)];\n#  else\n#      return Devectorize(self.child(1).rng());\n#  fi;\n#end;\n\nBlockVPerm.dmn := meth(self)\n       return [TArray(self.child(1).dmn()[1].t,self.child(1).dmn()[1].size*self.n)];\nend;\nBlockVPerm.rng := meth(self)\n       return [TArray(self.child(1).rng()[1].t,self.child(1).rng()[1].size*self.n)];\nend;\n\nClass(ScatQuestionMark, Scat, rec());\nClass(ICScatAcc,Scat,rec(codeletName:=\"ICSA\"));\n\nClass(VScatQuestionMark, VScat, rec());\n\nClass(VScat_svQuestionMark, VScat_sv, rec());\n\nClass(ScatInit, BaseMat, rec(\n   new := meth(self, f,con,c)\n        local res;\n        res := SPL(WithBases(self, rec(func:=f,cond:=con, _children:=c)));\n        return res;\n   end,\n   rng:=self>>self._children.rng(),\n   dmn:=self>>self._children.dmn(),\n   print := meth(self,i,is)\n      Print(self.name, \"(\", self.func, \", \",self.cond,\", \");\n      Print(\"\\n\", Blanks(i+is));\n      SPLOps.Print(self._children, i + is, is);\n      Print(\"\\n\", Blanks(i),\")\");\n      return;\n   end,\n   rChildren := self >> [self._children,self.func],\n   rSetChild := meth ( self, n, newChild )\n     if n= 1  then\n         self._children :=newChild;\n     elif n=2 then\n         self.func := newChild;\nelse\n        Error(\"<n> must be 1\");\n     fi;\n   end\n\n));\n\nClass(ScatInitProbe,ScatInit,rec());\nClass(ScatInitFixed,ScatInit,rec());\n\nClass(KroneckerSymbol, BaseMat, rec(\n   abbrevs := [ arg -> [Flat(arg)] ],\n   new := meth(self, l)\n        local res;\n        res := SPL(WithBases(self, rec(element:=l)));\n        return res;\n   end,\n   isExp:=true,\n   dims:=self>>[1,1]  #avoid recursive definition for the old-school Tensor\n));\n\n## Base Vector\nClass(BV, BaseMat, rec(\n   new := (self, i) >> #Checked(IsVar(i),SPL(WithBases(self, rec(element:=i))))\n       SPL(WithBases(self, rec(element:=i))),\n   dims:=self>>self.element.dimensions #[0,0]  #avoid recursive definition for the old-school Tensor\n));\n\n## Multiplication operator\n## Multiplication(1,n) is I(n)\n## Multiplication(2,n) is a point-wise multiplication of two vectors of size n\n Class(Multiplication, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n        local res;\n        if l[1]=1 then return Prm(fId(l[2])); fi;\n        res := SPL(WithBases(self, rec(element:=l,TType:=Replicate(l[1],TUnknown))));\n        return res;\n    end,\n    isPermutation := self >> false,\n#    dmn:=self>>Replicate(self.element[1],TArray(self.TType,self.element[2])),\n#HACK\n#    dmn:=meth(self) local a; a:=Replicate(self.element[1],TArray(self.TType,self.element[2]));a[1]:=TArray(TReal,1);return a; end,\n    dmn:=self >>List(self.TType,x->TArray(x,self.element[2])),\n    rng:=self>>let(a:=Try(First(self.TType,x->ObjId(x)=TVect)),t:=Cond(a[1],a[2],self.TType[1]),[TArray(t,self.element[2])]),\n    sums:= self>>self,\n    numops:=self>>self.element[2]*(self.element[1]-1),\n    transpose := self >>self,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \", \",self.element[2],\")\"); self.printA();\n      return;\n     end\n ));\n Class(ICMultiplication,Multiplication, rec(\n\n ));\n\n  _mk_advdim_r := (e) -> List(e, x -> When(IsList(x), _mk_advdim_r(x), [x]));\n  _mk_advdim := (d) -> _mk_advdim_r(When(IsList(d), d, [d]));\n                        \n  Class(Glue, BaseMat, rec(\n    abbrevs := [(n,size) ->[n,size]],\n    new := meth(self,n,size)\n        local res;\n        res := SPL(WithBases(self, rec(element:=[n,size],dimensions:=[size*n,Replicate(n,size)],TType:=Replicate(n,TUnknown))));\n        return res;\n    end,\n    isPermutation := self >> false,\n    dmn:=self >>List([1..(self.element[1])],x->TArray(self.TType[x],self.element[2])),\n    rng:=self>>[TArray(self.TType[1],self.element[1]*self.element[2])],\n    sums:= self>>self,\n    transpose:=self>>Copy(self),\n    numops:=self>>self.element[2]*(self.element[1]-1),\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \", \",self.element[2],\")\"); self.printA();\n      return;\n     end,\n    rChildren := self >> self.element,\n    rSetChild := meth( self, n, newChild ) self.element[n] := Checked(n=1 or n=2, newChild); end,\n    advdims := self >> let( d := self.dims(), [ _mk_advdim(d[1]), _mk_advdim(d[2]) ]),\n    normalizedArithCost := (self) >> 0,\n    isReal := self >> true, # makes no sense\n ));\n\n\n  Class(Split, BaseMat, rec(\n    abbrevs := [(size,n) ->[size,n]],\n    new := meth(self,size,n)\n        local res;\n        res := SPL(WithBases(self, rec(element:=[size,n],dimensions:=[Replicate(n,size / n),size],TType:=[TUnknown])));\n        return res;\n    end,\n    isPermutation := self >> false,\n    rng:=self >>List([1..self.element[2]],x->TArray(self.TType[1],self.element[1] / self.element[2])),\n    dmn:=self>>[TArray(self.TType[1],self.element[1])],\n    sums:= self>>self,\n    transpose:= self>>Copy(self),\n    numops:=self>>(self.element[1]),\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \", \",self.element[2],\")\"); self.printA();\n      return;\n     end,\n    rChildren := self >> self.element,\n    rSetChild := meth( self, n, newChild ) self.element[n] := Checked(n=1 or n=2, newChild); end,\n    advdims := self >> let( d := self.dims(), [ _mk_advdim(d[1]), _mk_advdim(d[2]) ]),\n    normalizedArithCost := (self) >> 0,\n    isReal := self >> true, # makes no sense\n ));\n\n\n## NoOp, used with in COND_OL()\nClass(NoOp, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(1, TUnknown))));\n        fi;\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> [TArray(self.TType[1], self.element[1])],\n    rng:=self >> [TArray(self.TType[1], self.element[1])],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\n\n## Constant\nClass(Const, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(1, TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> [],\n# [TArray(self.TType[1], 0)],\n    rng:=self >> [TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\nClass(Or, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\nClass(And, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\nClass(NotEqual, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\nClass(Equal, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\nClass(ExclusiveOr, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\n## Minimums\n## Minimums(n) -> Input is n-way vector\nClass(Minimums, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1)],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\n## Maximums\n## Maximums(n) -> Input is n-way vector\nClass(Maximums, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n       local res;\n        if (Length(l) = 1) then\n          return SPL(WithBases(self, rec(element:=l, TType:=Replicate(l[1], TUnknown))));\n        fi;\n\t# Here\n    end,\n    isPermutation := self >> false,\n    dmn:=self >> List(self.TType, x->TArray(x,1)),\n    rng:=self >> [ TArray(self.TType[1], 1) ],\n    sums:= self>>self,\n    numops:=self>> 0,\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \")\"); self.printA();\n      return;\n    end\n));\n\n\n#Addition\nClass(Addition, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n        local res;\n        if l[1]=1 then return Prm(fId(l[2])); fi;\n        res := SPL(WithBases(self, rec(element:=l,TType:=Replicate(l[1],TUnknown))));\n        return res.setDims();\n    end,\n    isPermutation := self >> false,\n    \n    dmn:=self >> List( [1..self.element[1]], i -> TArray(TUnknown, self.element[2])),\n    rng:=self >> [TArray(TUnknown, self.element[2])],\n    sums:= self>>self,\n    numops:=self>>self.element[2]*(self.element[1]-1),\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \", \",self.element[2],\")\"); self.printA();\n      return;\n     end,\n    transpose := self >> InertTranspose(self),\n    area := self >> self.element[2]*(self.element[1]-1),\n));\n\nClass(Subtraction, BaseMat, rec(\n    abbrevs := [ arg -> [Flat(arg)] ],\n    new := meth(self, l)\n        local res;\n        if l[1]=1 then return Prm(fId(l[2])); fi;\n        res := SPL(WithBases(self, rec(element:=l,TType:=Replicate(l[1],TUnknown))));\n        return res;\n    end,\n    isPermutation := self >> false,\n    dmn:=self >>List(self.TType,x->TArray(x,self.element[2])),\n    rng:=self>>let(a:=Try(First(self.TType,x->ObjId(x)=TVect)),t:=Cond(a[1],a[2],self.TType[1]),[TArray(t,self.element[2])]),\n    sums:= self>>self,\n    numops:=self>>self.element[2]*(self.element[1]-1),\n    print := meth(self,i,is)\n      Print(self.name, \"(\", self.element[1], \", \",self.element[2],\")\"); self.printA();\n      return;\n     end\n));\n\n# Declare(Cross);\n# Class(Cross, BaseOperation, rec(\n#    abbrevs := [ arg -> [Flat(arg)] ],\n\n#    new := meth(self, L)\n#         if Length(L)=1 then return L[1]; fi;\n#         return SPL(WithBases(self, rec(_children:=L)));\n#    end,\n\n#    codeletName:=\"C\",\n#    isPermutation := self >> false,\n#    dmn:=self>>let(li:=[],Flat(List(self._children, x-> x.dmn()))),\n#    rng:=self>>let(li:=[],Flat(List(self._children, x-> x.rng()))),\n#    sums:= meth(self)\n#    local i;\n#    for i in [1..Length(self._children)] do\n#       self._children[i]:=self._children[i].sums();\n#    od;\n#    return self;\n#    end,\n#    hasLeftGath:=meth(self)\n#       local i;\n#       for i in self._children do\n# #          if (ObjId(i)=Compose and ObjId(i.rChildren()[1])=Gath) or \n# #              (ObjId(i)=Gath) then\n# #              return true;\n#            if (ObjId(i)=Compose and IsBound(i.rChildren()[1].func) and i.rChildren()[1].func.free()<>Set([])) or (IsBound(i.func) and (not ObjId(i)=VGath_dup) and i.func.free()<>Set([])) and not(ObjId(i)=ISum) then\n#                return true;\n#           fi;\n#       od;\n#       return false;\n#    end,\n#    hasRightScat:=meth(self)\n#       local i;\n#       for i in self._children do\n# #          if (ObjId(i)=Compose and ObjId(Last(i.rChildren()))=Scat) or \n# #              (ObjId(i)=Scat) then\n# #              return true;\n# #          fi;\n#            if (ObjId(i)=Compose and ((IsBound(Last(i.rChildren()).func) and Last(i.rChildren()).func.free()=Set([])) or (ObjId(Last(i.rChildren()))=ISum) or (ObjId(Last(i.rChildren()))=VGath_dup and Length(Last(i.rChildren()).func.free())=1))) or (IsBound(i.func) and i.func.free()=Set([])) or (ObjId(i)=VGath_dup and Length(i.func.free())=1) or ObjId(i)=ISum  then\n#                return true;\n#           fi;\n#       od;\n#       return false;\n#    end,\n#    splitCross:=meth(self)\n#       local l,r;\n#       l:=Copy(self);\n#       r:=[];\n#       for i in [1..Length(l._children)] do\n# #          if (ObjId(l._children[i])=Compose and ObjId(Last(l._children[i].rChildren()))=Scat) then\n#            if (ObjId(l._children[i])=Compose and ((IsBound(Last(l._children[i].rChildren()).func) and Last(l._children[i].rChildren()).func.free()=Set([])) or (ObjId(Last(l._children[i].rChildren()))=ISum) or (ObjId(Last(l._children[i].rChildren()))=VGath_dup and Length(Last(l._children[i].rChildren()).func.free())=1))) or (ObjId(l._children[i])=ISum) then\n#               Add(r,Last(l._children[i].rChildren()));\n#               l._children[i]._children:=DropLast(l._children[i]._children,1);\n# #          elif (ObjId(l._children[i])=Scat) then\n#            elif (IsBound(l._children[i].func) and l._children[i].func.free()=Set([])) or (ObjId(i)=VGath_dup and Length(i.func.free())=1) then\n#               Add(r,l._children[i]);\n#               l._children[i]:=Prm(fId(l._children[i].dims()[1]));\n#           else\n#               Add(r,Prm(fId(l._children[i].dims()[2])));\n#           fi;\n#       od;\n#       return [l,Cross(r)];\n#    end\n#  )\n# );\n\nClass(CrossBlockTop,Cross);\n\nIdentities:=function(l)\n   return Cross(List(l,x->Prm(fId(x.size))));\nend;\n\n\nBB.numops:= self>>self.child(1).numops();\nNoPull.numops:= self>>self.child(1).numops();\nNoPullRight.numops:= self>>self.child(1).numops();\nNoPullLeft.numops:= self>>self.child(1).numops();\n\nPushR.numops:= self>>self.child(1).numops();\n\nISum.numops:=self>>self.child(1).numops()*self.domain;\n\nSUM.numops:=self>>Sum(List(self._children,c->c.numops()));\n\nCross.numops:=self>>Sum(List(self._children,c->c.numops()));\n\nCompose.numops:=self>>Sum(List(self._children,c->c.numops()));\n\nScat.numops:=self>>self.dims()[2];\n\nGath.numops:=self>>self.dims()[1];\n\nVGath.numops:=self>>self.dims()[1];\nVGath_dup.numops:=self>>self.dims()[1]; \nVReplicate.numops:=self>>self.v;\nVHAdd.numops:=self>>self.v*self.v;\nVPerm.numops:=self>>self.dimensions[1];\nTensor.numops:=self>>self.dimensions[1];\n\nScatAcc.numops:=self>>self.dimensions[2]*2; #an add and a store\nVScatAcc.numops:=self>>self.dimensions[2]*2; #an add and a store\nVScat.numops:=self>>self.dimensions[2];\n\nfBase.numops:=self>>0;\nfTensor.numops:=self>>0;\nfId.numops:=self>>0;\nScatInit.numops:=self>>self._children.numops();\n\nPrm.numops:=self>>0;\nI.numops:=self>>0;\n\nVTensor_OL.numops:=self>>self._children[1].numops()*self.vlen;\n\nClass(AOne,AGenericTag);\nClass(AMul,AGenericTag, rec(\n    __call__ := meth ( arg )\n      local  result, self, params;\n      self := arg[1];\n      params := arg{[ 2 .. Length(arg) ]};\n      result := WithBases(self, rec(\n              params := params,\n              operations := PrintOps));\n      return result;\n    end,\n    print := self >> Print(self.__name__, \"(\", PrintCS(self.params), \")\")\n   ));\n\nClass(VOLWrap, VWrapBase, rec(\n    __call__ := (self,isa) >> Checked(IsSIMD_ISA(isa), \n        WithBases(self, rec(operations:=PrintOps, isa:=isa))),\n\n    wrap := (self,r,t) >> let(isa := self.isa, v := isa.v,\n#This is OBVIOUSLY a hack. only deals with some kind of vectorization\n            nontransforms.ol.TTensorI_OL_Vectorize_AVecLast(TTensorI_OL(t, [ AOne, AVec ],[ [ 0, 2 ] ], [ 1, v ], [ AVecReg(isa) ]), r)),\n\n    twrap := (self, t) >> let(isa := self.isa, v := isa.v, \n#This is OBVIOUSLY a hack. only deals with some kind of vectorization\n           TTensorI_OL(t, [ AOne, AVec ],[ [ 0, 2 ] ], [ 1, v ], [ AVecReg(isa) ])\n        ),\n    \n    print := self >> Print(self.name, \"(\", self.isa, \")\")\n));\n\nClass(TTensorI_OL, Tagged_tSPL, rec(\n    abbrevs := [ \n        (nt,g,s,v)  -> [nt,List([1..Length(g)],i->When(v[i]=1,AOne,g[i])),s,v] \n    ],\n\n    dmn := self >> let(\n        nt := self.params[1],\n        sizes := self.params[4],\n        List([1..Length(sizes)], i->\n            TArray(nt.dmn()[i].t,sizes[i] * nt.dmn()[i].size)\n        )),\n\n    rng := self >> let(\n        nt := self.params[1],\n        s := self.params[3],\n        v := self.params[4],\n        List([1..Length(s)], i->\n            TArray(nt.rng()[i].t, Product(List(s[i], a ->\n                When(a=0,\n                    nt.rng()[i].size,\n                    v[a]\n                )\n            )))\n        )\n    ),\n\n    isReal := self >> self.params[1].isReal(),\n    doNotMeasure:=true,\n    doNotSaveInHashtable:=true,\n    decomposePerformance:=true,\n    transpose := self >> Copy(self),\n#D    tagpos :=5,\n));\n\n#Changed by Marek, looks OK\nNewRulesFor(TTensorI_OL, rec(\n    TTensorI_OL_Base :=rec(\n        applicable := (self,t) >> not(t.hasTag(AParSMP)) and t.getTags() = t.params[1].getTags(),\n        freedoms := nt -> let(\n            g := nt.params[2],\n            nbvars := Length(Filtered(g,x->x=APar or x=AVec)),\n            [Arrangements([1..nbvars],nbvars)]\n        ),\n        child := (nt,freedoms) -> [nt.params[1],InfoNt(freedoms)],\n        recompose := (nt,cnt,cperf) -> cperf[1]*Product(List(Filtered(Zip2(nt.params[2],nt.params[4]),l->l[1] in [APar,AVec]),x->x[2])),\n        apply := function(nt,c,cnt)\n            local g,s,v,perm,ind1,ind,ind2,gathers,scatters,result,z;\n            g := nt.params[2];\n            s := nt.params[3];\n            v := nt.params[4];\n            perm := cnt[2].params[1][1];\n            ind1 := List([1..Length(g)], i ->\n                Cond(g[i]=APar or g[i]=AVec, fBase(Ind(v[i])),\n                    g[i]=AOne, fId(1),\n                    ObjId(g[i])=AMul, g[i],\n                    Error(\"PV not known!\")\n                )\n            );\n            ind := List(ind1, x -> When(ObjId(x)=AMul,ind1[x.params[1]],x));\n            gathers := Cross(List([1..Length(g)], i -> let(\n                kernelsize := fId(cnt[1].dmn()[i].size),\n                When(g[i]=APar or (ObjId(g[i])=AMul and g[i].params[2]=APar),\n                    Gath(fTensor(ind[i],kernelsize)),\n                    Gath(fTensor(kernelsize,ind[i]))\n                )\n            )));\n            scatters := Cross(List([1..Length(s)], i -> \n                ScatQuestionMark( fTensor(\n                    List(s[i], y ->\n                        When(y=0, \n                            fId(cnt[1].rng()[i].size),\n                            ind[y]\n                        )\n                    )\n                ))\n            ));\n            result := scatters*c[1]*gathers;\n            ind2:=[];\n            for i in [1..Length(g)] do\n                if g[i]=APar or g[i]=AVec then\n                    Add(ind2,ind[i]);\n                fi;\n            od;\n            for i in [1..Length(ind2)] do\n                result:=ISum(ind2[perm[i]].params[2], ind2[perm[i]].params[1], result);\n            od;\n\n            return result;\n        end\n    ),\n#D        applicable :=(self,t) >> Length(Filtered(GetTags(t),x->ObjId(x)=AParSMP))=0 and GetTags(t)=GetTags(t.params[1])\n#D,\n#D            freedoms := nt -> let(g:=nt.params[2],\n#D                nbvars:=Length(Filtered(g,x->x=APar or x=AVec)),\n#D                [Arrangements([1..nbvars],nbvars)]),\n#D            child := (nt,freedoms) -> [nt.params[1],InfoNt(freedoms)],\n#D            recompose := (nt,cnt,cperf) -> cperf[1]*Product(List(Filtered(Zip2(nt.params[2],nt.params[4]),l->l[1] in [APar,AVec]),x->x[2])),\n#D            apply := function(nt,c,cnt)\n#D                local g,s,v,perm,ind1,ind,ind2,gathers,scatters,result,z;\n#D                g:=nt.params[2];\n#D                s:=nt.params[3];\n#D                v:=nt.params[4];\n#D                perm:=cnt[2].params[1][1];\n#D                ind1:=List([1..Length(g)],\n#D                    i->Cond(g[i]=APar or g[i]=AVec,fBase(Ind(v[i])),\n#D                    g[i]=AOne,fId(1),\n#D                    ObjId(g[i])=AMul,g[i],\n#D                    Error(\"PV not known!\")));\n#D                ind:=List(ind1,x->When(ObjId(x)=AMul,ind1[x.params[1]],x));\n#D                gathers:= Cross(List([1..Length(g)],\n#D                        i->let(kernelsize:=fId(cnt[1].dmn()[i].size),\n#D                            When(g[i]=APar or (ObjId(g[i])=AMul and g[i].params[2]=APar),\n#D                                Gath(fTensor(ind[i],kernelsize)),\n#D                                Gath(fTensor(kernelsize,ind[i]))))));\n#D                scatters:=Cross(List([1..Length(s)],\n#D                            i->ScatQuestionMark(fTensor(\n#D                                    List(s[i],y->\n#D                                        When(y=0,fId(cnt[1].rng()[i].size),\n#D                                            ind[y]))))));\n#D                result:=scatters*c[1]*gathers;\n#D                ind2:=[];\n#D                for i in [1..Length(g)] do\n#D                    if g[i]=APar or g[i]=AVec then\n#D                        Add(ind2,ind[i]);\n#D                    fi;\n#D                od;\n#D                for i in [1..Length(ind2)] do\n#D                        result:=ISum(ind2[perm[i]].params[2],ind2[perm[i]].params[1],result);\n#D                od;\n#D\n#D                return result;\n#D            end\n#D            ),\n        \n#Changed by Marek, looks OK\n    TTensorI_OL_Parrallelize_AParFirst := rec(\n        applicable :=(self,t) >> \n            t.isTag(1, AParSMP)\n            and 0 <> t.params[3][1][1]\n            and APar = t.params[2][t.params[3][1][1]]\n            and t.firstTag().params[1] = t.params[4][t.params[3][1][1]]\n            and 1 = t.params[3][1][1], #t.params[3][1][1]=1 is a trick to prevent // the 2nd input because TensorGeneral breaks at the moment\n\n        freedoms := nt -> [[1]],\n\n        child := function (nt,freedoms)\n            local PV,sizes;\n            sizes := Copy(nt.params[4]);\n            sizes[nt.params[3][1][1]] := 1;\n            if Length(Filtered(sizes, t -> t<>1)) > 0 then\n                PV:=Copy(nt.params[2]);\n                PV[nt.params[3][1][1]] := AOne;\n                return [TTensorI_OL(\n                    DropParTag(nt.params[1]),\n                    PV,\n                    nt.params[3],\n                    sizes,\n                    Drop(nt.params[5],1)\n                )];\n            else\n                return [ DropParTag(Copy(nt.params[1])) ];\n            fi;\n        end,\n\n        apply := function(nt,c,cnt)\n            local myCross,a,b,index;\n\n            index := Ind(nt.firstTag().params[1]);\n\n            a := List(c[1].dims()[2], x -> fId(x));\n            a[nt.params[3][1][1]] := fTensor(fBase(index), a[nt.params[3][1][1]]);\n\n            b:=List(a, x -> Gath(x));\n\n            myCross:=Cross(b);\n\n#              return SMPSum(GetFirstTag(nt).params[1],index, GetFirstTag(nt).params[1],ScatQuestionMark(fTensor(fBase(index), fId(c[1].dims()[1]))) *c[1]* Cross(Gath(fTensor(fBase(index), fId(c[1].dims()[2][1]))),Gath(fId(c[1].dims()[2][2]))));\n            return SMPSum(\n                nt.firstTag().params[1],\n                index,\n                nt.firstTag().params[1],\n                ScatQuestionMark(fTensor(\n                    fBase(index), \n                    fId(c[1].dims()[1])\n                ))\n                * c[1] * myCross\n            );\n        end\n    ),\n#D            applicable :=(self,t) >> FirstTagEq(t, AParSMP) and t.params[3][1][1]<>0 and \n#D               t.params[2][t.params[3][1][1]]=APar and \n#D               t.params[4][t.params[3][1][1]]=GetFirstTag(t).params[1] and \n#D               t.params[3][1][1]=1, #t.params[3][1][1]=1 is a trick to prevent // the 2nd input because TensorGeneral breaks at the moment\n#D            freedoms := nt -> [[1]],\n#D            child := function (nt,freedoms)\n#D              local PV,sizes;\n#D              sizes:=Copy(nt.params[4]);\n#D              sizes[nt.params[3][1][1]]:=1;\n#D              if Length(Filtered(sizes, t->t<>1))>0 then\n#D                  PV:=Copy(nt.params[2]);\n#D                  PV[nt.params[3][1][1]]:=AOne;\n#D              return [TTensorI_OL(DropParTag(nt.params[1]),\n#D                          PV,nt.params[3],sizes,Drop(nt.params[5],1))];\n#D              else\n#D                  return [DropParTag(Copy(nt.params[1]))];\n#D              fi;\n#D            end,\n#D            apply := function(nt,c,cnt)\n#D              local myCross,a,b,index;\n#D              index:=Ind(GetFirstTag(nt).params[1]);\n#D              a:=List(c[1].dims()[2],x->fId(x));\n#D              a[nt.params[3][1][1]]:=fTensor(fBase(index),a[nt.params[3][1][1]]);\n#D              b:=List(a,x->Gath(x));\n#D              myCross:=Cross(b);\n#D#              return SMPSum(GetFirstTag(nt).params[1],index, GetFirstTag(nt).params[1],ScatQuestionMark(fTensor(fBase(index), fId(c[1].dims()[1]))) *c[1]* Cross(Gath(fTensor(fBase(index), fId(c[1].dims()[2][1]))),Gath(fId(c[1].dims()[2][2]))));\n#D              return SMPSum(GetFirstTag(nt).params[1],index, GetFirstTag(nt).params[1],ScatQuestionMark(fTensor(fBase(index), fId(c[1].dims()[1]))) *c[1]* myCross);\n#D            end),\n\n    #That code vectorizes the last guy if it is a AVec of the vector size\n    #Hack, only works with one output\n#Changed by Marek, looks OK\n    TTensorI_OL_Vectorize_AVecLast :=rec(\n        applicable := (self,t) >> \n            t.isTag(1, AVecReg)\n            and Last(t.params[3][1])<>0 \n            and AVec = t.params[2][Last(t.params[3][1])]\n            and t.params[4][Last(t.params[3][1])] = t.firstTag().v,\n\n        freedoms := nt -> [[1]],\n\n        child := function(nt, freedoms)\n            local PV, sizes;\n\n            sizes := Copy(nt.params[4]);\n            sizes[Last(nt.params[3][1])] := 1;\n\n            if Length(Filtered(sizes, t->t<>1))>0 then\n                PV:=Copy(nt.params[2]);\n                PV[Last(nt.params[3][1])]:=AOne;\n                return [TTensorI_OL(\n                    DropVectorTag(nt.params[1]).setWrap(VOLWrap(nt.firstTag().isa)),\n                    PV,\n                    nt.params[3],\n                    sizes,\n                    Drop(nt.params[5],1)\n                )];\n            else\n                return [ DropVectorTag(Copy(nt.params[1])).setWrap(VOLWrap(nt.firstTag().isa)) ];\n          fi;\n        end,\n\n        apply := function(nt,c,cnt)\n            local myCross, myScat, mydims, v;\n\n            v := nt.firstTag().v;\n\n            #little hack for KernelDup\n            if ObjId(nt.params[1]).name <> \"KernelMMMDuped\" then\n                myCross := Cross(List(nt.dims()[2], t ->\n                    VGath_dup(fId(t), v)\n                ));\n                myCross._children[Last(nt.params[3][1])] :=\n                    VPrm_x_I(\n                        fId( nt.dims()[2][Last(nt.params[3][1])] / v ), \n                        nt.firstTag().v\n                    );\n            else \n                mydims := nt.dims()[2];\n                mydims[1] := mydims[1] * v;\n                myCross := Cross(List(mydims, t ->\n                    VPrm_x_I( fId(t/v), v )\n                ));\n            fi;\n\n            myScat := VScat(fId( nt.dims()[1]/v ), v );\n\n            return myScat * VTensor_OL(c[1], v) * myCross;\n        end\n    ),\n#D            applicable :=(self,t) >> FirstTagEq(t, AVecReg) and Last(t.params[3][1])<>0 and t.params[2][Last(t.params[3][1])]=AVec and t.params[4][Last(t.params[3][1])]=GetFirstTag(t).v,\n#D            freedoms := nt -> [[1]],\n#D            child := function (nt,freedoms)\n#D              local PV,sizes;\n#D              sizes:=Copy(nt.params[4]);\n#D              sizes[Last(nt.params[3][1])]:=1;\n#D              if Length(Filtered(sizes, t->t<>1))>0 then\n#D                  PV:=Copy(nt.params[2]);\n#D                  PV[Last(nt.params[3][1])]:=AOne;\n#D              return [TTensorI_OL(DropVectorTag(nt.params[1]).setWrap(VOLWrap(GetFirstTag(nt).isa)),\n#D                          PV,nt.params[3],sizes,Drop(nt.params[5],1))];\n#D              else\n#D                  return [DropVectorTag(Copy(nt.params[1])).setWrap(VOLWrap(GetFirstTag(nt).isa))];\n#D              fi;\n#D            end,\n#D            apply := function(nt,c,cnt)\n#D              local myCross,myScat,mydims;\n#D#little hack for KernelDup\n#D              if (ObjId(nt.params[1]).name<>\"KernelMMMDuped\") then\n#D                  myCross:=Cross(List(nt.dims()[2],t->VGath_dup(fId(t),GetFirstTag(nt).v)));\n#D                  myCross._children[Last(nt.params[3][1])]:=\n#D                  VPrm_x_I(fId(nt.dims()[2][Last(nt.params[3][1])]/GetFirstTag(nt).v),GetFirstTag(nt).v);\n#D              else \n#D                  mydims:=nt.dims()[2];\n#D                  mydims[1]:=mydims[1]*GetFirstTag(nt).v;\n#D                  myCross:=Cross(List(mydims,t->VPrm_x_I(fId(t/GetFirstTag(nt).v),GetFirstTag(nt).v)));\n#D              fi;\n#D              myScat:=VScat(fId(nt.dims()[1]/GetFirstTag(nt).v),GetFirstTag(nt).v);\n#D              return myScat*VTensor_OL(c[1],GetFirstTag(nt).v)*myCross;\n#D            end),\n\n#Changed by Marek, looks OK\n    TTensorI_OL_Vectorize_AParFirst :=rec(\n        switch:=false,\n\n        applicable := (self,t) >> \n            t.isTag(1, AVecReg)\n            and 0 <> First(t.params[3][1], x -> true)\n            and APar = t.params[2][First(t.params[3][1],x -> true)]\n            and t.firstTag().v = t.params[4][First(t.params[3][1], x -> true)],\n\n        freedoms := nt -> [[1]],\n\n        child := function (nt,freedoms)\n            local PV,outorder,theguy;\n\n            PV := Copy(nt.params[2]);\n            PV[First(nt.params[3][1],x->true)] := AVec;\n\n            theguy := Copy(First(nt.params[3][1], x->true));\n            outorder := Drop(Copy(nt.params[3][1]),1);\n            Add(outorder,theguy);\n\n            return [\n                TTensorI_OL( nt.params[1], PV, [outorder], nt.params[4], nt.params[5]),\n                TL(nt.rng()[1].size, nt.firstTag().v, 1, 1, nt.params[5]),\n                TL(\n                    nt.dmn()[First(nt.params[3][1], x -> true)].size, \n                    nt.dmn()[First(nt.params[3][1], x -> true)].size / nt.firstTag().v,\n                    1,\n                    1,\n                    nt.params[5]\n                )\n            ];\n        end,\n\n        apply := function(nt,c,cnt)\n            local i;\n\n            i := Identities(nt.dmn());\n            i._children[First(nt.params[3][1], x -> true)] := c[3];\n\n            return c[2] * c[1] * i;\n        end\n    ),\n\n#D            applicable :=(self,t) >> FirstTagEq(t, AVecReg) and First(t.params[3][1],x->true)<>0 and t.params[2][First(t.params[3][1],x->true)]=APar and t.params[4][First(t.params[3][1],x->true)]=GetFirstTag(t).v,\n#D            freedoms := nt -> [[1]],\n#D            child := function (nt,freedoms)\n#D              local PV,outorder,theguy;\n#D              PV:=Copy(nt.params[2]);\n#D              PV[First(nt.params[3][1],x->true)]:=AVec;\n#D              theguy:=Copy(First(nt.params[3][1],x->true));\n#D              outorder:=Drop(Copy(nt.params[3][1]),1);\n#D              Add(outorder,theguy);\n#D              return [TTensorI_OL(nt.params[1],PV,[outorder],nt.params[4],nt.params[5]),TL(nt.rng()[1].size,GetFirstTag(nt).v,1,1,nt.params[5]),TL(nt.dmn()[First(nt.params[3][1],x->true)].size,nt.dmn()[First(nt.params[3][1],x->true)].size/GetFirstTag(nt).v,1,1,nt.params[5])];\n#D            end,\n#D            apply := function(nt,c,cnt)\n#D              local i;\n#D              i:=Identities(nt.dmn());\n#D              i._children[First(nt.params[3][1],x->true)]:=c[3];\n#D              return c[2]*c[1]*i;\n#D            end),\n));\n\n\n\n\n\n\n\n\n\n\n", "meta": {"hexsha": "9ecab60a40ab69f575d8134db6d1701ae2cec8d7", "size": 35111, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/nontransforms/ol/operators.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/nontransforms/ol/operators.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/nontransforms/ol/operators.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 35.9743852459, "max_line_length": 367, "alphanum_fraction": 0.5194383527, "num_tokens": 10589, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4882833952958347, "lm_q2_score": 0.02758528252657529, "lm_q1q2_score": 0.013469435412271044}}
{"text": "InstallMethod( JupyterRender, [ IsRecord ],\n               r -> Objectify( JupyterRenderableType\n                             , rec( data := rec( text\\/plain := String(r) )\n                                   , metadata := rec() ) ) );\n\n# This is still an ugly hack, but its already much better than before!\nBindGlobal(\"JupyterSplashDot\",\nfunction(dot)\n    local fn, fd, r;\n\n    fn := TmpName();\n    fd := IO_File(fn, \"w\");\n    IO_Write(fd, dot);\n    IO_Close(fd);\n\n    fd := IO_Popen(IO_FindExecutable(\"dot\"), [\"-Tsvg\", fn], \"r\");\n    r := IO_ReadUntilEOF(fd);\n    IO_close(fd);\n    IO_unlink(fn);\n\n    return JupyterRenderable( rec( (\"image/svg+xml\") := r )\n                            , rec( (\"image/svg+xml\") := rec( width := 500, height := 500 ) ) );\nend);\n\n# Splash the subgroup lattice of a group\nBindGlobal(\"JupyterSplashSubgroupLattice\",\nfunction(group)\n    local fn, fd, r, L, dot;\n\n    fn := TmpName();\n\n    L := LatticeSubgroups(group);\n    DotFileLatticeSubgroups(L, fn);\n\n    fd := IO_Popen(IO_FindExecutable(\"dot\"), [\"-Tsvg\", fn], \"r\");\n    r := IO_ReadUntilEOF(fd);\n    IO_close(fd);\n    IO_unlink(fn);\n\n    return JupyterRenderable( rec( (\"image/svg+xml\") := r )\n                            , rec( (\"image/svg+xml\") := rec( width := 500, height := 500 ) ) ) ;\n\nend);\n\n# To show TikZ in a GAP jupyter notebook\nBindGlobal(\"JupyterSplashTikZ\",\nfunction(tikz)\n    local tmpdir, fn, header, ltx, svgfile, stream, svgdata, tojupyter;\n\n    header:=Concatenation( \"\\\\documentclass[crop,tikz]{standalone}\\n\",\n                    \"\\\\usepackage{pgfplots}\",\n                    \"\\\\makeatletter\\n\",\n                    \"\\\\batchmode\\n\",\n                    \"\\\\nonstopmode\\n\",\n                    \"\\\\begin{document}\",\n                    \"\\\\begin{tikzpicture}\");\n    header:=Concatenation(header, tikz);\n    header:=Concatenation(header,\"\\\\end{tikzpicture}\\n\\\\end{document}\");\n\n    tmpdir := DirectoryTemporary();\n    fn := Filename( tmpdir, \"svg_get\" );\n\n    PrintTo( Concatenation( fn, \".tex\" ), header );\n\n    ltx := Concatenation( \"pdflatex -shell-escape --output-directory \",\n                   Filename( tmpdir, \"\" ), \" \",\n                   Concatenation( fn, \".tex\" ), \" > \", Concatenation( fn, \".log2\" ) );\n    Exec( ltx );\n\n    if not( IsExistingFile( Concatenation(fn, \".pdf\") ) ) then\n        tojupyter := rec( json := true, name := \"stdout\",\n                          data := \"No pdf was created; pdflatex is installed in your system?\" );\n    else\n        svgfile := Concatenation( fn, \".svg\" );\n        ltx := Concatenation( \"pdf2svg \", Concatenation( fn, \".pdf\" ), \" \",\n                       svgfile, \" >> \", Concatenation( fn, \".log2\" ) );\n        Exec( ltx );\n\n        if not( IsExistingFile( svgfile ) ) then\n            tojupyter := rec( json := true, name := \"stdout\",\n                              data := \"No svg was created; pdf2svg is installed in your system?\" );\n        else\n            stream := InputTextFile( svgfile );\n            if stream <> fail then\n                svgdata := ReadAll( stream );\n                tojupyter := rec( json := true, source := \"gap\",\n                                  data := rec( ( \"image/svg+xml\" ) := svgdata ),\n                                  metadata := rec( ( \"image/svg+xml\" ) := rec( width := 500, height := 500 ) ) );\n                CloseStream( stream );\n            else\n                tojupyter := rec( json := true, name := \"stdout\",\n                                  data := Concatenation( \"Unable to render \", tikz ), metadata := rec() );\n            fi;\n        fi;\n    fi;\n\n    return JupyterRenderable(tojupyter.data, tojupyter.metadata);\nend);\n\n# This is really not what I should be doing here...\nInstallGlobalFunction(ISO8601Stamp,\nfunction()\n    local tz, gm, pad;\n\n    tz := IO_gettimeofday();\n    pad := function(i, l, c)\n        local s;\n        s := String(i);\n        if Length(s) < l then\n            return Concatenation(RepeatedString(c, l - Length(s)), s);\n        else\n            return s;\n        fi;\n    end;\n\n    gm := IO_gmtime(tz.tv_sec);\n    return STRINGIFY( 1900 + gm.tm_year, \"-\"\n                      , pad(gm.tm_mon + 1, 2, '0'), \"-\"\n                      , pad(gm.tm_mday, 2, '0'), \"T\"\n                      , pad(gm.tm_hour, 2, '0'), \":\"\n                      , pad(gm.tm_min, 2, '0'), \":\"\n                      , pad(gm.tm_sec, 2, '0'), \".\"\n                      , pad(tz.tv_usec, 6, '0') );\nend);\n", "meta": {"hexsha": "09889f62a487f049fcc48b2d1e6378789eb1c06f", "size": 4412, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterUtil.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterUtil.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterUtil.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 35.296, "max_line_length": 113, "alphanum_fraction": 0.5027198549, "num_tokens": 1146, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.43014734858584286, "lm_q2_score": 0.03067580093527886, "lm_q1q2_score": 0.01319511443805732}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nIsSIMD_ISA := x -> IsRec(x) and IsBound(x.isSIMD_ISA) and x.isSIMD_ISA=true;\nIsISA      := x -> IsRec(x) and IsBound(x.isISA) and x.isISA=true;\n\nDeclare(ISAOps);\nISAOps := rec(\n    operations := OpsOps,\n    name := \"ISAOps\",\n    Print := s->s.print(),\n    # backward compatibility hack - descendants equal to parent classes\n    \\= := (c1, c2) -> Same(c1,c2) or (IsISA(c1) and IsISA(c2) and (Same(ObjId(c1),c2) or Same(c1,ObjId(c2)) or c1.id()=c2.id())),\n    \\< := (c1, c2) -> not ISAOps.\\=(c1, c2) and Cond(not IsISA(c1) or not IsISA(c2), BagAddr(c1) < BagAddr(c2),  c1.id()<c2.id()), \n);\n\nClass(ISA, rec(\n    verbose := false,\n    isISA   := true,\n    id      := self >> self.__name__,\n\n    fixProblems := (c,opts) -> c,\n\n    rChildren := self >> [],\n    from_rChildren := (self, rch) >> self,\n\n    gt := self >> self.t,\n\n    operations := ISAOps,\n    print := self >> Print(self.__name__, When(self._cplx, \".cplx()\", \"\")),\n\n    autolib := rec(\n        includes      := () -> [], # list of includes, ex: [ \"<pmmintrin.h>\" ]\n        timerIncludes := () -> [], # list of timer includes\n    ),\n    # wrap(<spl>) wraps spl to ISA boundaries container (at this moment VContainer)\n    wrap := (self, spl) >> spl,\n));\n\nClass(SIMD_ISA, ISA, rec(\n    isSIMD_ISA := true,\n\n    _cplx := false,\n\n    # isCplx()\n    isCplx := self >> self._cplx,\n\n    # cplx()  -- set the complex vectorization flag, which makes .getV() return v/2\n    #            which is needed so that VContainer inside complex vectorization \n    #            region correctly resolves its vector length\n    cplx := self >> CopyFields(self, rec(_cplx := true)),\n\n    # uncplx()  -- unset the complex vectorization flag, which makes .getV() return v\n    #              which is needed so that VContainer inside complex vectorization \n    #              region correctly resolves its vector length\n    uncplx := self >> CopyFields(self, rec(_cplx := false)),\n\n    # getV() -- returns the effective vector length that should be used, it is\n    #           equal to ISA's vector length normally, but inside complex vector-\n    #           ization regions it is vlen/2.\n    getV := self >> Cond(self._cplx, self.v/2, self.v),\n\n\n    getTags := self >> [AVecReg(self)],\n    getTagsCx := self >> [AVecRegCx(self)],\n    getOpts := self >> self.splopts,\n    rules_loaded := false,\n    rules_built := false,\n    setRules := meth(self, rules)\n                    self.rules := rules;\n                    self.rules_loaded := true;\n                end,\n    flushRules := meth(self)\n                      self.rules_loaded := false;\n                      self.rules_built := false;\n                      if IsBound(self.rules) then Unbind(self.rules); fi;\n                  end,\n    \n    # realVect()  -- returns true if real vectorization is allowed\n    realVect := True,\n    # cplxVect()  -- returns true if complex vectorization is allowed\n    cplxVect := True,\n\n    simpIndicesInside := [], # to which instructions we should apply expensive index simplification rules,\n                             # these should include gather/scatter instructions\n    # ISA atomic data type\n    gt := self >> self.t.t,\n\n    wrap := (self, spl) >> spiral.paradigms.vector.sigmaspl.VContainer(spl, self),\n\n    #F .loadCont(<n>, <y>, <yofs>, <x>, <xofs>, <xofs_align>)\n    #F\n    #F Read <n> values from address <x> + <xofs> into (lower) slots in vector pointer at <y> + <yofs>\n    #F\n    #F <n> - integer, how many points to load, must be <= self.v\n    #F <y> - destination pointer\n    #F <yofs> - destination offset in vectors\n    #F <x> - source pointer\n    #F <xofs> - source offset\n    #F <xofs_align> - alignment, must be (xofs mod self.v), this parameter allows us\n    #F                to pass in a simplified expression which may be constant\n    #F\n    #F Assumptions: 1 <= n <= self.v\n    #F              xofs_align = xofs mod self.v\n    #F \n    #F When n = self.v, this operation becomes an unaligned load (unless xofs_align=0)\n    #F\n    loadCont := (self, n, y, yofs, x, xofs, xofs_align, opts) >> let(\n\ta  := _unwrap(xofs_align),\n\tnn := _unwrap(n), \n\tyy := vtref(self.t, y, yofs),\n        When(IsBound(self.loadc_align) and IsInt(a) and not IsUnalignedPtrT(x.t),\n\t     self.loadc_align(nn, a, opts)(yy, x, xofs),\n\t     self.loadc(nn, opts)(yy, nth(x, xofs)))),\n\n    #F .storeCont(<n>, <y>, <yofs>, <yofs_align>, <x>, <xofs>)\n    #F\n    #F Store (lower) <n> values from address <x> + <xofs> into address <y> + <yofs>\n    #F\n    #F <n> - integer, how many points to store, must be <= self.v\n    #F <y> - destination pointer\n    #F <yofs> - destination offset\n    #F <yofs_align> - alignment, must be (yofs mod self.v), this parameter allows us\n    #F                to pass in a simplified expression which may be constant\n    #F <x> - source pointer\n    #F <xofs> - source offset in vectors\n    #F \n    #F Assumptions: 1 <= n <= self.v\n    #F              yofs_align = yofs mod self.v\n    #F \n    #F When n = self.v, this operation becomes an unaligned load (unless yofs_align=0)\n    #F\n    storeCont := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\ta  := _unwrap(yofs_align),\n\tnn := _unwrap(n),\n\txx := vtref(self.t, x, xofs),\n        When(IsBound(self.storec_align) and IsInt(a) and not IsUnalignedPtrT(y.t), \n\t     self.storec_align(nn, a, opts)(y, yofs, xx), # storec_align is not implemented anywhere\n\t     self.storec[nn](nth(y, yofs), xx))),\n\n    storeContAcc := (self, n, y, yofs, yofs_align, x, xofs, opts) >> let(\n\ta  := _unwrap(yofs_align),\n\tnn := _unwrap(n),\n\txx := vtref(self.t, x, xofs),\n\tt  := TempVec(TArray(xx.t.t, xx.t.size)),\n\tdecl([t], chain(\n\t    self.loadCont(nn, t, 0, y, yofs, yofs_align, opts), \n\t    assign(vtref(self.t, t, 0), vtref(self.t, t, 0) + xx), \n\t    self.storeCont(nn, y, yofs, yofs_align, t, 0, opts)))),\n\n    # ===============================================================================\n    # Other fields that must be defined in subclasses\n\n    # Required:\n    #  active\n    #  bin_shl1  bin_shl2  bin_shr1  bin_shr2  bin_shrev\n    #  bits, ctype, t, v\n    #  countrec\n    #  includes\n    #  info\n    #  instr\n    #  isFixedPoint, isFloat\n    #  loadc + loadc_align (optional)  OR  loadCont\n    #  mul_cx, mul_cx_conj\n    #  reverse\n    #  splopts\n    #  storec  OR  storeCont\n    #  svload\n    #  svstore\n    #  RCVIxJ2\n    #  dupload, duploadn\n    #  hadd\n    #  swap_cx\n    #  vzero\n\n    # Fixed point:\n    #  fracbits\n    #  saturatedArithmetic\n\n    # Viterbi:\n    #  interleavedmask, hmin, average (?), isSigned\n\n    # Hacks (used in 2x32f), supported but not required:\n    #  loadop,      requireLoad\n    #  storeop,     requireStore\n    #  scalarVar,   needScalarVarFix \n\n));\n\nIsSIMD_ISA := x -> IsRec(x) and IsBound(x.isSIMD_ISA) and x.isSIMD_ISA=true;\nIsISA      := x -> IsRec(x) and IsBound(x.isISA) and x.isISA=true;\n\nClass(SIMD_ISA_DB, rec(\n    verbose := false,\n    isa_db := rec(),\n    addISA := meth(self, isa) self.isa_db.(isa.name) := isa; end,\n    installed := self >> Filtered(RecFields(self.isa_db), x -> not IsSystemRecField(x)),\n    active := self >> List(Filtered(Filtered(RecFields(self.isa_db), x -> not IsSystemRecField(x)), e->self.isa_db.(e).active), k->self.isa_db.(k)),\n    info := self >> Print(\"\\nSpiral SIMD ISA database\\n\",\n                          \"installed ISAs: \", PrintCS(self.installed()), \"\\n\",\n                          \"active ISAs: \", PrintCS(self.active()), \"\\n\"),\n    getISA := (self, isa) >> self.isa_db.(isa),\n#------------------------------------------\n    HASH_FILE := file -> let(p := Conf(\"path_sep\"), base := Conf(\"spiral_dir\"), Concat(base, p, \"namespaces\", p, \"spiral\", p, \"platforms\", p, \"_\", file, \"_generated1.gi\")),\n    RULES_FILE := file -> let(p := Conf(\"path_sep\"), base := Conf(\"spiral_dir\"), Concat(base, p, \"namespaces\", p, \"spiral\", p, \"platforms\", p, \"_\", file, \"_generated0.gi\")),\n    hash := HashTableDP(),\n    hashFlush := meth(self) self.hash := HashTableDP(); end,\n    hashSave := meth(self)\n                    local _entry, entry, item, isa;\n                    if self.verbose then Print(\"saving hash\\n\"); fi;\n                    _entry := Flat(Filtered(self.hash.entries, True));\n\n                    for isa in self.active() do\n                        PrintTo(self.HASH_FILE(isa.file), \"\");\n                    od;\n\n                    for isa in self.active() do\n#                        Error();\n                        for entry in Filtered(_entry, (a) -> a.key.getTags()[1].isa = isa)  do\n#                            for item in entry  do\n                            item := entry; #only save first hash entry\n                            AppendTo(self.HASH_FILE(isa.file), self.name, \".hashAdd(\", item.key, \", \", item.data, \");\\n\");\n#                            od;\n                        od;\n                    od;\n                end,\n    hashAdd := meth(self, a, b) HashAdd(self.hash, a,b); end,\n    getHash:= self >> Copy(self.hash),\n    hash_rebuilt := false,\n    rules_rebuilt := false,\n    init0 := meth(self)\n        local isa;\n        self.rules_rebuilt := false;\n        if self.verbose then Print(\"\\n\"); fi;\n        for isa in self.active() do\n            if self.verbose then Print(isa, \": base cases...\\n\"); fi;\n            if not IsBound(isa.rules) then\n                Print(isa, \" rules are being rebuilt and saved...\\n\");\n                isa.buildRules();\n                self.rules_rebuilt := true;\n            fi;\n        od;\n        if self.rules_rebuilt then self.saveRules(); fi;\n    end,\n    init1 := meth(self)\n        local isa;\n        self.hash_rebuilt := false;\n        if self.verbose then Print(\"\\n\"); fi;\n        for isa in self.active() do\n            if self.verbose then Print(isa, \": TL hash...\\n\"); fi;\n            if not self.checkBases(isa) then\n                Print(isa, \" hash is being rebuilt and saved...\\n\");\n                self.buildBases(isa);\n                self.hash_rebuilt := true;\n            fi;\n        od;\n        if self.hash_rebuilt then self.hashSave(); fi;\n    end,\n    saveRules := meth(self)\n                    local isa;\n                    if self.verbose then Print(\"saving rules\\n\"); fi;\n                    paradigms.vector.sigmaspl.VPerm.plong();\n\n                    for isa in self.active() do\n                        PrintTo(self.RULES_FILE(isa.file), \"\");\n                    od;\n\n                    for isa in self.active() do\n                        if IsBound(isa.rules) then\n                            AppendTo(self.RULES_FILE(isa.file), isa.name, \".setRules(\", isa.rules, \");\\n\");\n                        fi;\n                    od;\n                    paradigms.vector.sigmaspl.VPerm.pshort();\n                 end,\n    reset := meth(self)\n                local isa, verb;\n                verb := self.verbose;\n                for isa in self.active() do\n                    PrintTo(self.RULES_FILE(isa.file), \"\");\n                    PrintTo(self.HASH_FILE(isa.file), \"\");\n                od;\n                self.verbose := true;\n                self.hashFlush();\n                for isa in self.active() do\n                    isa.flushRules();\n                od;\n                self.init0();\n                self.init1();\n                self.verbose := verb;\n             end,\n    required_bases := isa -> Concat(\n            When(isa.realVect(), [\n                arch -> TL(2*arch.v,2,1,1).withTags(arch.getTags()),\n                arch -> TL(2*arch.v,arch.v,1,1).withTags(arch.getTags()),\n                arch -> TL(arch.v^2,arch.v,1,1).withTags(arch.getTags()) ], []),\n            When(isa.cplxVect(), [\n                arch -> TL(arch.v^2/4,arch.v/2,1,2).withTags(arch.getTags()) ], []),\n            When(isa.cplxVect() and isa.v=8, [\n                arch -> TL(4,2,1,2).withTags(arch.getTags()) ], [])),\n    getBases := (self, isa) >> List(self.required_bases(isa), i-> i(isa)),\n    lookupBases := (self, isa) >> List(self.getBases(isa), i-> HashLookup(self.hash, i)),\n    checkBases := (self, isa) >> not ForAny(self.lookupBases(isa), i -> i=false or i=[])\n));\n\n", "meta": {"hexsha": "785b12c38284eda79fc4200f38ca19eadb4a7f4c", "size": 12120, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/isa_db.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/isa_db.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/isa_db.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 39.4788273616, "max_line_length": 173, "alphanum_fraction": 0.5372937294, "num_tokens": 3363, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4186969093556867, "lm_q2_score": 0.03114383368216085, "lm_q1q2_score": 0.013039826908208284}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nFindUnexpandableNonterminal := function(t, opts)\n    local trees, res;\n    Constraint(IsSPL(t));\n    trees := ExpandSPL(t, opts);\n    if trees=[] then return [t];\n    else\n        return ConcatList(trees, tr -> \n\t    ConcatList(tr.children, c -> FindUnexpandableNonterminal(c, opts)));\n    fi;\nend;\n\nRuleTreeClass_rChildren := self >> [self.node, self.children];\nRuleTreeClass_rSetChild := rSetChildFields(\"node\", \"children\");\n   \n\nEnableRuleTreeRewriting := function(switch)\n    if switch then\n        RuleTreeClass.rChildren := RuleTreeClass_rChildren;\n        RuleTreeClass.rSetChild := RuleTreeClass_rSetChild;\n    else \n        Unbind(RuleTreeClass.rChildren);\n        Unbind(RuleTreeClass.rSetChild);\n    fi;\nend;\n\nVerifyRulesInRuleTree := function(r, opts)\n    local nt, n, bad;\n    EnableRuleTreeRewriting(true);\n    nt := CollectNR(r, @.cond(IsNonTerminal));\n    bad := [];\n    for n in nt do\n        #if n.free() <> [] then \n            n:=HashAsSPL(n); \n        #fi;\n        if ObjId(n) <> InfoNt then\n            Print(Red(\"-------\", n, \"-------\"), \"\\n\");\n            if VerifyRulesForSPL(n, opts) = false then\n                Add(bad, n);\n            fi;\n        fi;\n    od;\n    EnableRuleTreeRewriting(true);\n    Print(Red(\"Failed:\\n    \"), bad, \"\\n\");\nend;\n\n_VerifySubRuleTrees := function(r, opts, rt_tomat_func, ind)\n    local subtrees, rt, bugs, hashrt, t, innerbugs;\n    EnableRuleTreeRewriting(true);\n    bugs := [];\n    for rt in r.children do\n        t := HashAsSPL(rt.node);\n\thashrt := ApplyRuleTreeSPL(rt, t, opts);\t\n        if InfinityNormMat(MatSPL(rt_tomat_func(hashrt)) - MatSPL(hashrt.node)) > 1e-13 then\n\t    PrintLine(Blanks(ind), hashrt.node, RedStr(\"  FAIL\"));\n\t    bugs := [hashrt];\n\t    innerbugs := _VerifySubRuleTrees(hashrt, opts, rt_tomat_func, ind+4);\n\t    return Cond(innerbugs=[], bugs, innerbugs);\n\telse \n\t    PrintLine(Blanks(ind), hashrt.node, GreenStr(\"  OK\"));\n\tfi;\n    od;\n    EnableRuleTreeRewriting(false);\n    return bugs;\nend;\n\nVerifySubRuleTreesSPL := (r, opts) -> _VerifySubRuleTrees(r, opts, SPLRuleTree, 0);\n\n#VerifySubRuleTreesSums := (r, opts) -> _VerifySubRuleTrees(r, opts, x->SumsRuleTree(x, opts), 0);\n", "meta": {"hexsha": "3a4263169ace3c4e03f426fe2f9762a4f2719cb8", "size": 2247, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/bug.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/bug.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/bug.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 30.3648648649, "max_line_length": 98, "alphanum_fraction": 0.6283934134, "num_tokens": 642, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4726834766204329, "lm_q2_score": 0.027169228778706325, "lm_q1q2_score": 0.012842445516214825}}
{"text": "LETTERS;\n# \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\nLETTERS{[5 .. 10]};\n# \"EFGHIJ\"\n", "meta": {"hexsha": "e6b872ff0233bc1775fef9f72808d1416f710ac7", "size": 97, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Substring/GAP/substring.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Substring/GAP/substring.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Substring/GAP/substring.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 19.4, "max_line_length": 56, "alphanum_fraction": 0.7731958763, "num_tokens": 24, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3812195662561499, "lm_q2_score": 0.033589507826800535, "lm_q1q2_score": 0.012804977604490451}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n\n#F ScriptGenBase()\n#F\n\nClass(ScriptGenBase, rec(\n\n\n\t_settings := rec(),\n\n    ##\n    ## Public methods\n    ##\n\t\n\n\t\n\tgetAllSettings := (self) >> Copy(self._settings),\n\t\n\t\n\tsetAllSettings := meth(self, newrec)\n\t\tlocal field;\n\t\t\n\t\tif not IsRec(newrec) then\n\t\t\treturn false; \n\t\tfi;\n\t\t\n\t\tfor field in RecFields(newrec) do\n\t\t\tself._settings.(field) := Copy(newrec.(field));\n\t\tod;\n\t\t\n\t\t#later validate new settings\n\t\t\n\t\treturn true;\n\tend,\n\t\n\t\n\tgetSettingsValue := meth(self, key)\n\t\tif not IsBound(self._settings.(key)) then\n\t\t\treturn \"\";\n\t\tfi;\n\t\treturn self._settings.(key);\n\tend,\n\t\n\t\n\tsetSettingsValue := meth(arg)\n\t\tlocal self, key, value;\n\t\tif Length(arg) < 3 then return false; fi;\n\t\t\n\t\tself  := arg[1];\n\t\tkey   := arg[2];\n\t\tvalue := arg[3];\n\t\t\n\t\t#quick out if already set\n\t\tif IsBound(self._settings.(key)) and (value = self._settings.(key)) then\n\t\t\treturn true;\n\t\tfi;\n\t\t\n\t\tif key = SGKEY_TRANSFORM then\n\t\t\treturn self._setTransform(value);\n\t\telif key = SGKEY_SIZE then\n\t\t\treturn self._setSize(value);\n\t\telif (key = SGKEY_DATATYPE) then\n\t\t\treturn self._setType(value);\n\t\telif key = SGKEY_FILENAME then\n\t\t\treturn self._setFilename(value);\n\t\telif key = SGKEY_FUNCNAME then\n\t\t\treturn self._setFuncname(value);\n\t\tfi;\n\t\t\n\t\tself._settings.(key) := value;\n\t\n\t\treturn true;\n\tend,\n\t\n\t\n\t# TEMP simple set of sequences for early release, just works for FFT\n\tgetSettingsSequence := meth(self)\n\t\tlocal seq;\n\t\t\n\t\tseq  := [SGKEY_TRANSFORM, SGKEY_DATATYPE, SGKEY_SIZE];\n\t\t\t\t\n\t\treturn seq;\n\tend,\n\t\n\t\n\tgetSettingsDetails := meth(self, key)\n\t\tlocal retrec;\n\t\t\n\t\tif not IsString(key) then\n\t\t\treturn rec();\n\t\tfi;\n\t\t\t\n\t\tretrec := rec(\n\t\t\t(SGKEY_NAME)\t\t:= key,\n\t\t\t(SGKEY_DISPLAYNAME)\t:= self.getDisplayName(key),\n\t\t);\n\t\t\n\t\tif key = SGKEY_SIZE then\n\t\t\tif self.getSettingsValue(SGKEY_TRANSFORM) in [SGKEY_FFT_2D, SGKEY_IFFT_2D] then\n\t\t\t\tretrec.(SGKEY_TYPE) := [SGTYPE_INT, SGTYPE_INT];\n\t\t\telse\n\t\t\t\tretrec.(SGKEY_TYPE) := SGTYPE_INT;\n\t\t\tfi;\n\t\t\tretrec.(SGKEY_MULTIPLEVALUES) := true;\n\t\telif key in [SGKEY_DATATYPE, SGKEY_FILENAME, SGKEY_TRANSFORM] then\n\t\t\tretrec.(SGKEY_TYPE) := SGTYPE_STRING;\n\t\tfi;\n\t\t\n\t\treturn retrec;\n\tend,\n\t\n\t\n\t\n\tgetValidValues := meth(self, key)\n\t\tif (key = SGKEY_TRANSFORM) then\n\t\t\treturn Cond(IsBound(self._validTransforms), self._validTransforms(), []);\n\t\telif (key = SGKEY_SIZE) then\n\t\t\treturn Cond(IsBound(self._validSizes), self._validSizes(), []);\n\t\telif (key = SGKEY_DATATYPE) then\n\t\t\treturn Cond(IsBound(self._validTypes), self._validTypes(), []);\n\t\telse\n\t\t\treturn [];\n\t\tfi;\n\tend,\n\t\n\t\n\tgetDisplayName := key -> GetScriptGenDisplayName(key),\n\t\n\n\tsetDisplayName := function(key, string)\n\t\tif not ( IsString(key) and IsString(string) ) then\n\t\t\tError(\"usage: setDisplayName(key, string)\\n  both <key> and <string> must be strings\");\n\t\tfi;\n\t\t\n\t\tSetScriptGenDisplayName(key, string);\n\tend,\n\t\n\t\t\n    getDocumentation := key -> GetScriptGenDocumentation(key),\n\t\n\t\t\n\tsetDocumentation := function(key, string)\n\t\tif not ( IsString(key) and IsString(string) ) then\n\t\t\tError(\"usage: setDocumentation(key, string)\\n  both <key> and <string> must be strings\");\n\t\tfi;\n\t\t\n\t\tSetScriptGenDocumentation(key, string);\n\tend,\n\t\n\t\n\twriteScript := meth(arg)\n\t\tlocal self, key, choiceKey, fname, myPrint, allKeys;\n\t\t\n\t\tself := arg[1];\n\t\tif Length(arg) > 1 then\n\t\t\tkey := arg[2];\n\t\telse\n\t\t\tkey := SGSTR_ALL;\n\t\tfi;\n\t\t\n\t\tfname   := self.getSettingsValue(SGKEY_FILENAME);\n\t\t\n\t\tif fname = SGSTR_STDOUT then\n\t\t\tmyPrint := (arg) -> ApplyFunc(Print, arg);\n\t\telse\n\t\t\t# create file or overwrite existing, then use AppendTo for actual writing\n\t\t\tPrintTo(fname, \"\");\n\t\t\tmyPrint := (arg) -> ApplyFunc(AppendTo, Concat([fname], arg));\n\t\tfi;\n\t\t\n\t\tif key in self.getScriptChoices() then\n\t\t\tmyPrint(self._genScript(key));\n\t\telif key = SGSTR_CONSTRUCTOR then\n\t\t\tmyPrint(\"NewScriptGen(\\\"\"::self._arch()::\"\\\", \");\n\t\t\tmyPrint(self._settings);\n\t\t\tmyPrint(\");\\n\");\n\t\telif key = SGSTR_ALL then\n\t\t\tmyPrint(\"\\n##! BEGIN CONSTRUCTOR\\n\\n\");\n\t\t\tmyPrint(\"NewScriptGen(\\\"\"::self._arch()::\"\\\", \");\n\t\t\tmyPrint(self._settings);\n\t\t\tmyPrint(\");\\n\");\n\t\t\tmyPrint(\"\\n##! END CONSTRUCTOR\\n\\n\");\n\t\t\t\n\t\t\tfor choiceKey in self.getScriptChoices() do\n\t\t\t\tmyPrint(\"##! BEGIN SCRIPT \"::choiceKey::\"\\n\");\n\t\t\t\tmyPrint(\"# \"::self.getDisplayName(choiceKey)::\"\\n\\n\");\n\t\t\t\tmyPrint(self._genScript(choiceKey));\n\t\t\t\tmyPrint(\"\\n##! END SCRIPT \"::choiceKey::\"\\n\\n\");\n\t\t\tod;\n\t\telse\n\t\t\tallKeys := Concat([SGSTR_ALL, SGSTR_CONSTRUCTOR], self.getScriptChoices());\n\t\t\tError(\"key must be one of: \", allKeys);\n\t\tfi;\n\tend,\n\t\n\t\n\tgetScriptChoices := (self) >> [SGSTR_RUNRANDOMALL, SGSTR_RUNALL], \n\t\n\t\n\tgetAllChoicesAsJSON := meth(self)\n\t\tlocal json, indentStr, tree;\n\t\t\n\t\tindentStr := \"    \";\n\t\t\n\t\tjson := \"{\\n\" :: indentStr :: \"\\\"isa\\\" : \\\"\" :: self._arch() :: \"\\\"\";\n\t\t\n\t\ttree := self._getChoicesDetailsJSON(1, indentStr);\n\t\t\n\t\tif Length(tree) > 0 then\n\t\t\tjson := json :: \",\\n\" :: tree;\n\t\tfi;\n\t\t\n\t\tjson := json :: \"\\n}\\n\";\n\t\n\t\treturn json;\n\tend,\n\t\n\t\n\twriteJSONChoices := meth(arg)\n\t\tlocal self, file, json;\n\t\t\n\t\tself := arg[1];\n\t\tif Length(arg) > 1 then\n\t\t\tfile := arg[2];\n\t\telse\n\t\t\tfile := SGSTR_STDOUT;\n\t\tfi;\n\t\t\n\t\tjson := self.getAllChoicesAsJSON();\n\t\t\n\t\tPrintTo(file, json);\n\tend,\n\n\n\t\n    ##\n    ## Private methods\n\t##\n\t\n\t\n\t__call__ := meth(arg)\n\t\tlocal self, me, field;\n\t\tself := arg[1];\n\t\t\n\t\t# create a new instance of the class\n\t\t\n\t\tme := WithBases(self, rec(_settings := rec()));\n\t\t\n\t\tme._init();\n\t\t\n\t\tif IsBound(arg[2]) and IsRec(arg[2]) then\n\t\t\tfor field in RecFields(arg[2]) do\n\t\t\t\tme._settings.(field) := Copy(arg[2].(field));\n\t\t\tod;\n\t\tfi;\n\t\t\n\t\treturn me;\n\tend,\n\t\n\n\t# subclass must implement _init()\n\t_init := (self) >> Error(\"Cannot instantiate abstract class\\n\"),\n\t\n\t\n\t_setTransform := meth(self, tr)\n\t\tlocal szs;\n\t\tif not tr in self._validTransforms() then\n\t\t\treturn false;\n\t\tfi;\n\t\tself._settings.(SGKEY_TRANSFORM) := tr;\n\t\t\n\t\t# make sure size is still valid\n\t\tself._validateAndFixSize();\n\t\t\n\t\treturn true;\n\tend,\n\t\n\t\n\t_setType := meth(self, type)\n\t\tlocal szs;\n\t\tif not type in self._validTypes() then\n\t\t\treturn false;\n\t\tfi;\n\t\tself._settings.(SGKEY_DATATYPE) := type;\n\t\t\n\t\t# make sure size is still valid\n\t\tself._validateAndFixSize();\n\t\n\t\treturn true;\n\tend,\n\t\n\t\n\t_setSize := meth(arg)\n\t\tlocal self, sz, szlist, idx, xform;\n\t\t\n\t\tif Length(arg) < 2 then return false; fi;\n\t\t\n\t\tself := arg[1];\n\t\tsz   := arg[2];\n\t\t\n\t\t# 1D is a list of one or more valid ints\n\t\t# 2D is a list of one or more valid pairs of ints\n\t\t\n\t\txform := self.getSettingsValue(SGKEY_TRANSFORM);\n\t\tif xform in [SGKEY_FFT_2D, SGKEY_IFFT_2D] then\n\t\t\tif (not IsList(sz)) or (Length(sz) < 1) then\n\t\t\t\treturn false;\n\t\t\tfi;\n\t\t\tif IsInt(sz[1]) then\n\t\t\t\tszlist := [ sz ];\n\t\t\telse\n\t\t\t\tszlist := sz;\n\t\t\tfi;\n\t\telse\n\t\t\tif IsList(sz) and (Length(sz) > 0) then\n\t\t\t\tszlist := sz;\n\t\t\telse\n\t\t\t\tszlist := [ sz ];\n\t\t\tfi;\n\t\tfi;\n\t\t\t\t\n\t\tif szlist <> self._validateSize(szlist) then\n\t\t\treturn false;\n\t\tfi;\n\n\t\tself._settings.(SGKEY_SIZE) := szlist;\n\t\treturn true;\n\tend,\n\t\n\t\n\t_setFilename := meth(self, fname)\n\t\tif not IsString(fname) then\n\t\t\treturn false;\n\t\tfi;\n\t\tif Length(fname) = 0 then\n\t\t\tself._settings.(SGKEY_FILENAME) := SGSTR_STDOUT;\n\t\telse\n\t\t\tself._settings.(SGKEY_FILENAME) := fname;\n\t\tfi;\n\t\treturn true;\n\tend,\n\t\n\t\n\t_setFuncname := meth(self, fname)\n\t\tif not IsString(fname) then\n\t\t\treturn false;\n\t\tfi;\n\t\t\n\t\t### NOTE don't allow whitespace in string\n\t\t\n\t\tif Length(fname) = 0 then\n\t\t\tUnbind(self._settings.(SGKEY_FUNCNAME));\n\t\telse\n\t\t\tself._settings.(SGKEY_FUNCNAME) := fname;\n\t\tfi;\n\t\treturn true;\n\tend,\n\t\n\t\n\t_validateSize := meth(self, szlist)\n\t\tlocal goodsizes;\n\t\tgoodsizes := self._validSizes();\n\t\tif (Length(szlist) > 0) and ForAll(szlist, s -> s in goodsizes) then\n\t\t\treturn szlist;\n\t\tfi;\n\t\n\t\treturn Cond(Length(goodsizes) > 0, [ goodsizes[1] ], []);\n\tend,\n\t\n\t\n\t_validateAndFixSize := meth(self)\n\t\tlocal oldsz, newsz;\n\t\toldsz := Cond(IsBound(self._settings.(SGKEY_SIZE)), self._settings.(SGKEY_SIZE), [ 0 ]) ;\n\t\tnewsz := self._validateSize(oldsz);\n\t\tif newsz <> oldsz then\n\t\t\tself._settings.(SGKEY_SIZE) := newsz;\n\t\tfi;\n\tend,\n\t\t\n\t\n\t_getChoicesDetailsJSON := meth(arg)\n\t\tlocal self, level, indentStr, id, descr, json, indent, i, sequence, key, choices, value;\n\t\t\n\t\tif Length(arg) < 3 then\n\t\t\treturn \"\";\n\t\tfi;\n\t\tself := arg[1];\n\t\tlevel := arg[2];\n\t\tindentStr := arg[3];\n\t\tid    := Cond(IsBound(arg[4]) and IsString(arg[4]), arg[4], \"\");\n\t\tdescr := self.getDisplayName(id);\n\t\t\n\t\tindent := \"\";\n\t\tfor i in [2..level] do\n\t\t\tindent := indent :: indentStr :: indentStr;\n\t\tod;\n\t\t\n\t\tsequence := self.getSettingsSequence();\n\t\tif level > Length(sequence) then return \"\"; fi;\n\t\tkey := sequence[level];\n\t\t\n\t\tif level > 1 then\n\t\t\tjson := indent :: indentStr :: \"\\\"ident\\\" : \\\"\" :: id :: \"\\\",\\n\";\n\t\t\tjson := json :: indent :: indentStr :: \"\\\"descr\\\" : \\\"\" :: descr :: \"\\\",\\n\";\n\t\telse\n\t\t\tjson := \"\";\n\t\tfi;\n\t\t\n\t\tjson := json :: indent :: indentStr :: \"\\\"choice_name\\\" : \\\"\" :: key :: \"\\\",\\n\";\n\t\tjson := json :: indent :: indentStr :: \"\\\"choice_display\\\" : \\\"\" :: self.getDisplayName(key) :: \"\\\",\\n\";\n\t\t\n\t\tchoices := self.getValidValues(key);\n\t\t\n\t\tif level >= Length(sequence) then\n\t\t\treturn json :: indent :: indentStr :: \"\\\"choices\\\" : \" :: String(choices);\n\t\tfi;\n\t\t\n\t\tjson := json :: indent :: indentStr :: \"\\\"choices\\\" : [\\n\";\n\t\t\n\t\tfor i in [1..Length(choices)] do\n\t\t\tjson := json :: indent :: indentStr :: indentStr :: \"{\\n\";\n\t\t\t\n\t\t\tvalue := choices[i];\n\t\t\tself.setSettingsValue(key, value);\n\t\t\tjson := json :: self._getChoicesDetailsJSON(level+1, indentStr, value) :: \"\\n\";\n\t\t\n\t\t\tjson := json :: indent :: indentStr :: indentStr :: Cond(i < Length(choices), \"},\\n\", \"}\\n\");\n\t\tod;\n\t\t\t\n\t\tjson := json :: indent :: indentStr :: \"]\";\n\t\n\t\treturn json;\n\tend,\n\t\n\t\n\t_genScript := (self, runType) >> \"\",\n\t\n\t\n\t_localSupport := () -> true,\n\t\n\t\n)); # Class ScriptGen\n\n\n_constructors := rec();\n\n\nSetScriptGenConstructor := function(gen)\n\tif IsCallable(gen) and IsBound(gen._arch) then\n\t\t_constructors.(gen._arch()) := gen;\n\telse\n\t\tError(\"Invalid argument\\n\");\n\tfi;\nend;\n\n\n\n\n", "meta": {"hexsha": "86420f84c5ed3e1dc08661e43dc51326ca3d4911", "size": 9909, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/scriptgen/scriptgen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/scriptgen/scriptgen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/scriptgen/scriptgen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 21.4017278618, "max_line_length": 106, "alphanum_fraction": 0.6249873852, "num_tokens": 2953, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.30404167496654744, "lm_q2_score": 0.04208773242132242, "lm_q1q2_score": 0.01279642466092273}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_sum2 := function(lst)\n    local i, res;\n    res := 0;\n    for i in [2..Length(lst)] do\n        res := res + lst[i][1] + lst[i][2];\n    od;\n    return res;\nend;\n\n# objhead = [ objid_addr, param1_uid, param2_uid, ... ]\n# uid is unique position in the hashtable returned by HashAdd\nClass(ObjHashBase, HashTable( \n    (objhead,size) -> When(IsInt(objhead), 1 + (objhead mod size),\n                       1 + ((objhead[1] + _sum2(objhead)) mod size)),\n    (objhead1, objhead2) -> objhead1 = objhead2)\n);\n\nObjHashBase.operations := WithBases(HashOps, rec(\n    Print := o -> Print(o.name)\n));\n\nClass(ObjHash, ObjHashBase, rec(\n    liveEntries := self >> Filtered(self.entries, True),\n    numLiveEntries := self >> Sum(List(self.liveEntries(), Length)),\n\n    nonrecLookupAdd := meth(self, o)\n        local lkup;\n\tlkup := HashLookupUID(self, InternalHash(o));\n\tif Same(lkup, false) then\n\t    return HashAdd(self, InternalHash(o), o);\n\telse return lkup;\n\tfi;\n    end,\n\n    listLookupAdd := meth(self, o)\n        local lkup, uids;\n\tuids := [T_LIST];\n\tAppend(uids, List(o, e -> self.uidObj(e)));\n\tlkup := HashLookupUID(self, uids);\n\tif Same(lkup, false) then\n\t    return HashAdd(self, uids, o);\n\telse return lkup;\n\tfi;\n    end,\n\n    uidObj := (self,o) >> Cond(\n    IsRec(o) and IsBound(o.uid), o.uid, \n    IsRec(o), Error(\"Unhashed object <o>\"),\n    IsList(o), self.listLookupAdd(o),\n    self.nonrecLookupAdd(o)),\n\n    objAdd := meth(self, res, h)\n        local uid;\n    uid := HashAdd(self, h, res);\n    res.h := h;\n    res.uid := uid;\n    return res;\n    end,\n\n    singletonAdd := (self, o) >> self.objAdd(o, [BagAddr(o)]),\n\n    _prList := meth(self, lst) \n        local p;\n    for p in lst do\n            if IsRec(p) then Print(ObjId(p));\n        elif IsList(p) then Print(\"(\",self._prList(p), \")\");\n        else Print(p);\n        fi;\n        Print(\":\",self.uidObj(p), \" \");\n        od;\n    end,\n\n    debug := true,\n\n    objLookup := meth(self, objid, params) \n        local h,lkup,hcodes;\n\th := [BagAddr(objid)];\n\tAppend(h, List(params, p -> self.uidObj(p))); \n\tlkup := HashLookup(self, h);\n\n\tif self.debug then \n\t    if Same(lkup,false) then \n\t\tPrint(\"(\", objid, \" \", self._prList(params), \")\\n\");\n\t    else  \n\t\tPrint(objid, \" : hit \", lkup.uid, \"\\n\"); \n\t    fi;\n\tfi;\n\t    \n\treturn [lkup,h];\n    end,\n\n    memClassFunc := meth(self, cls, orig, bck)\n        Constraint(IsBound(cls.(orig)));\n        #Constraint(not IsBound(cls.__call_no_memo__));\n    cls.(bck) := cls.(orig);\n    cls._hash := self;\n    bck := RecName(bck); # this will make lookup a bit faster\n\n    cls.(orig) := meth(arg)\n            local clsself, params, lkup, res, h;\n        clsself := arg[1]; params := Drop(arg,1);\n        h := clsself._hash;\n        if h<>false then \n        lkup := h.objLookup(clsself, params);\n        if lkup[1] <> false then return lkup[1]; fi;\n        fi;\n        res := ApplyFunc(clsself.(bck), params);\n        if h<>false then \n        return h.objAdd(res, lkup[2]);\n        else return res;\n        fi;\n    end;\n    end,\n\n    memClass := (self,cls) >> self.memClassFunc(cls, \"__call__\", \"__call_no_memo__\")\n));\n", "meta": {"hexsha": "57852b088217dcd4882d614d0899d0d9a6387eb1", "size": 3189, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/objhash.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/objhash.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/objhash.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 26.1393442623, "max_line_length": 84, "alphanum_fraction": 0.5697710881, "num_tokens": 954, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4225046493573919, "lm_q2_score": 0.030214585975821884, "lm_q1q2_score": 0.012765803053193395}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\n# the rule set to promote nonterminals\nClass(RulesFFTXPromoteNT, RuleSet);\n\nClass(RulesFFTXPromoteNT_Cleanup, RuleSet);\n\n#RewriteRules(RulesFFTXPromoteNT, rec(\n#    IPRDFT_RCDiag_PRDFT__Circulant_Rule := Rule([Compose, @(1,IPRDFT), [@(2,RCDiag), @(4, FDataOfs, e->e.ofs = 0), @(5,I)], @(3,PRDFT)],\n#        e->let(n := @(1).val.params[1], fdata := @(2).val.element,\n#            Circulant(n, FDataNT(fdata.var, @(1).val), -n))\n#    )\n#));\n\n_toSymList := l -> [Minimum(l)..Maximum(l)];\n\nRewriteRules(RulesFFTXPromoteNT, rec(\n#   batch1_MDXFFT := Rule(@@(1, [MDDFT, MDPRDFT, IMDPRDFT, TColMajor], \n#       (e,cx) -> ForAll([TTensorI, TColMajor, TDAG, TDAGNode, HStack, VStack, Compose], i -> (not IsBound(cx.(i.name)) or cx.(i.name) = []))),\n#       e-> TTensorI(@@(1).val, 1, AVec, AVec)),\n\n    Scat_Circulant_Gath__IOPrunedRConv := ARule(Compose, [[@(1, Gath), fAdd],  @(2,Circulant), [@(3, Scat), fAdd]], \n        e-> [IOPrunedRConv(@(2).val.params[1], \n            FDataOfs(@(2).val.params[2].var, 2*(@(2).val.params[1]/2+1), 0), \n            1, _toSymList(List(@(1).val.func.tolist(), _unwrap)), \n            1, _toSymList(List(@(3).val.func.tolist(), _unwrap)), true)]),\n            \n# This is one mega promotion rule for Hockney that needs to be broken apart after MDRConv and/or PrunedMDRDFT is introduced\n    Hockney_hack := ARule(Compose, [[@(6, Gath), @(8,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))],\n                                     @(1,IMDPRDFT, e -> e.params[2] = 1), [@(2,RCDiag), @(4, FDataOfs, e->e.ofs = 0), @(5,I)], \n                                     @(3,MDPRDFT, e -> e.params[2] = Product(e.params[1])-1),\n                                     [@(7, Scat), @(9,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))]],\n        e-> let(ii := Ind(Rows(@(2).val)),\n            sym := @(2).val.element.var,\n            symf := Lambda(ii, nth(sym,ii)),\n            opat := List(@(8).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))),\n            ipat := List(@(9).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))),\n        [ IOPrunedMDRConv(@(1).val.params[1], symf, 1, opat, 1, ipat, true) ])),\n        \n# This is one mega promotion rule for Hockney that needs to be broken apart after MDRConv and/or PrunedMDRDFT is introduced\n    Hockney_hack2 := ARule(Compose, [[@(6, Gath), @(8,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))],\n                                     @(1,IMDPRDFT, e -> e.params[2] = 1), [@(2,RCDiag), @(4, FData), @(5,I)], \n                                     @(3,MDPRDFT, e -> e.params[2] = Product(e.params[1])-1),\n                                     [@(7, Scat), @(9,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))]],\n        e-> let(ii := Ind(Rows(@(2).val)),\n            sym := @(2).val.element.var,\n            symf := Lambda(ii, nth(sym,ii)),\n            opat := List(@(8).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))),\n            ipat := List(@(9).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))),\n        [ IOPrunedMDRConv(@(1).val.params[1], symf, 1, opat, 1, ipat, true) ])),\n        \n# DAG to Compose rules\n    DAG_collapse1 := Rule([@(1, TDAG), ..., @(2, TDAGNode, e->ForAny(Drop(@(1).val.params[1], 1), k->k.params[3] = e.params[2])), ...], \n        e->  let(nbr := Filtered(@(1).val.params[1], k->k.params[3] = @(2).val.params[2])[1], \n                 ch := Filtered(Drop(@(1).val.params[1],1) , i -> i<> nbr),\n                 dn := TDAGNode(nbr.params[1] * @(2).val.params[1], nbr.params[2], @(2).val.params[3]),\n                 TDAG([dn]::ch))),\n    DAG_remove := Rule([@(1,TDAG), [@(2, TDAGNode), @(3), \n            @(4).cond(e->IsList(e) and Length(e) = 1 and let(_e := e[1].free(), Length(_e) = 1 and ObjId(_e[1]) = var and _e[1].id in [\"Y\", \"Yptr\"] and Collect(e[1], TColMaj) = [])), \n            @(5).cond(e->IsList(e) and Length(e) = 1 and let(_e := e[1].free(), Length(_e) = 1 and ObjId(_e[1]) = var and _e[1].id in [\"X\", \"Xptr\"] and Collect(e[1], TColMaj) = [])),\n            ...],...],\n        e-> @(2).val.params[1]),\n        \n    propagate_ColMaj := Rule([@(1,TDAGNode), [TRC, @(2,MDDFT),...],\n            @(3).cond(e->ObjId(e[1])=tcast and ObjId(e[1].args[1].t) = TColMaj), \n            @(4).cond(e->ObjId(e[1])=tcast and ObjId(e[1].args[1].t) = TColMaj),...],\n        e -> TDAGNode(TRC(TColMajor(@(2).val)), @(3).val[1].args[2], @(4).val[1].args[2])),    \n        \n    Drop_TDecl := Rule(@(1, TDecl, e->ForAll(e.params[2], i->not i in e.params[1].free())),\n        e -> @(1).val.params[1]), \n        \n    Drop_TTensorI := Rule(@(1, TTensorI, e -> e.params[2] = 1), e -> e.params[1])    \n));\n\nRewriteRules(RulesFFTXPromoteNT_Cleanup, rec(\n# FIXME: the promotion rule does not (yet) have the guard to ensure the value of k is correct\n    IPRDFT_RCDiag_PRDFT__Circulant_ARule := ARule(Compose, [@(1,IPRDFT, e -> e.params[2] = 1), [@(2,RCDiag), \n            @(4, FDataOfs, e->e.ofs = 0), @(5,I)], @(3,PRDFT, e -> e.params[2] = e.params[1]-1)],\n        e->let(n := @(1).val.params[1], fdata := @(2).val.element,\n            [Circulant(n, FDataNT(fdata.var, @(1).val), -n) ])),\n            \n# FIXME: the promotion rule does not (yet) have the guard to ensure the value of k is correct\n    IMDPRDFT_RCDiag_MDPRDFT__RConv_ARule := ARule(Compose, [@(1,IMDPRDFT, e -> e.params[2] = 1), [@(2,RCDiag), @(4, FDataOfs, e->e.ofs = 0), @(5,I)], \n            @(3,MDPRDFT, e -> e.params[2] = Product(e.params[1])-1)],\n        e->let(n := @(1).val.params[1], fdata := @(2).val.element,\n            [MDRConv(n, fdata.var, true) ])),\n\n# FIXME: the promotion rule does not (yet) have the guard to ensure the value of k is correct\n    IMDPRDFT_Diag_MDPRDFT__RConv_ARule := ARule(Compose, [@(1,IMDPRDFT, e -> e.params[2] = 1), [@(2,Diag), [diagTensor, @(4, FDataOfs, e->e.ofs = 0), @(5,fConst, e->e.params = [ TReal, 2, 1 ])]], \n            @(3,MDPRDFT, e -> e.params[2] = Product(e.params[1])-1)],\n        e->let(n := @(1).val.params[1], fdata := @(4).val,\n            [MDRConvR(n, fdata.var, true) ])),\n            \n# MDDFT * Scat -> PrunedMDDFT\n    MDDFT_Scat__PrunedMDDFT := ARule(Compose, [@(1,MDDFT), [@(2, Scat), @(3,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))]],\n        e -> [ PrunedMDDFT(@(1).val.params[1], @(1).val.params[2], 1,  List(@(3).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))))] ),\n        \n# Gath * MDDFT -> PrunedIMDDFT\n    Gath_MDDFT__PrunedIMDDFT := ARule(Compose, [[@(1, Gath), @(2,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))], @(3, MDDFT)],\n        e -> [PrunedIMDDFT(@(3).val.params[1], @(3).val.params[2], 1,  List(@(2).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))))]),\n\n# PRDFT * Scat -> PrunedPRDFT\n    PRDFT_Scat__PrunedPRDFT := ARule(Compose, [@(1,PRDFT), [@(2, Scat), @(3,fAdd)]],\n        e -> [ PrunedPRDFT(@(1).val.params[1], @(1).val.params[2], 1,  _toSymList(List(@(3).val.tolist(), _unwrap)))] ),\n        \n# MDPRDFT * Scat -> PrunedMDPRDFT\n    MDPRDFT_Scat__PrunedMDPRDFT := ARule(Compose, [@(1,MDPRDFT), [@(2, Scat), @(3,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))]],\n        e -> [ PrunedMDPRDFT(@(1).val.params[1], List(@(3).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))), @(1).val.params[2])] ),\n\n# Gath * IMDPRDFT -> PrunedIMDPRDFT\n    Gath_IMDPRDFT__PrunedIMDPRDFT := ARule(Compose, [[@(1, Gath), @(2,fTensor, e->ForAll(e.children(), i->ObjId(i)=fAdd))], @(3, IMDPRDFT)],\n        e -> [ PrunedIMDPRDFT(@(3).val.params[1], List(@(2).val.children(), i-> _toSymList(List(i.tolist(), _unwrap))), @(3).val.params[2])] ),\n\n# Gath * PRDFT -> PrunedIPRDFT\n    Gath_PRDFT__PrunedIPRDFT := ARule(Compose, [[@(1, Gath), @(2,fAdd)], @(3, IPRDFT)],\n        e -> [PrunedIPRDFT(@(3).val.params[1], @(3).val.params[2], 1,  _toSymList(List(@(2).val.tolist(), _unwrap)))]),\n        \n    Compose_TCompose := Rule(@@(1, Compose, (e,cx) -> IsBound(cx.TFCall) and Length(cx.TFCall) = 1 and cx.TFCall[1].hasTags()), \n        e -> TCompose(e.children()))\n));\n\n        \n# WarpX stuff\nClass(RulesFFTXPromoteWarpX1, RuleSet);\nRewriteRules(RulesFFTXPromoteWarpX1, rec(\n    MultiX := Rule([@(0, TDAGNode), @(1), @(2), @(3).cond(e->IsList(e) and Length(e) = 1 and ObjId(e[1]) = nth and e[1].loc = X), ...],\n        e -> TDAGNode(@(1).val * GathPtr(@(3).val[1], fId(Cols(@(1).val))), @(2).val, [ @(3).val[1].loc ]).withTags(@(0).val.getTags())),\n\n    MultiY := Rule([@(0, TDAGNode), @(1), @(2).cond(e->IsList(e) and Length(e) = 1 and ObjId(e[1]) = nth and e[1].loc = Y), @(3), ...],\n        e -> TDAGNode(ScatPtr(@(2).val[1], fId(Rows(@(1).val))) * @(1).val, [ @(2).val[1].loc ], @(3).val).withTags(@(0).val.getTags())),\n));\n        \nClass(RulesFFTXPromoteWarpX2, RuleSet);\nRewriteRules(RulesFFTXPromoteWarpX2, rec(\n    TDAGNode_VStack1 := Rule([@(1, TDAG), ..., @(2, TDAGNode, \n            e-> IsList(e.params[2]) and Length(e.params[2]) = 1 and ObjId(e.params[2][1]) = nth and e.params[2][1].loc <> Y and _unwrap(e.params[2][1].idx) = 0\n                and not ObjId(e.params[3][1]) = nth), \n            ...],\n        e -> let(\n            vr := @(2).val.params[2][1].loc,\n            ch := Filtered(@(1).val.params[1], c->IsList(c.params[2]) and Length(c.params[2]) = 1 and ObjId(c.params[2][1]) = nth and c.params[2][1].loc = vr\n                     and c.params[3] = @(2).val.params[3]),\n            sl := Flat(SortRecordList(ch, c->_unwrap(c.params[2][1].idx))),\n            spls := List(sl, i-> i.params[1]),\n            vstk := VStack(spls),\n            dn := TDAGNode(vstk, [vr], @(2).val.params[3]),\n            nch := Filtered(@(1).val.params[1], c->(not IsList(c.params[2])) or (not Length(c.params[2]) = 1) or (not ObjId(c.params[2][1]) = nth) or (not c.params[2][1].loc = vr)\n                     or (not c.params[3] = @(2).val.params[3])),\n            TDAG([dn]::nch).withTags(@(1).val.tags)\n        )),\n        \n    TDAGNode_VStack2 := Rule([@(1, TDAG), ..., @(2, TDAGNode, \n            e-> IsList(e.params[3]) and Length(e.params[3]) = 1 and ObjId(e.params[3][1]) = nth and e.params[3][1].loc <> X and _unwrap(e.params[3][1].idx) = 0\n                and not ObjId(e.params[2][1]) = nth), \n            ...],\n        e -> let(\n            vr := @(2).val.params[3][1].loc,\n            ch := Filtered(@(1).val.params[1], c->IsList(c.params[3]) and Length(c.params[3]) = 1 and ObjId(c.params[3][1]) = nth and c.params[3][1].loc = vr\n                     and c.params[2] = @(2).val.params[2]),\n            sl := Flat(SortRecordList(ch, c->_unwrap(c.params[3][1].idx))),\n            spls := List(sl, i-> i.params[1]),\n            hstk := HStack(spls),\n            dn := TDAGNode(hstk,  @(2).val.params[2], [vr]),\n            nch := Filtered(@(1).val.params[1], c->(not IsList(c.params[3])) or (not Length(c.params[3]) = 1) or (not ObjId(c.params[3][1]) = nth) or (not c.params[3][1].loc = vr)\n                     or (not c.params[2] = @(2).val.params[2])),\n            TDAG(nch::[dn]).withTags(@(1).val.tags)\n        )),\n        \n   TResample_TGath := Rule(@(1, TResample, e->TResample_TGath.applicable(e)),\n       e->let(l := @(1).val,\n              c := TResample_TGath.children(l)[1],\n              TResample_TGath.apply(l, c, c)\n           )),\n        \n   TResample_TScat := Rule(@(1, TResample, e->TResample_TScat.applicable(e)),\n       e->let(l := @(1).val,\n              c := TResample_TScat.children(l)[1],\n              TResample_TScat.apply(l, c, c)\n           )),\n\n   TResample_MD_nofrac := Rule(@(1, TResample, e->TResample_MD_nofrac.applicable(e)),\n       e->let(l := @(1).val,\n              c := TResample_MD_nofrac.children(l)[1],\n              TResample_MD_nofrac.apply(l, c, c)\n           )),\n          \n   TGath_Gath := Rule(@(1, TGath, e-> TGath_base.applicable(e)), e->ApplyRuleSPL(TGath_base, @(1).val)),\n\n   TScat_Scat := Rule(@(1, TScat, e-> TScat_base.applicable(e)), e->ApplyRuleSPL(TScat_base, @(1).val)),\n           \n   Gath_GathPtr := ARule(Compose, [@(1, Gath, e-> ObjId(e.func) = fTensor and ForAll(e.func.children(), c->ObjId(c) = fId or (ObjId(c) = fAdd and c.params[3] = 0))), @(2, GathPtr)], \n       e->[ GathPtr(@(2).val.ptr, fId(Rows(@(1).val))) ]),\n        \n   ScatPtr_Scat := ARule(Compose, [@(1, ScatPtr), @(2, Scat, e-> ObjId(e.func) = fTensor and ForAll(e.func.children(), c->ObjId(c) = fId or (ObjId(c) = fAdd and c.params[3] = 0)))], \n       e->[ ScatPtr(@(1).val.ptr, fId(Cols(@(2).val))) ]), \n       \n   Expand_TResample := Rule(@(1, TResample, e->TResample_MD_frac.applicable(e)),\n       e->let(trs := @(1).val,\n               c := TResample_MD_frac.children(trs)[1],\n               TResample_MD_frac.apply(trs, c, c)\n           )),\n));\n           \nClass(RulesFFTXPromoteWarpX3, RuleSet);\nRewriteRules(RulesFFTXPromoteWarpX3, rec(          \n    Merge_TTensorI_VStack := ARule(Compose, [ @(1, TTensorI, e->e.params[3] = APar and e.params[4] = APar), \n        @(2, VStack, e->@(1).val.params[2] = Length(e.children()) and ForAll(e.children(), e->Rows(e) = Cols(@(1).val.params[1]))) ],\n        e->[VStack(List(@(2).val.children(), c->@(1).val.params[1] * c))]),     \n\n    Merge_HStack_TTensorI := ARule(Compose, [ @(1, HStack),\n        @(2, TTensorI, e->e.params[3] = APar and e.params[4] = APar and\n            e.params[2] = Length(@(1).val.children()) and ForAll(@(1).val.children(), j->Cols(j) = Rows(e.params[1]))) ],\n        e->[HStack(List(@(1).val.children(), c->c * @(2).val.params[1]))]), \n       \n# this rule is WRONG: the sign needs to be inverse of each other!       \n    MDPRDFT_IMDPRDFT := ARule(Compose, [@(1, MDPRDFT), @(2, IMDPRDFT, e->Length(@(1).val.params[1]) = Length(e.params[1]) and Mod(@(1).val.params[2] + e.params[2], Product(e.params[1])) = 0 and \n        ForAll([1..Length(e.params[1])], j->e.params[1][j] = @(1).val.params[1][j]))], \n        e->[Diag(fConst(TReal, Rows(@(1).val), Product(@(1).val.params[1])))]),\n        \n    Diag_RCDiag := ARule(Compose, [@(1, Diag, e->ObjId(e.element) = fConst and e.element.range() = TReal), @(2, RCDiag)],\n        e -> [RCDiag(diagMul(@(1).val.element, @(2).val.element))]),\n\n    RCDiag_Diag := ARule(Compose, [@(1, RCDiag), @(2, Diag, e->ObjId(e.element) = fConst and e.element.range() = TReal)],\n        e -> [RCDiag(diagMul(@(2).val.element, @(1).val.element))]),\n\n        \n # these rules need a bit more guards to not misfire      \n    Peel_HStack_RCDiag := Rule(@(1, HStack, e->ForAll(e.children(), c->let(cc := c.children(), Length(cc) = 3 and \n            ObjId(cc[1]) = ScatPtr and ObjId(cc[2]) = IMDPRDFT and ObjId(cc[3]) = RCDiag  and ObjId(cc[3].element) = RCData))),\n        e -> let(cc := @(1).val.children(), i := Ind(Length(cc)), c1 := cc[1].children()[1], c2 := cc[1].children()[2],\n#                Error(), \n                fts := Flat(List(cc, c->Collect(c, fTensor))),\n#                rng := List(fts, f->List([1..Length(f.children())], ii->f.child(ii).range())),\n                _rng := Flat(List(fts, f->List([1..Length(f.children())], ii->f.child(ii).range()))),\n#                rngf := FData(rng),\n                _rngf := FData(_rng),\n                dom := fts[1].child(1).domain(),\n#                fts2 := fTensor(List([0..Length(fts[1].children())-1],  ii->fAdd(nth(rngf.at(i), ii), dom, 0))),\n                _fts2 := fTensor(List([0..Length(fts[1].children())-1],  ii->fAdd(_rngf.at(Length(fts[1].children()) * i + ii), dom, 0))),\n            TNoDiagPullinRight(TIterHStack(TCompose([ScatPtr(nth(c1.ptr.loc, i), _fts2), c2]), i)) * \n                TNoPullLeft(RCDiag(RCData(diagDirsum(List(cc, c->Last(c.children()).element.func))))))),\n            \n    Peel_RCDiag_VStack := Rule(@(1, VStack, e->ForAll(e.children(), c->let(cc := Reversed(c.children()), Length(cc) in [2, 3] and \n            ObjId(cc[1]) = GathPtr and ObjId(cc[2]) = MDPRDFT and When(Length(cc) = 3, ObjId(cc[3]) = RCDiag and ObjId(cc[3].element) = RCData, true)))),\n        e-> let(cc := @(1).val.children(), i := Ind(Length(cc)), rcc := Reversed(cc[1].children()),\n                fts := Flat(List(cc, c->Collect(c, fTensor))),\n#                rng := List(fts, f->List([1..Length(f.children())], ii->f.child(ii).range())),\n                _rng := Flat(List(fts, f->List([1..Length(f.children())], ii->f.child(ii).range()))),\n#                rngf := FData(rng),\n                _rngf := FData(_rng),\n                dom := fts[1].child(1).domain(),\n#                fts2 := fTensor(List([0..Length(fts[1].children())-1],  ii->fAdd(nth(rngf.at(i), ii), dom, 0))),\n                _fts2 := fTensor(List([0..Length(fts[1].children())-1],  ii->fAdd(_rngf.at(Length(fts[1].children()) * i + ii), dom, 0))),\n\n            TNoPullRight(RCDiag(RCData(diagDirsum(List(cc, c->When(ObjId(c.children()[1]) = RCDiag, c.children()[1].element.func, \n                fConst(TComplex, Rows(rcc[2])/2, V(1)))))))) *\n            TNoDiagPullinLeft(TIterVStack(TCompose([rcc[2], GathPtr(nth(rcc[1].ptr.loc, i), _fts2)]), i))\n        )),\n        \n    Fuse_Diag := ARule(Compose, [ @(1, TNoPullLeft, e->ObjId(e.params[1]) = RCDiag), @(2, TRC), @(3, TNoPullRight, e->ObjId(e.params[1]) = RCDiag)], \n        e->[ TRC(TGrp(TCompose([Diag(@(1).val.params[1].element.func), @(2).val.params[1], Diag(@(3).val.params[1].element.func)])))]),\n        \n    Promote_Compose := Rule(@(1, Compose, e->ForAll(e.children(), c->ObjId(c) in [TRC, TNoDiagPullinLeft, TNoDiagPullinRight])),\n        e->TCompose(@(1).val.children())),\n        \n    flatten_I := Rule(@(1, Tensor, e->ForAll(e.children(), c->ObjId(c)=I)), e->I(Rows(@(1).val))), \n  \n));\n\n\nRewriteRules(RulesSums, rec(\n PullInRightScatPtr := ARule( Compose,\n       [ @(1, [ScatPtr, TNoPullLeft]),\n         @(2, [RecursStep, Grp, BB, SUM, Buf, ISum, Data, COND, TNoDiagPullin, TNoDiagPullinLeft, TNoDiagPullinRight, NeedInterleavedComplex, SIMTISum]) ],\n    e -> [ CopyFields(@(2).val, rec(\n             _children :=  List(@(2).val._children, c -> @(1).val * c),\n             dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n PullInLeftGathPtr := ARule( Compose,\n       [ @(1, [RecursStep, Grp, BB, SUM, SUMAcc, Buf, ISum, ISumAcc, Data, COND, TNoDiagPullin, TNoDiagPullinLeft, TNoDiagPullinRight, NeedInterleavedComplex, SIMTISum]),\n         @(2, [GathPtr, TNoPullRight]) ],\n    e -> [ CopyFields(@(1).val, rec(\n                _children := List(@(1).val._children, c -> c * @(2).val),\n                dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n ComposeGathGathPtr := ARule(Compose, [ @(1, Gath), @(2, GathPtr) ], # o 1-> 2->\n     e -> [ GathPtr(@(2).val.ptr, fCompose(@(2).val.func, @(1).val.func)) ]),\n\n ComposeScatPtrScat := ARule(Compose, [ @(1, ScatPtr), @(2, Scat) ], # <-1 <-2 o\n     e -> [ ScatPtr(@(1).val.ptr, fCompose(@(1).val.func, @(2).val.func)) ]),\n                \n));\n\n\n\n\n# IOPrunedRConv(@(2).val.params[1], @(2).val.params[2], 1, _toSymList(List(@(1).val.func.tolist(), _unwrap)), 1, _toSymList(List(@(3).val.func.tolist(), _unwrap)));\n# IOPrunedRConv(@(2).val.params[1], FDataOfs(@(2).val.params[2].var, 2*(@(2).val.params[1]/2+1), 0), 1, _toSymList(List(@(1).val.func.tolist(), _unwrap)), 1, _toSymList(List(@(3).val.func.tolist(), _unwrap)), true);\n\n\n", "meta": {"hexsha": "40bfd8a2f1a00e5f2692400eaa8765949cd9771b", "size": 19105, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "rewrite/promote.gi", "max_stars_repo_name": "mikefranusich/spiral-package-fftx", "max_stars_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "rewrite/promote.gi", "max_issues_repo_name": "mikefranusich/spiral-package-fftx", "max_issues_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "rewrite/promote.gi", "max_forks_repo_name": "mikefranusich/spiral-package-fftx", "max_forks_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 63.261589404, "max_line_length": 215, "alphanum_fraction": 0.540225072, "num_tokens": 6688, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4339814648038985, "lm_q2_score": 0.029312229797394368, "lm_q1q2_score": 0.012720964424141688}}
{"text": "Reversed(\"abcdef\");\n# \"fedcba\"\n", "meta": {"hexsha": "d2b56cbc1bc33077dc90fa95f32785ab607942c5", "size": 31, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Reverse-a-string/GAP/reverse-a-string.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Reverse-a-string/GAP/reverse-a-string.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Reverse-a-string/GAP/reverse-a-string.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 10.3333333333, "max_line_length": 19, "alphanum_fraction": 0.6451612903, "num_tokens": 10, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.28776782797747225, "lm_q2_score": 0.04401865252793398, "lm_q1q2_score": 0.012667152028458629}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nEmptyCS := [\n    Compile.pullDataDeclsRefs,\n    Compile.declareVars\n];\n\nBaseCS := [\n    c -> Compile.pullDataDeclsRefs(c),\n    c -> Compile.fastScalarize(c),\n    c -> UnrollCode(c),\n    c -> FlattenCode(c),\n    c -> UntangleChain(c), \n    CopyPropagate,\n    (c, opts) -> HashConsts(c, opts),\n];\n\nNoCSE := Concatenation(BaseCS, [\n    Compile.declareVars\n]);\n\nNoSchedCSE_CS := Concatenation(BaseCS, [\n    (c, opts) -> BinSplit(c, opts), \n    CSE,  MarkDefUse, CopyPropagate,\n    Compile.declareVars\n]);\n\nSimpleCS := Concatenation(BaseCS, [\n    (c, opts) -> BinSplit(c, opts),\n    CSE, MarkDefUse, DFSChain, CopyPropagate,\n    Compile.declareVars\n]);\n\n\n# IsCoarseType: checks if <coarse_t> is more general version of <fine_t> data type as defined by UnifyPair.\n#        ex: TReal is a general version of T_Real(32) data type.\nIsCoarseType := (coarse_t, fine_t) -> When( \n    coarse_t = fine_t, false, \n    Try(UnifyPair(fine_t, coarse_t)) = [true, fine_t]\n);\n\n# FixValueTypes: unifies value type with the type of surrounding expression.\n#        SSE unparser needs this for figuring out actual data type of constants.\n#        Fixed point backends rely on this to convert constants to fixed point...\n#\nFixValueTypes := c -> SubstTopDownRulesNR(c, rec( \n    fixValueTypes := Rule(\n        @@(1, Value, (x, cx) -> \n            ObjId(Last(cx.parents)) in \n\t        [add, sub, mul, bin_and, bin_xor, bin_or, absdiff, absdiff2, idiv, ddiv] and \n\t\tIsCoarseType(x.t, Last(cx.parents).t) and not IsPtrT(Last(cx.parents).t)),\n\t(e, cx) -> Last(cx.parents).t.value(e.v)\n    )\n)); \n\n\nDerefNthCode := c -> SubstTopDownRules(c, rec(\n    deref_nth := Rule(\n\t[nth, @(1).cond(e -> not(ObjId(e) in [Value, param])), @(2)], \n\te -> let(\n\t    b := @(1).val, idx := @(2).val, \n\t    Cond(\n\t\tObjId(idx) = add, deref(ApplyFunc(add, [b] :: idx.args)),\n\t\tObjId(idx) = sub, deref(ApplyFunc(add, [b] :: [idx.args[1], neg(idx.args)])),\n                                  deref(b + idx))))\n));\n\nNthDerefCode := c -> SubstTopDownRules(c, rec(\n    deref_var := Rule([deref, @(1, var)], e -> nth(@(1).val, TInt.value(0))), \n    deref_add := Rule([deref, [add, @(1, var), @(2, Value)]], e -> nth(@(1).val, @(2).val))\n));\n\nBaseIndicesCS := [\n    c -> Compile.pullDataDeclsRefs(c),\n    c -> Compile.fastScalarize(c),\n    c -> UnrollCode(c), \n    c -> FlattenCode(c), \n    c -> UntangleChain(c), \n    (c, opts) -> CopyPropagate.initial(c, opts), \n    (c, opts) -> HashConsts(c, opts), \n    c -> MarkDefUse(c), \n    (c, opts) -> BinSplit(c, opts), \n    c -> MarkDefUse(c),\n    CopyPropagate, # does CSE\n];\n\n# Uses a fast (no strength reduction) final CopyPropagate pass, which\n# kicks out vars used only once. Sometimes (MMM?) its not good (prevents hoisting)\n# and then IndicesCS2 should be used.\n#\nIndicesCS0 := Concatenation(BaseIndicesCS, [\n    c -> MarkDefUse(c), \n    # kicks out vars used only once or never\n    (c, opts) -> CopyPropagate.fast(c, CopyFields(opts, rec(autoinline := true))), \n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> Compile.declareVars(c), \n]);\n\n# Uses a full final CopyPropagate pass, which kicks out vars used only once\n# and properly simplifies out redundant double butterfly structures, i.e. F(2)*F(2)\n# \nIndicesCS := Concatenation(BaseIndicesCS, [\n    c -> MarkDefUse(c), \n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    c -> MarkDefUse(c), \n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\n# IndicesCS + extra CopyPropagate pass to do DAG pruning\nIndicesCS_Prune := Concatenation(BaseIndicesCS, [\n    c -> MarkDefUse(c),\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    c -> MarkDefUse(c),\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\n# Does not use a final CopyPropagate pass, to keep variables used once, and \n# not prevent hoisting.\n#\nIndicesCS2 := Concatenation(BaseIndicesCS, [\n    # - kicking out variables never used is fine.\n    # - kicking out variables used once should be a GLOBAL pass because\n    # - right now it prevents hoisting\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\nIndicesCS_FMA := Concatenation(BaseIndicesCS, [\n    DoFMA,\n    MarkDefUse, #\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\nIndicesCS_Fixed := (bitwidth, fracbits) -> (\n    IndicesCS ::\n    [ c -> FixedPointCode(c, bitwidth, fracbits) ]\n);\n\nIndicesCS_FixedNew := \n    IndicesCS ::\n    [ (c, opts) -> FixedPointCode2(c) ];\n\n\nIndicesCS2_FMA := Concatenation(BaseIndicesCS, [\n    DoFMA,\n    CopyPropagate,\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\nIndicesCS_CXFMA := Concatenation(BaseIndicesCS, [\n    DoCXFMA,\n    MarkDefUse, #\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\nIndicesCS2_CXFMA := Concatenation(BaseIndicesCS, [\n    DoCXFMA,\n    CopyPropagate,\n    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n    c -> FixValueTypes(c),\n    c -> Compile.declareVars(c)\n]);\n\n# OLD STUFF\n\n# RCSE_CS := Concatenation(BaseCS, [\n#     (c, opts) -> BinSplit(c, opts), RCSE,\n#     MarkDefUse, DFSChain, CopyPropagate,\n#     Compile.declareVars\n# ]);\n\n# FFTW_CS := Concatenation(BaseCS, [\n#     (c, opts) -> BinSplit(c, opts), RCSE,\n#     MarkDefUse, FFTWScheduleAssignments, CopyPropagate,\n#     Compile.declareVars\n# ]);\n\n#\n# FMA\n#\nFMA_CS := Concatenation(BaseCS, [\n    (c, opts) -> BinSplit(c, opts), (c, opts) -> BinSplit(c, opts), CSE,\n    MarkDefUse, DFSChain, CopyPropagate,\n    DoFMA,\n    Compile.declareVars\n]);\n\nFMA_FFTW_CS := Concatenation(BaseCS, [\n    (c, opts) -> BinSplit(c, opts), (c, opts) -> BinSplit(c, opts), CSE,\n    MarkDefUse, FMA, ClearDefUse,\n    MarkDefUse, FFTWScheduleAssignments, CopyPropagate,\n    DoFMA,\n    Compile.declareVars\n]);\n\n# # seems to be slower\n# NewUnrollCS := [\n#     myUnrollCode, CopyPropagate,\n#     HashConstantsCode,\n#     MarkDefUse, DFSChain, CopyPropagate,\n#     Compile.declareVars\n# ];\n\n# CompileStrategyFull := [\n#     Compile.pullDataDeclsRefs, \n#     UnrollCode, FlattenCode, SSA,  CopyPropagate,\n#     FoldIf, SSA, CopyPropagate,   # Remove dead IF branches\n# #    Compile.scalarize,\n#     SSA, CopyPropagate,\n#     EliminatePhiSSA, CopyPropagate, # Eliminate Phi functions\n#     HashConstantsCode,\n#     (c, opts) -> BinSplit(c, opts), CSE, CopyPropagate,  # CSE\n#     MarkDefUse, #DFSChain,\n#     Compile.declareVars\n# ];\n\n# This compile strategy is safe for IFs inside basic blocks. but does not\n# fully perform copy propagation. Thus the name 'conservative'. To fully and\n# safely optimize, we need to extend the CopyPropagate pass\n#\nconservativeCompileSSA := [\n    Compile.pullDataDeclsRefs, # -- 1\n    Compile.fastScalarize,     # -- 2\n    UnrollCode,    # -- 3\n    FlattenCode,   # -- 4\n#    SimpIndicesCode, # -- 5   (YSV: simpIndices was disabled before, not clear why)\n    FoldIf,        # -- 6   FoldIf happens before SSA and SSA has to happen before Copyprop\n    SSA,           # -- 7\n    UntangleChain, # -- 8\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(doScalarReplacement:=false))),  # -- 9\n    (c, opts) -> HashConsts(c, opts),                                                  # -- 10\n    (c, opts) -> When(IsBound(opts.useDeref) and opts.useDeref, DerefNthCode(c), c), # -- 11\n    MarkPreds,\n    (c, opts) -> BinSplit(c, opts),                                                        # -- 12, 13\n    MarkDefUse,\n    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(doScalarReplacement:=false))), # 14\n    EliminatePhiSSA, \n    Compile.declareVars\n];\n\n\nCompileSSA := [\n    Compile.pullDataDeclsRefs,\n    Compile.fastScalarize, UnrollCode,\n    FlattenCode,\n    FoldIf,\n    UntangleChain,\n    CopyPropagate,\n    SSA,\n    (c, opts) -> HashConsts(c, opts), \n    (c, opts) -> When(IsBound(opts.useDeref) and opts.useDeref, DerefNthCode(c), c),\n    MarkPreds,\n    (c, opts) -> BinSplit(c, opts),\n    ClearDefUse,\n    MarkDefUse,\n    CopyPropagate,\n    EliminatePhiSSA,\n    CopyPropagate,\n    Compile.declareVars\n];\n\n\n", "meta": {"hexsha": "7969475cdd0d236683a3909aaebe57f001b980b3", "size": 9378, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/strategy.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/strategy.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/strategy.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 32.4498269896, "max_line_length": 107, "alphanum_fraction": 0.6282789507, "num_tokens": 2814, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3007455664065234, "lm_q2_score": 0.04208772356010582, "lm_q1q2_score": 0.012657696260845204}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(SSEUnparser);\n\n_toReal := v -> Cond(IsValue(v), Value(TReal, v.v), tcast(TReal, v));\n\n@Value      := @.cond(IsValue);\n@TInt       := @.cond(x->IsIntT(x.t));\n@TReal      := @.cond(x->IsRealT(x.t));\n@TRealInt   := @.cond(x->IsIntT(x.t) or IsRealT(x.t));\n@_scalar    := @.cond(x->IsIntT(x.t) or IsRealT(x.t) or IsPtrT(x.t));\n@TVect      := @.cond(x->IsVecT(x.t));\n@TVectUChar := @.cond(x->IsVecT(x.t) and ObjId(x.t.t)=TUChar);\n\n_isa := self -> self.opts.vector.isa;\n_epi_or_px := (self, o) -> When(_isa(self).isFixedPoint or IsOrdT(o.t.t),\n    \"epi\" :: self.ctype_suffixval(o.t, _isa(self)),\n    self.ctype_suffix(o.t, _isa(self)));\n\n_epu_or_px := (self, o) -> When(_isa(self).isFixedPoint,\n    \"epu\" :: self.ctype_suffixval(o.t, _isa(self)),\n    self.ctype_suffix(o.t, _isa(self)));\n\n_epi := (self, o) -> Concat(\"epi\", self.ctype_suffixval(o.t, _isa(self)));\n\n_epu_to_epi := (s) -> Cond( s{[1..3]} = \"epu\", \"epi\" :: s{[4..Length(s)]}, s );\n\n\nClass(SSEUnparser, CMacroUnparserProg, rec(\n    # -----------------------------\n    # ISA independent constructs\n    # -----------------------------\n    nth := (self, o, i, is) >> self.printf(\"$1[$2]\", [o.loc, o.idx]),\n    fdiv := (self, o, i, is) >> self.printf(\"(((double)$1) / ($2))\", o.args),\n    div  := (self, o, i, is) >> self.printf(\"(($1) / ($2))\", o.args),\n    idiv := (self, o, i, is) >> self.printf(\"(($1) / ($2))\", o.args),\n\n    # --------------------------------\n    # ISA constructs, general\n    # -------------------------------\n\n    # This is a general suffix for intrinsics that is determine from the data type\n    ctype_suffix := (self, t, isa) >> Cond(\n        t = TVect(T_Int(128), 1),  \"epi128\",\n        t = TVect(T_UInt(128), 1), \"epu128\",\n\n        t = TVect(T_Real(32), 4) or\n        t = TVect(T_Real(32), 2) and isa=SSE_2x32f or\n        t = TVect(TReal, 4) and isa=SSE_4x32f or\n        t = TVect(TReal, 2) and isa=SSE_2x32f,\n        \"ps\",\n\n        # no way to create __m64 type directly from floats, have to go thru integers\n        t = TVect(T_Real(32), 2) and isa=SSE_4x32f or\n        t = TVect(TReal, 2) and isa=SSE_4x32f,\n        \"ps_half\",\n\n        t = TVect(TInt, 4) or\n        t = TVect(T_Int(32), 4) or\n        t = TVect(TReal, 4) and isa.isFixedPoint,\n        \"epi32\",\n\n        t = TVect(T_UInt(32), 4), \"epu32\",\n\n        t = TVect(T_Real(64), 2) or\n        t = TVect(TReal, 2) and isa=SSE_2x64f,\n        \"pd\",\n\n        t = TVect(TInt, 2) or\n        t = TVect(T_Int(64), 2) or\n        t = TVect(TReal, 2) and isa.isFixedPoint,\n        \"epi64\",\n\n        t = TVect(T_UInt(64), 2), \"epu64\",\n\n        t = TVect(T_Int(16),  8), \"epi16\",\n        t = TVect(T_UInt(16), 8), \"epu16\",\n        t = TVect(TInt,       8), \"epi16\",\n        t = TVect(TReal,      8), \"epi16\",\n\n        t = TVect(T_Int(8),  16), \"epi8\",\n        t = TVect(T_UInt(8), 16), \"epu8\",\n        t = TVect(TReal,     16), When(isa.isSigned, \"epi8\", \"epu8\"),\n        t = TVect(TInt,      16), \"epi8\",\n        t = TVect(TUChar,    16), \"epu8\",\n        \"\"\n    ),\n\n    mul_suffix := (t,isa) -> Cond(\n        t = TVect(T_Real(32), 2), \"_ps\",\n        t = TVect(T_Real(32), 4), \"_ps\",\n        t = TVect(T_Real(64), 2), \"_pd\",\n        t = TVect(TReal, 2) and isa = SSE_2x32f, \"_ps\",\n        t = TVect(TReal, 2), \"_pd\",\n        t = TVect(TInt, 2), \"_epi64\",\n        t = TVect(TReal, 4), \"_ps\",\n        t = TVect(TInt, 4), \"_epi32\",\n        t = TVect(T_Int(32), 4), \"lo_epi32\",\n        t = TVect(TReal, 8), \"lo_epi16\",\n        t = TVect(TReal, 16), Error(\"16-way multiplication is not supported\"),\n        t = TVect(TUChar, 16), Error(\"16-way multiplication is not supported\"),\n        \"\"\n    ),\n\n    # This is a general suffix for intrinsics that is determine from the data type\n    ctype_suffixval := (t, isa) -> Cond(\n\tt = TVect(TReal, 2), \"64\",\n\tt = TVect(TInt, 4), \"32\",\n\tt = TVect(TReal, 4), \"32\",\n\tt = TVect(T_Int(32), 4), \"32\",\n    t = TVect(T_UInt(32), 4), \"32\",\n\tt = TVect(TReal, 8), \"16\",\n\tt = TVect(TInt, 8), \"16\",\n\tt = TVect(T_Int(16), 8), \"16\",\n    t = TVect(T_UInt(16), 8), \"16\",\n\tt = TVect(TReal, 16), \"8\",\n\tt = TVect(TInt, 16), \"8\",\n\tt = TVect(T_Int(8), 16), \"8\",\n    t = TVect(T_UInt(8), 16), \"8\",\n\tt = TVect(TUChar, 16), \"8\",\n\tt = TVect(T_Real(32), 4), \"32\",\n\tt = TVect(T_Real(64), 2), \"64\",\n\t\"\"\n    ),\n\n    # This is the type used for declarations of vector variables\n    ctype := (self, t, isa) >> Cond(\n        # NOTE: used for unaligned vector pointers,for single prec, it should be \"float\"\n\tt in [TReal, TVect(TReal, 1)],\n            Cond(isa = SSE_2x64f, \"double\",\n\t\t isa = SSE_2x64i, \"__int64\",\n\t\t isa = SSE_4x32f, \"float\",\n\t\t isa = SSE_2x32f, \"float\",\n\t\t isa = SSE_4x32i, \"__int32\",\n\t\t isa = SSE_8x16i, \"short\",\n\t\t isa = SSE_16x8i, Cond(isa.isSigned, \"char\", \"unsigned char\"),\n\t\t isa.ctype),\n\n\tt = TVect(TReal, 2),\n            Cond(isa = SSE_2x64f, \"__m128d\",\n\t\t isa = SSE_2x64i, \"__m128i\",\n\t\t isa = SSE_4x32f, \"__m64\",\n\t\t isa = SSE_8x16i, \"__int32\",\n\t\t isa = SSE_16x8i, \"__int16\",\n\t\t isa = SSE_2x32f, \"__m64\"),\n\n\tt = TVect(TReal, 4),\n            Cond(isa = SSE_4x32f, \"__m128\",\n\t\t isa = SSE_2x32f, \"__m128\",\n\t\t isa = SSE_4x32i, \"__m128i\"),\n\n        t = TVect(TInt,    2), \"__m128i\",\n\tt = TVect(TInt,    4), \"__m128i\",\n\tt = TVect(TInt,    8), \"__m128i\",\n\tt = TVect(TReal,   8), \"__m128i\",\n\tt = TVect(TInt,   16), \"__m128i\",\n\tt = TVect(TUChar, 16), \"__m128i\",\n\tt = TVect(TReal,  16), \"__m128i\",\n\n\tt = TInt,\n            Cond(isa = SSE_2x64i, \"__int64\",\n\t\t isa = SSE_4x32i, \"__int32\",\n\t\t isa = SSE_8x16i, \"short\",\n\t\t isa = SSE_16x8i, \"char\",\n\t\t \"int\"),\n\n\tt = TVect(T_Int(128), 1), \"__m128i\",\n\tt = TVect(T_Int(64),  2), \"__m128i\",\n\tt = TVect(T_Int(32),  4), \"__m128i\",\n\tt = TVect(T_Int(16),  8), \"__m128i\",\n\tt = TVect(T_Int(8),  16), \"__m128i\",\n\n\tt = TVect(T_UInt(128), 1), \"__m128i\",\n\tt = TVect(T_UInt(64),  2), \"__m128i\",\n\tt = TVect(T_UInt(32),  4), \"__m128i\",\n\tt = TVect(T_UInt(16),  8), \"__m128i\",\n\tt = TVect(T_UInt(8),  16), \"__m128i\",\n\n        t = TVect(T_Real(32), 2), \"__m64\",\n\tt = TVect(T_Real(32), 4), \"__m128\",\n\tt = TVect(T_Real(64), 2), \"__m128d\",\n\tError(self,\".ctype doesn't know type \",t)\n    ),\n\n    cvalue_suffix  := (self, t)  >> let( isa := _isa(self), Cond(\n        (t = TReal and isa in [SSE_2x32f, SSE_4x32f]) or t = T_Real(32), \"f\",\n        (t = TReal) or t = T_Real(64), \"\",\n        Error(self,\".cvalue_suffix doesn't know type \",t)\n    )),\n\n    vhex := (self, o, i, is) >> Print(\"_mm_set_\", _epi(self, o), \"(\", self.infix(Reversed(o.p), \", \"), \")\"),\n\n    Value := (self, o, i, is) >> let(zero := \"0\" :: self.cvalue_suffix(TReal), Cond(\n        o.t = TString, Print(o.v),\n\n        o.t = TReal or ObjId(o.t)=T_Real, let(v := When(IsCyc(o.v), ReComplex(Complex(o.v)), Double(o.v)),\n            When(v<0, Print(\"(\", v, self.cvalue_suffix(o.t), \")\"), Print(v, self.cvalue_suffix(o.t)))),\n\n        #IsComplexT(o.t),\n\t#    Print(\"COMPLEX(\", ReComplex(Complex(o.v)), self.cvalue_suffix(o.t.realType()), \", \",\n\t#        ImComplex(Complex(o.v)), self.cvalue_suffix(o.t.realType()), \")\"),\n\n        IsIntT(o.t) or IsUIntT(o.t),\n            When(o.v < 0, Print(\"(\", o.v, \")\"), Print(o.v)),\n\n        ObjId(o.t) = TVect and _isa(self) = SSE_2x32f,\n            Cond(self.cx.isInside(Value) and Length(self.cx.Value) >= 2, # nested in an array\n\t\t Print(          \"{\", zero, \", \", zero, \", \", self.infix((o.v), \", \"), \"}\"),\n\t\t Print(\"_mm_set_ps(\", zero, \", \", zero, \", \", self.infix(Reversed(o.v), \", \"), \")\")),\n\n        ObjId(o.t) = TVect and Length(Set(o.v)) = 1,\n            Cond(self.cx.isInside(Value) and Length(self.cx.Value) >= 2, # nested in an array\n\t\t Print(\"{\", self.infix(Replicate(o.t.size, o.v[1]), \", \"), \"}\"),\n\t\t Print(\"_mm_set1_\", _epi_or_px(self, o), \"(\", self(o.v[1], i, is), \")\")),\n\n        ObjId(o.t) = TVect,\n            Cond(self.cx.isInside(Value) and Length(self.cx.Value) >= 2, # nested in an array\n\t\t Print(                                 \"{\", self.infix((o.v), \", \"), \"}\"),\n\t\t Print(\"_mm_set_\", _epi_or_px(self, o), \"(\", self.infix(Reversed(o.v), \", \"), \")\")),\n\n        IsArray(o.t),\n            Print(\"{\", self.infix(o.v, \", \"), \"}\"),\n\n        ObjId(o.t) = TSym,\n            Print(\"(\", self.declare(o.t, [], 0, 0), \") \", o.v),\n\n        o.t = TBool, Print(When(o.v = true, \"1\", \"0\")),\n\n\tInherited(o, i, is)\n    )),\n\n    vpack := (self, o, i, is) >> let(\n        sfx := _epi_or_px(self, o),\n        Print(\"_mm_set_\", sfx, \"(\", self.infix(Reversed(o.args), \", \"), \")\")),\n\n    vdup := (self, o, i, is) >> let(\n\tsfx := _epi_or_px(self, o),\n        CondPat(o,\n            [vdup, nth, @.cond(x->x.t=TInt and x.v=2)], self.printf(\"_mm_loaddup_$1(&($2))\", [sfx, o.args[1]]),\n            [vdup, @, @TInt], self.printf(\"_mm_set1_$1($2)\", [sfx, o.args[1]]))),\n\n    # --------------------------------\n    # Declarations\n    _declTVect := (self, t, vars, i, is) >> let(ctype := self.ctype(t, _isa(self)), Print(ctype, \" \", self.infix(vars, \", \", i+is))),\n    _unparseTVect := (self, t, i, is) >> let(ctype := self.ctype(t, _isa(self)), Print(ctype)),\n\n    TVect := arg >> When(Length(arg)=5, arg[1]._declTVect(arg[2], arg[3], arg[4], arg[5]),\n\t                                arg[1]._unparseTVect(arg[2], arg[3], arg[4])),\n    TReal := ~.TVect,\n    TInt  := (self, t, vars, i, is) >> Print(\"int \", self.infix(vars, \", \", i+is)),\n    TBool := (self, t, vars, i, is) >> Print(\"int \", self.infix(vars, \", \", i+is)),\n\n    # --------------------------------\n    # Arithmetic\n    #\n    mul := (self, o, i, is) >> let(n := Length(o.args), Cond(\n        not IsVecT(o.t),\n            Print(\"(\",self.pinfix(o.args, \")*(\"),\")\"),\n\tn > 2 and n mod 2 <> 0,\n            self(mul(o.args[1], ApplyFunc(mul, Drop(o.args, 1))), i, is),\n        n > 2,\n            self(mul(ApplyFunc(mul, o.args{[1..n/2]}), ApplyFunc(mul, o.args{[n/2+1..n]})), i, is),\n        CondPat(o,\n\t    [mul, @TReal, @TVect], Cond(_isa(self) = SSE_2x32f,\n                self(mul(vdup(o.args[1], 4), o.args[2]), i, is), # NOTE: HACK for SSE_2x32f\n                self(mul(vdup(o.args[1], o.t.size), o.args[2]), i, is)),\n\t    [mul, @TVect, @TReal],  self(mul(o.args[1], vdup(o.args[2],o.t.size)), i, is),\n            # NOTE: This hack is probably no longer necessary (was used for PRDFTs)\n\t    [mul, @(1, cond, e -> e.t=TInt), @TVect],\n\t        self(mul(cond(o.args[1].args[1],\n\t\t\t      vdup(o.t.t.value(o.args[1].args[2]), o.t.size),\n\t\t\t      vdup(o.t.t.value(o.args[1].args[3]), o.t.size)), o.args[2]), i, is),\n\t    [mul, @TInt, @TVect],  self(mul(vdup(_toReal(o.args[1]),o.t.size), o.args[2]), i, is),\n\t    [mul, @TVect, @TInt],  self(mul(o.args[1], vdup(_toReal(o.args[2]),o.t.size)), i, is),\n\t    [mul, @TVect, @TVect], self.printf(\"_mm_mul$1($2, $3)\", [self.mul_suffix(o.t, _isa(self)), o.args[1], o.args[2]]),\n\t    Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n    ))),\n\n    fpmul := (self, o, i, is) >> let(isa := _isa(self), CondPat(o,\n        # preparing for SSSE3 _mm_mulhrs_epi16 (__m128i a, __m128i b)\n        # self.printf(\"_mm_mulhrs_epi16($1, $2)\", [o.args[2], o.args[3].t.value(List(o.args[3].v, i->bin_shl(i,1)))]),\n        [fpmul, @, @TVect, @], self.printf(\"$1($2($3, $4), $5)\",\n\t    [isa.vlshift, isa.vmul, o.args[2], o.args[3], isa.bits-o.args[1]]),\n\n        [fpmul, @, @, @],      self.printf(\"$1($2(_mm_set1_$3($4), $5), $6)\",\n\t    [isa.vlshift, isa.vmul, self.ctype_suffix(o.t, _isa(self)), o.args[2], o.args[3], isa.bits-o.args[1]]))),\n\n    add := (self, o, i, is) >> let(n := Length(o.args), Cond(\n\tnot IsVecT(o.t),\n            self.pinfix(o.args, \" + \"),\n        n > 2 and n mod 2 <> 0,\n            self(add(o.args[1], ApplyFunc(add, Drop(o.args, 1))), i, is),\n        n > 2,\n            self(add(ApplyFunc(add, o.args{[1..n/2]}), ApplyFunc(add, o.args{[n/2+1..n]})), i, is),\n        let(isa := _isa(self), # ugly, backward compatibility, use <adds> instead\n\t    saturated := When(IsBound(isa.isFloat) and IsBound(isa.saturatedArithmetic) and not isa.isFloat and isa.saturatedArithmetic, \"s\", \"\"),\n\t    _sfx      := self.ctype_suffix(o.t, isa),\n\t    sfx       := Cond( saturated=\"\", _epu_to_epi(_sfx), _sfx),\n\t    CondPat(o,\n\t\t[add, @TVect,   @TVect], self.printf(\"_mm_add$1_$2($3, $4)\", [saturated, sfx, o.args[1], o.args[2]]),\n\t\tError(\"Don't know how to unparse <o>. Unrecognized type combination\"))))),\n\n    adds := (self, o, i, is) >> CondPat(o,\n\t\t[adds, @TVect, @TVect, ...],\n\t\t    Cond( Length(o.args)>2,\n\t\t        self(adds(o.args[1], brackets(ApplyFunc(adds, Drop(o.args, 1)))), i, is),\n\t\t        self.printf(\"_mm_adds_$1($2, $3)\", [self.ctype_suffix(o.t, rec()), o.args[1], o.args[2]])),\n\t\tInherited(o, i, is)),\n\n    _sub := (self, t, a, i, is) >> let(\n\tisa := _isa(self),\n\tsfx := _epu_to_epi(self.ctype_suffix(t, isa)),\n\tsaturated := When(IsBound(isa.isFloat) and IsBound(isa.saturatedArithmetic) and not isa.isFloat and isa.saturatedArithmetic, \"s\", \"\"),\n\tCondPat(a,\n            [ListClass, @TVect,   @TVect], self.printf(\"_mm_sub$1_$2($3, $4)\", [saturated, sfx, a[1], a[2]]),\n            [ListClass, @, @],             self.printf(\"($1 - ($2))\", a),\n            Error(\"Don't know how to unparse subtraction of a[1] and a[2]. Unrecognized type combination\"))),\n\n    sub := (self, o, i, is) >> self._sub(o.t, o.args, i, is),\n\n    neg := (self, o, i, is) >> CondPat(o,\n        [@, @TVect], self._sub(o.t, [o.t.zero(), o.args[1]], i, is),\n        self.printf(\"(-$1)\", o.args)),\n\n    stickyNeg := ~.neg,\n\n    sqrt  := (self, o, i, is) >> Cond( IsVecT(o.t),\n        Checked( IsRealT(o.t.t), self.printf(\"_mm_sqrt_$1($2)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1]])),\n        Inherited(o, i, is)),\n\n    rsqrt := (self, o, i, is) >> Cond( IsVecT(o.t), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx=\"ps\", self.printf(\"_mm_rsqrt_ps($1)\", [o.args[1]]))),\n        Inherited(o, i, is)),\n\n    # assuming we have ICC <ia32intrin.h> here\n    log := (self, o, i, is) >> Cond( IsVecT(o.t), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx in [\"ps\", \"pd\"], Cond(\n            Length(o.args)>1 and (o.args[2]=2 or o.args[2]=o.t.value(2)),\n                self.printf(\"_mm_log2_$1($2)\", [sfx, o.args[1]]),\n            Length(o.args)>1 and (o.args[2]=10 or o.args[2]=o.t.value(10)),\n                self.printf(\"_mm_log10_$1($2)\", [sfx, o.args[1]]),\n            Length(o.args)=1 or o.args[2]=d_exp(1) or o.args[2]=o.t.value(d_exp(1)),\n                self.printf(\"_mm_log_$1($2)\", [sfx, o.args[1]]),\n            self.printf(\"_mm_div_$1(_mm_log_$1($2), _mm_log_$1($3))\", [sfx, o.args[1]])))),\n        Inherited(o, i, is)),\n\n    # assuming we have ICC <ia32intrin.h> here\n    exp := (self, o, i, is) >> Cond( IsVecT(o.t), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx in [\"ps\", \"pd\"], self.printf(\"_mm_exp_$1($2)\", [sfx, o.args[1]]))),\n        Inherited(o, i, is)),\n\n    # assuming we have ICC <ia32intrin.h> here\n    pow := (self, o, i, is) >> Cond( IsVecT(o.t), let( sfx := self.ctype_suffix(o.t, _isa(self)),\n        Checked( sfx in [\"ps\", \"pd\"], Cond(\n            o.args[1]=2 or o.args[1]=o.t.value(2),\n                self.printf(\"_mm_exp2_$1($2)\", [sfx, o.args[2]]),\n            o.args[1]=d_exp(1) or o.args[1]=o.t.value(d_exp(1)),\n                self.printf(\"_mm_exp_$1($2)\", [sfx, o.args[2]]),\n            self.printf(\"_mm_pow_$1($2, $3)\", [sfx, o.args[1], o.args[2]])))),\n        Inherited(o, i, is)),\n\n    imod  := (self, o, i, is) >> Cond( IsIntT(o.t.base_t()) and Is2Power(o.args[2]),\n        # in two's complement arithmetics this will work for both positive and negative o.args[1]\n        self(bin_and(o.args[1], o.args[2]-1), i, is),\n        self.printf(\"(($1) % ($2))\", o.args)),\n\n    # --------------------------------\n    # logic\n    #\n    arith_shl := (self, o, i, is) >> self.prefix(_isa(self).vlshift, o.args),\n    arith_shr := (self, o, i, is) >> CondPat( o,\n        [arith_shr, @.cond(x->x.t=TVect(T_Int(32), 4)), @],\n            self.prefix(\"_mm_srai_epi32\", o.args),\n        [arith_shr, @.cond(x->x.t=TVect(T_Int(16), 8)), @],\n            self.prefix(\"_mm_srai_epi16\", o.args),\n        [arith_shr, @TVect, @],\n            self.prefix(_isa(self).vrshift, o.args),\n        Inherited(o, i, is)),\n\n    bin_xor := (self, o, i, is) >> CondPat(o,\n                [bin_xor, @TVect, @TVect], self.prefix(\"_mm_xor_si128\", o.args),\n                Inherited(o, i, is)),\n    bin_and := (self, o, i, is) >> CondPat(o,\n                [bin_and, @TVect, @TVect], self.prefix(\"_mm_and_si128\", o.args),\n                Inherited(o, i, is)),\n\n    bin_andnot := (self, o, i, is) >> self.prefix(\"_mm_andnot_si128\", o.args),\n\n    bin_or := (self, o, i, is) >> CondPat(o,\n        [bin_or, @TVect, @TVect], let(sfx := self.ctype_suffix(o.t, _isa(self)),\n\t    Cond( not (sfx in [\"ps\", \"pd\", \"ps_half\"]), #was: _isa(self).isFixedPoint,\n\t\tself.printf(\"_mm_or_si128($1, $2)\", o.args),\n\t\tself.printf(\"_mm_castsi128_$3(_mm_or_si128(_mm_cast$3_si128($1), _mm_cast$3_si128($2)))\",\n\t\t            o.args :: [sfx]))),\n        [bin_or, @TReal, @TReal], self.printf(\"(($1) | ($2))\", o.args),\n\n\tInherited(o, i, is)),\n\n    min := (self, o, i, is) >> CondPat(o,\n        [min, @TVect, @TVect], self.prefix(\"_mm_min_\" :: self.ctype_suffix(o.t, _isa(self)), o.args),\n            Inherited(o, i, is)),\n\n    max := (self, o, i, is) >> let(n := Length(o.args), When(\n    \tIsVecT(o.t) and n > 2, self.printf(\"_mm_max_$1($2, $3)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1], ApplyFunc(max, Drop(o.args, 1))]),\n        CondPat(o,\n            [max, @TVect, @TVect], self.prefix(\"_mm_max_\" :: self.ctype_suffix(o.t, _isa(self)), o.args),\n                Inherited(o, i, is)))),\n\n    abs := (self, o, i, is) >> CondPat(o,\n        [abs, @TVect], let( sfx := self.ctype_suffix(o.t, _isa(self)),\n                            Cond( sfx = \"ps\", self.printf(\"_mm_castsi128_ps(_mm_and_si128(_mm_castps_si128($1), _mm_set_epi32(0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF)))\", o.args),\n                                  sfx = \"pd\", self.printf(\"_mm_castsi128_pd(_mm_and_si128(_mm_castpd_si128($1), _mm_set_epi32(0x7FFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF)))\", o.args),\n                                  Error(\"not implemented\"))),\n            Inherited(o, i, is)),\n\n    bin_shl := (self, o, i, is) >> CondPat(o,\n        [bin_shl, @TVect, @TInt], let(\n            sfx := self.ctype_suffix(o.t, _isa(self)),\n\t    Cond( _isa(self).isFixedPoint,                            # legacy\n\t\t     self.printf(\"_mm_slli_si128($1, $2)\", o.args),   # legacy\n\t\t  sfx in [\"epi16\", \"epi32\", \"epi64\", \"epu16\", \"epu32\", \"epu64\"],\n\t\t      self.printf(\"_mm_slli_$3($1, $2)\", o.args :: [_epu_to_epi(sfx)]),\n\t\t  sfx in [\"epi8\", \"epu8\"],\n\t\t      Error(\"bin_shl is undefined for epi8 and epu8\"),\n\t\t  sfx in [\"epi128\", \"epu128\"], # shift with byte granularity\n\t\t      self.printf(\"_mm_slli_si128($1, $2)\", [o.args[1], idiv(o.args[2], 8)] ),\n\t\t  # else, shift whole register with shift argument specified in bytes (legacy, fix using epi128 in ISAs first)\n\t\t  self.printf(\"_mm_castsi128_$3(_mm_slli_si128(_mm_cast$3_si128($1), $2))\", o.args :: [sfx]))),\n        [bin_shl, @TReal, @TInt], self.printf(\"(($1) << ($2))\", o.args),\n        [bin_shl, @TInt, @TInt], self.printf(\"(($1) << ($2))\", o.args),\n        [bin_shl, @, @], self.prefix(\"_mm_slli_\" :: self.ctype_suffix(o.t, _isa(self)), o.args)),\n\n    bin_shr := (self, o, i, is) >> CondPat(o,\n        [bin_shr, @TVect, @TInt], let(\n            sfx := self.ctype_suffix(o.t, _isa(self)),\n\t    Cond( _isa(self).isFixedPoint,                            # legacy\n\t\t      self.printf(\"_mm_srli_si128($1, $2)\", o.args),  # legacy\n\t\t  sfx in [\"epi16\", \"epi32\", \"epi64\", \"epu16\", \"epu32\", \"epu64\"],\n\t\t      self.printf(\"_mm_srli_$3($1, $2)\", o.args :: [_epu_to_epi(sfx)]),\n\t\t  sfx in [\"epi8\", \"epu8\"],\n\t\t      Error(\"bin_shr is undefined for epi8 and epu8\"),\n\t\t  sfx in [\"epi128\", \"epu128\"], # shift with byte granularity\n\t\t      self.printf(\"_mm_srli_si128($1, $2)\", [o.args[1], idiv(o.args[2], 8)] ),\n\t\t  # else, shift whole register with shift argument specified in bytes (legacy, fix using epi128 in ISAs first)\n\t\t  self.printf(\"_mm_castsi128_$3(_mm_srli_si128(_mm_cast$3_si128($1), $2))\", o.args :: [sfx]))),\n\t# default\n\t[bin_shr, @TReal, @TInt], self.printf(\"(($1) >> ($2))\", o.args),\n\t[bin_shr, @TInt, @TInt], self.printf(\"(($1) >> ($2))\", o.args),\n\t# what's this?\n\t[bin_shr, @, @], self.prefix(\"_mm_srli_\" :: self.ctype_suffix(o.t, _isa(self)), o.args)),\n\n    # vector shifts\t\n    vec_shr := (self, o, i, is) >> let(\n        isa := _isa(self),\n        sfx := self.ctype_suffix(o.t, isa),\n        # making sure this is SSE data type\n        t   := Checked(IsVecT(o.t) and sfx<>\"\", o.t),\n        a   := o.args[1],\n        s   := o.args[2] * 16 / t.size,\n        # may need typecasts to please compiler\n        Cond( self.ctype(t, isa)=\"__m128i\",\n            self.printf(\"_mm_srli_si128($1, $2)\", [a, s] ),\n            self.printf(\"_mm_castsi128_$3(_mm_srli_si128(_mm_cast$3_si128($1), $2))\", [a, s, sfx])\n        )),\n\n    vec_shl := (self, o, i, is) >> let(\n        isa := _isa(self),\n        sfx := self.ctype_suffix(o.t, isa),\n        # making sure this is SSE data type\n        t   := Checked(IsVecT(o.t) and sfx<>\"\", o.t),\n        a   := o.args[1],\n        s   := o.args[2] * 16 / t.size,\n        # may need typecasts to please compiler\n        Cond( self.ctype(t, isa)=\"__m128i\",\n            self.printf(\"_mm_slli_si128($1, $2)\", [a, s] ),\n            self.printf(\"_mm_castsi128_$3(_mm_slli_si128(_mm_cast$3_si128($1), $2))\", [a, s, sfx])\n        )),\n\n    # --------------------------------\n    # comparison\n    #\n    eq := (self, o, i, is) >> let( ctype := self.ctype_suffix(o.args[1].t, _isa(self)),\n        sfx := _epu_to_epi(ctype),\n        Cond(IsVecT(o.t), self.prefix(\"_mm_cmpeq_\" :: sfx, o.args),\n            Inherited(o, i, is))),\n\n    lt := (self, o, i, is) >> Cond(IsVecT(o.t),\n        self.prefix(\"_mm_cmplt_\" :: self.ctype_suffix(o.args[1].t, _isa(self)), o.args),\n        Inherited(o, i, is)),\n\n    gt := (self, o, i, is) >> Cond(ObjId(o.t)=TVect,\n        self.prefix(\"_mm_cmpgt_\" :: self.ctype_suffix(o.args[1].t, _isa(self)), o.args),\n        Inherited(o, i, is)),\n\n    mask_eq := ~.eq,\n    mask_lt := ~.lt,\n    mask_gt := ~.gt,\n\n    vparam := (self, o, i, is) >> iclshuffle(o.p),\n\n    # --------------------------------\n    # ISA specific : SSE_2x64f\n    #\n    vunpacklo_2x64f := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_pd\", o.args),\n    vunpackhi_2x64f := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_pd\", o.args),\n    vshuffle_2x64f  := (self, o, i, is) >> self.prefix(\"_mm_shuffle_pd\", o.args),\n    vushuffle_2x64f := (self, o, i, is) >> self(o.binop(o.args[1], o.args[1], o.args[2]), i, is),\n\n    vload1sd_2x64f := (self, o, i, is) >> self.prefix(\"_mm_load_sd\", o.args),\n    vload_1l_2x64f := (self, o, i, is) >> self.prefix(\"_mm_loadl_pd\", o.args),\n    vload_1h_2x64f := (self, o, i, is) >> self.prefix(\"_mm_loadh_pd\", o.args),\n    vloadu_2x64f   := (self, o, i, is) >> self.prefix(\"_mm_loadu_pd\", o.args),\n\n    vstore_1l_2x64f := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storel_pd\", o.args), \";\\n\"),\n    vstore_1h_2x64f := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeh_pd\", o.args), \";\\n\"),\n    vstoreu_2x64f   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeu_pd\", o.args), \";\\n\"),\n\n    addsub_2x64f := (self, o, i, is) >> Checked(Length(o.args) = 2,\n        CondPat(o,\n           [addsub_2x64f, @TReal, @TVect], self(addsub_2x64f(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n           [addsub_2x64f, @TVect, @TReal], self(addsub_2x64f(o.args[1], vdup(o.args[2], o.t.size)), i, is),\n           [addsub_2x64f, @TInt,  @TVect], self(addsub_2x64f(vdup(_toReal(o.args[1]), o.t.size), o.args[2]), i, is),\n           [addsub_2x64f, @TVect, @TInt],  self(addsub_2x64f(o.args[1], vdup(_toReal(o.args[2]), o.t.size)), i, is),\n           [addsub_2x64f, @TVect, @TVect], self.printf(\"_mm_addsub_pd($1, $2)\", o.args),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n    )),\n\n    hadd_2x64f := (self, o, i, is) >> self.printf(\"_mm_hadd_pd($1, $2)\", [o.args[1], o.args[2]]),\n\n    chslo_2x64f := (self, o, i, is) >> self.printf(\n\t\"_mm_castsi128_pd(_mm_xor_si128(_mm_castpd_si128($1), _mm_set_epi32(0, 0, 0x80000000, 0)))\", o.args),\n    chshi_2x64f := (self, o, i, is) >> self.printf(\n\t\"_mm_castsi128_pd(_mm_xor_si128(_mm_castpd_si128($1), _mm_set_epi32(0x80000000, 0, 0, 0)))\", o.args),\n    chshi_4x32f := (self, o, i, is) >> self.printf(\n\t\"_mm_castsi128_ps(_mm_xor_si128(_mm_castps_si128($1), _mm_set_epi32(0x80000000, 0, 0x80000000, 0)))\", o.args),\n    chslo_4x32f := (self, o, i, is) >> self.printf(\n\t\"_mm_castsi128_ps(_mm_xor_si128(_mm_castps_si128($1), _mm_set_epi32(0, 0x80000000, 0, 0x80000000)))\", o.args),\n\n    vcvt_64f32f := (self, o, i, is) >> self.prefix(\"_mm_cvtps_pd\", o.args),\n\n    cmpge_2x64f := (self, o, i, is) >> self.prefix(\"_mm_cmpge_pd\", o.args),\n\n    cmple_2x64f := (self, o, i, is) >> self.prefix(\"_mm_cmple_pd\", o.args),\n    cmpeq_2x64f := (self, o, i, is) >> self.prefix(\"_mm_cmpeq_pd\", o.args),\n\n\n    # --------------------------------\n    # ISA specific : SSE_2x32f\n    #\n    vunpacklo_2x32f := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_ps\", o.args),\n    vunpackhi_2x32f := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_ps\", o.args),\n    vshuffle_2x32f  := (self, o, i, is) >> self.prefix(\"_mm_shuffle_ps\", o.args),\n    vushuffle_2x32f := (self, o, i, is) >> self(o.binop(o.args[1], o.args[1], o.args[2]), i, is),\n    vload_2x32f     := (self, o, i, is) >> self.prefix(\"_mm_loadl_pi\", o.args),\n    vstore_2x32f    := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storel_pi\", o.args), \";\\n\"),\n    vstoreu_2x32f   := (self, o, i, is) >> Print(Blanks(i), self.printf(\"_mm_storel_epi64($1, _mm_castps_si128($2));\\n\", o.args)),\n    vloadu_2x32f    := (self, o, i, is) >> self.printf(\"_mm_castsi128_ps(_mm_loadl_epi64($1))\", o.args),\n\n    # --------------------------------\n    # ISA specific : SSE_4x32f\n    #\n    prefix_cast := (self, prefix, t, o) >> Cond( self.ctype(t, _isa(self)) = self.ctype(o.t, _isa(self)), self.prefix(prefix, o.args),\n                                             self(tcast(o.t, ApplyFunc(ObjId(o), List(o.args, a -> Cond(IsExp(a), tcast(t, a), a)))), 0, 1)),\n\n    vunpacklo_4x32f := (self, o, i, is) >> self.prefix_cast(\"_mm_unpacklo_ps\", TVect(T_Real(32), 4), o),\n    vunpackhi_4x32f := (self, o, i, is) >> self.prefix_cast(\"_mm_unpackhi_ps\", TVect(T_Real(32), 4), o),\n    vshuffle_4x32f  := (self, o, i, is) >> self.prefix_cast(\"_mm_shuffle_ps\", TVect(T_Real(32), 4), o),\n    vushuffle_4x32f := (self, o, i, is) >> self(o.binop(o.args[1], o.args[1], o.args[2]), i, is),\n    hadd_4x32f  := (self, o, i, is) >> self.printf(\"_mm_hadd_ps($1, $2)\", [o.args[1], o.args[2]]),\n    vldup_4x32f := (self, o, i, is) >> self.prefix(\"_mm_moveldup_ps\", o.args),\n    vhdup_4x32f := (self, o, i, is) >> self.prefix(\"_mm_movehdup_ps\", o.args),\n\n    vinsert_4x32f  := (self, o, i, is) >> self.printf(\n\t\"_mm_castsi128_ps(_mm_insert_epi32(_mm_castps_si128($1), $2, $3))\", [o.args[1], o.args[2], o.args[3].p-1]),\n    vextract_4x32f := (self, o, i, is) >> Print(Blanks(i),\n\tself.printf(\"$1 = _mm_extract_ps($2, $3)\", [deref(o.args[1]), o.args[2], o.args[3]-1]), \";\\n\"),\n\n    vload1_4x32f   := (self, o, i, is) >> self.prefix(\"_mm_load_ss\", o.args),\n    vload_2l_4x32f := (self, o, i, is) >> self.prefix(\"_mm_loadl_pi\", o.args),\n    vload_2h_4x32f := (self, o, i, is) >> self.prefix(\"_mm_loadh_pi\", o.args),\n    vloadu_4x32f   := (self, o, i, is) >> self.printf(\"_mm_loadu_ps($1)\", o.args),\n    vloadu2_4x32f  := (self, o, i, is) >> self.printf(\"_mm_castsi128_ps(_mm_loadl_epi64($1))\", o.args),\n\n    vstore1_4x32f   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_store_ss\",  o.args), \";\\n\"),\n    vstore_2l_4x32f := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storel_pi\", o.args), \";\\n\"),\n    vstore_2h_4x32f := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeh_pi\", o.args), \";\\n\"),\n    vstoreu_4x32f   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeu_ps\", o.args), \";\\n\"),\n    vstoreu2_4x32f  := (self, o, i, is) >> Print(Blanks(i), self.printf(\"_mm_storel_epi64($1, _mm_castps_si128($2));\\n\",\n        o.args)),\n\n    vstoremsk_4x32f := (self, o, i, is) >> Print(Blanks(i),\n\tself.printf(\"_mm_maskmoveu_si128(_mm_castps_si128($2), _mm_set_epi32($3, $4, $5, $6), $1);\\n\",\n            [o.args[1], o.args[2]] :: List(Reversed(o.args[3].v), e->e.v))),\n\n    alignr_4x32f := (self, o, i, is) >> self.printf(\n\t\"_mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128($1), _mm_castps_si128($2), $3))\", [o.args[1], o.args[2], o.args[3].p]),\n\n    # --------------------------------\n    # ISA specific : SSE_8x16i\n    #\n    vzero_8x16i := (self, o, i, is) >> Print(\"_mm_setzero_si128()\"),\n\n    vunpacklo_8x16i  := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi16\", o.args),\n    vunpackhi_8x16i  := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi16\", o.args),\n    vunpacklo2_8x16i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi32\", o.args),\n    vunpackhi2_8x16i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi32\", o.args),\n    vunpacklo4_8x16i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi64\", o.args),\n    vunpackhi4_8x16i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi64\", o.args),\n\n    vpacks_8x16i     := (self, o, i, is) >> self.prefix(\"_mm_packs_epi16\",    o.args),\n    vpackus_8x16i    := (self, o, i, is) >> self.prefix(\"_mm_packus_epi16\",   o.args),\n\n    vshuffle2_8x16i := (self, o, i, is) >> self.printf(\n\t\"_mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps($1), _mm_castsi128_ps($2), $3))\", o.args),\n\n    vshuffle4_8x16i := (self, o, i, is) >> self.printf(\n\t\"_mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd($1), _mm_castsi128_pd($2), $3))\", o.args),\n\n    vload1_8x16i := (self, o, i, is) >> self.printf(\"_mm_insert_epi16($1, $2, $3)\", o.args),\n    vload2_8x16i := (self, o, i, is) >> self.prefix(\"_mm_cvtsi32_si128\", o.args),\n    vload4_8x16i := (self, o, i, is) >> self.prefix(\"_mm_loadl_epi64\", o.args),\n    vloadu_8x16i := (self, o, i, is) >> self.prefix(\"_mm_loadu_si128\", o.args),\n\n    vextract1_8x16i := (self, o, i, is) >> self.prefix(\"_mm_extract_epi16\", o.args),\n    vextract2_8x16i := (self, o, i, is) >> self.prefix(\"_mm_cvtsi128_si32\", o.args),\n    vstoreu_8x16i   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeu_si128\", o.args), \";\\n\"),\n    vstore4_8x16i   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storel_epi64\", o.args), \";\\n\"),\n    vstoremsk_8x16i := (self, o, i, is) >> Print(Blanks(i),\n\tself.printf(\"_mm_maskmoveu_si128($2, _mm_set_epi16($3), $1);\\n\",\n        [o.args[1], o.args[2], () -> PrintCS(Reversed(o.args[3]))])),\n\n    vushuffle2_8x16i  := (self, o, i, is) >> self(o.binop(o.args[1], o.args[1], o.args[2]), i, is),\n    vushufflelo_8x16i := (self, o, i, is) >> self.prefix(\"_mm_shufflelo_epi16\", o.args),\n    vushufflehi_8x16i := (self, o, i, is) >> self.prefix(\"_mm_shufflehi_epi16\", o.args),\n\n    interleavedmask_8x16i := (self, o, i, is) >> self.printf(\n\t\"_mm_movemask_epi8(_mm_unpacklo_epi8(_mm_packs_epi16($1, _mm_setzero_si128()), _mm_packs_epi16($2, _mm_setzero_si128())))\",\n\to.args),\n\n    alignr_8x16i := (self, o, i, is) >> self.printf(\"_mm_alignr_epi8($1, $2, $3)\", [o.args[1], o.args[2], o.args[3].p]),\n\n    # FF: NOTE: couldnt figure out how to use the general case with type propagation etc...\n    cmplt_8x16i := (self, o, i, is) >> self.printf(\"_mm_cmplt_epi16($1, $2)\", o.args),\n\n    # SSSE3 8x16i instructions\n    chs_8x16i := (self, o, i, is) >> self.prefix(\"_mm_sign_epi16\", o.args),\n    vushuffle_8x16i := (self, o, i, is) >> self.prefix(\"_mm_shuffle_epi8\", o.args),\n\n    # --------------------------------\n    # ISA specific : SSE_16x8i\n    #\n    vloadu_16x8i  := (self, o, i, is) >> self.prefix(\"_mm_loadu_si128\", o.args),\n    vstoreu_16x8i := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeu_si128\", o.args), \";\\n\"),\n\n    vunpacklo_16x8i  := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi8\", o.args),\n    vunpackhi_16x8i  := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi8\", o.args),\n    vunpacklo2_16x8i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi16\", o.args),\n    vunpackhi2_16x8i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi16\", o.args),\n    vunpacklo4_16x8i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi32\", o.args),\n    vunpackhi4_16x8i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi32\", o.args),\n    vunpacklo8_16x8i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi64\", o.args),\n    vunpackhi8_16x8i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi64\", o.args),\n\n    vushufflelo2_16x8i := (self, o, i, is) >> self.prefix(\"_mm_shufflelo_epi16\", o.args),\n    vushufflehi2_16x8i := (self, o, i, is) >> self.prefix(\"_mm_shufflehi_epi16\", o.args),\n    vushuffle4_16x8i   := (self, o, i, is) >> self.prefix(\"_mm_shuffle_epi32\", o.args),\n\n    interleavedmasklo_16x8i := (self, o, i, is) >> Print(\"_mm_movemask_epi8(_mm_unpacklo_epi8(\",o.args[1],\",\",o.args[2],\"))\"),\n    interleavedmaskhi_16x8i := (self, o, i, is) >> Print(\"_mm_movemask_epi8(_mm_unpackhi_epi8(\",o.args[1],\",\",o.args[2],\"))\"),\n    average_16x8i           := (self, o, i, is) >> Print(\"_mm_avg_epu8(\",o.args[1],\",\",o.args[2],\")\"),\n    vmovemask_16x8i         := (self, o, i, is) >> self.prefix(\"_mm_movemask_epi8\", o.args),\n\n    # XXX NOTE XXXX\n    # Also fix other vstoremsk's. The problem here is that after latest changes to Spiral\n    # the last argument (list of strings) in vstoremsg gets wrapped into V, and strings too\n    # this is super stupid+ugly\n    vstoremsk_16x8i := (self, o, i, is) >> Print(Blanks(i), self.printf(\"_mm_maskmoveu_si128($2, _mm_set_epi8($3), $1);\\n\",\n        [o.args[1], o.args[2], () -> PrintCS(Reversed(List(_unwrapV(o.args[3]), _unwrapV)))])),\n\n    addsub_4x32f := (self, o, i, is) >> Checked(Length(o.args) = 2,\n        CondPat(o,\n           [addsub_4x32f, @TReal, @TVect], self(addsub_4x32f(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n           [addsub_4x32f, @TVect, @TReal], self(addsub_4x32f(o.args[1], vdup(o.args[2],o.t.size)), i, is),\n           [addsub_4x32f, @TInt,  @TVect], self(addsub_4x32f(vdup(_toReal(o.args[1]),o.t.size), o.args[2]), i, is),\n           [addsub_4x32f, @TVect, @TInt],  self(addsub_4x32f(o.args[1], vdup(_toReal(o.args[2]),o.t.size)), i, is),\n           [addsub_4x32f, @TVect, @TVect], self.printf(\"_mm_addsub_ps($1, $2)\", [o.args[1], o.args[2]]),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n    )),\n\n    hadd_4x32f   := (self, o, i, is) >> self.printf(\"_mm_hadd_ps($1, $2)\", [o.args[1], o.args[2]]),\n\n    vloadu_16x8i := (self, o, i, is) >>  self.prefix(\"_mm_loadu_si128\", o.args),\n\n    # --------------------------------\n    # ISA specific : SSE_4x32i\n    #\n    vunpacklo_4x32i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi32\", o.args),\n    vunpackhi_4x32i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi32\", o.args),\n    vpacks_4x32i    := (self, o, i, is) >> self.prefix(\"_mm_packs_epi32\", o.args),\n    # 32 bit integer shuffles are *not* the same as 32 bit float, but similar to 16 bit integer shuffles\n    vushuffle_4x32i := (self, o, i, is) >> self.prefix(\"_mm_shuffle_epi32\", o.args),\n    vshuffle_4x32i  := (self, o, i, is) >> self.printf(\n\t\"_mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps($1), _mm_castsi128_ps($2), $3))\", o.args),\n\n    # subvector unparsing not yet done...\n    vload1_4x32i := (self, o, i, is) >> self.prefix(\"_mm_cvtsi32_si128\", o.args), #svpcprint guy\n    vload2_4x32i := (self, o, i, is) >> self.prefix(\"_mm_loadl_epi64\", o.args),\n    vload2_4x32i := (self, o, i, is) >> self.prefix(\"_mm_loadl_epi64\", o.args),\n    vloadu_4x32i := (self, o, i, is) >> self.prefix(\"_mm_loadu_si128\", o.args),\n\n    vextract_4x32i  := (self, o, i, is) >> self.prefix(\"_mm_cvtsi128_si32\", o.args),\n    vstoreu_4x32i   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storeu_si128\", o.args), \";\\n\"),\n    vstore2_4x32i   := (self, o, i, is) >> Print(Blanks(i), self.prefix(\"_mm_storel_epi64\", o.args), \";\\n\"),\n    vstoremsk_4x32i := (self, o, i, is) >> Print(Blanks(i),\n\tself.printf(\"_mm_maskmoveu_si128($2, _mm_set_epi16($3), $1);\\n\", [o.args[1], o.args[2], ()->PrintCS(Reversed(o.args[3]))])),\n        # complicated, buggy\n\n    interleavedmask_4x32i := (self, o, i, is) >> self.printf(\n\t\"_mm_movemask_epi8(_mm_packs_epi16(_mm_unpacklo_epi16(_mm_packs_epi16($1, $3), _mm_packs_epi16($2, $3)), $3))\",\n\to.args :: [\"_mm_setzero_si128()\"]),\n\n    vcvt_4x32_i2f  := (self, o, i, is) >> self.prefix(\"_mm_cvtepi32_ps\", o.args),\n    vcvt_4x32_f2i  := (self, o, i, is) >> self.prefix(\"_mm_cvtps_epi32\", o.args),\n    vcvtt_4x32_f2i := (self, o, i, is) >> self.prefix(\"_mm_cvttps_epi32\", o.args),\n\n    testz_4x32i := (self, o, i, is) >> self.prefix(\"_mm_testz_si128\", o.args),\n    testc_4x32i := (self, o, i, is) >> self.prefix(\"_mm_testc_si128\", o.args),\n    testnzc_4x32i := (self, o, i, is) >> self.prefix(\"_mm_testnzc_si128\", o.args),\n\n    # --------------------------------\n    # ISA specific : SSE_2x64i\n    #\n    vunpacklo_2x64i := (self, o, i, is) >> self.prefix(\"_mm_unpacklo_epi64\", o.args),\n    vunpackhi_2x64i := (self, o, i, is) >> self.prefix(\"_mm_unpackhi_epi64\", o.args),\n    vshuffle_2x64i  := (self, o, i, is) >> self.printf(\n\t\"_mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd($1), _mm_castsi128_pd($2), $3))\", o.args),\n    vushuffle_2x64i := (self, o, i, is) >> self(o.binop(o.args[1], o.args[1], o.args[2]), i, is),\n\n    # --------------------------------\n    # tcast __m128 <-> __m128i\n\n    tcast := (self, o, i, is) >> let(\n        isa := _isa(self),\n        i128 := @.cond(x-> let( t := When(IsType(x), x, x.t), IsVecT(t) and self.ctype(t, isa)=\"__m128i\")),\n        f128 := @.cond(x-> let( t := When(IsType(x), x, x.t), IsVecT(t) and self.ctype(t, isa)=\"__m128\" )),\n        d128 := @.cond(x-> let( t := When(IsType(x), x, x.t), IsVecT(t) and self.ctype(t, isa)=\"__m128d\" )),\n        CondPat(o,\n            [tcast, i128, f128], self.prefix(\"_mm_castps_si128\", [o.args[2]]),\n            [tcast, i128, d128], self.prefix(\"_mm_castpd_si128\", [o.args[2]]),\n            [tcast, f128, i128], self.prefix(\"_mm_castsi128_ps\", [o.args[2]]),\n            [tcast, i128, i128], self(o.args[2], i, is),\n            [tcast, f128, f128], self(o.args[2], i, is),\n            Inherited(o, i, is))),\n\n    tcvt := (self, o, i, is) >> self.printf(\"(($1)($2))\", [o.args[1], o.args[2]]),\n\n    #NOTE: finish this, it should look at TVect.size and instruction set for figuring out exactly what to do\n    vcastizxlo := (self, o, i, is) >> self(vunpacklo_16x8i(o.args[1], o.t.zero()), i, is),\n    vcastizxhi := (self, o, i, is) >> self(vunpackhi_16x8i(o.args[1], o.t.zero()), i, is),\n    vcastuzxlo := ~.vcastizxlo,\n    vcastuzxhi := ~.vcastizxhi,\n\n    average := (self, o, i, is) >> CondPat(o,\n        [average, @TVect, @TVect], let(\n            sfx := self.ctype_suffix(o.t, _isa(self)),\n            Cond( sfx in [\"epu8\", \"epu16\"],\n                self.printf(\"_mm_avg_$1($2, $3)\",[sfx, o.args[1],o.args[2]]),\n                Error(\"finish SSE unparser\"))),\n        Inherited(o, i, is)),\n));\n", "meta": {"hexsha": "e2d29f8cba955eb9ec22cd88d20979777954b4f8", "size": 39138, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/sse/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/sse/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/sse/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 50.5658914729, "max_line_length": 186, "alphanum_fraction": 0.5567734682, "num_tokens": 14356, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.45713670203584295, "lm_q2_score": 0.027585281427362537, "lm_q1q2_score": 0.0126102445764351}}
{"text": "# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(apack, nth, var, toExpArg, ExpOps, VarOps, NthOps, ExprFuncs, AnySyms, errExp, funcExp);\n\nClass(Symbolic, rec(\n    isSymbolic := true,\n    visitAs := \"Symbolic\",\n\n    setType := meth(self)\n        self.t := self.computeType();\n\treturn self;\n    end,\n\n    dims := self >> Cond(\n\tIsArrayT(self.t), self.t.dims(),\n\tError(\"<self>.dims() is only valid when self.t is a TArray\"))\n\n    # must be implemented in subclasses\n    #computeType := self >> ..type of self..\n));\n\nIsSymbolic := o -> IsRec(o) and IsBound(o.isSymbolic) and o.isSymbolic;\nIsExpArg := o -> IsSymbolic(o) or IsValue(o);\nIsLoc := x -> IsRec(x) and IsBound(x.isLoc) and x.isLoc;\nIsNth := x -> IsRec(x) and IsBound(x.__bases__) and x.__bases__[1] = nth;\nIsVar := x -> IsRec(x) and IsBound(x.__bases__) and x.__bases__[1] = var;\nIsExp := x -> IsRec(x) and IsBound(x.isExp) and x.isExp;\n\ntoRange := rng -> Cond(\n    rng = [], 0,\n    IsRange(rng), Checked(rng[1]=0, Last(rng)+1),\n    IsInt(rng), rng,\n    IsValue(rng), rng.v,\n    IsSymbolic(rng), rng,\n    Error(\"<rng> must be a range, an integer, or a symbolic expression\"));\n\nlistRange := rng -> Cond(\n    IsRange(rng), Checked(rng[1]=0, rng),\n    IsInt(rng), [0..rng-1],\n    Error(\"<rng> must be a range or an integer\"));\n\n# _ListElmOp: executes operation on evaluated list elements\nDeclare(_ListElmOp);\n_ListElmOp := (a, b, op) ->\n    Cond( IsList(a) and IsList(b) and not IsString(a) and not IsString(b),\n              Checked(Length(a)=Length(b), List([1..Length(a)], i -> _ListElmOp(a[i], b[i], op))),\n          IsRec(a) and IsBound(a.ev),\n              _ListElmOp(a.ev(), b, op),\n          IsRec(b) and IsBound(b.ev),\n              _ListElmOp(a, b.ev(), op),\n          IsList(a) and not IsString(a),\n              List(a, e -> _ListElmOp(e, b, op)),\n          IsList(b) and not IsString(b),\n              List(a, e -> _ListElmOp(e, b, op)),\n          op(a, b) );\n\nClass(Loc, Symbolic, rec(\n    isLoc := true,\n    isExp := true,\n    free := self >> Set(ConcatList(self.rChildren(), FreeVars)),\n    print := self >> Print(self.__name__, \"(\", PrintCS(self.rChildren()), \")\"),\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n));\n\n#F nth(<loc>, <idx>) -- symbolic representation of array access\n#F\nClass(nth, Loc, rec(\n    __call__ := (self, loc, idx) >> WithBases(self,\n        rec(operations := NthOps,\n            loc := toExpArg(loc),\n            idx := toExpArg(idx))).setType().cfold(),\n\n    can_fold := self >> self.idx _is funcExp or (IsValue(self.idx) and\n                  (IsValue(self.loc) or (IsVar(self.loc) and IsBound(self.loc.value)) or self.loc _is apack)),\n    cfold := self >> When(self.can_fold(), self.eval(), self),\n\n    rChildren := self >> [self.loc, self.idx],\n    rSetChild := rSetChildFields(\"loc\", \"idx\"),\n\n    ev := self >> let(e := self.eval(),\n\tCond(IsBound(e.v), e.v, e)),\n\n    eval := self >> let(loc := self.loc.eval(), idx := self.idx.eval(),\n        evself := CopyFields(self, rec(loc := loc, idx := idx)), # Simply return expression in case value cannot be returned (although it appears this wasn't desired originally?)\n        Cond(idx _is funcExp,\n                 self.t.value(idx.args[1]),\n             not IsValue(idx),\n                 evself, # self,\n             idx.v < 0,\n                 errExp(self.t),\n             loc _is apack,\n                 Cond(idx.v >= Length(loc.args), errExp(self.t), loc.args[idx.v+1]),\n             IsValue(loc),\n                 Cond(idx.v >= Length(loc.v), errExp(self.t), V(loc.v[idx.v+1])),\n             IsVar(loc) and IsBound(loc.value),\n                 Cond(idx.v >= Length(loc.value.v), errExp(self.t), V(loc.value.v[idx.v+1])),\n             evself)), # self)),\n\n    computeType := self >> Cond(\n\tIsPtrT(self.loc.t) or IsArrayT(self.loc.t) or IsListT(self.loc.t), self.loc.t.t,\n        ObjId(self.loc.t)=TSym, TSym(\"Containee\"), #used with C++ container objects (EnvList)\n        self.loc.t = TUnknown,  self.loc.t,\n\tError(\"Unknown types of 1st argument <self.loc> in \", ObjId(self))\n    ),\n\n    isExpComposite := true\n));\n\n#F deref(<loc>)  -- symbolic representation of pointer dereference, equivalent to nth(<loc>, 0)\n#F\nClass(deref, nth, rec(\n    __call__ := (self, loc) >> Inherited(loc, TInt.value(0)),\n    rChildren := self >> [self.loc],\n    rSetChild := rSetChildFields(\"loc\"),\n));\n\n#F addrof(<loc>) -- symbolic representation of address of <loc>.\n#F\n#F For a variable 'foo', addrof(foo) is the equivalent of &(foo) in C\n#F\nClass(addrof, Loc, rec(\n    __call__ := (self, loc) >> WithBases(self,\n\trec(operations := NthOps, loc := loc, idx := 0)).setType(),\n\n    computeType := self >> TPtr(self.loc.t),\n\n    rChildren := self >> [self.loc],\n    rSetChild := rSetChildFields(\"loc\"),\n    can_fold := False,\n));\n\n#F var(<id>, <t>)\n#F var(<id>, <t>, <range>)\n#F var.fresh(<id>, <t>, <range>)\n#F var.fresh_t(<id>, <t>)\n#F\n#F Create symbolic variables. variables are kept in a global hash, and thus\n#F two variables with same name will refer to same physical object.\n#F Namely\n#F     Same(var(\"zz\", TInt), var(\"zz\", TInt)) == true\n#F Moreover,\n#F   spiral> v1 := var(\"zz\", TInt);;\n#F   spiral> v2 := var(\"zz\", TReal);;\n#F   spiral> v1.t;\n#F       TReal;\n#F   spiral> v2.t;\n#F       TReal;\n#F\nClass(var, Loc, rec(\n    rChildren := self >> [],\n    from_rChildren := (self, rch) >> self,\n    free := self >> Set([self]),\n    equals := (self,o) >> Same(self,o),\n\n    setAttr := meth(self, attr) self.(attr) := true; return self; end,\n    setAttrTo := meth(self, attr, val) self.(attr) := val; return self; end,\n\n    computeType := self >> self.t,\n\n    __call__ := meth(arg)\n        local self, id, range, t, v;\n        self := arg[1];\n        id := arg[2];\n\n        if Length(arg) >= 3 then t := arg[3]; else t := TUnknown; fi;\n        if Length(arg) >= 4 then range := arg[4]; else range := false; fi;\n\n        if not IsBound(self.table.(id)) then\n            v := WithBases(self, rec(operations := VarOps, id := id, t := t));\n            if range <> false then v.range := range; fi;\n            self.table.(id) := CantCopy(v);\n            v.uid := [BagAddr(v),1];\n            return v;\n        else\n            v := self.table.(id);\n            if t<>TUnknown then v.t := t; fi;\n            if range <> false then v.range := range; fi;\n            #if Length(arg) >= 3 then\n            #return Error(\"Variable '\", id, \"' is already defined, use var(..).xxx to update fields\");\n            #fi;\n            return v;\n        fi;\n    end,\n\n    setRange := meth(self, r)\n       self.range := r;\n       return self;\n    end,\n\n    setValue := meth(self, v)\n       self.value := v;\n       return self;\n    end,\n\n    clone := self >> When(\n        IsBound(self.range),\n        var.fresh(self.id{[1]}, self.t, self.range),\n        var.fresh_t(self.id{[1]}, self.t)\n    ),\n\n    printFull := self >> Print(\n        self.__name__, \"(\\\"\", self.id, \"\\\", \", self.t,\n        When(\n            IsBound(self.range),\n            Print(\", \", self.range), \"\"\n        ),\n        \")\"\n    ),\n\n#    printShort := self >> Print(self.__name__, \"(\\\"\", self.id, \"\\\")\"),\n    printShort := self >> Print(self.id),\n\n    print := ~.printShort,\n\n    fresh := (self,id,t,range) >> self(self._id(id), t, range),\n\n    fresh_t := (self,id,t) >> Cond(\n\tIsInt(t) or IsScalar(t),\n\t    self(self._id(id), TInt, t),\n\tIsType(t),\n\t    self(self._id(id), t),\n\tError(\"<t> must be a type or an integer that represents an interval\")),\n\n    _id := meth(self, id)\n       local cnt, st;\n\n       cnt := When(IsBound(self.counter.(id)), self.counter.(id), 1);\n       # Intel compiler (ver 8 and 9)\n       # in linux uses variable i386 as a keyword.\n       if cnt = 385 then\n           self.counter.(id) := cnt+2;\n       else\n           self.counter.(id) := cnt+1;\n       fi;\n       st := Concat(id, String(cnt));\n#       st := Concat(id, VarNameInt(cnt));\n       if IsBound(self.table.(st)) then\n       self.counter.(id) := cnt+1000;\n       return self._id(id);\n       else return st;\n       fi;\n    end,\n\n    nth := (self, idx) >> nth(self, idx),\n\n    ev := self >> self, #When(IsBound(self.value), self.value.ev(), self),\n    eval := self >> self,\n    can_fold := False,\n\n    flush := meth(self)\n        self.table := WeakRef(tab());\n        self.counter := tab();\n    end,\n\n    table := WeakRef(tab()),\n    counter := tab(),\n    has_range := self >> IsInt(self.range)\n));\n\n#F ----------------------------------------------------------------------------------------------\n#F Exp : expressions\n#F ----------------------------------------------------------------------------------------------\n\nClass(Exp, Symbolic, rec(\n   isExp := true,\n   isExpComposite := true,\n\n   __call__ := arg >> WithBases(arg[1],\n       rec(args := List(Drop(arg, 1), toExpArg), operations := ExpOps)).setType(),\n\n   print := self >> Print(self.__name__, \"(\", PrintCS(self.args), \")\"),\n\n   ev := self >> Error(\"not implemented\"),\n\n   eval := meth(self)\n       local evargs, res, type;\n       evargs := List(self.args, e -> e.eval());\n\n       if evargs <> [] and ForAll(evargs, IsValue) then\n           res := ShallowCopy(self);\n           res.args := evargs;\n           res := res.ev();\n           type := self.computeType();\n\t   return type.value(res);\n       else\n           res := ApplyFunc(ObjId(self), evargs);\n           res.t := self.t; # NOTE: why is this line here?\n           return res;\n       fi;\n   end,\n\n   rChildren := self >> self.args,\n   rSetChild := meth(self, n, newChild)\n       self.args[n] := newChild;\n   end,\n   from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n\n   free := self >> Set(ConcatList(self.args, FreeVars)),\n\n   can_fold := self >> not IsPtrT(self.t) and\n       let(rch := self.rChildren(), rch<>[] and ForAll(rch, c -> IsValue(c) or (IsVar(c) and IsBound(c.value)))),\n\n   cfold := self >> When(self.can_fold(), self.eval(), self),\n\n   setType := meth(self)\n        if IsBound(self.computeType) then\n\t    self.t := self.computeType();\n\telse\n\t    self.t := UnifyTypes(List(self.args, x->x.t));\n\t    PrintErr(\"Warning: \", ObjId(self), \" needs a computeType() method. \",\n\t\t     \"(default type = \", self.t, \")\\n\");\n\tfi;\n\treturn self;\n    end\n));\n\nClass(AutoFoldExp, Exp, rec(\n   __call__ := arg >> ApplyFunc(Inherited, Drop(arg, 1)).cfold()\n));\n\n#F AutoFoldRealExp -- scalar or vector expression with floating point result type\nClass(AutoFoldRealExp, AutoFoldExp, rec(\n    computeType := self >> let(\n        t := UnifyTypesL(self.args),\n        Cond( IsRealT(t.base_t()), t, Cond(IsVecT(t), TVect(TReal. t.size), TReal)))\n));\n\nClass(ListableExp, Exp, rec(\n   __call__ := meth(arg)\n       local self, res;\n       self := arg[1];\n       arg := Drop(arg, 1);\n       if Length(arg)=2 then\n       if IsList(arg[1]) then return List(arg[1], e->self(e, arg[2]));\n       elif IsList(arg[2]) then return List(arg[2], e->self(arg[1], e));\n       fi;\n       fi;\n       res := WithBases(self, rec(args := List(arg, toExpArg), operations := ExpOps));\n       return res.cfold();\n   end\n));\n\n\nDeclare(apack);\n\n# TArray expression\nClass(apack, AutoFoldExp, rec(\n    ev := self >> List(self.args, x->x.ev()),\n    computeType := self >> TArray(UnifyTypes(List(self.args, x->x.t)), Length(self.args)),\n    can_fold := False, # apack expected to be in nth, let nth to fold first instead of apack\n\n    fromList := (lst, func) -> ApplyFunc(apack, Map(lst, func)),\n    fromMat  := (mat, func) -> apack.fromList(mat, r -> apack.fromList(r, func)),\n));\n\n#F cxpack(<re>, <im>) -- packs <re> <im> pair into complex number\n\nClass( cxpack, AutoFoldExp, rec(\n    ev          := self >> ApplyFunc(Complex, List(self.args, x->x.ev())),\n    computeType := self >> UnifyTypesV(self.args).complexType(),\n));\n\n#F brackets(<exp>) -- symbolic representation of brackets\n\nClass(brackets, Exp, rec(\n   __call__ := arg >> Checked( Length(arg) = 2, ApplyFunc(Inherited, Drop(arg, 1))),\n   computeType := self >> self.args[1].t,\n   can_fold := self >> Inherited() and Length(self.args)=1,\n));\n\n#F fcall(<func>, <arg1>, ...) -- symbolic representation of a function call\n#F   <func> could be a variable or a Lambda\n#F   Example:\n#F     f := var(\"f\", TFunc(TInt, TInt));\n#F     fcall(f, 1);\n#F     fcall(L(16,4).lambda(), 1);\n#F\nClass(fcall, Exp, rec(\n    __call__ := arg >> let(\n        self := arg[1],\n\targs := List(Drop(arg, 1), toExpArg),\n\tCond(Length(args) < 1,\n                 Error(\"fcall must have at least 1 argument: function\"),\n\t     IsLambda(args[1]),\n                 ApplyFunc(args[1].at, Drop(args, 1)),\n\t     #else\n\t         WithBases(self, rec(args := args, operations := ExpOps)).setType())),\n\n    computeType := self >> let(ft := self.args[1].t, Cond(\n        (ft in [TString, TUnknown]) or (ObjId(ft)=TPtr and ObjId(ft.t)=TSym), TUnknown,\n        ObjId(ft) = TFunc, Last(ft.params),\n        Error(\"<self.args[1].t> must be TFunc(..) or TUnknown\"))),\n\n    eval := self >> ApplyFunc(ObjId(self), List(self.args, e->e.eval())),\n    can_fold := False,\n));\n\nClass(gapcall, Exp, rec(\n    __call__ := meth(arg)\n        local res, fname;\n        res := WithBases(arg[1], rec(args := List(Drop(arg, 1), toExpArg),\n                                     operations := ExpOps,\n                                     t := TUnknown));\n    if Length(res.args) < 1\n        then Error(\"gapcall must have at least 1 argument: function name\"); fi;\n    if IsVar(res.args[1]) then\n        fname  := res.args[1].id;\n        elif IsString(res.args[1]) then\n            fname := res.args[1];\n        else\n            return res;\n        fi;\n\n    if IsBound(ExprFuncs.(fname)) then\n        return ApplyFunc(ExprFuncs.(fname), Drop(res.args, 1));\n    else\n        return res;\n        fi;\n    end,\n\n    ev := self >> ApplyFunc(Eval(DelayedValueOf(self.args[1].id)),\n                            List(Drop(self.args,1), x->x.ev())),\n    eval := meth(self)\n        local evargs;\n        evargs := List(Drop(self.args,1), e->e.eval());\n        if ForAll(evargs, IsValue) then return V(self.ev());\n        else return ApplyFunc(ObjId(self), Concatenation([self.args[1]], evargs));\n        fi;\n    end\n));\n\nExprDelay := function(d)\n   d := FunccallsDelay(d);\n   d := DelaySubst(d, e->Global.Type(e) in [T_VAR, T_VARAUTO],\n       e -> var(NameOf(e)));\n   d := DelaySubst(d, e->Global.Type(e) = T_FUNCCALL,\n       e -> ApplyFunc(gapcall, e{[1..Length(e)]}));\n   return When(IsExp(d), d, V(d));\nend;\n\ntoExpArg := x -> Cond(IsRec(x) or IsFunction(x), x,\n                      IsDelay(x), ExprDelay(x),\n                      V(x));\n\ntoAssignTarget := x -> x;\n\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Basic Arithmetic\n#F\n#F add(<a>, <b>, ...)\nClass(add, AutoFoldExp, rec(\n\n    # __sum is overriden in descendant 'adds' (saturated addition)\n    __sum := (self, a, b) >> self.t.value(self.t.sum(_stripval(a), _stripval(b))),\n\n#    ev := self >> FoldL(self.args, (acc, e)->self.__sum(acc, e.ev()), self.t.zero()).ev(),\n    ev := self >> let(fe := FoldL(self.args, (acc, e)->self.__sum(acc, e.ev()), self.t.zero()), When(self = fe, self, fe.ev()) ),\n\n    # the intricate logic below is for computing the new alignment when dealing\n    # with pointer types\n    _ptrPlusOfs := (ptr_t, ofs) ->\n        TPtr(ptr_t.t, ptr_t.qualifiers, [ptr_t.alignment[1], (ptr_t.alignment[2] + ofs) mod ptr_t.alignment[1]]),\n\n    _addPtrT := function(ptr_args)\n        local align, el_t, t;\n\tif Length(ptr_args)=1 then return ptr_args[1].t; fi;\n\talign := [ Gcd(List(ptr_args, x->x.t.alignment[1])) ];\n\talign[2] := Sum(ptr_args, x->x.t.alignment[2]) mod align[1];\n\tel_t := UnifyTypes(List(ptr_args, x->x.t.t));\n\treturn TPtr(el_t, ConcatList(ptr_args, x->x.t.qualifiers), align);\n    end,\n\n    computeType := meth(self)\n        local len, t, ptr_args, other_args, sum;\n\tlen := Length(self.args);\n\tif   len=0  then return TInt;\n\telif len=1  then return self.args[1].t;\n\telse\n\t    [ptr_args, other_args] := SplitBy(self.args, x->IsPtrT(x.t) or IsArrayT(x.t));\n\t    if Length(ptr_args)=0 then\n\t\treturn UnifyTypesL(self.args);\n\t    elif Length(ptr_args)=1 then\n\t\tsum := Sum(other_args);\n\t\tif other_args<>[] and not IsIntT(sum.t) then Error(\"Can't add non-integer to a pointer\"); fi;\n\t\treturn self._ptrPlusOfs(ptr_args[1].t, sum);\n\t    elif Length(other_args)=0 then\n\t        return self._addPtrT(ptr_args);\n\t    else\n\t        return Error(\"Addition of more than one pointer and integers is not defined\");\n\t    fi;\n\tfi;\n    end,\n\n    # premultiplies all constants, removes 0s\n    cfold := meth(self)\n        local cons, sym, e, a, t, zero;\n        a := self.args;\n        # Processing size 1 first allows to skip computation of the type\n        # and of the zero\n        if Length(a)=1 then\n            return a[1];\n        # fast special case for 2 terms, i.e., add(a, b)\n        elif Length(a)=2 then\n            if IsBound(self.t.zero) then\n                t    := self.t;\n                zero := self.t.zero();\n                return Cond((a[1]=0 or a[1]=zero) and a[2].t = t, a[2],\n                            (a[2]=0 or a[2]=zero) and a[1].t = t, a[1],\n                            IsValue(a[1]) and IsValue(a[2]), t.value(self.__sum(a[1].v, a[2].v)),\n                            self);\n            else\n                return self;\n            fi;\n        # general case for add with >2 terms\n        else\n            t := self.t;\n            if IsBound(t.zero) then\n                zero := t.zero(); cons := zero; sym := [];\n                for e in self.args do\n                    if IsSymbolic(e) then Add(sym, e);\n                    else cons := self.__sum(cons, e);\n                    fi;\n                od;\n                if sym=[]                then return cons;\n                elif (cons=0 or cons=zero) and CopyFields(self, rec(args:=sym)).computeType() = t then self.args := sym;\n                else self.args := [When(IsPtrT(t), TInt.value(cons.v), cons)] :: sym;\n                fi;\n                if Length(self.args)=1 then return self.args[1]; fi;\n            fi;\n            return self;\n        fi;\n    end,\n    has_range := self >> ForAll(self.args, e -> Cond(IsValue(e), true, IsBound(e.has_range), e.has_range(), false) ),\n    range := self >> let(ranges := List(self.args, e -> Cond(IsValue(e), e, IsVar(e), V(e.range-1), e.range())), Sum(ranges))\n));\n\n#F adds(<a>, <b>, ...) saturated addition\nClass(adds, add, rec(\n    __sum := (self, a, b) >> self.t.saturate(_stripval(a) + _stripval(b)),\n));\n\nClass(neg, AutoFoldExp, rec(\n    ev := self >> -self.args[1].ev(),\n    computeType := self >> let(t := self.args[1].t,\n\tCond(IsPtrT(t),\n\t     t.aligned([t.alignment[1], -t.alignment[2] mod t.alignment[1]]),\n\t     t)),\n));\n\n#F sub(<a>, <b>)\nClass(sub,  AutoFoldExp, rec(\n\n    # __sub is overriden in descendant 'subs' (saturated substraction)\n    __sub := (self, a, b) >> let(type := self.computeType(), type.value(a - b)),\n\n    ev := self >> let(eve := self.__sub(self.args[1].ev(), self.args[2].ev()), When(self = eve, self, eve.ev()) ),\n\n    computeType := meth(self)\n        local a, b, isptr_a, isptr_b;\n\t[a, b] := self.args;\n\t[isptr_a, isptr_b] := [IsPtrT(a.t) or IsArrayT(a.t), IsPtrT(b.t) or IsArrayT(b.t)];\n\tif not isptr_a and not isptr_b then return UnifyPair(a.t, b.t);\n\telif isptr_a and isptr_b then\n\t    return add._addPtrT([a, neg(b)]);\n\telif isptr_a then\n\t    return add._ptrPlusOfs(a.t, -b);\n\telse #isptr_b\n\t    return add._ptrPlusOfs(neg(b).t, a);\n\tfi;\n    end,\n\n\n    cfold := self >> let(a := self.args[1], b := self.args[2], zero := self.t.zero(),\n        Cond((a=0 or a=zero) and b.t=self.t, neg(b),\n             (b=0 or b=zero) and a.t=self.t, a,\n             a=b, zero,\n             IsValue(a) and IsValue(b), self.__sub(a, b),\n             self)),\n));\n\n#F subs(<a>, <b>) saturated substraction\nClass(subs,  sub, rec(\n    __sub := (self, a, b) >> self.t.saturate(_stripval(a) - _stripval(b)),\n));\n\nClass(mul,  AutoFoldExp, rec(\n    ev := self >> let(eve := FoldL(self.args, (z, x) -> self.t.product(_stripval(z), x.ev()), self.t.one()), When(self = eve, self, V(eve).ev())),\n\n    _ptrMul := function(ptr_t, mult)\n        local t;\n\tt := Copy(ptr_t);\n\tt.alignment[2] := (t.alignment[2] * mult) mod t.alignment[1];\n\treturn t;\n    end,\n\n    computeType := meth(self)\n        local len, t, ptr_t, ptr_args, other_args, prod, args;\n\targs := self.args;\n\n\tlen := Length(args);\n\tif   len=0  then return TInt;\n\telif len=1  then return args[1].t;\n\t# elif len=2  then\n\t#     if IsPtrT(args[1].t) then\n\t# \tif not IsIntT(args[2].t) then Error(\"Can't multiply a pointer by a non-integer\"); fi;\n\t# \treturn self._ptrMul(args[1].t, args[2]);\n\t#     elif IsPtrT(args[2].t) then\n\t# \tif not IsIntT(args[1].t) then Error(\"Can't multiply a pointer by a non-integer\"); fi;\n\t# \treturn self._ptrMul(args[2].t, args[1]);\n\t#     else\n\t# \treturn UnifyPair(args[1].t, args[2].t);\n\t#     fi;\n\n\telse\n\t    [ptr_args, other_args] := SplitBy(args, x->IsPtrT(x.t));\n\t    if ptr_args=[] then\n\t\treturn UnifyTypesL(args);\n\t    elif Length(ptr_args) > 1 then Error(\"Can't multiply pointers\");\n\t    else\n\t\tprod := Product(other_args);\n\t\tif other_args<>[] and not IsIntT(prod.t) then Error(\"Can't multiply a pointer by a non-integer\"); fi;\n\t\treturn  self._ptrMul(ptr_args[1].t, prod);\n\t    fi;\n\tfi;\n    end,\n\n    # premultiplies all constants, removes 1s, and returns 0 if any factors is = 0\n    cfold := meth(self)\n        local cons, sym, e, a, one, zero, t;\n        t := self.t;   one := t.one();    zero := t.zero();\n        a := self.args;\n        # fast special case for 2 factors, i.e., mul(a, b)\n        if Length(a)=2 then\n            return Cond((a[1]=1 or a[1]=one) and t=a[2].t, a[2],\n                        (a[2]=1 or a[2]=one) and t=a[1].t, a[1],\n                        a[1]=0 or a[2]=0 or a[1] = zero or a[2] = zero, zero,\n                        IsValue(a[1]) and IsValue(a[2]), t.value(t.product(a[1].v, a[2].v)),\n                        self);\n        elif Length(a)=1 then return a[1];\n        # general case for mul with >2 factors\n        else\n            cons := one; sym := [];\n            for e in self.args do\n                if IsSymbolic(e) then Add(sym, e);\n                elif e=0 or e=zero then return zero;\n                else cons := cons * e;\n                fi;\n            od;\n            if sym=[] then return cons;\n            elif (cons=1 or cons=one) and t=UnifyTypesL(sym) then self.args := sym;\n            else self.args := [cons] :: sym;\n            fi;\n            if Length(self.args)=1 then return self.args[1]; fi;\n            return self;\n        fi;\n    end,\n    has_range := self >> ForAll(self.args, e -> Cond(IsValue(e), true, IsBound(e.has_range), e.has_range(), false) ),\n    range := self >> let(ranges := List(self.args, e -> Cond(IsValue(e), e, IsVar(e), V(e.range-1), e.range())), Product(ranges))\n));\n\nClass(pow,  AutoFoldExp, rec(\n    ev := self >> self.args[1].ev() ^ self.args[2].ev(),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\n\n\n# max(...) is derived from min(...) by overloading _ev(<vars list>) method\n\nClass(min, AutoFoldExp, rec(\n\n    ev := self >> self._ev(self.args).ev(),\n\n    computeType := self >> UnifyTypes(List(self.args, x->x.t)),\n    cfold := meth(self)\n        local m, vals, exps, args, i, a, op;\n        op := ObjId(self);\n        m  := Set(self.args);\n        if Length(m)=1 then\n            return m[1];\n        else\n            i := 1; vals := []; exps := [];\n            while i<=Length(m) do\n                a := m[i];\n                if a _is Value then\n                    Add(vals, a);\n                elif a _is op then\n                    Append(m, a.args);\n                else\n                    Add(exps, a);\n                fi;\n                i := i+1;\n            od;\n            args := When(vals<>[], [self._ev(vals)], []) :: exps;\n            if args = self.args then\n                return self;\n            else\n                return ApplyFunc(op, args);\n            fi;\n        fi;\n    end,\n\n    _ev := (self, vals) >> self.t.value(FoldL1(vals, (a,b) -> _ListElmOp(a, b, Min2))),\n\n));\n\nClass(max, min, rec(\n    _ev := (self, vals) >> self.t.value(FoldL1(vals, (a,b) -> _ListElmOp(a, b, Max2))),\n));\n\n#F average(<a>, <b>)\nClass(average,  AutoFoldExp, rec(\n    ev := self >> _ListElmOp(self.t.sum(self.args[1].ev(), self.args[2].ev()), 2, QuoInt),\n    computeType := self >> UnifyTypes(List(self.args, x->x.t)),\n));\n\nClass(re, AutoFoldExp, rec(\n    ev := self >> let(\n\tt := InferType(self.args[1]),\n        v := self.args[1].ev(),\n        Cond(IsVecT(t), List(v, e -> ReComplex(Complex(e.ev()))),\n                        ReComplex(Complex(v)))\n    ),\n    computeType := self >> self.args[1].t.realType()\n));\n\n\nClass(im, AutoFoldExp, rec(\n    ev := self >> let(\n\tt := InferType(self.args[1]),\n        v := self.args[1].ev(),\n        Cond(IsVecT(t), List(v, e -> ImComplex(Complex(e.ev()))),\n                        ImComplex(Complex(v)))\n    ),\n    computeType := self >> self.args[1].t.realType()\n));\n\nClass(conj, AutoFoldExp, rec(\n    ev := self >> let(a := self.args[1].ev(),\n        When(IsCyc(a), Global.Conjugate(a),\n             ReComplex(a)-Cplx(0,1)*ImComplex(a))),\n    computeType := self >> self.args[1].t\n));\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Division\n#F\n#F fdiv(<a>, <b>) - divides two integers or two reals, result if always TReal\n#F This is different from idiv and div.\n#F\n#F fdiv(TInt, TInt) == TReal\n#F idiv(TInt, TInt) == TInt (rounding can happen)\n#F ddiv(TInt, TInt) == TInt (rounding can happen, but unlike idiv add(ddiv(a,b),ddiv(c,b), ...) => ddiv(add(a,c, ...), b) allowed)\n#F  div(TInt, TInt) == TInt (arguments are expected to be divisible)\n#F\n\n#F fdiv(a, b). Floating-point division\n#F    fdiv(TInt, TInt) = TReal.\nClass(fdiv,  AutoFoldExp, rec(\n    ev := self >> (self.args[1].ev() / self.args[2].ev()),\n    computeType := self >> TReal));\n\nDeclare(idiv);\n\n_handle_idiv_mul := function(div_obj)\n  local factors, d, gcd, f, m, den, ranges;\n  m := div_obj.args[1];\n  den := div_obj.args[2];\n  \n  if m.has_range() and m.range() < den then\n  \treturn V(0);\n  fi;\n\n  factors := [];\n  d := den;\n  for f in m.args do\n    if IsValue(f) then\n      gcd := Gcd(f.ev(), d.ev());\n      Add(factors, f/gcd);\n      d := d/gcd;\n    else Add(factors, f);\n    fi;\n  od;\n  if d = 1 then return ApplyFunc(mul, factors);\n  else return div_obj;\n  fi;\nend;\n\n_handle_idiv_add := function(div_obj)  \n  local values, addends, a, den, ranges;\n  a := div_obj.args[1];\n  den := div_obj.args[2];\n\n  if a.has_range() and a.range() < den then\n\treturn V(0);\n  fi;\n\n  values := Filtered(a.args, v -> IsValue(v));\n  if ForAny(values, v -> (v.ev() mod den.ev()) <> 0) then\n    return div_obj;\n  fi;\n  addends := List(a.args, v -> idiv(v, den));\n  if ForAll(addends, v -> ObjId(v) <> idiv) then return ApplyFunc(add, addends);\n  else return div_obj;\n  fi;\nend;\n\n#F idiv(a, b). Integer division with rounding.\n#F    idiv(a, b) = floor(fdiv(a, b))\nClass(idiv, AutoFoldExp, rec(\n    ev := self >> _ListElmOp(self.args[1], self.args[2], QuoInt),\n    cfold := self >> let(a := self.args[1], b := self.args[2],\n        Cond(a=a.t.zero(),                 self.t.zero(),\n             a=b,                          self.t.one(),\n             b=b.t.one() and a.t = self.t, a,\n             IsValue(a) and IsValue(b),    self.t.value(self.ev()),\n#Dani: Simplifying expr\n             ObjId(a) = mul and IsValue(b), _handle_idiv_mul(self),\n             ObjId(a) = add and IsValue(b), _handle_idiv_add(self),\n             IsVar(a) and IsValue(b) and IsInt(a.range), When((a.range-1)<b.ev(), V(0), self),\n             self)),\n    computeType := self >> let( t := UnifyTypes(List(self.args, e -> e.t)),\n                                Checked(IsOrdT(t.base_t()), t) ),\n    has_range := self >> ForAll(self.args, e -> Cond(IsValue(e), true, IsBound(e.has_range), e.has_range(), false) ),\n    range := self >> let(a := self.args[1], a_range := Cond(IsValue(a), a.ev(), IsVar(a), a.range-1, a.range().ev()), V(QuoInt(a_range, self.args[2].ev())) )\n));\n\n#F idivmod(i, n, d) = imod( idiv(i, d), n ).\n#F Assume N-dim tensor dimension where d is the stride of dimension D and n*d of dimension D+1.\n#F idivmod isolates the index i_D from the linearized i = .. + i_{D+1}*n*d + i_D*d + ...\nClass(idivmod,  AutoFoldExp, rec(\n    ev := self >> idiv( self.args[1].ev(), self.args[3].ev() ) mod self.args[2].ev() ,\n    computeType := self >> TInt));\n\n\nidiv_ceil := (a, b) -> idiv(a+b-1, b);\n\n#F ddiv(a, b). Integer division with rounding. Same as idiv but\n#F     add(ddiv(a,b),ddiv(c,b), ...) => ddiv(add(a,c, ...), b) allowed\nClass(ddiv, idiv);\n\n#F div(a, b). Exact integer (no rounding) or floating-point division\n#F    If <a> and <b> are integers, they are expected to be divisible.\n#F    If both are reals, then div(a, b) = fdiv(a, b)\n#F\nClass(div,  AutoFoldExp, rec(\n    ev := self >> self.args[1].ev() / self.args[2].ev(),\n    cfold := self >> let(a := self.args[1], b := self.args[2],\n        Cond(a=0,                       self.t.zero(), # what if b==0?\n             a=b,                       self.t.one(),\n             b=1 and a.t = self.t,      a,\n             IsValue(a) and IsValue(b), self.t.value(a.v / b.v),\n             self)),\n    computeType := self >> UnifyTypes(List(self.args, x->x.t))\n));\n\n#param div, a division that is propagated to params, when it is known that\n#the params are divisible\nClass(pdiv, div);\n\n# In Spiral (unlike C) mod from negative number is a positive number: -5 mod 3 = 1\nClass(imod, AutoFoldExp, rec(\n    ev := self >> self.args[1].ev() mod self.args[2].ev(),\n    cfold := self >> let(a := self.args[1], b := self.args[2],\n        Cond(a=0, a,\n             b=1, self.t.zero(),\n             IsValue(a) and IsValue(b), self.t.value(a.v mod b.v),\n\t     ObjId(a)=ObjId(self) and a.args[2] = b, a,\n\t     \t IsBound(a.has_range) and a.has_range() and IsValue(b), let(r := When(IsVar(a), V(a.range-1), a.range()), When(r < b, a, self)),\n             self)),\n    computeType := self >> When(IsPtrT(self.args[1].t), TInt, UnifyTypes([self.args[1].t, self.args[2].t]))\n));\n\nClass(floor, AutoFoldExp, rec(\n    ev := self >> let(f := self.args[1].ev(), Cond(\n\tIsDouble(f), d_floor(f),\n\tIsRat(f),    spiral.approx.FloorRat(f),\n\tError(\"Don't know how take floor of <f>\"))),\n\n    computeType := self >> TInt));\n\nClass(ceil, AutoFoldExp, rec(\n    ev := self >> let(f := self.args[1].ev(), Cond(\n\tIsDouble(f), d_ceil(f),\n\tIsRat(f),    spiral.approx.CeilingRat(f),\n\tError(\"Don't know how take ceiling of <f>\"))),\n\n    computeType := self >> TInt));\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Various functions\n#F\nV_true := V(true);\nV_false := V(false);\n\nClass(null, Exp, rec(\n    computeType := self >> TPtr(TVoid)\n));\n\n# powmod(<phi>, <g>, <exp>, <N>) = phi * g^exp mod N\nClass(powmod, AutoFoldExp, rec(\n    ev := self >> self.args[1].ev () * PowerMod(self.args[2].ev(), self.args[3].ev(), self.args[4].ev())\n                  mod self.args[4].ev(),\n    computeType := self >> TInt));\n\n# ilogmod(<n>, <g>, <N>) --  solution <exp> in powmod(1, <g>, <exp>, <N>) = <n> [g^exp mod N = n]\nClass(ilogmod, AutoFoldExp, rec(\n    ev := self >> LogMod(self.args[1].ev(), self.args[2].ev(), self.args[3].ev()),\n    computeType := self >> TInt));\n\n#F abs(<a>)  -- absolute value\nClass(abs, AutoFoldExp, rec(\n    ev := self >> _ListElmOp(self.args[1], self.args[1], (a,b) -> SignInt(a)*b),\n    computeType := self >> self.args[1].t\n));\n\n\n#F absdiff(<a>,<b>)  -- absolute difference |<a>-<b>|\nClass(absdiff, AutoFoldExp, rec(\n    ev := self >> sub(max(self.args[1], self.args[2]), min(self.args[1], self.args[2])).ev(),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\n\n#F absdiff2(<a>,<b>)  -- absolute difference between a and b where 0<=b && (a==0 || a==2^n-1 && b<=a)\n#F this operation can be implemented as a xor b for integer a and b\nClass(absdiff2, absdiff);\n\n#F sign(<a>) -- returns 1 if a is positive, -1 if negative, 0 if a=0\nClass(sign, AutoFoldExp, rec(\n    ev := self >> let(a:=self.args[1].ev(),\n        Cond(a>0, 1, a<0, -1, 0)),\n    computeType := self >> self.args[1].t\n));\n\n#F fpmul(fracbits, a, b)  -- fixed point multiplication, computes (a*b) >> fracbits\nClass(fpmul, AutoFoldExp, rec(\n    ev := self >> (self.args[2].ev() * self.args[3].ev()) / 2^self.args[1].ev(),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Boolean Arithmetic and Conditions\n#F\nClass(logic_and,  AutoFoldExp, rec(\n    ev := self >> ForAll(self.args, x->x.ev()),\n    cfold := meth(self)\n        local a;\n        a := Filtered(self.args, x->x<>true);\n        if ForAny(a, x->x=false) then return V_false;\n        elif a=[] then return V_true;\n        elif Length(a)=1 then return a[1];\n        else self.args := a;\n             return self;\n        fi;\n    end,\n    computeType := self >> TBool\n));\n\nClass(logic_or,   AutoFoldExp, rec(\n    ev := self >> ForAny(self.args, x->x.ev()),\n    cfold := meth(self)\n        local a;\n        a := Filtered(self.args, x->x<>false);\n        if ForAny(a, x->x=true) then return V_true;\n        elif a=[] then return V_false;\n        elif Length(a)=1 then return a[1];\n        else self.args := a;\n             return self;\n        fi;\n    end,\n    computeType := self >> TBool\n));\n\nClass(logic_neg,  AutoFoldExp, rec(\n    ev := self >> When(self.args[1].ev(), false, true),\n    computeType := self >> TBool));\n\n\n# Mixin for comparision operations.\n# Users should define method _ev_op(a, b) only, which defines operation.\n_logic_mixin := rec(\n    computeType := self >> let(\n        types := List(self.args, e->e.t),\n        # There is no TPtr unification defined at the moment but it's legal\n        # to compare pointers (at least with TPtr(TVoid)) so here is this stupid hack\n        t     := Cond( ForAny(types, IsPtrT), TBool, UnifyTypes(types)),\n        When( IsVecT(t),\n            TVect(TBool, t.size),\n        # else\n            TBool)),\n    ev := self >> let(\n        a := self.args,\n        l := Length(a),\n        Checked( l>1,\n            ApplyFunc(logic_and, List([2..l],\n                i -> _ListElmOp(a[i-1], a[i], self._ev_op)\n            )).ev()\n        )\n    ),\n);\n\n#F eq(a, b, c, ...) symbolic representation of a = b = c = ...\nClass(eq,  _logic_mixin, AutoFoldExp, rec( _ev_op := (a, b) -> Checked(not AnySyms(a,b), a=b  )));\n\n#F neq(a, b) symbolic representation of a<>b\nClass(neq, _logic_mixin, AutoFoldExp, rec( _ev_op := (a, b) -> Checked(not AnySyms(a,b), a<>b )));\n\n#F leq(a, b, c, ...) symbolic representation of a <= b <= c <= ...\nClass(leq, _logic_mixin, AutoFoldExp, rec( _ev_op := (a, b) -> Checked(not AnySyms(a,b), a<=b )));\n\n#F lt(a, b, c, ...) symbolic representation of a < b < c < ...\nClass(lt,  _logic_mixin, AutoFoldExp, rec( _ev_op := (a, b) -> Checked(not AnySyms(a,b), a<b  )));\n\n#F geq(a, b, c, ...) symbolic representation of a >= b >= c >= ...\nClass(geq, _logic_mixin, AutoFoldExp, rec( _ev_op := (a, b) -> Checked(not AnySyms(a,b), a>=b )));\n\n#F gt(a, b, c, ...) symbolic representation of a > b > c > ...\nClass(gt,  _logic_mixin, AutoFoldExp, rec( _ev_op := (a, b) -> Checked(not AnySyms(a,b), a>b  )));\n\n_logic_mask_mixin := rec(\n    computeType := self >> let(\n        t  := UnifyTypes(List(self.args, e->e.t)),\n        b  := t.base_t(),\n        nb := Cond(\n            ObjId(b) in [T_Real, T_Int, T_UInt], T_Int(b.params[1]),\n            b        in [TReal, TInt, TUInt],    TInt,\n            Error(\"unexpected data type\")\n        ),\n        Cond( IsVecT(t), TVect(nb, t.size), nb)\n    ),\n\n    ev := self >> let( b := Inherited(), _ListElmOp( b, b, (a, b) -> Checked(not IsSymbolic(a), When(a=true, -1, 0))))\n);\n\n#F mask_gt(a, b) symbolic representation of a > b where result is an integer mask: -1 (true) or 0 (false)\nClass(mask_gt, _logic_mask_mixin, gt);\n\n#F mask_eq(a, b) symbolic representation of a = b where result is an integer mask: -1 (true) or 0 (false)\nClass(mask_eq, _logic_mask_mixin, eq);\n\n#F mask_lt(a, b) symbolic representation of a < b where result is an integer mask: -1 (true) or 0 (false)\nClass(mask_lt, _logic_mask_mixin, lt);\n\n\nClass(cond, Exp, rec(\n    eval := meth(self)\n        local i, cc;\n\ti := 0;\n        for i in [1..QuoInt(Length(self.args),2)] do\n            cc := self.args[2*i-1].eval();\n            if not IsValue(cc) then return self; # unevaluatable cond\n            elif ((IsBool(cc.v) and cc.v) or (IsInt(cc.v) and cc.v<>0)) then # true clause found\n                return self.args[2*i].eval();\n            fi;\n        od;\n\tif 2*i+1 > Length(self.args) then\n            # in the case of nested conds, this particular cond might be unreachable,\n\t    # so it can be invalid, we generate errExp() in this case, instead of crashing\n\t    # return errExp(self.t);\n            return Error(\"Else clause missing in 'cond' object <self>\");\n        else\n\t    return self.args[2*i+1].eval();\n\tfi;\n    end,\n    computeType := self >> UnifyTypes(List([1..QuoInt(Length(self.args),2)], i->self.args[2*i].t)),\n    ev := self >> let(ev:=self.eval(), When(IsValue(ev), ev.v, ev))\n));\n\n#F _map_cond(<cexp>, <pred_func>, <exp_func>)\n#F   Maps cond(...) expression <cexp> by applying <pred_func> to predicates and <exp_func> to expressions.\n\n_map_cond := (cexp, pred_func, exp_func) -> ApplyFunc(cond, List([1..Length(cexp.args)], i ->\n    Cond( i mod 2 = 1 and i<>Length(cexp.args), pred_func, exp_func)(cexp.args[i])));\n\n#F maybe() --  \"magic\" boolean function, that satisfies logic_not(maybe()) = maybe()\n#F\n#F  maybe() behaves as 'true' inside 'and'/'or' operators,\n#F  but also satisfies the uncertainty rule logic_not(maybe()) = maybe()\n#F\nClass(maybe, Exp, rec(\n    computeType := self >> TBool\n));\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Bit manipulation\n#F\n\nClass(bin_parity, Exp, rec(\n    ev := self >> BinParity(self.args[1].ev()),\n    computeType := self >> self.args[1].t\n));\nClass(bin_and, Exp, rec(\n    ev := self >> _ListElmOp(self.args[1], self.args[2], BinAnd),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\nClass(bin_or, Exp, rec(\n    ev := self >> _ListElmOp(self.args[1], self.args[2], BinOr),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\nClass(bin_andnot, Exp, rec(\n    ev := self >> BinAnd(BinNot(self.args[1].ev()), self.args[2].ev()),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\nClass(bin_xor,   Exp, rec(\n    ev := self >> _ListElmOp(self.args[1], self.args[2], BinXor),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\nClass(adrgen, Exp, rec(\n    ev := self >> (2^self.args[1].ev()-1) - (2^self.args[2].ev()-1),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\nClass(concat, Exp, rec(\n    ev := self >> (self.args[1].ev() * (2^self.args[3].ev()) + self.args[2].ev()),\n    computeType := self >> UnifyPair(self.args[1].t, self.args[2].t)\n));\nClass(truncate, Exp, rec(\n    ev := self >> BinAnd(self.args[1].ev(), 2^self.args[2].ev()-1),\n    computeType := self >> self.args[1].t\n));\n\nClass(bin_shr, Exp, rec(\n    ev := self >> let(\n        a:=self.args[1].ev(), b:=self.args[2].ev(), bits:=When(IsBound(self.args[3]), self.args[3].ev(), false),\n        Cond(bits=false, When( IsList(a), ShiftList(a, -b, 0), Int(a * 2^(-b))), Int(a * 2^(-b)) mod 2^bits)),\n    computeType := self >> self.args[1].t\n));\n\nClass(bin_shl,  Exp, rec(\n    ev := self >> let(\n        a:=self.args[1].ev(), b:=self.args[2].ev(), bits:=When(IsBound(self.args[3]), self.args[3].ev(), false),\n        Cond( bits=false, When( IsList(a), ShiftList(a, b, 0), Int(a * 2^b) ),\n              Int(a * 2^b) mod 2^bits)),\n    computeType := self >> self.args[1].t\n));\n\nClass(arith_shr, Exp, rec(\n    ev := self >> let(\n        a:=self.args[1].ev(), b:=self.args[2].ev(), bits:=When(IsBound(self.args[3]), self.args[3].ev(), false),\n        Cond(bits=false, When( IsList(a), ShiftList(a, -b, Last(a)), Int(a * 2^(-b))), Int(a * 2^(-b)) mod 2^bits)),\n    computeType := self >> self.args[1].t\n));\n\nClass(arith_shl,  Exp, rec(\n    ev := self >> let(\n        a:=self.args[1].ev(), b:=self.args[2].ev(), bits:=When(IsBound(self.args[3]), self.args[3].ev(), false),\n        Cond(bits=false, When( IsList(a), ShiftList(a, b, 0), Int(a * 2^b)), Int(a * 2^b) mod 2^bits)),\n    computeType := self >> self.args[1].t\n));\n\nClass(rCyclicShift, Exp, rec(\n    ev := self >> let(a := self.args[1].ev(), shift := self.args[2].ev(),\n        c := 2^shift, bits := self.args[3].ev(),\n        BinAnd(a, c-1) * 2^(bits-shift) + Int(a / c)),\n    computeType := self >> self.args[1].t\n));\n\nClass(bit_sel, Exp, rec(\n    ev := self >> let(a := self.args[1].ev(), bit := self.args[2].ev(),\n                      bin_and(arith_shr(a, bit), 1).ev()\n    )\n));\n\nClass(xor, Exp, rec(\n    ev := self >> Xor    (self.args, e -> e.ev()),\n    computeType := self >> UnifyTypes(List(self.args, x->x.t))\n));\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Irrational functions\n#F\nClass(omega, AutoFoldExp, rec(\n    ev := self >> E(self.args[1].ev()) ^ self.args[2].ev(),\n    computeType := self >> TComplex));\nClass(exp, AutoFoldRealExp, rec(\n    ev := self >> d_exp(self.args[1].ev())));\nClass(log, AutoFoldRealExp, rec(\n    ev := self >> let( l := d_log(self.args[1].ev()),\n         Cond(Length(self.args)=2, l/d_log(self.args[2].ev()), l))));\nClass(cospi, AutoFoldExp, rec(\n    ev := self >> CosPi(self.args[1].ev()),\n    computeType := self >> TReal));\nClass(sinpi, AutoFoldExp, rec(\n    ev := self >> SinPi(self.args[1].ev()),\n    computeType := self >> TReal));\nClass(omegapi, AutoFoldExp, rec(\n    ev := self >> ExpIPi(self.args[1].ev()),\n    computeType := self >> TComplex));\nClass(sqrt, AutoFoldRealExp, rec(\n    ev := self >> Sqrt(self.args[1].ev())));\nClass(rsqrt, AutoFoldRealExp, rec(\n    ev := self >> 1/Sqrt(self.args[1].ev())));\n\n#F ----------------------------------------------------------------------------------------------\n#F Expressions: Specials and Wrappers\n#F\nClass(PlaceholderExp, Exp, rec(\n    ev := self >> self.args[1].ev(),\n    computeType := self >> self.args[1].t\n));\n\nClass(no_mod,  PlaceholderExp);\nClass(small_mod, imod);\nClass(accu,    PlaceholderExp);\nClass(depends, PlaceholderExp);\nClass(depends_memory, depends);\n\nClass(virtual_var, Exp, rec(\n    __call__ := (self, vars, idx) >>\n       let(idx2 := toExpArg(idx),\n           When(IsValue(idx2),\n               Cond(idx2.v >= Length(vars), errExp(self.t), vars[idx2.v+1]),\n               WithBases(self,\n                   rec(args := [vars, idx2],\n                       operations := ExpOps,\n                       t := Last(vars).t)))),\n\n    computeType := self >> Last(self.args[1]).t,\n\n    ev := self >> let(\n            vars := self.args[1],\n            idx := self.args[2].eval(),\n        Cond(not IsValue(idx),\n                 self,\n             idx.v < 0,\n                 errExp(self.t),\n             IsList(vars),\n                 Cond(idx.v >= Length(vars), errExp(self.t), vars[idx.v+1]))),\n));\n\n#F castizx(<exp>) - cast signed <exp> to twice larger data type with zero extension\nClass(castizx, Exp, rec(\n    __call__ := (self, expr) >>\n        WithBases(self, rec(\n\t    args       := [toExpArg(expr)],\n\t    operations := ExpOps,\n\t)).setType(),\n\n    computeType := self >> self.args[1].t.double().toSigned(),\n\n    ev := self >> self.args[1].t.toUnsigned().value(self.args[1].ev()).ev(),\n));\n\n#F castuzx(<exp>) - cast unsigned <exp> to twice larger data type with zero extension\nClass(castuzx, castizx, rec(\n    computeType := self >> self.args[1].t.double().toUnsigned(),\n));\n\n\n\n\n# cmemo(<expr>, <target>, <prefix>)\nClass(cmemo, Exp, rec(\n    __call__ := (self, prefix, target, exp) >>\n    Cond(IsValue(exp), exp.v,\n         #IsVar(exp), exp,\n         WithBases(self, rec(\n         operations := ExpOps,\n         prefix  := prefix,\n         target  := target,\n         args := [ var.fresh_t(prefix, TInt) ],\n         mapping := toExpArg(exp).eval() ))),\n    eval := self >> self.mapping.eval()\n));\n\nExprFuncs := rec(\n    T_SUM := add,\n    T_DIFF := sub,\n    T_PROD := mul,\n    T_QUO  := div,\n    T_MOD  := imod,\n    T_POW  := pow,\n    nth    := nth,\n    Int    := floor,\n    QuoInt := idiv,\n    LogMod := ilogmod,\n    CosPi := cospi,\n    SinPi := sinpi,\n    Sqrt  := sqrt,\n    ReComplex := re,\n    ImComplex := im,\n    Cond := cond\n);\n\n#F noneExp(<t>) -  represents an uninialized value of type <t>\n#F\n#F This handles the sitation with Scat * Diag * Scat(f)\n#F Scat(f) should never write explicit 0's even though Diag scales them\n#F\nClass(noneExp, Exp, rec(\n    computeType := self >> self.args[1]\n));\n\n#F errExp(<t>) -  represents an invalid result of type <t>\n#F\n#F   The reason this is used is to support the following strange rewrite:\n#F      0 * nth(T, i) -> 0,   when i is out of bounds\n#F   For example if i<0, normally the above might break, but using errExp:\n#F      0 * nth(T, -1) -> 0 * errExp(TReal) -> 0\n#F\nClass(errExp, Exp, rec(\n    computeType := self >> self.args[1]\n));\n\n#F funcExp(<i>) -- used to \"hack\" affine transformations out of Gath/Scat\n#F\n#F See Doc(Gath) for an explanation on how this works.\n#F <i> must be an integer expression.\n#F\n#F Currently, this has the following semantics\n#F\n#F  nth(X, i)          == X[i]\n#F  nth(X, funcExp(i)) == i\n#F\n#F The proper way of doing this would be instead (using h. coords, X[len(x)] = 1)\n#F nth(X, funcExp(i)) -> i * nth(X, len(X)) = i * X[len(X)] = i\n#F\n#F See http://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations\n#F\nClass(funcExp, Exp, rec(\n    eval := self >> funcExp(self.args[1].eval()),\n    computeType := self >> self.args[1].t,\n    can_fold := False,\n));\n\n#F ----------------------------------------------------------------------------------------------\n#F GAP Operations Records\n#F\n\nClass(ExpOps, PrintOps, rec(\n   \\+   := add,\n   \\-   := sub,\n   \\*   := (e1,e2) -> When(e1=-1, neg(e2), mul(e1,e2)),\n   \\/   := div,\n   \\^   := pow,\n   \\mod := imod,\n   \\=   := (e1,e2) -> Cond(\n       ObjId(e1) <> ObjId(e2), false,\n       e1.rChildren() = e2.rChildren()),\n   \\<   := (e1,e2) -> Cond(\n       ObjId(e1) <> ObjId(e2), ObjId(e1) < ObjId(e2),\n       e1.rChildren() < e2.rChildren())\n));\n\nClass(VarOps, ExpOps, rec(\n    \\= := (v1,v2) -> Same(v1,v2),\n    \\< := (v1,v2) -> Cond(not (IsVar(v1) and IsVar(v2)), ObjId(v1) < ObjId(v2),\n                          BagAddr(v1) < BagAddr(v2))\n));\n\nClass(NthOps, ExpOps, rec(\n    \\= := (v1,v2) -> IsRec(v1) and IsRec(v2) and Same(ObjId(v1), ObjId(v2))\n                     and v1.loc=v2.loc and v1.idx = v2.idx,\n    \\< := (v1,v2) -> Cond(\n                      not Same(ObjId(v1), ObjId(v2)), ObjId(v1) < ObjId(v2),\n                      v1.loc=v2.loc, v1.idx < v2.idx,\n                      v1.loc < v2.loc)\n));\n\n_val := x->Cond(IsValue(x) or IsSymbolic(x), x, InferType(x).value(x));\n\nValueOps.\\+ := (aa,bb) -> let(a:=_val(aa), b:=_val(bb), Cond(IsValue(a) and IsValue(b),\n    let(t:=UnifyPair(a.t, b.t), t.value(t.sum(a.v, b.v))), add(a, b)));\n\nValueOps.\\- := (aa,bb) -> let(a:=_val(aa), b:=_val(bb), Cond(IsValue(a) and IsValue(b),\n    let(t:=UnifyPair(a.t, b.t), t.value(t.sum(a.v, -b.v))), sub(a, b)));\n\nValueOps.\\* := (aa,bb) -> let(a:=_val(aa), b:=_val(bb), Cond(IsValue(a) and IsValue(b),\n    let(t:=UnifyPair(a.t, b.t), t.value(t.product(a.v, b.v))), mul(a, b)));\n\nValueOps.\\/ := div;\nValueOps.\\^ := pow;\nValueOps.\\mod := imod;\n\n#----------------------------------------------------------------------------------------------\n# Command : high level instructions\n#\n#   skip\n#   assign\n#   chain\n#   decl\n#   data\n#   loop\n#----------------------------------------------------------------------------------------------\n\nCmdOps := rec(Print := s -> s.print(0,3));\n\nClass(Command, AttrMixin, rec(\n   isCommand := true,\n   print := (self,i,si) >> Print(self.__name__),\n\n   countedArithCost := (self, countrec) >> countrec.arithcost(self.countOps(countrec)),\n\n   countOps := meth(self, countrec)\n      local cmds, ops, i;\n      ops := List([1..Length(countrec.ops)], i->0);\n\n      if self.__name__ = \"func\" and self.id = \"init\" then return(ops); fi;\n\n      if IsBound(self.cmds) then cmds := self.cmds;\n      else if IsBound(self.cmd) then cmds := [self.cmd]; else return(0); fi;\n      fi;\n\n      for i in cmds do\n        if IsBound(i.countOps) then\n           ops := ops + i.countOps(countrec);\n        else\n           Error(i.__name__, \"doesn't have countOps\");\n        fi;\n      od;\n      return(ops);\n   end,\n\n   free := self >> Set(ConcatList(self.rChildren(), FreeVars)),\n   from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch).takeA(self.a)\n));\n\nClass(ExpCommand, Command, rec(\n    isExpCommand := true,\n    __call__ := arg >> let(self := arg[1], args := Drop(arg,1),\n    WithBases(self, rec(\n       operations := CmdOps,\n        args := List(args, toExpArg)))),\n    rChildren := self >> self.args,\n    rSetChild := meth(self, i, newC) self.args[i] := newC; return newC; end,\n    print := (self,i,si) >>\n        Print(self.__name__, \"(\", PrintCS(self.args), \")\")\n));\n\nIsCommand := x -> IsRec(x) and IsBound(x.isCommand) and x.isCommand;\nIsExpCommand := x -> IsRec(x) and IsBound(x.isExpCommand) and x.isExpCommand;\n\n#F throw(<arg>) - symbolic representation of exception throw\n#F\nClass(throw, ExpCommand);\n\n#F call(<func>, <arg1>, <arg2>, ...) - symbolic representation of an external function call\n#F\nClass(call, ExpCommand);\n\nClass(skip, Command, rec(\n   __call__ := self >> WithBases(self, rec(operations:=CmdOps)),\n   print := (self,i,si) >> Print(self.__name__, \"()\"),\n   rChildren := self >> [],\n   free := self >> [],\n   op_in := self >> Set([])\n));\n\nClass(break, skip);\n\nClass(const, Command, rec(\n  __call__ := (self, value) >> WithBases(self, rec(operations:=CmdOps, val:=value)),\n   print := (self,i,si) >> Print(self.__name__, \"(\", self.val ,\")\"),\n   rChildren := self >> [],\n   free := self >> []\n));\n\nClass(dma_barrier, skip, rec(\n));\n\nClass(dist_barrier, skip, rec(\n));\n\nClass(noUnparse, Command, rec(\n   __call__ := (self, string) >> WithBases(self, rec(operations:=CmdOps, str:=string)),\n   print := (self,i,si) >> Print(self.__name__, \"(\\\"\", self.str, \"\\\")\"),\n   rChildren := self >> [],\n   rSetChild := (self, n, c) >> Error(\"no children\")\n));\n\nClass(assign, Command, rec(\n   isAssign := true,\n   __call__ := (self, loc, exp) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       exp := toExpArg(exp))),\n\n   rChildren := self >> [self.loc, self.exp],\n   rSetChild := rSetChildFields(\"loc\", \"exp\"),\n   unroll := self >> self,\n\n   #Must do a collect so that nested assigns work\n   countOps := (self, countrec) >> List([1..Length(countrec.ops)],\n        i->Length(Collect(self, @(1, countrec.ops[i], e->IsRec(e) and\n            ((IsBound(e.t) and (ObjId(e.t)=TVect) or (IsBound(e.countAsVectOp) and e.countAsVectOp())))))) ),\n\n   print := (self,i,si) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.exp, \")\"))\n\n\n));\n\nClass(regassign, assign, rec(\n   isAssign := true,\n   __call__ := (self, loc, exp) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       exp := toExpArg(exp))),\n\n   rChildren := self >> [self.loc, self.exp],\n   rSetChild := rSetChildFields(\"loc\", \"exp\"),\n   unroll := self >> self,\n\n   #Must do a collect so that nested assigns work\n   countOps := (self, countrec) >> List([1..Length(countrec.ops)],\n        i->Length(Collect(self, @(1, countrec.ops[i], e->IsRec(e) and\n            ((IsBound(e.t) and (ObjId(e.t)=TVect) or (IsBound(e.countAsVectOp) and e.countAsVectOp())))))) ),\n\n   print := (self,i,is) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.exp, \")\"))\n\n\n));\n\nIsAssign := x -> IsRec(x) and IsBound(x.isAssign) and x.isAssign;\n\nClass(assign_acc, assign);\n\n# syntax like a printf, prints out something in the output code.\n\nClass(PRINT, Command, rec(\n    __call__ := (arg) >> let(\n        self := arg[1],\n        fmt := arg[2],\n        vars := Drop(arg, 2),\n        Checked(\n            IsString(fmt),\n            IsList(vars),\n            WithBases(self, rec(\n                operations := CmdOps,\n                fmt := fmt,\n                vars := vars\n            ))\n        )\n    ),\n\n    rChildren := self >> Concat([self.fmt], self.vars),\n\n    rSetChild := meth(self, n, val)\n        if n = 1 then\n            self.fmt := val;\n        else\n            self.vars[n-1] := val;\n        fi;\n    end,\n\n    print := (self, i, si) >> Print(self.__name__, \"(\\\"\", self.fmt, When(Length(self.vars) <> 0, \"\\\", \", \"\\\"\"), PrintCS(self.vars), \")\")\n));\n\n#NOTE THAT HAO\n# Class(PRINT, Exp);\n\n# inserts a comment into the output code\nClass(comment, Command, rec(\n    isComment := true,\n    __call__ := (self, exp) >> Checked(\n        IsString(exp),\n        WithBases(self,\n            rec(operations := CmdOps,\n                exp := exp\n            )\n        )\n    ),\n\n    rChildren := self >> [self.exp],\n    rSetChild := rSetChildFields(\"exp\"),\n\n    print := (self, i, si) >> Print(self.__name__, \"(\\\"\", self.exp, \"\\\")\")\n));\n\nClass(quote, Command, rec(\n    isQuote := true,\n    __call__ := (self, cmd) >> Checked(\n        IsCommand(cmd),\n        WithBases(self, rec(\n            operations := CmdOps,\n            cmd := cmd\n        ))\n    ),\n\n    rChildren := self >> [self.cmd],\n    rSetChild := rSetChildFields(\"cmd\"),\n\n    print := (self, i, si) >> Print(self.__name__, \"(\", self.cmd.print(i+si,si), \")\")\n));\n\nClass(wrap, Command, rec(\n   rChildren := self >> [ self.cmd ],\n   rSetChild := rSetChildFields(\"cmd\"),\n\n   __call__ := (self, cmd) >> WithBases(self,\n       rec(operations := CmdOps,\n           cmd        := Checked(IsCommand(cmd), cmd))),\n\n   print := meth(self,i,si)\n         Print(self.__name__, \"(\\n\");\n         Print(Blanks(i+si), self.cmd.print(i+si, si), \"\\n\");\n     Print(Blanks(i), \")\");\n   end\n));\n\nClass(multiwrap, Command, rec(\n   rChildren := self >> self.cmds,\n   rSetChild := meth(self, n, newChild) self.cmds[n] := newChild; end,\n\n   __call__ := meth(arg)\n       local self, cmds;\n       self := arg[1];\n       cmds := Flat(Drop(arg, 1));\n       return WithBases(self,\n       rec(operations := CmdOps,\n           cmds       := Checked(ForAll(cmds, IsCommand), cmds)));\n   end,\n\n   printCmds := meth(self, i, si)\n       local c;\n       for c in Take(self.cmds, Length(self.cmds)-1) do\n           Print(Blanks(i));\n       c.print(i, si);\n       Print(\",\\n\");\n       od;\n       Print(Blanks(i));\n       Last(self.cmds).print(i, si);\n       Print(\"\\n\");\n   end,\n\n   print := (self,i,si) >> When(Length(self.cmds)=0,\n       Print(self.__name__, \"()\"),\n       Print(self.__name__, \"(\\n\", self.printCmds(i+si, si), Blanks(i), \")\"))\n));\n\nIsChain :=  x -> IsRec(x) and IsBound(x.isChain) and x.isChain;\n\nClass(chain, multiwrap, rec(\n   isChain := true,\n\n   flatten := self >> let(cls := self.__bases__[1],\n       CopyFields(self, rec(cmds := ConcatList(self.cmds,\n           c -> Cond(IsChain(c) and not IsBound(c.doNotFlatten), c.cmds,\n                 ObjId(c) = skip, [],\n             [c]))))),\n\n   __call__ := meth(arg)\n       local self, cmds;\n       [self, cmds] := [arg[1], Flat(Drop(arg, 1))];\n       return WithBases(self, rec(\n           operations := CmdOps,\n           cmds       := Checked(ForAll(cmds, IsCommand), cmds)));\n   end\n\n));\n\nClass(unroll_cmd, multiwrap, rec(\n    flatten := self >> chain(self.cmds).flatten()\n));\n\nClass(kern, Command, rec(\n    __call__  := (self, bbnum, cmd) >> WithBases(self, rec(\n        bbnum := bbnum,\n        cmd := Checked(IsCommand(cmd), cmd),\n        operations := CmdOps\n    )),\n\n    rChildren := self >> [self.bbnum, self.cmd],\n    rSetChild := rSetChildFields(\"bbnum\", \"cmd\"),\n\n    print := (self, i, si) >> Print(self.__name__, \"(\", self.bbnum, \", \", self.cmd.print(i+si,si), \")\")\n));\n\nClass(unparseChain, multiwrap, rec(\n   #rChildren := self >> [],\n   #rSetChild := self >> Error(\"Not implemented\"),\n\n   __call__ := meth(arg)\n       local self, cmds;\n       [self, cmds] := [arg[1], Flat(Drop(arg, 1))];\n       return WithBases(self, rec(\n           operations := CmdOps,\n           cmds       := cmds));\n   end,\n\n   print := (self,i,si) >> Print(self.__name__)\n));\n\n\nClass(decl, Command, rec(\n   __call__ := meth(self, vars, cmd)\n       local tvars;\n       if IsList(vars) and Length(vars)=0 then return cmd; fi;\n       tvars := When(IsList(vars), Checked(ForAll(vars, IsLoc), vars),\n                                   Checked(IsLoc(vars), [vars]));\n       Sort(tvars, (a,b) -> a.id < b.id);\n       return WithBases(self,\n           rec(operations := CmdOps,\n           cmd        := Checked(IsCommand(cmd), cmd),\n           vars       := tvars));\n   end,\n\n   rChildren := self >> [self.vars, self.cmd],\n   rSetChild := rSetChildFields(\"vars\", \"cmd\"),\n\n   print := (self, i, si) >> Print(self.__name__, \"(\", self.vars, \",\\n\",\n       Blanks(i+si),\n       self.cmd.print(i+si, si),\n       \"\\n\", Blanks(i), \")\"),\n\n   free := self >> Difference(self.cmd.free(), Set(self.vars)),\n));\n\nClass(data, Command, rec(\n   __call__ := (self, var, value, cmd) >> WithBases(self,\n           rec(operations := CmdOps,\n           cmd        := Checked(IsCommand(cmd), cmd),\n           var        := Checked(ObjId(var) in [code.var,code.param], var),\n           value      := value)), #Checked(IsValue(value), value))),\n\n   rChildren := self >> [self.var, self.value, self.cmd],\n   rSetChild := rSetChildFields(\"var\", \"value\", \"cmd\"),\n\n   free := self >> Difference(Union(FreeVars(self.cmd), FreeVars(self.value)), [self.var]),\n\n   print := (self, i, si) >> Print(self.__name__, \"(\", self.var, \", \",\n       self.value, \",\\n\", Blanks(i+si),\n       self.cmd.print(i+si, si),\n       \"\\n\", Blanks(i), \")\"),\n\n));\n\n#F rdepth_marker(<depth>, <cmd>) - Autolib's recursion depth marker,\n#F    BCRDepth turnes into this marker, <depth> >= 1, one is the deepest (recursion) level.\n#F\nClass(rdepth_marker, Command, rec(\n    __call__  := (self, depth, cmd) >> WithBases(self, rec(\n        depth      := depth,\n        cmd        := Checked(IsCommand(cmd), cmd),\n        operations := CmdOps\n    )),\n\n    rChildren := self >> [self.depth, self.cmd],\n    rSetChild := rSetChildFields(\"depth\", \"cmd\"),\n\n    print := (self, i, si) >> Print(self.__name__, \"(\", self.depth, \", \", self.cmd.print(i+si,si), \")\")\n));\n\nDeclare(SubstVars);\n\nClass(asmvolatile, Command, rec(\n   __call__ := meth(self, asm)\n       return WithBases(self,\n           rec(operations := CmdOps,\n           asm       := asm));\n   end,\n\n   rChildren := self >> [self.asm],\n   rSetChild := rSetChildFields(\"asm\"),\n  print := (self, i, si) >> Print(\"asmvolatile(\\n\",self.asm,\")\\n\"))\n);\n\nClass(loop_base, Command, rec(\n   isLoop := true,\n\n   countOps := (self, countrec) >> self.cmd.countOps(countrec) * Length(listRange(self.range)),\n\n   rChildren := self >> [self.var, self.range, self.cmd],\n   rSetChild := rSetChildFields(\"var\", \"range\", \"cmd\"),\n\n   print := (self, i, si) >> Print(self.__name__, \"(\", self.var, \", \",\n       self.range, \",\\n\", Blanks(i+si),\n       self.cmd.print(i+si, si),\n       Print(\"\\n\", Blanks(i), \")\")),\n\n   free := meth(self) local c;\n       c := self.cmd.free();\n       if IsExp(self.range) then c:=Set(Concat(c, self.range.free())); fi;\n       SubtractSet(c, Set([self.var]));\n       return c;\n   end\n));\n\nDeclare(loopn);\n\n\nFreshVars := function (code, map)\n    local v;\n    for v in Filtered(Difference(Collect(code, var), code.free()), e -> IsArrayT(e.t)) do\n        map.(v.id) := var.fresh_t(String(Filtered(v.id, c -> not c in \"0123456789\")), v.t);\n    od;\n    return SubstTopDownNR(code, @(1, var, x -> IsBound(map.(x.id))), e -> map.(e.id));\nend;\n\nClass(loop, loop_base, rec(\n\n   __call__ := meth(self, loopvar, range, cmd)\n       local result;\n#       Constraint(IsVar(loopvar)); YSV: could be a param\n       Constraint(IsCommand(cmd));\n       if IsSymbolic(range) then return loopn(loopvar, range, cmd); fi;\n       range := toRange(range);\n       if range = 1 then\n           return SubstBottomUp(Copy(cmd), @(1, var, e->e=loopvar), e->V(0));\n       elif range = 0 then\n           return skip();\n       else\n           loopvar.setRange(range);\n           range := listRange(range);\n           result := WithBases(self,\n               rec(operations := CmdOps, cmd := cmd, var := loopvar, range := range));\n           loopvar.isLoopIndex := true;\n           #loopvar.loop := result;\n           return result;\n       fi;\n   end,\n\n   unroll := self >>\n      chain( List(self.range,\n              index_value -> FreshVars(Copy(self.cmd),\n                                   tab((self.var.id) := V(index_value)))))\n));\n\n\nClass(multibuffer_loop, loop_base, rec(\n\n   __call__ := meth(self, loopvar, range, y, x, gathmem, twiddles, bufs, cmd, scatmem)\n       local result;\n#       Constraint(IsVar(loopvar));  YSV: could be a param\n       Constraint(IsCommand(cmd));\n       #if IsSymbolic(range) then return loopn(loopvar, range, cmd); fi;\n       range := toRange(range);\n       #if range = 1 then\n       #    return SubstBottomUp(Copy(cmd), @(1, var, e->e=loopvar), e->V(0));\n       #elif range = 0 then\n       #    return skip();\n       #else\n           loopvar.setRange(range);\n           range := listRange(range);\n           result := WithBases(self,\n               rec(operations := CmdOps,\n               gathmem := gathmem,\n               twiddles := twiddles,\n               bufs := bufs,\n               cmd := cmd,\n               y := y,\n               x := x,\n               scatmem := scatmem,\n               var := loopvar,\n               range := range));\n           loopvar.isLoopIndex := true;\n           #loopvar.loop := result;\n           return result;\n       #fi;\n   end,\n\n   rChildren := self >> [self.var, self.range, self.y, self.x, self.gathmem, self.twiddles, self.bufs, self.cmd, self.scatmem],\n   rSetChild := rSetChildFields(\"var\", \"range\", \"y\", \"x\", \"gathmem\", \"twiddles\", \"bufs\", \"cmd\", \"scatmem\"),\n\n   unroll := self >>\n      chain( List(self.range,\n              index_value -> SubstVars(Copy(self.cmd),\n                                   tab((self.var.id) := V(index_value)))))\n));\n\n\nClass(mem_loop, multibuffer_loop);\n\n\nClass(loop_sw, loop, rec(\n   unroll := self >>\n      chain( List(self.range,\n              index_value -> SubstVars(Copy(self.cmd),\n                                   tab((self.var.id) := V(index_value)))))\n));\n\n\nClass(loopn, loop_base, rec(\n\n   __call__ := meth(self, loopvar, range, cmd)\n       local result;\n#       Constraint(IsVar(loopvar)); # YSV: could be a param\n       Constraint(IsCommand(cmd));\n       range := toExpArg(range);\n       if IsValue(range) then return loop(loopvar, range.v, cmd);\n       else\n           loopvar.setRange(range);\n           result := WithBases(self,\n               rec(operations := CmdOps, cmd := cmd, var := loopvar, range := range));\n           loopvar.isLoopIndex := true;\n           return result;\n       fi;\n   end,\n\n   unroll := self >> let(res:=loop(self.var, self.range.ev(), self.cmd),\n       When(ObjId(res)=loop, res.unroll(), res)), # res if loop has single iteration it returns just the body\n));\n\nClass(doloop, loop_base, rec(\n   __call__ := (self, loopvar, range, cmd) >> WithBases(self,\n               rec(operations := CmdOps, cmd := cmd, var := loopvar, range := range))\n));\n\n\n# IF(<cond>, <then_cmd>, <else_cmd>)  -  symbolic representation of a conditional\n#\nClass(IF, Command, rec(\n   __call__ := (self, cond, then_cmd, else_cmd) >>\n       Cond( cond = true,  Checked(IsCommand(then_cmd), then_cmd),\n             cond = false, Checked(IsCommand(else_cmd), else_cmd),\n             WithBases( self, rec(\n                 operations := CmdOps,\n                 then_cmd   := Checked(IsCommand(then_cmd), then_cmd),\n                 else_cmd   := Checked(IsCommand(else_cmd), else_cmd),\n                 cond       := toExpArg(cond))) ),\n\n   rChildren := self >> [self.cond, self.then_cmd, self.else_cmd],\n   rSetChild := rSetChildFields(\"cond\", \"then_cmd\", \"else_cmd\"),\n\n   free := self >> Union(self.cond.free(), self.then_cmd.free(), self.else_cmd.free()),\n\n   print := (self, i, si) >>\n       Print(self.__name__, \"(\", self.cond, \",\\n\",\n         Blanks(i+si), self.then_cmd.print(i+si, si), \",\\n\",\n         Blanks(i+si), self.else_cmd.print(i+si, si), \"\\n\",\n         Blanks(i), \")\")\n));\n\nClass(DOWHILE, Command, rec(\n  __call__ := (self, cond, then_cmd) >> WithBases(self,\n           rec(operations := CmdOps,\n           then_cmd   := Checked(IsCommand(then_cmd), then_cmd),\n           cond       := toExpArg(cond))),\n\n   rChildren := self >> [self.cond, self.then_cmd],\n   rSetChild := rSetChildFields(\"cond\", \"then_cmd\"),\n\n   free := self >> Union(self.cond.free(), self.then_cmd.free()),\n\n   print := (self, i, si) >>\n       Print(self.__name__, \"(\", self.cond, \",\\n\",\n         Blanks(i+si), self.then_cmd.print(i+si, si), \"\\n\",\n         Blanks(i), \")\")\n));\n\nClass(WHILE, Command, rec(\n  __call__ := (self, cond, then_cmd) >> WithBases(self,\n           rec(operations := CmdOps,\n           then_cmd   := Checked(IsCommand(then_cmd), then_cmd),\n           cond       := toExpArg(cond))),\n\n   rChildren := self >> [self.cond, self.then_cmd],\n   rSetChild := rSetChildFields(\"cond\", \"then_cmd\"),\n\n   free := self >> Union(self.cond.free(), self.then_cmd.free()),\n\n   print := (self, i, si) >>\n       Print(self.__name__, \"(\", self.cond, \",\\n\",\n         Blanks(i+si), self.then_cmd.print(i+si, si), \"\\n\",\n         Blanks(i), \")\")\n));\n\n\nClass(multi_if, ExpCommand, rec(\n    __call__ := arg >> let(\n        self := arg[1],\n        args := Cond( Length(arg)=2 and IsList(arg[2]), arg[2], Drop(arg,1)),\n        Cond( # Length(args)=0, skip(), #NOTE: code in autolib's _genPlan relies on this and messing with 'args' directly\n              Length(args)=1, toExpArg(args[1]),\n              WithBases(self, rec(\n                  operations := CmdOps,\n                  args := List(args, toExpArg))))),\n\n   print := (self, i, si) >> Print(self.__name__, \"(\\n\",\n       DoForAll([1..Length(self.args)], j ->\n           Cond( IsOddInt(j), Print(Blanks(i+si), self.args[j]),\n                              Print(\", \", self.args[j].print(i+si+si, si), When(j<>Length(self.args), \",\\n\")))),\n       Print(\"\\n\", Blanks(i), \")\"))\n\n\n));\n\n\n#F program(<cmd1>, <cmd2>, ...) - top level collection of commands,\n#F   usually each cmd is decl, func or struct\n#F\nClass(program, multiwrap);\n\nClass(trycatch, multiwrap);\nClass(tryfinally, multiwrap);\n\n#F func(<ret>, <id>, <params>, <cmd>)\n#F   ret    - return type\n#F   id     - function name string\n#F   params - list of parameters (typed vars)\n#F   cmd    - function body\n#F\nClass(func, Command, rec(\n    __call__ := (self, ret, id, params, cmd) >> WithBases(self, rec(\n            ret    := Checked(IsType(ret), ret),\n            id     := Checked(IsString(id), id),\n            params := Checked(IsList(params), params),\n            cmd    := Checked(IsCommand(cmd), cmd),\n            operations := CmdOps)),\n\n    free := self >> Difference(self.cmd.free(), self.params),\n    rChildren := self >> [self.ret, self.id, self.params, self.cmd],\n    rSetChild := rSetChildFields(\"ret\", \"id\", \"params\", \"cmd\"),\n\n    print := (self, i, si) >> Print(self.__name__, \"(\", self.ret, \", \\\"\", self.id, \"\\\", \", self.params, \", \\n\",\n        Blanks(i+si), self.cmd.print(i+si, si), \"\\n\", Blanks(i), \")\", self.printA()),\n\n    # we have to handle vector values differently, since we only want to count unique ones, but they may be masqueraded by vparam or as integer constants in fpmuls\n    countOps := meth(self, countrec)\n        local count, reccountrec, vals, vparams, fpmuls;\n        if self.id = \"transform\" and Last(countrec.ops) = Value then\n            reccountrec := Copy(countrec);\n            reccountrec.ops := DropLast(countrec.ops, 1);\n            count := self.cmd.countOps(reccountrec);\n            vals := Set(List(Collect(self.cmd, @@(1, Value, (e,cx)->ObjId(e.t)=TVect or\n                (IsBound(cx.Value) and cx.Value=[] and ObjId(e.t)=AtomicTyp and e.t.name=\"TReal\" and IsFloat(e.v)))), i->i.v));\n            vparams := Set(List(Collect(self.cmd, @(1, spiral.platforms.vparam, e->IsList(e.p) and ForAll(e.p, IsString))), i->i.p));\n            fpmuls := Set(Filtered(List(Collect(self.cmd, fpmul), i-> i.args[2]), IsValue));\n            Add(count, Length(vals)+Length(vparams)+Length(fpmuls));\n            return count;\n        else\n            return self.cmd.countOps(countrec);\n        fi;\n    end\n\n));\n\nClass(func_ppe, func);\n\n#\n## define\n#\n# this command is used to define new types in the unparsed code.\n# if you need a\n#\n# typedef struct { ... }\n#\n# this is it.\n#\nClass(define, Command, rec(\n    __call__ := (self, types) >> WithBases(self, rec(\n        types := types,\n        operations := CmdOps\n    )),\n\n    rChildren := self >> [self.types],\n    rSetChild := rSetChildFields(\"types\"),\n\n    print := (self, i, si) >> Print(\n        self.__name__, \"(\", self.types, \")\"\n    )\n));\n\n#\n## IfDef\n#\n# A #if statement to control execution in code. Used for debugging -- getting counts for only\n# certain kernels, etc.\n#\nClass(IfDef, Command, rec(\n    __call__ := (self, cond, cmd) >> WithBases(self, rec(\n        cond := Checked(IsString(cond), cond),\n        operations := CmdOps,\n        cmd := Checked(IsCommand(cmd), cmd)\n    )),\n\n    rChildren := self >> [self.cond, self.cmd],\n    rSetChild := rSetChildFields(\"cond\", \"cmd\"),\n\n    print := (self, i, si) >> Print(\n        self.__name__, \"(\\\"\", self.cond, \"\\\", \", self.cmd, \")\"\n    ),\n));\n\nClass(Define, Command, rec(\n    __call__ := (self, var, exp) >> WithBases(self, rec(\n        operations := CmdOps,\n        var := var,\n        exp := exp\n    )),\n    rChildren := self >> [self.exp, self.var],\n    rSetChild := rSetChildFields(\"exp\", \"var\"),\n    print := (self, i, si) >> Print(\n        self.__name__, \"(\", self.var, \", \", self.exp, \")\")\n));\n\n#-----------------------------------------------------------------------------\n#F Ind()\n#F Ind(<range>)  -- <range> must be an integer or symbolic integer that will\n#F                  imply the range of variable of [0 .. <range>-1]\n#F NB: we do not set isLoopIndex attribute below, because Ind() is now\n#F     used in Lambda's and some other places which are not loops\n#F     NOTE?\n#F\nInd := arg -> Cond(\n   Length(arg)=0, var.fresh_t(\"i\", TInt),\n   Length(arg)=1,\n       Cond(arg[1]=TInt, var.fresh_t(\"ii\", TInt),\n                         var.fresh(\"i\", TInt, toRange(arg[1]))),\n   Error(\"Usage: Ind() | Ind(<range>)\")\n);\n\nIndNR := () -> var.fresh_t(\"i\", TInt);\nIntVar := pfx -> var.fresh_t(pfx, TInt);\nDataInd := (type, range) -> var.fresh(\"k\", type, toRange(range));\nTempVec := type -> var.fresh_t(\"T\", type);\nDat := type -> var.fresh_t(\"D\", type);\nDat1d := (type,nentries) -> var.fresh_t(\"D\", TArray(type, nentries));\nDat2d := (type,rows,cols) -> var.fresh_t(\"D\", TArray(TArray(type, cols), rows));\nDat3d := (type,planes,rows,cols) -> var.fresh_t(\"D\", TArray(TArray(TArray(type, cols), rows), planes));\nTempVar := type -> var.fresh_t(\"t\", type);\n\n\nIsLoop := x->IsRec(x) and IsBound(x.isLoop) and x.isLoop;\nIsUnrollableLoop := x->IsRec(x) and IsBound(x.isLoop) and x.isLoop and x.__name__ <> \"dist_loop\";\nIsChain := x->IsRec(x) and IsBound(x.isChain) and x.isChain;\n\n\nIsLoopIndex := v -> IsRec(v) and IsBound(v.isLoopIndex) and v.isLoopIndex;\nIsParallelLoopIndex := v -> IsRec(v) and IsBound(v.isParallelLoopIndex) and v.isParallelLoopIndex;\nIndPar := idx -> Ind(idx).setAttr(\"isParallelLoopIndex\");\n\n\n#F FlattenCode(<code>) . . . . . . . . . . . flattens nested chain commands\n#F\nFlattenCode := c -> SubstBottomUp(c, @.cond(x->IsChain(x) or ObjId(x)=unroll_cmd), e -> e.flatten());\n\n#F FlattenCode2(<code>) . . . same as FlattenCode, but also replaces chain(c) by c\n#F\nFlattenCode2 := c -> SubstBottomUpRules(c, [\n    [@.cond(x->IsChain(x) or ObjId(x)=unroll_cmd), e -> e.flatten(), \"flatten1\"],\n    [[chain, @(1)], e->e.cmds[1], \"flatten2\"]\n]);\n\n#F FlattenCode0(<code>) . . same as FlattenCode, but avoids unroll_cmd\n#F\nFlattenCode0 := c -> SubstBottomUp(c, @.cond(x->IsChain(x)), e -> e.flatten());\n\n\n#F UnrollCode(<code>) . . . . . . fully unrolls <code> without optimization\n#F   SubstBottomUp works faster than SubstTopDown as it unrolls innermost loops first\n#F   but it doesn't work when loop domain depends from outer loop variable.\nUnrollCode := c -> let(\n    buc := SubstBottomUp(c, @.cond(x -> IsLoop(x) and not IsSymbolic(x.range)), e->e.unroll()),\n    tdc := SubstTopDown(buc, @.cond(IsLoop), e->e.unroll()),\n    SubstBottomUp(tdc, virtual_var, e->e.ev())\n);\n\n\n#F ArithCostCode(<code>)  . . . . . . . returns a list [num_adds, num_muls]\n#F\nArithCostCode := c -> let(\n    ops := List([Collect(c, add), Collect(c, sub), Collect(c, mul)],\n\t        lst -> Sum(lst, x->Length(x.args)-1)),\n    [ops[1]+ops[2], ops[3]]);\n\n\n#F SubstVars(<expr>, <bindings>)\n#F\n#F Evaluates several variables in <expr> to their values given in <bindings>.\n#F <bindings> should be a record or a table of the form:\n#F   rec( var1 := value1, ...)  OR\n#F   tab( var1 := value1, ...)\n#F\nSubstVars := function (expr, bindings)\n    return SubstLeaves(expr, @(200, var, e -> IsBound(bindings.(e.id))),\n    e -> bindings.(e.id));\nend;\n\nSubstVarsEval := function (expr, bindings)\n    return SubstBottomUp(expr, @,\n    e -> Cond(IsVar(e), bindings.(e.id), IsExp(e), e.eval(), V(e)));\nend;\n", "meta": {"hexsha": "d0e0af78d04da94ca69aa6892d64cf5ee5bc2590", "size": 74652, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/ir.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/ir.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/ir.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.1188299817, "max_line_length": 178, "alphanum_fraction": 0.5480898034, "num_tokens": 21614, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3738758227716966, "lm_q2_score": 0.03358950468268333, "lm_q1q2_score": 0.012558303699731987}}
{"text": "Class(ACubeRot_ZXY, ASingletonTag);\nClass(ACubeRot_YZX, ASingletonTag);\nClass(ACubeRot_XYZ, ASingletonTag);\nClass(ACubeRot_ZYX, ASingletonTag);\n\n\nClass(TTensorII, Tagged_tSPL_Container, rec(\n    abbrevs :=  [ (nt, s, l, r) -> Checked(\n        IsSPL(nt),\n\t[nt, s, l, r])\n    ],\n\n    dims := self >> self.params[1].dims()*Product(self.params[2]),\n\n    SPLtSPL := (self, nt, P) >> Error(\"not implemented\"),\n\n    terminate := self >> Error(\"not implemented\"),\n\n    transpose := self >> let(p := self.params,\n        TTensorII(p[1].transpose(), p[2], p[4], p[3]).withTags(self.getTags())),\n\n    isReal := self >> self.params[1].isReal(),\n\n    normalizedArithCost := self >>\n        self.params[1].normalizedArithCost() * Product(self.params[2]),\n\n    doNotMeasure := true,\n\n    HashId := self >> let(\n\tp := self.params,\n\th := When(IsBound(p[1].HashId), p[1].HashId(), p[1]),\n        [h, p[2], p[3], p[4]] :: When(IsBound(self.tags), self.tags, [])\n    ),\n));\n\n", "meta": {"hexsha": "c9b1fe97bfba5b09c67fb86296a5c22dd7e3fcca", "size": 955, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "nonterm.gi", "max_stars_repo_name": "spiral-software/spiral-package-mpi", "max_stars_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "nonterm.gi", "max_issues_repo_name": "spiral-software/spiral-package-mpi", "max_issues_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "nonterm.gi", "max_forks_repo_name": "spiral-software/spiral-package-mpi", "max_forks_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-24T13:52:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-24T13:52:26.000Z", "avg_line_length": 26.5277777778, "max_line_length": 80, "alphanum_fraction": 0.5958115183, "num_tokens": 303, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.45326183324442865, "lm_q2_score": 0.02758528032814983, "lm_q1q2_score": 0.012503354732098666}}
{"text": "ImportAll(simt);\n\nClass(mpi_rcperm, call);\n\nClass(MPICUDACodeGenMixin, rec(\n    MPIRCPrm := (self,o,y,x,opts) >> simt_block(ApplyFunc(mpi_rcperm, [y,x]::o.func.params{[1..2]}::[Length(o.func.params[3])]::o.func.params[3]))\n));\n\n\nClass(MPICUDAUnparserMixin, rec(\n    mpi_rcperm := (self, o, i, is) >> Print(Blanks(i), \"fftx_mpi_rcperm\", self.pinfix(o.args, \", \"), \";\\n\")  \n));\n\n\nFixUpMPICUDAPerm := function(c)\n    local mpicalls, mpinames, cucalls, mc, cc, ic;  \n\n    mpicalls := Collect(c, @(1, specifiers_func, e->IsBound(e.cmd.cmds) and ObjId(e.cmd.cmds[1]) in [call, mpi_rcperm]));\n    mpinames := List(mpicalls, i->i.id);\n    cucalls := Collect(c, cu_call);\n    \n    for mc in mpicalls do\n        SubstVars(mc, FoldR(Zip2(mc.params, Filtered(cucalls, cc->cc.func = mc.id)[1].args), (a,b) -> CopyFields(a, rec((b[1].id) := V(b[2]))), rec()));\n    od;\n    \n    c:= SubstTopDown(c, @(1, cu_call, e->e.func in mpinames),\n        e->Filtered(mpicalls, i->i.id = @(1).val.func)[1].cmd.cmds[1]\n    );\n    \n    c := SubstTopDown(c, @(1, specifiers_func, e->IsBound(e.cmd.cmds) and ObjId(e.cmd.cmds[1]) in [call, mpi_rcperm]),\n        e->skip());\n        \n    c := SubstBottomUp(c, @(1, chain), e-> chain(Filtered(@(1).val.cmds, c->ObjId(c) <> skip)));\n    \n    cc := Collect(c, @(1, call, e->IsBound(e.args[1].codegen)));\n    ic := List(cc, _c -> _c.args[1].codegen.init());\n    c := SubstBottomUp(c, @@(1, chain, (e,cx)->IsBound(cx.func) and Length(cx.func) = 1 and cx.func[1].id = \"init\"),\n           e->chain(@@(1).val.cmds::ic));\n        \n    c := FoldL(List(cc, d->d.args[1].codegen), (a,b)->b.data(a), chain(c.cmds));\n    c := program(decl(c.free(), c));\n    c := SubstBottomUp(c, @(1, decl), \n        e -> decl(Filtered(@(1).val.vars, v -> v in @(1).val.cmd.free()), @(1).val.cmd));\n        \n    return c;    \nend;\n", "meta": {"hexsha": "fb3f1e5fc9d75b6908066ce171c14da986620a23", "size": 1819, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "code.gi", "max_stars_repo_name": "spiral-software/spiral-package-mpi", "max_stars_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "code.gi", "max_issues_repo_name": "spiral-software/spiral-package-mpi", "max_issues_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "code.gi", "max_forks_repo_name": "spiral-software/spiral-package-mpi", "max_forks_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-24T13:52:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-24T13:52:26.000Z", "avg_line_length": 38.7021276596, "max_line_length": 152, "alphanum_fraction": 0.5662451897, "num_tokens": 634, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.36296920551961687, "lm_q2_score": 0.03410042436258875, "lm_q1q2_score": 0.012377403938770626}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nClass(CCMContextScratchUnparserProg, CScratchUnparserProg, rec(\n\tpar_exec := (self,o,i,is) >> Print(Blanks(i), \"parallel(&sub_cpu) \\n\",\n                              Blanks(i), \"{\\n\", self(o.cmds[1],i+is,is),\n                              Blanks(i+is), \"if(isFinished) {\\n\",\n                              Blanks(i+is+is), \"setFinished;\\n\",\n                              Blanks(i), self(o.cmds[2],i+is,is),\n                              Blanks(i+is),\"}\\n\",\n                              Blanks(i),\"}\\n\"),\n));\n", "meta": {"hexsha": "c61c44202daaf77acbfe6307ac8676f144ed0ed1", "size": 590, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/scratch_x86/cmunparser.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/scratch_x86/cmunparser.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/scratch_x86/cmunparser.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 42.1428571429, "max_line_length": 72, "alphanum_fraction": 0.4593220339, "num_tokens": 157, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.2974699426047947, "lm_q2_score": 0.04146227197113573, "lm_q1q2_score": 0.012333779663518134}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#Class(MultiBufBB, RuleSet);\n#RewriteRules(MultiBufBB, rec(\n#     remove_bbs := Rule(@(1, Compose, e->ForAll(e.children(), c->ObjId(c)=DistSum)),\n#        e -> ComposeDists(@(1).val.children()) )\n#));\n\napplyCellInplace := function(sums, opts)\n    SubstBottomUp(sums, GathDist, e->Inplace(e));\n    SubstBottomUp(sums, GathRecv, e->Inplace(e));\n    SubstBottomUp(sums, ScatDist, e->Inplace(e));\n\n    SubstBottomUp(sums, ScatMem, e->Inplace(e));\n    SubstBottomUp(sums, GathMem, e->Inplace(e));\n\n\n    # BB(Inplace()) -> Inplace() (So that a copy operation need not take place)\n    SubstBottomUp(sums, [BB, Inplace], e->e.rChildren()[1]);\n    return(sums);\nend;\n\n\n#s := SubstBottomUp(s, ScatMem, e->Inplace(e));\n#s := SubstBottomUp(s, GathMem, e->Inplace(e));\n#s := SubstBottomUp(s, [BB, Inplace], e->e.rChildren()[1]);\n\n\n# DistSum(Scat__ * MultiBufISum() * Gath__) -> DistSumLoop(MultiBufISum(ScatMem * () * GathMem))\n\n# DistSum has to be converted to a DistSumLoop because DistSum expects its Scat\n# and Gath to span the entire expanse of the computation, and therefore assumes\n# an appropriate Scat/Gath. DistSumLoop does not.\n\n\ndoMultiBufBC := function(sums, opts)\n    Error(\"doMultiBufBC: BP\");\n    return(sums);\nend;\n\n#F Dist(MultiBuf) is for independent DFTs running on separate SPEs (or sets of\n#F SPEs), each multibuffered separately\nClass(DistMultiBuf, RuleSet);\n\nRewriteRules(DistMultiBuf, rec(\n     # HACK: rule assumes we do only independent DFTs\n     join_dist_multibuf_compose := Rule([@(1,DistSum), @, @(2,Compose, e->Length(Collect(e.rChildren()[1], MultiBufISum))=1) ],\n       e -> let(\n          dsum := @(1).val,\n          Error(\"\"),\n          msum := Collect(@(2).val, MultiBufISum)[1],\n          sp   := Collect(dsum, @(3,[ScatDist, ScatSend]))[1],\n          sm   := msum.scatmem,\n          sdm  := fCompose(sp.func, fTensor(sm.func, fId(sm.pkSize/sp.pkSize))),\n          \n          gp   := Collect(dsum, @(3,[GathDist, GathRecv]))[1],\n          gm   := msum.gathmem,\n          gdm  := fCompose(gp.func, fTensor(gm.func, fId(gm.pkSize/gp.pkSize))),\n          \n          DistSumLoop(dsum.P, dsum.var, dsum.domain,\n            MultiBufISum(msum.var, msum.domain,\n              #ScatDirectMem(sdm, sp.pkSize, dsum.P, dsum.var),\n              ScatMem(sdm, sp.pkSize),\n              msum.rChildren()[2],\n              #GathDirectMem(gdm, gp.pkSize, dsum.P, dsum.var)\n              GathMem(gdm, gp.pkSize)\n            ) \n          )\n       )\n     ),\n\n     join_dist_multibuf_separate := Rule(@(1, DistSum, e->Length(Collect(e.rChildren()[2], MultiBufISum))=1),\n       e -> let(\n          dsum := @(1).val,\n          msum := Collect(@(1).val, MultiBufISum)[1],\n\n          sp   := Collect(dsum, @(3,[ScatDist, ScatSend]))[1],\n          sm   := msum.scatmem,\n          spm  := fCompose(fTensor(sp.func, fId(sp.pkSize/sm.pkSize)), sm.func),\n\n          \n          gp   := Collect(dsum, @(3,[GathDist, GathRecv]))[1],\n          gm   := msum.gathmem,\n          gpm  := fCompose(fTensor(gp.func, fId(gp.pkSize/gm.pkSize)), gm.func),\n\n          \n          DistSumLoop(dsum.P, dsum.var, dsum.domain,\n            MultiBufISum(msum.var, msum.domain,\n              #ScatDirectMem(spm, sp.pkSize, dsum.P, dsum.var),\n              ScatMem(spm, sm.pkSize),\n              msum.rChildren()[2],\n              #GathDirectMem(gpm, gp.pkSize, dsum.P, dsum.var)\n              GathMem(gpm, gm.pkSize)\n            ) \n          )\n       )\n     )\n\n));\n\n#F MultiBuf(Dist) is for parallel DFTs that are multibuffered\n#F We pull out a parallel scat (gath) function into the multibufisum's scat (gath) function\n#F Sums becomes invalid (strictly speaking) because we now use loop vars outside of their definition.\nClass(MultiBufDist, RuleSet);\nRewriteRules(MultiBufDist, rec(\n    # This has to be done exactly once, else will loop infinitely. Look at hack below\n    #NOTE: The rule below doesn't seem to fire. Probably doesn't match becacuse of the # of @'s at the end in this line:\n     join_multibuf_dist_compose := Rule([@(1,[MultiBufISum,MemISum]), @(2,[Compose,ComposeDists], e->Length(Collect(e.rChildren()[2], DistSum))=1), @, @ ],\n       e -> let(\n\n          #HACK: clean way of getting the right gath/scat is to ask for the Compose's leftmost Scat/Gath\n          msum := @(1).val,\n          dsums := Collect(@(2).val, DistSum),\n          dsum1 := dsums[1],\n          dsum2 := dsums[Length(dsums)],\n\n          sd   := Collect(dsum1, @(3,[ScatDist, ScatSend]))[1],\n          sm   := msum.scatmem,\n          sdm  := fCompose(fTensor(sm.func, fId(sm.pkSize/sd.pkSize)), sd.func),\n          \n          gd   := Collect(dsum2, @(3,[GathDist, GathRecv]))[1],\n          gm   := msum.gathmem,\n          gdm  := fCompose(fTensor(gm.func, fId(gm.pkSize/gd.pkSize)), gd.func),\n\n          isum := When(ObjId(@(1).val)=MultiBufISum, MultiBufISumFinal, MemISumFinal),\n\n          # HACK: Converting to a MultiBufISumFinal so this rule won't match more than once\n          isum(msum.var, msum.domain,\n              ScatMem(sdm, sd.pkSize),\n              msum.rChildren()[2],    #NOTE: is this okay?\n              GathMem(gdm, gd.pkSize)\n          )\n       )\n     ),\n\n     join_multibuf_dist_separate := Rule(@(1, MultiBufISum, e->Length(Collect(e.rChildren()[2], DistSum))=1),\n       e -> let(\n\n          msum := @(1).val,\n          dsum := Collect(@(1).val, DistSum)[1],\n\n          sd   := Collect(dsum, @(3,[ScatDist, ScatSend]))[1],\n          sm   := msum.scatmem,\n          sdm  := fCompose(fTensor(sm.func, fId(sm.pkSize/sd.pkSize)), sd.func),\n          \n          gd   := Collect(dsum, @(3,[GathDist, GathRecv]))[1],\n          gm   := msum.gathmem,\n          gdm  := fCompose(fTensor(gm.func, fId(gm.pkSize/gd.pkSize)), gd.func),\n\n          # HACK: Converting to a MultiBufISumFinal so this rule won't match more than once\n          MultiBufISumFinal(msum.var, msum.domain,\n              ScatMem(sdm, sd.pkSize),\n              msum.rChildren()[2],    #NOTE: is this okay?\n              GathMem(gdm, gd.pkSize)\n          )\n       )\n     )\n));\n\n#F MultiBufDist_large is for large DFTs that must be multibuffered in parts.\n#F Since the multibuf loop is the outer loop, it assumes the \"chip\" can bring\n#F data from memory on to it. In reality, \"chips\" don't exist -- only cores do. So\n#F this rule distributed chip access across the core. It's different from the\n#F MultiBufDist rule in that it doesn't interact with the inside DistSum's\n#F Scatters or gathers. It does use the parallel loop var outside of its\n#F definition when done.\n\n\nClass(MultiBufDist_large, RuleSet);\n\nRewriteRules(MultiBufDist_large, rec(\n    distribute_scatgathmems := Rule(@(1, MultiBufISum, e->Length(Collect(e.rChildren()[2], DistSum))>=1 ),\n      e -> let(\n\n        msum  := @(1).val,\n        dsum  := Collect(@(1).val, DistSum)[1],\n        sm    := msum.scatmem,\n        gm    := msum.gathmem,\n\n        sf    := When(sm.func.domain()=1, dsum.P, 1),\n        gf    := When(gm.func.domain()=1, dsum.P, 1),\n\n        sfunc := When(sf=1, sm.func, fTensor(sm.func, fId(sf))),\n        gfunc := When(gf=1, gm.func, fTensor(gm.func, fId(gf))),\n\n\n        Ns    := sf*sm.func.range()/msum.domain,\n        ns    := sf*sm.func.domain()/dsum.P,\n        bs    := (dsum.var * ns),\n\n        Ng    := gf*gm.func.range()/msum.domain,\n        ng    := gf*gm.func.domain()/dsum.P,\n        bg    := (dsum.var * ng),\n\n        smnew := ScatMem(fCompose(sfunc, H(Ns, ns, bs, 1)), sm.pkSize/sf),\n        gmnew := GathMem(fCompose(gfunc, H(Ng, ng, bg, 1)), gm.pkSize/gf),\n\n        #Error(\"BP\"),\n\n\n        isum := When(ObjId(@(1).val)=MultiBufISum, MultiBufISumFinal, MemISumFinal),\n\n        isum(msum.var, msum.domain,\n            smnew,\n            msum.rChildren()[2],    #NOTE: is this okay?\n            gmnew\n        )\n      )\n    )\n));\n\n\n# HACK!!!\n# This is the way the system works: the above rules (RulesVRC) passes VRCL and\n# VRCR tags to the scat and gath of a multibufisum. BUT, these have\n# cannotchangedataformat set to true, AND, they're not exposed to the VRC\n# rules. So the VRC rules don't really touch these. So in some cases, they end\n# up with VRCL and VRCR, when in reality, they don't have either. The following\n# rule \"fixes\" this problem by simply assuming they're either VRCs or VRCLRs.\n# Hackity hack.\nRewriteRules(RulesVRC, rec(\n    VRC_MultiBufISum := Rule([@(1, [VRC,VRCL,VRCR,VRCLR]), @(2, [MultiBufISum])],\n       e->let(v := @(1).val,\n              m := @(2).val,\n              MultiBufISum(m.var, m.domain, \n                ObjId(v)(m.scatmem, v.v),\n                ObjId(v)(m._children[1], v.v), \n                ObjId(v)(m.gathmem, v.v))\n              )\n       ),\n    VRC_MemISum := Rule([@(1, [VRC,VRCL,VRCR,VRCLR]), @(2, [MemISum])],\n       e->let(v := @(1).val,\n              m := @(2).val,\n              MemISum(m.var, m.domain, \n                ObjId(v)(m.scatmem, v.v),\n                ObjId(v)(m._children[1], v.v), \n                ObjId(v)(m.gathmem, v.v))\n              )\n       )\n));\n\n\nRewriteRules(CellVRCTerm, rec(\n    VRC_ScatMem_Term := Rule([@(1, [RC, VRCL, VRCR, VRC,VRCLR]), @(2, [ScatMem])], \n    e->ScatMem(@(2).val.func, @(2).val.pkSize*2)),\n\n    VRC_GathMem_Term := Rule([@(1, [RC, VRCL, VRCR, VRC,VRCLR]), @(2, [GathMem])], \n    e->GathMem(@(2).val.func, @(2).val.pkSize*2)),\n));\n\n\n\nRewriteRules(RulesRC, rec(\n    RC_MultiBufISum := Rule([RC, @(1, MultiBufISum)],\n        e -> let(s:=@(1).val, MultiBufISum( s.var, s.domain, s.scatmem, RC(s.child(1)), s.gathmem ))\n    ),\n));\n\n\n# To convert Compose(A, B) -> ComposeStreams(A, B) when A,B=MultiBufISum\n# ObjId(c)=DistSumLoop below is a hack. Obviously, DistSumLoop does not necessarily imply composing streams.\nClass(RulesComposeStreams, RuleSet);\nRewriteRules(RulesComposeStreams, rec(\n    stream_compose := Rule(@(1, Compose, e->ForAll(e.children(), c->(ObjId(c)=MultiBufISum  or ObjId(c)=MultiBufISumFinal or ObjId(c)=DistSumLoop) )),\n        e -> ComposeStreams(@(1).val.children()) )\n));\n\n\n\n# Pull Diag into MultiBufISum. D*MBufISum(SAG) -> MBufISum(SDAG) and\n# MBufISum(SAG)*D -> MBufISum(SADG) Unlike the DistSum rules to do the same\n# thing, this combining has to be done in a single step because the Scat and\n# Gath of the MultiBufISum are not exposed.\n\nRewriteRules(RulesDiagStandalone, rec(\n #  MBufISum(SAG)*D\n CellPullInCommuteGathDiag := ARule(Compose, [ @(1, MultiBufISum), @(2, [Prm, Gath, Diag, RCDiag]) ],\n    e->let(msum := @(1).val,\n           diag := @(2).val,\n           gath := msum.gathmem,\n           newdiag := Diag(fCompose(diag.element, fTensor(gath.func, fId(gath.pkSize)))).attrs(diag),\n        [ MultiBufISum(msum.var, msum.domain, msum.scatmem, msum.child(1) * newdiag, msum.gathmem) ]\n       )\n ),\n\n CellPullInCommuteScatDiag := ARule(Compose,  [ @(1, [RCDiag, Diag, Prm, Scat]), @(2, MultiBufISum) ],\n    e->let(msum := @(2).val,\n           diag := @(1).val,\n           scat := msum.scatmem,\n           newdiag := Diag(fCompose(diag.element, fTensor(scat.func, fId(scat.pkSize))  )).attrs(diag),\n        [ MultiBufISum(msum.var, msum.domain, msum.scatmem, newdiag * msums.child(1), msum.gathmem) ]\n       )\n ),\n\n # NOTE\n ## Gath * RCDiag\n #CellCommuteGathRCDiag := ARule( Compose,\n #      [ [@(1, [ GathDist, GathRecv ]), [@(0,fTensor), ..., [fId,@(2).cond(IsEvenInt)]]],\n #     @(4, RCDiag) ],\n # e -> [ RCDiag(fCompose(@(4).val.element, @(0).val), @(4).val.post),\n #        @(1).val ]),\n\n ## RCDiag * Scat\n #CellCommuteRCDiagScat := ARule( Compose,\n #      [ @(4, RCDiag),\n #    [@(1, [Scat, ScatDist, ScatSend]), [@(0,fTensor), ..., [fId,@(2).cond(IsEvenInt)]]] ],\n # e -> [ @(1).val,\n #        RCDiag(fCompose(@(4).val.element, @(0).val), @(4).val.post) ]),\n\n));\n\n", "meta": {"hexsha": "a43f8211308cea71220c641ee338379ba24618cf", "size": 11716, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/multibuffer/rewrite.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/multibuffer/rewrite.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/multibuffer/rewrite.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 37.1936507937, "max_line_length": 155, "alphanum_fraction": 0.5841584158, "num_tokens": 3740, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.33458944125318596, "lm_q2_score": 0.036769465020075824, "lm_q1q2_score": 0.012302674756245736}}
{"text": "\n# TODO: Really we should be formatting text and HTML output\n#       And the HTML output could for instance link to the \n#       documentation of the attributes\nBindGlobal(\"JUPYTER_FormatKnown\",\nfunction(obj)\n    local res, n, p, props, attrs, len;\n\n    props := KnownPropertiesOfObject(obj);\n    attrs := KnownAttributesOfObject(obj);\n\n    len   := Maximum(List(props, Length));\n    len   := Maximum(len, Maximum(List(props, Length))) + 1;\n\n    res := \"Properties:\\n\\n\";\n    props := List(props,\n                  x -> STRINGIFY(String(x, -len), \": \",\n                                 ValueGlobal(x)(obj)));\n    Append(res, JoinStringsWithSeparator(props, \"\\n\"));\n\n    Append(res, \"\\n\\nAttributes:\\n\\n\");\n    attrs := List(attrs,\n                  x -> STRINGIFY(String(x, -len), \": \",\n                                 ValueGlobal(x)(obj)));\n    Append(res, JoinStringsWithSeparator(attrs, \"\\n\"));\n    return res;\nend);\n\nBindGlobal(\"JUPYTER_FindHelp\",\nfunction(ident)\n    local s, matches, match, book, data, data1, lines, info;\n\n    s := SIMPLE_STRING(ident);\n    matches := HELP_GET_MATCHES(HELP_KNOWN_BOOKS[1], s, true);\n    if matches[1] <> [] then\n        match := matches[1][1];\n    elif matches[2] <> [] then\n        match := matches[2][1];\n    else\n        return \"Undocumented\";\n    fi;\n    book := match[1];\n    info := HELP_BOOK_INFO(match[1]);\n\n    data := HELP_BOOK_HANDLER.GapDocGAP.HelpData(info, match[2], \"text\");\n    data1 := HELP_BOOK_HANDLER.GapDocGAP.HelpData(info, match[2] + 1, \"text\");\n\n    if IsString(data.lines) then\n        lines := SplitString(data.lines, \"\\n\");\n    else\n        lines := data.lines;\n    fi;\n    return JoinStringsWithSeparator(lines{[data.start..data1.start-1]}, \"\\n\");\nend);\n\nInstallGlobalFunction(JUPYTER_Inspect,\nfunction(str, pos)\n    local cpos, ipos, ident, ws, sep, fapp, result, found,\n          var, textplain, texthtml;\n\n    found := false;\n    textplain := \"\";\n    texthtml := \"\";\n\n    # extract keyword/identifier\n    # go to the left of pos\n    # TODO: This should really use a GAP Parser or the\n    #       SYNTAX_TREE module; SYNTAX_TREE doesn't have position\n    #       information\n    # Once we can parse code partially, we could even try to evaluate\n    # subexpressions for help tips?\n\n    # ( is not a separator, because we use it to\n    # detect function application\n    sep := [\") \\t\\n\\r;:=<>=!.\"];\n\n    cpos := Minimum(pos, Length(str));\n    ipos := 1;\n    fapp := false;\n    ident := [];\n\n    # skip whitespace\n    while cpos > 0 and (str[cpos] in \" \\t\") do cpos := cpos - 1; od;\n    while cpos > 0 and (not str[cpos] in sep) do\n        if str[cpos] = '(' then\n            fapp := true;\n        else\n            ident[ipos] := str[cpos];\n            ipos := ipos + 1;\n        fi;\n        cpos := cpos - 1;\n    od;\n    ident := Reversed(ident);\n\n    if ident <> \"\" then\n        found := true;\n        if fapp then\n            # find documentation for function application\n            textplain := JUPYTER_FindHelp(ident{[1..Length(ident)-1]});\n        elif IsBoundGlobal(ident) then\n            var := ValueGlobal(ident);\n            if IsFunction(var) then\n                # try finding doc?\n                textplain := JUPYTER_FindHelp(ident);\n            elif\n                IsObject(var) then\n                # Display Known Properties/Attributes/Categories/Types\n                textplain := JUPYTER_FormatKnown(var);\n            fi;\n        fi;\n    fi;\n    return rec( status := \"ok\",\n                found := found,\n                data := rec( text\\/html := texthtml,\n                             text\\/plain := textplain,\n                             metadata := rec( text\\/html := \"\",\n                                              text\\/plain := \"\" ) ) );\nend);\n", "meta": {"hexsha": "f21df5896c7f2cfa24d155ea8f48675cb2d3200c", "size": 3746, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterInspection.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterInspection.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterInspection.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 31.4789915966, "max_line_length": 78, "alphanum_fraction": 0.5480512547, "num_tokens": 946, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.331119752830196, "lm_q2_score": 0.03676946739500242, "lm_q1q2_score": 0.012175096955531152}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n# -------------------------------------------------------------------------\n# Scalar bit-level instructions\n# 16x1i: 16-way bit register\n# -------------------------------------------------------------------------\n\nClass(sklr_bcast_16x1i,  VecExp_16.binary());\nClass(sklr_loadu_16x1i,  VecExp_16.ternary());\nClass(sklr_storeu_16x1i, VecExpCommand.quad(), rec(\n    isStoreop := True,\n    __call__ := (self, loc, offs, exp, p) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       offs := toExpArg(offs),\n       exp := toExpArg(exp),\n       p := p)),\n\n    rChildren := self >> [self.loc, self.offs, self.exp, self.p],\n    rSetChild := rSetChildFields(\"loc\", \"offs\", \"exp\", \"p\"),\n\n    print := (self,i,is) >> Print(self.__name__, \"(\", self.loc.print(), \", \", self.offs.print(), \", \", self.exp.print(), \", \", self.p, \")\"),\n\n    # in case of explicit type cast (YSV modification), we don't need getNoScalar,\n    # and below returns [], compiler understands not to mess with typecasts\n    getNoScalar := self >> When(IsBound(self.noscalar) and IsBound(self.args[self.noScalar].loc),\n    self.args[self.noScalar].loc, [])\n));\n\n# -------------------------------------------------------------------------\n# Scalar bit-level instructions\n# 32x1i: 32-way bit register\n# -------------------------------------------------------------------------\n\nClass(sklr_bcast_32x1i,  VecExp_32.binary());\nClass(sklr_loadu_32x1i,  VecExp_32.ternary());\nClass(sklr_storeu_32x1i, VecExpCommand.quad(), rec(\n    isStoreop := True,\n    __call__ := (self, loc, offs, exp, p) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       offs := toExpArg(offs),\n       exp := toExpArg(exp),\n       p := toExpArg(p))),\n\n    rChildren := self >> [self.loc, self.offs, self.exp, self.p],\n    rSetChild := rSetChildFields(\"loc\", \"offs\", \"exp\", \"p\"),\n\n    print := (self,i,is) >> Print(self.__name__, \"(\", self.loc.print(), \", \", self.offs.print(), \", \", self.exp.print(), \", \", self.p, \")\"),\n\n    # in case of explicit type cast (YSV modification), we don't need getNoScalar,\n    # and below returns [], compiler understands not to mess with typecasts\n    getNoScalar := self >> When(IsBound(self.noscalar) and IsBound(self.args[self.noScalar].loc),\n    self.args[self.noScalar].loc, [])\n));\n\n# -------------------------------------------------------------------------\n# Scalar bit-level instructions\n# 64x1i: 64-way bit register\n# -------------------------------------------------------------------------\n\nClass(sklr_bcast_64x1i, VecExp_64.binary());\nClass(sklr_loadu_64x1i, VecExp_64.ternary());\nClass(sklr_storeu_64x1i, VecExpCommand.quad(), rec(\n    isStoreop := True,\n    __call__ := (self, loc, offs, exp, p) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc := toAssignTarget(loc),\n       offs := toExpArg(offs),\n       exp := toExpArg(exp),\n       p := toExpArg(p))),\n\n    rChildren := self >> [self.loc, self.offs, self.exp, self.p],\n    rSetChild := rSetChildFields(\"loc\", \"offs\", \"exp\", \"p\"),\n\n    print := (self,i,is) >> Print(self.__name__, \"(\", self.loc.print(), \", \", self.offs.print(), \", \", self.exp.print(), \", \", self.p, \")\"),\n\n    # in case of explicit type cast (YSV modification), we don't need getNoScalar,\n    # and below returns [], compiler understands not to mess with typecasts\n    getNoScalar := self >> When(IsBound(self.noscalar) and IsBound(self.args[self.noScalar].loc),\n    self.args[self.noScalar].loc, [])\n));\n\n", "meta": {"hexsha": "47c19d09e469e07262d5fcd1bfeb9b8a584c3fbf", "size": 3577, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/scalar/bitisa/code.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/scalar/bitisa/code.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/scalar/bitisa/code.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.5930232558, "max_line_length": 140, "alphanum_fraction": 0.5568912497, "num_tokens": 945, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.34510527095787247, "lm_q2_score": 0.0351448455165293, "lm_q1q2_score": 0.012128671434754414}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# size = scratchpad segment size\n# nsgmts = number of segments, defaults to 1.\nClass(ALStore, AGenericTag, rec(\n    updateParams := meth(self)\n        Checked(Length(self.params)=3);\n        self.size := self.params[1];\n        self.nsgmts := self.params[2];\n        self.linesize := self.params[3];\n    end,\n    isRegCx := false\n));\n\nClass(ALStoreCx, ALStore, rec(\n    updateParams := meth(self)\n        Checked(Length(self.params)=3);\n        self.size := self.params[1]/2;\n        self.nsgmts := self.params[2];\n        self.linesize := self.params[3];\n    end,\n    isRegCx := true\n));\n\n# APad tag.\n# \n# APad is a special buffering tag meant for things like scratchpads, hence\n# the name. It takes four parameters. In order, they are:\n# b - the block size in number of elements\n# s - the segment size, in number of blocks\n# u - the number of segments\n# n - a string identifier\n#\n# The block size is the SMALLEST allowed transfer size when copying data.\n# The breakdown rules which propagate the APad tag insure that sub-block\n# numbers of contiguous elements are never moved when the tag is present.\n#\n# A segment is a discrete memory separate from other segments, in the case\n# that the 'u' parameter is >1. In the case of DPA, each segment is\n# connected to a different compute processor, and we do parallelization\n# after the APad tag is dropped.\n#\n# The string identifier is for the platform writer. You can label things\n# like \"local memory\" or \"vector register file.\"\n#\n# Also, the software pipelining loop (rather than a standard ISum) is\n# automatically used with the APad tag.\n\nClass(APad, AGenericTag, rec(\n    applied := false,\n\n    b := (self) >> self.params[1],\n    s := (self) >> self.params[2],\n    u := (self) >> self.params[3],\n    bs := (self) >> self.params[1] * self.params[2],\n    bsu := (self) >> Product(DropLast(self.params, 1)),\n    n := (self) >> self.params[4],\n\n    apply := self >> CopyFields(self, rec(applied := true)),\n\n    updateParams := meth(self)\n        Checked(Length(self.params)=4);\n    end,\n\n    print := meth(self) \n        Print(self.name, \"(\", PrintCS([self.b(), self.s(), self.u()]),\n            \", \\\"\", self.n(), \"\\\")\");\n    end\n));\n", "meta": {"hexsha": "b19ccb92e9a3683d7799511eb7fed9c78dc87dd2", "size": 2265, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/tag.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/tag.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/tag.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.0273972603, "max_line_length": 74, "alphanum_fraction": 0.6476821192, "num_tokens": 599, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3486451217982255, "lm_q2_score": 0.03461883933717822, "lm_q1q2_score": 0.012069689457223701}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\n", "meta": {"hexsha": "192f33a596cfc29350d09d5a9c5b9b78224443b7", "size": 86, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/cuda/codegen.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "platforms/cuda/codegen.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "platforms/cuda/codegen.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 17.2, "max_line_length": 55, "alphanum_fraction": 0.7209302326, "num_tokens": 25, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.392336815956846, "lm_q2_score": 0.030675799606029917, "lm_q1q2_score": 0.012035245544360048}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F ArgsExp(<exp>)\n#F   Collects all location leaves in an expression.\n#F   This is equivalent to Collect(exp, @.cond(IsLoc)), but has less overhead.\n#F\nArgsExp := exp -> Cond(  \n    not IsRec(exp) or not IsSymbolic(exp), [],\n    IsLoc(exp), Concatenation([exp], ConcatList(exp.rChildren(), ArgsExp)), \n    IsValue(exp) or not IsBound(exp.args), [],\n    Concatenation(List(exp.args, ArgsExp)));\n\nassign.op_in  := self >> ConcatList(self.loc.rChildren(), ArgsExp) :: ArgsExp(self.exp);\nassign.op_out := self >> [self.loc];\nassign.op_inout := self >> [];\n\nIsCmdOp := x -> IsCommand(x) and IsBound(x.op_in) and IsBound(x.op_out) and IsBound(x.op_inout);\n\nVarArgsExp := exp -> Cond(  \n    IsVar(exp), [exp], \n    IsValue(exp) or not IsRec(exp), [],\n    ConcatList(exp.rChildren(), VarArgsExp));\n\n#\n# Def/Succ/Pred\n#\n\nMarkDefLoc := function(loc, d)\n    loc.def := d;\n    if not IsBound(loc.succ) then loc.succ := Set([]); fi;\nend;\n\nMarkPredLoc := function(loc, pred)\n    pred := Set(ShallowCopy(pred));\n    if not IsBound(loc.pred) then loc.pred := pred;\n    # NOTE: below statement crashes with \"<loc.pred> is not a set\" error \n    #        if UniteSet(loc.pred, pred) is used. This is an indication of \n    #        broken < or = operations. Union() fixes the problem, but is\n    #        essentially a hack\n    else loc.pred := Union(loc.pred, pred); \n    fi;\n\n    if IsBound(loc.def) then\n\tif not IsBound(loc.def.pred) then loc.def.pred := pred;\n\telse loc.def.pred := Union(loc.def.pred, pred);\n\tfi;\n    fi;\nend;\n\n# succesors is NOT a set to allow multiplicity (2 uses from same statement, like a = b*b, succ(b)=[a, a])\n# this aids compiler from preventing propagation of b in this case in CopyPropagate.propagate()\n#\nMarkSuccLoc := function(loc, cmd_loc)\n    if IsVar(loc) then\n        if not IsBound(loc.succ) then loc.succ := [cmd_loc];\n        else                          Add(loc.succ, cmd_loc); fi;\n\n        if IsBound(loc.def) then\n            if not IsBound(loc.def.succ) then loc.def.succ := [cmd_loc];\n            else Add(loc.def.succ, cmd_loc);\n            fi;\n        fi;\n    fi;\nend;\n\nDefLoc   := loc -> When(IsBound(loc.def),  loc.def,  false);\nPredLoc  := loc -> When(IsBound(loc.pred), loc.pred, Set([]));\nSuccLoc  := loc -> When(IsBound(loc.succ), loc.succ, ([]));\n\nPredCmd  := cmd -> When(IsBound(cmd.pred), cmd.pred, Set([]));\nSuccCmd  := cmd -> When(IsBound(cmd.succ), cmd.succ, ([]));\n\nDeclare(MarkDefUse, MarkPreds, ClearDefUse);\n\n_ChainMarkDefUse := function(code)\n    local c, u, pred;\n    for c in code.cmds do\n        if IsCmdOp(c) then \n\t    DoForAll(c.op_out(), x->MarkDefLoc(x, c));\n\t    pred := c.op_in() :: c.op_inout();\n\t    DoForAll(c.op_out(), x->MarkPredLoc(x, pred));\n\t    for u in pred do\n\t        DoForAll(c.op_out(), x->MarkSuccLoc(u, x));\n\t    od;\n\telse\n\t    DoForAll(c.rChildren(), MarkDefUse);\n\tfi;\n    od;\n    return code;\nend;\n\n_MarkDefUse := function(code)\n    if not IsCommand(code) then return;\n    elif IsChain(code) then _ChainMarkDefUse(code);\n    else DoForAll(code.rChildren(), _MarkDefUse);\n    fi;\n    return code;\nend;\n\nMarkDefUse := function(code)\n    code := ClearDefUse(code);\n    return _MarkDefUse(code);\nend;\n\n_ChainMarkPreds := function(code)\n    local c, u, pred;\n    for c in code.cmds do\n        if IsAssign(c) then \n\t    pred := c.op_in() :: c.op_inout();\n\t    MarkPredLoc(c.loc, pred);\n\telse\n\t    DoForAll(c.rChildren(), MarkPreds);\n\tfi;\n    od;\n    return code;\nend;\n\n_MarkPreds := function(code)\n    if not IsCommand(code) then return;\n    elif IsChain(code) then _ChainMarkPreds(code);\n    else DoForAll(code.rChildren(), _MarkPreds);\n    fi;\n    return code;\nend;\n\nMarkPreds := function(code)\n    code := ClearDefUse(code);\n    return _MarkPreds(code);\nend;\n\n\nClearDefUseLoc := function(loc)\n   if IsBound(loc.def) then\n       Unbind(loc.def.pred);\n       Unbind(loc.def.succ);\n   fi;\n   Unbind(loc.def);\n   Unbind(loc.succ);\n   Unbind(loc.pred);\n   return loc;\nend;\n\ndepthLoc := x -> When(IsBound(x.depth), x.depth, 0);\nrdepthLoc := (x, max) -> When(IsBound(x.rdepth), x.rdepth, max);\n\nComputeDepthsChain := function(code)\n    local cmd, depth, rdepth, maxdepth, succs, dd, preds, succs;\n    Constraint(ObjId(code)=chain);\n    for cmd in code.cmds do\n        Constraint(IsAssign(cmd));\n\tpreds := PredCmd(cmd);\n\tdd := List(preds, depthLoc);\n        depth := When(dd=[], 0, 1 + Maximum(dd));\n\tcmd.allpreds := Union(Filtered(preds,x->IsVar(x) and IsBound(x.def)),\n\t    Union(List(preds, x->When(IsVar(x) and IsBound(x.def) and \n\t\t\t              IsBound(x.def.allpreds), x.def.allpreds, []))));\n        cmd.earliest := depth; \n\tcmd.loc.depth := depth;\n    od;\n    maxdepth := Length(code.cmds);\n    for cmd in Reversed(code.cmds) do\n\tsuccs := SuccCmd(cmd);\n        dd := List(succs, s -> rdepthLoc(s, maxdepth));\n        rdepth := When(dd=[], maxdepth,  -1 + Minimum(dd));\n\tcmd.allsuccs := Union(succs, \n\t    Union(List(succs, x->When(IsBound(x.def) and \n\t\t\t              IsBound(x.def.allsuccs), x.def.allsuccs, []))));\n\t\n        cmd.latest := rdepth; \n\tcmd.loc.rdepth := rdepth;\n    \n    od;\nend;\n\n#F ClearDefUse(<code)> - clears attributes set by MarkDefUse\n#F\nClearDefUse := code -> Chain(DoForAll(Collect(code, var), ClearDefUseLoc), code);\n\n\nDFSChain := function(code)\n    local c, cmds, W, next, p, added, schedule;\n    cmds := code.cmds; W := []; schedule := [];\n    for c in cmds do\n       if not IsBound(c.loc.generated) then\n       Add(schedule, c); c.loc.generated := true;\n       if IsBound(c.loc.succ) then \n           Append(W, c.loc.succ);\n       fi;\n       fi;\n       while Length(W)<>0 do\n           next := Last(W);\n       added := false;\n       if IsBound(next.pred) then \n           for p in next.pred do \n               if not IsBound(p.generated) then Add(W, p); added := true; fi;\n           od;\n       fi;\n       if not added then \n           if IsBound(next.def) then Add(schedule, next.def); fi;\n           next.generated := true;\n           RemoveLast(W, 1);\n       fi;\n       od;\n    od;\n\n    for c in cmds do Unbind(c.loc.generated); od;\n    return chain(schedule);\nend;\n\nInputsChain := code -> List(Filtered(code.cmds, x->not ForAny(x.loc.pred,p->IsBound(p.def))),x->x.loc);\nOutputsChain := code -> List(Filtered(code.cmds, x->not IsBound(x.loc.succ) or x.loc.succ=[]), x->x.loc);\n\n_ClearRedBlue := function(v) Unbind(v.blue); Unbind(v.red); end;\n\nClearRedBlue := code -> DoForAll(Collect(code, var), _ClearRedBlue);\n\n_HSplitChain := function(c,inp,out)\n    local i,o,x,inpsucc,outpred, mid,done,red,blue,rcmds,bcmds;\n    mid := Set([]);\n    blue := Set(inp); bcmds:=List(blue, x->x.def);\n    red := Set(out); rcmds:=List(red, x->x.def);\n\n    done := (inp=[]) and (out=[]);\n    while not done do\n        inp := Difference(Union(List(inp, x->x.succ)),blue); # unvisited successors\n    out := Difference(Union(List(out, x->x.pred)),red); # unvisited predecessors\n\n    for x in inp do \n        AddSet(blue, x);  \n        if not (x in red) then Add(bcmds,x.def); fi; \n    od;\n\n    for x in out do\n        AddSet(red, x); \n        if not (x in blue) then Add(rcmds,x.def); fi;\n    od;\n\n    inp := Difference(inp, red);\n    out := Difference(out, blue);\n\n    done := (inp=[]) and (out=[]);\n    od;\n    return [Intersection(red,blue), bcmds, Reversed(rcmds)];\nend;\n\nHSplitChain := function(c)\n    local inp, out, mid;\n    inp := Set(InputsChain(c));\n    out := Set(OutputsChain(c));\n    mid := _HSplitChain(c, inp, out);\n    return mid;\nend;\n\nscheduled := code -> Inherit(code, rec(cmd := DFSChain(code.cmd)));\n", "meta": {"hexsha": "965adeca7e7ce75da196f325292eba4c1a307615", "size": 7586, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/dag.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/dag.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/dag.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.4031007752, "max_line_length": 105, "alphanum_fraction": 0.6071711047, "num_tokens": 2182, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3738758367247084, "lm_q2_score": 0.03161876954994039, "lm_q1q2_score": 0.011821493921689696}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nRows := s -> Cond(\n    IsMat(s),  \n        Length(s),\n\n    IsBound(s.rng) and IsBound(s.dmn),\n        s.dims()[1],\n\t\n    IsValue(s) or IsSymbolic(s),\n        Checked(IsArrayT(s.t), IsArrayT(s.t.t), \n\t    s.t.size),\n\n    s.dimensions[1]\n);\n\nCols := s -> Cond(\n    IsMat(s),  \n        Length(s[1]),\n\n    IsBound(s.rng) and IsBound(s.dmn),\n        s.dims()[2],\n\t\n    IsValue(s) or IsSymbolic(s),\n        Checked(IsArrayT(s.t), IsArrayT(s.t.t), \n\t    s.t.t.size),\n\n    s.dimensions[2]\n);\n\nolRows := s -> Flat([Rows(s)]);\nolCols := s -> Flat([Cols(s)]);\n\n#F SPL(<rec>)\n#F    Set operations field to SPLOps. This function should be called\n#F    to initialize SPL instances.\nSPL := function(record)\n   record.operations := SPLOps;\n   return record;\nend;\n\nHashAsSPL := o -> Cond(\n    IsList(o), \n        List(o, HashAsSPL),\n    not IsRec(o) or (not IsBound(o.hashAs) and not IsBound(o.from_rChildren)), \n        o,\n    IsBound(o.hashAs), \n        o.hashAs(),\n    IsValue(o),\n        o.v,\n    o.from_rChildren(List(o.rChildren(), HashAsSPL))\n);\n\n# ==========================================================================\n# ClassSPL\n#\n# Base class for all SPL constructs\n# ==========================================================================\nClass(ClassSPL, AttrMixin, rec(\n    isSPL := true,\n    transposed := false,\n\n#DD this allows objects which are not TaggedNonTerminals to drop tags automagically\n#DD and without error.\n    withTags := (self, t) >> self,\n\n    _short_print := false,\n    _newline := i ->  Print(\"\\n\", Blanks(i)),\n    _indent  := i ->  Print(Blanks(i)),\n    _indentStr := Blanks,\n\n\n    __call__ := meth(arg)\n        local self, params, nump, A,p,res,h,lkup;\n        self := arg[1];\n        params := arg{[2..Length(arg)]};\n        nump := Length(params);\n\n        if not IsBound(self.new)  then\n            Error(\"Constructor for this class is not implemented\");\n        elif IsBound(self.abbrevs) and self.abbrevs <> [] then\n            for A in self.abbrevs do\n                if NumArgs(A) = -1 or NumArgs(A) = nump then\n                    params := ApplyFunc(A, params);\n                fi;\n            od;\n        fi;\n\n        if NumArgs(self.new)-1 <> Length(params) then\n            Error(\"Constructor requires \", NumArgs(self.new)-1, \" parameters (\",\n                Length(arg)-1, \" given): \",\n                ParamsMeth(self.new));\n        else\n            h := self.hash;\n            if h<>false then\n                lkup := h.objLookup(self, params);\n                if lkup[1] <> false then return lkup[1]; fi;\n            fi;\n\n            res := ApplyFunc(self.new, params);\n\n            if h<>false then return h.objAdd(res, lkup[2]);\n            else return res;\n            fi;\n        fi;\n    end,\n\n    hash := false,\n\n    checkDims := self >> DimensionsMat(MatSPL(self)) = self.dimensions,\n\n    #-----------------------------------------------------------------------\n    # create a new object with .<name> field set to true\n    setAttr := meth(self, name)\n        local s;\n        s:= Copy(self);\n        s.(name) := true;\n        return s;\n    end,\n    # ----------------------------------------------------------------------\n    # create a new object with .<name> field set to <val>\n    setAttrTo := meth(self, name, val)\n        local s;\n        s:= Copy(self);\n        s.(name) := val;\n        return s;\n    end,\n\n    #---------Backwards Compatibility for the new dimension system------\n    setDims := meth(self) self.dimensions := self.dims(); return self; end,\n\n    dims := self >> [ StripList(List(self.rng(), l -> l.size)), \n\t              StripList(List(self.dmn(), l -> l.size)) ],\n\n    advdims := (self) >> let(d := self.dims(), [ [[ d[1] ]], [[ d[2] ]] ]),\n    arity   := (self) >> List(self.dims(), e -> Length(Flat([e]))),\n\n    TType:=TUnknown,\n\n    rng := meth(self) local d;\n        if IsBound(self.dims) then\n            d := Flat([self.dims()[1]]);\n        else \n            d := [self.dimensions[1]];\n        fi;\n        if IsBound(self.a.t_out) then\n            return List(TransposedMat([self.a.t_out, d]), e -> TArray(e[1], e[2]));\n        else\n            return List(d, e -> TArray(self.TType, e));\n        fi;\n    end,\n\n    dmn := meth(self) local d;\n        if IsBound(self.dims) then\n            d := Flat([self.dims()[2]]);\n        else \n            d := [self.dimensions[2]];\n        fi;\n        if IsBound(self.a.t_in) then\n            return List(TransposedMat([self.a.t_in, d]), e -> TArray(e[1], e[2]));\n        else\n            return List(d, e -> TArray(self.TType, e));\n        fi;\n    end,\n\n    free := self >> Union(List(self.rChildren(), FreeVars)),\n\n    equals := (self, o) >>\n        ObjId(self) = ObjId(o) and self.rChildren() = o.rChildren() and self.a = o.a,\n\n    lessThan := (self, o) >> Cond(\n        ObjId(self) <> ObjId(o), ObjId(self) < ObjId(o),\n        [ ObjId(self), self.rChildren(), self.a ] < [ ObjId(o), o.rChildren(), o.a ]\n    ),\n\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch).appendAobj(self),\n\n\n    print := (self, i, is) >> self._print(self.rChildren(), i, is),\n\n    _print := meth(self, ch, indent, indentStep)\n        local s, first, newline;\n\n\tif self._short_print or ForAll(ch, x->not IsRec(x) or IsSPLSym(x) or IsSPLMat(x)) then\n\t    newline := Ignore;\n\telse \n\t    newline := self._newline;\n\tfi;\n\n\tfirst := true;\n        Print(self.__name__, \"(\");\n\tfor s in ch do\n            if(first) then first:=false;\n            else Print(\", \"); fi;\n            newline(indent + indentStep);\n            When(IsSPL(s) or (IsRec(s) and IsBound(s.print) and NumGenArgs(s.print)=2),\n                 s.print(indent + indentStep, indentStep), \n\t\t Print(s));\n\tod;\n\tnewline(indent);\n\tPrint(\")\");\n        self.printA();\n\n\tif IsBound(self._setDims) then\n            Print(\".overrideDims(\", self._setDims, \")\");\n\tfi;\n    end,\n\n    printlatex := meth(self)\n        local s, first, newline, i;\n\n\tfirst := true;\n        Print(\"(\");\n        i := Length(self.rChildren());\n        for s in self.rChildren() do\n            When(IsSPL(s) or (IsRec(s) and IsBound(s.printlatex) and NumGenArgs(s.printlatex)=0),\n                 s.printlatex(),\n\t\t Print(s));\n                 if i >=2 then \n                    Print(\" \", When(IsBound(self.latexSymbol), self.latexSymbol, \"\"), \" \");\n                 fi;\n                 i := i-1;\n\tod;\n\tPrint(\")\");\n    end,\n\n\n\n    overrideDims := (self, dims) >> CopyFields(self, rec(_setDims := dims, dimensions := dims)),\n\n    terminate     := self >> self.from_rChildren(List(self.rChildren(), x->When(IsSPL(x), x.terminate(), x))),\n\n    # ------------------------- Required methods ---------------------------\\\n    transposeSymmetric := True,\n    dims          := meth(self) Error(\"Not implemented\"); end,\n    isPermutation := meth(self) Error(\"Not implemented\"); end,\n    isTerminal    := meth(self) Error(\"Not implemented\"); end,\n    isReal        := meth(self) Error(\"Not implemented\"); end,\n    isInplace     := self >> Rows(self)=Cols(self) and let(ch:=self.children(), Cond(Length(ch)=0, false, ForAll(ch, x->x.isInplace()))),\n    children      := meth(self) return []; end,\n    numChildren   := meth(self) return 0; end,\n    child         := meth(self,n) Error(\"Not implemented\"); end,\n    setChild      := meth(self,n,what) Error(\"Not implemented\"); end,\n    toAMat        := meth(self) Error(\"Not implemented\"); end,\n    transpose     := meth(self) Error(\"Not implemented\"); end,\n    conjTranspose  := meth(self) Error(\"Not implemented\"); end,\n));\n\n\n#F <SPL> * <SPL>\n#F <scalar> * <SPL>\n#F   is equivalent to ComposeSPL and ScalarMultiple resp.\n#F\nSPLOps.\\* := (S1, S2) ->\n    Cond(IsSPL(S1) and IsSPL(S2),   Compose(S1, S2),\n         IsSPL(S2),                 Scale(S1, S2),\n     IsSPL(S1),                 Scale(S2, S1),\n     Error(\"do not know how to compute <S1> * <S2>\"));\n\n#F <SPL> + <SPL>\n#F   is equivalent to SUM(<S1>, <S2>)\n#F\nSPLOps.\\+ := (S1, S2) ->\n    Cond(IsSPL(S1) and IsSPL(S2),   SUM(S1, S2),\n     Error(\"do not know how to compute <S1> + <S2>\"));\n\n#F S1 ^ S2\n#F   is equivalent to ConjugateSPL(S1, S2).\n#F\nSPLOps.\\^ := (S1, S2) ->\n    When(IsSPL(S1) and IsSPL(S2),\n         Conjugate(S1, S2),\n     Error(\"do not know how to compute S1 ^ S2\"));\n", "meta": {"hexsha": "3a232f837a2b60479fc76fca7ccc9b7bc6888292", "size": 8290, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/SPL.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/SPL.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/SPL.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.9277978339, "max_line_length": 137, "alphanum_fraction": 0.5139927624, "num_tokens": 2265, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3960681520167196, "lm_q2_score": 0.029760095667014458, "lm_q1q2_score": 0.011787026094675199}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n# utility functions\n\nRange0 := (a) -> When(IsList(a), [0..Length(a)-1], [0..a-1]);\nRange1 := (a) -> When(IsList(a), [1..Length(a)], [1..a]);\n\n# special rules for annotating the recursion level for all variables. \n# allows us to just keep the variables, instead of also needing to keep\n# the ISums.\n\n_checkTag := function(e, cx)\n    local sums;\n\n    if IsBound(e.var.order) then\n        return false;\n    fi;\n\n    sums :=  Filtered(cx.parents, e -> ObjId(e) = ISum);\n\n    return (sums = [] or IsBound(Last(sums).var.order));\nend;\n\n_setTag := function(e, cx)\n    local sums;\n\n    sums :=  Filtered(cx.parents, e -> ObjId(e) = ISum);\n\n    if sums = [] then\n        e.var.order := 0;\n    else\n        e.var.order := Last(sums).var.order + 1;\n    fi;\n\n    return e;\nend;\n\nClass(_MissEstPreprocessJams, RuleSet);\nClass(_MissEstSanitize, RuleSet);\nClass(_MissEstRules, RuleSet);\nClass(_MissEstCleanup, RuleSet);\nClass(_MissEstInplace, RuleSet);\n\nClass(_GSWrap, SumsBase, rec(\n    __call__ := (self, rng, dmn, payload) >> WithBases(self, rec(\n        _dmn := dmn,\n        _rng := rng,\n        _payload := payload,\n        _children := []\n    )),\n    rChildren := (self) >> [],\n    dims := (self) >> [\n        StripList(List(self.rng(), (l) -> l.size)),\n        StripList(List(self.dmn(), (l) -> l.size))\n    ],\n    rSetChild := (self, n, what) >> Error(\"no kids\"),\n    rng := (self) >> self._rng,\n    dmn := (self) >> self._dmn,\n    print := (self,i,is) >> Print(self.name)\n));\n\n\nClass(_AltBB, BB);\nClass(_AltInplace, Inplace);\n\n# wrapper needs an identifier, for later matching since two wraps \n# are always spawned. See _MissEstInplace.InplaceExpand rule.\n#\nClass(_InplaceWrap, _GSWrap);\n#SumsBase, BaseMat, rec(\n#    new := (self, id) >> SPL(WithBases(self, rec(\n#        id := id\n#    )))\n#));\n        \nClass(_KeepScat, Scat);\nClass(_KeepGath, Gath);\n\nRewriteRules(_MissEstPreprocessJams, rec(\n\n ComposeGathGath := ARule(Compose, [ @(1, Gath), @(2, [Gath, Prm]) ], # o 1-> 2->\n     e -> [ Gath(fCompose(@(2).val.func, @(1).val.func)) ]),\n\n ComposeScatScat := ARule(Compose, [ @(1, [Scat, ScatAcc]), @(2, [Scat, ScatAcc]) ], # <-1 <-2 o\n     e -> [ Cond(ObjId(@(1).val)=ScatAcc or ObjId(@(2).val)=ScatAcc,\n                 ScatAcc(fCompose(@(1).val.func, @(2).val.func)),\n                 Scat   (fCompose(@(1).val.func, @(2).val.func))) ]),\n\n\n PullInRight := ARule( Compose,\n       [ @(1, [Prm, Scat, ScatAcc, TCast, PushR, PushLR, Conj, ConjL, ConjR, ConjLR, FormatPrm]),\n         @(2, [RecursStep, Grp, BB, SUM, JamISum, Buf, ISum, ICompose, Data, COND, NoDiagPullin, NoDiagPullinLeft, NoDiagPullinRight, NeedInterleavedComplex]) ],\n  e -> [ CopyFields(@(2).val, rec(\n             _children :=  List(@(2).val._children, c -> @(1).val * c),\n             dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n\n PullInLeft := ARule( Compose,\n       [ @(1, [RecursStep, Grp, BB, SUM, SUMAcc, JamISum, Buf, ISum, ICompose, ISumAcc, Data, COND, NoDiagPullin, NoDiagPullinLeft, NoDiagPullinRight, NeedInterleavedComplex]),\n         @(2, [Prm, Gath, TCast, PushL, PushLR, Conj, ConjL, ConjR, ConjLR, FormatPrm]) ],\n     e -> [ CopyFields(@(1).val, rec(\n                _children := List(@(1).val._children, c -> c * @(2).val),\n                dimensions := [Rows(@(1).val), Cols(@(2).val)] )) ]),\n));\n\nRewriteRules(_MissEstSanitize, rec(\n\n    # sometimes there is a BB inside a BB. this is not good for me.\n    # this removes all interior BBs\n    RemoveInnerBB := Rule(@@(1,BB,(e,cx) -> ForAny(cx.parents, e -> ObjId(e) = BB)), e -> @@(1).val.rChildren()[1]),\n\n    # BB cannot have an inplace inside of it, since all operations inside\n    # the BB do not spill to memory.\n    RemoveInnerInplaceFromBB := Rule(@@(1,Inplace,(e,cx) -> ForAny(cx.parents, e -> ObjId(e) = BB)), e -> @@(1).val.rChildren()[1]),\n\n    # same thing with Inplace wrappers. leave only the outer.\n    RemoveInnerInplace := Rule(@@(1,Inplace,(e,cx) -> ForAny(cx.parents, e -> ObjId(e) = Inplace)), e -> @@(1).val.rChildren()[1])\n));\n\n# we tag the BB with an inplace tag, if that basic block is to be performed\n# inplace.\n\n_tagBBin := function(bb, v)\n    bb.inplin := v;\n    return bb;\nend;\n\n_tagBBout := function(bb, v)\n    bb.inplout := v;\n    return bb;\nend;\n\n_tagInplace := function(k, v)\n    k.inplace := v;\n    return k;\nend;\n\n#\n# this thing works very similarly to the keepgath/keepscat below. we start with\n# the inplace tag, generate some wrappers from it, propagate the wrappers\n# into the sigm-spl tree looking for a BB. once the wrappers hit the BB, they\n# tag it. \n\nRewriteRules(_MissEstInplace, rec(\n    InplaceExpand := Rule(Inplace,  e ->\n        let(i := Ind(2),\n            _AltInplace(Compose(Concat(\n                [_InplaceWrap(e.rng(), e.rng(), i)], \n                e.rChildren(), \n                [_InplaceWrap(e.dmn(), e.dmn(), i)]\n            )))\n        )\n    ),\n\n    WrapCompose := ARule(Compose, [@(1, _InplaceWrap), @(2, Compose)], e -> [\n        Compose(\n            Concat([@(1).val], @(2).val.rChildren())\n        )\n    ]),\n\n    ComposeWrap := ARule(Compose, [@(1, Compose), @(2, _InplaceWrap)], e -> [\n        Compose(\n            Concat(@(2).val.rChildren(), [@(1).val])\n        )\n    ]),\n\n    WrapISum := ARule(Compose, [@(2, _InplaceWrap), @(1, [ISum, JamISum])], e -> [\n        CopyFields(@(1).val, rec(\n            _children := [\n                Compose(\n                    @(2).val, # _GSWrap(@(1).val.rng(), @(1).val.rng()),\n                    @(1).val.child(1)\n                )\n            ],\n            dimensions := [Rows(@(1).val), Cols(@(2).val)]\n        ))\n    ]),\n\n    ISumWrap := ARule(Compose, [@(1, [ISum, JamISum]), @(2, _InplaceWrap)], e -> [\n        CopyFields(@(1).val, rec(\n            _children := [\n                Compose(\n                    @(1).val.child(1),\n                    @(2).val # _GSWrap(@(1).val.rng(), @(1).val.dmn()) # have to adjust the size as we move it in.\n                )\n            ],\n            dimensions := [Rows(@(1).val), Cols(@(2).val)]\n        ))\n    ]),\n\n    InplaceWrapBB := ARule(Compose, [@(1, _InplaceWrap), @(2,BB)], e -> [\n        _tagBBout(@(2).val, @(1).val._payload)\n    ]),\n\n    BBInplaceWrap := ARule(Compose, [@(1, BB), @(2, _InplaceWrap)], e -> [\n        _tagBBin(@(1).val, @(2).val._payload)\n    ]),\n\n    ComposeAssoc := ARule( Compose, [ @(1,Compose) ],  e -> @(1).val.children() )\n\n));\n\n#\n# we push into the basic block to figure out the gath/scat which access memory.\n#\nRewriteRules(_MissEstRules, rec(\n\n    # insert a first gather and last scatter. replace BB with\n    # a fake for a while.\n    BBExpand := Rule(BB,  e ->\n        _AltBB(Compose(Concat(\n            [_GSWrap(e.rng(), e.rng(), When(IsBound(e.inplout), e.inplout, false))], \n            e.rChildren(), \n            [_GSWrap(e.dmn(), e.dmn(), When(IsBound(e.inplin), e.inplin, false))])\n        ))\n    ),\n    WrapCompose := ARule(Compose, [@(1, _GSWrap), @(2, Compose)], e -> [\n        Compose(\n            Concat([@(1).val], @(2).val.rChildren())\n        )\n    ]),\n\n    ComposeWrap := ARule(Compose, [@(1, Compose), @(2, _GSWrap)], e -> [\n        Compose(\n            Concat(@(2).val.rChildren(), [@(1).val])\n        )\n    ]),\n\n    WrapISum := ARule(Compose, [@(2, _GSWrap), @(1, [JamISum, ISum])], e -> [\n        CopyFields(@(1).val, rec(\n            _children := [\n                Compose(\n                    @(2).val, # _GSWrap(@(1).val.rng(), @(1).val.rng()),\n                    @(1).val.child(1)\n                )\n            ],\n            dimensions := [Rows(@(1).val), Cols(@(2).val)]\n        ))\n    ]),\n\n    ISumWrap := ARule(Compose, [@(1, [JamISum, ISum]), @(2, _GSWrap)], e -> [\n        CopyFields(@(1).val, rec(\n            _children := [\n                Compose(\n                    @(1).val.child(1),\n                    @(2).val # _GSWrap(@(1).val.rng(), @(1).val.dmn()) # have to adjust the size as we move it in.\n                )\n            ],\n            dimensions := [Rows(@(1).val), Cols(@(2).val)]\n        ))\n    ]),\n\n    GSWrapScat := ARule(Compose, [@(1, _GSWrap), @(2,Scat)], e -> [\n        _tagInplace(_KeepScat(@(2).val.func), @(1).val._payload)\n    ]),\n\n    GathGSWrap := ARule(Compose, [@(1, Gath), @(2, _GSWrap)], e -> [\n        _tagInplace(_KeepGath(@(1).val.func), @(2).val._payload)\n    ]),\n\n    ComposeAssoc := ARule( Compose, [ @(1,Compose) ],  e -> @(1).val.children() )\n));\n\nRewriteRules(_MissEstCleanup, rec(\n    ISumTagVar := Rule(@@(1,[JamISum, ISum], _checkTag), _setTag),\n\n    RemoveBlk := ARule(Compose, [Blk], e -> []),\n    RemoveRCDiag := ARule(Compose, [RCDiag], e -> []),\n\n#    RemoveScatGath := ARule(Compose, [Scat, Gath], e -> []),\n#    RemoveGath := ARule(Compose, [Gath], e -> []),\n#    RemoveScat := ARule(Compose, [Scat], e -> []),\n    # collapse ISums with just one G or S inside. \n#    ISumGath := Rule([ISum, @(1, [Gath, Scat])], e -> @(1).val),\n\n    ComposeAssoc := ARule( Compose, [ @(1,Compose) ],  e -> @(1).val.children() ),\n\n    AltBBtoBB := Rule(@(1, _AltBB), e -> BB(@(1).val.child(1))),\n\n    AltInplacetoInplace := Rule(@(1,_AltInplace), e -> Inplace(@(1).val.child(1))),\n\n#    ComposeAltInplacetoInplace := ARule(Compose, [@(1, _AltInplace)], e -> \n#        [Inplace(@(1).val.child(1))]\n#    ),\n\n#    buggy rule. huh?\n#    DropInplaceWrap := ARule(Compose, [@(1, _InplaceWrap)], e -> [])\n));\n\n\n# plot 1\n# naive iterative inplace WHT(1M)\n\n_returnAndReset := function(a)\n    local t;\n\n    t := a.switch;\n\n    a.switch := false;\n\n    return t;\nend;\n\n_set := function(a, v)\n    a.switch := v;\nend;\n\nClass(cachesim, rec(\n    __call__ := (self, e, s, a) >> WithBases(self, rec(\n        e := e,\n        s := s,\n        a := a,\n\n        tagstore := List(Range1(s), e -> \n            List(Range1(a), ee -> \n                rec(tag:=-1, time:=0)\n            )\n        ),\n        count := 0,\n\t\thash := false\n    )),\n\n    reset := meth(self)\n        self.tagstore := List(Range1(self.s), e -> \n            List(Range1(self.a), ee -> \n                rec(tag:=-1, time:=0)\n            )\n        );\n        self.count := 0;\n    end,\n\n    access := meth(self, addr)\n        local setidx, tag, tagidx, new, bits, mask, shift;\n\n\t\tif self.hash then\n\t\t\tbits := Log2Int(self.a * self.s);\n\t\t\tmask := self.e * ((self.a * self.s) - 1);\n\t\t\tshift := bits;\n\n\t\t\t# we clip it (somewhat arbitrarily) at 30 bits.\n\t\t\twhile (shift < 30) do\n\t\t\t\taddr := BinXor(\n\t\t\t\t\taddr, \n\t\t\t\t\tBinAnd(\n\t\t\t\t\t\tmask,\n\t\t\t\t\t\tInt(addr / shift)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tshift := shift + bits;\n\t\t\tod;\n\t\tfi;\n\n\t\t# add 1 for array offset\n       \tsetidx := 1 + (Int(addr / self.e) mod self.s); \n\n        tag := Int(addr / (self.e * self.s));\n\n        tagidx := Filtered(Range1(self.a), e -> \n            tag = self.tagstore[setidx][e].tag\n        );\n\n        # paranoia\n        Constraint(Length(tagidx) <= 1);\n\n        if Length(tagidx) = 0 then\n            tagidx := self.a;\n            self.tagstore[setidx][tagidx].tag := tag;\n            new := 1;\n        else\n            tagidx := tagidx[1];\n            new := 0;\n        fi;\n\n        self.count := self.count + 1;\n        self.tagstore[setidx][tagidx].time := self.count;\n\n        # sort based on access time, promotion to MRU happens here.\n        Sort(self.tagstore[setidx], (a,b) -> a.time > b.time);\n\n\t\t# AppendTo(\"accesses\", addr, \" (\", setidx, \", \", tagidx, \"): \", new, \"\\n\");\n        return new;\n    end,\n\n    evaljam := meth(self, l, spl, res, jams)\n        local l2, last, i, memaddr;\n    \n        if jams = [] then\n            # get the actual address.\n            memaddr := spl.array.offset + l.eval().v;\n    \n\t\t\t# AppendTo(\"accesses\", When(ObjId(spl) = _KeepGath, \"G \", \"S \"));\n            # perform the memory access!\n            res.activ := res.activ + self.access(memaddr);\n            res.access := res.access + 1;\n        else\n    \n            last := Last(jams);\n    \n            for i in Range0(last.range) do\n                l2 := Copy(l);\n    \n                SubstVars(l2, tab((last.id) := V(i)));\n    \n                self.evaljam(l2, spl, res, DropLast(jams, 1));\n    \n            od;\n        fi;\n    end,\n\n\tevalinner := meth(self, l, spl, res, inners, jams)\n\t\tlocal i, l2, last;\n\n\t\tif inners = [] then\n        \tfor i in Range0(l.vars[1].range) do\n\n            \tl2 := Copy(l.at(i));\n\n            \t# now we have to deal with multiple jammed loops\n            \t# that means we have a nice little recursion here.\n            \tself.evaljam(l2, spl, res, jams);\n        \tod;\n\t\telse\n\t\t\tlast := Last(inners);\n\n\t\t\tfor i in Range0(last.range) do \n\t\t\t\tl2 := Copy(l);\n\n\t\t\t\tSubstVars(l2, tab((last.id) := V(i)));\n\n\t\t\t\tself.evalinner(l2, spl, res, DropLast(inners, 1), jams);\n\t\t\tod;\n\t\tfi;\n\tend,\n\n    evalspl := meth(self, spl, data)\n        local res, id, i, j, tres, l, l2;\n        res := rec(access := 0, activ := 0);\n\n        id := ObjId(spl);\n\n        if id = ISum then\n\n\t\t\t# we evaluate ISums inside of BB differently\n\t\t\tif data.currsize <= data.K then\n\t\t\t\t# AppendTo(\"traverse\", \"inner \", spl.var.id, \" \", spl.var.range,\", \", data.currsize, \"\\n\");\n\t\t\t\tAdd(data.innervar, spl.var);\n\t\t\t\tdata.currsize := data.currsize / spl.var.range;\n            \ttres := self.evalspl(spl.child(1), data);\n\t\t\t\tdata.currsize := data.currsize * spl.var.range;\n            \tdata.innervar := DropLast(data.innervar, 1);\n\n            \tres.access := res.access + tres.access;\n            \tres.activ := res.activ + tres.activ;\n\n\t\t\telse\n\t\t\t\t# AppendTo(\"traverse\", \"outer\", spl.var.id, \" \", spl.var.range,\", \", data.currsize, \"\\n\");\n\t\t\t\tdata.currsize := data.currsize / spl.var.range;\n            \tfor i in Range0(spl.var.range) do\n                \tAdd(data.var, spl.var.id);\n                \tAdd(data.val, V(i));\n                \ttres := self.evalspl(spl.child(1), data);\n                \tdata.var := DropLast(data.var, 1);\n                \tdata.val := DropLast(data.val, 1);\n\t\n                \tres.access := res.access + tres.access;\n                \tres.activ := res.activ + tres.activ;\n            \tod;\n\t\t\t\tdata.currsize := data.currsize * spl.var.range;\n\t\t\tfi;\n\n\n\t\telif id = BB then\n\t\t\tdata.inBB := true;\n            tres := self.evalspl(spl.child(1), data);\n\t\t\tdata.inBB := false;\n\n            res.access := res.access + tres.access;\n            res.activ := res.activ + tres.activ;\n\n        elif id = JamISum then\n            Add(data.jamvar, spl.var);\n            tres := self.evalspl(spl.child(1), data);\n            data.jamvar := DropLast(data.jamvar, 1);\n\n            res.access := res.access + tres.access;\n            res.activ := res.activ + tres.activ;\n\n        elif id = Compose then\n            for i in Reversed(spl.children()) do\n                tres := self.evalspl(i, data);\n                res.access := res.access + tres.access;\n                res.activ := res.activ + tres.activ;\n            od;\n                \n        elif id = _KeepGath or id = _KeepScat then\n\n            l := spl.func.lambda();\n\n            # subst the normal loops\n            DoForAll(Range1(data.var), e -> \n                SubstVars(l, tab((data.var[e]) := data.val[e]))\n            );\n\n\t\t\t# handle the innermost outer loop, nice little\n\t\t\t# recursion here.\n\t\t\tself.evalinner(l, spl, res, data.innervar, data.jamvar);\n\n        else\n            tres := List(spl.children(), e -> self.evalspl(e, data));\n            res.access := Sum(List(tres, e -> e.access));\n            res.activ := Sum(List(tres, e -> e.activ));\n        fi;\n\n        return res;\n    end,\n\n\tapplyRules := (self, s, o) >>\n        ApplyStrategy(s, [\n            _MissEstPreprocessJams,\n            RulesFuncSimp,\n            _MissEstSanitize, \n            _MissEstInplace, \n            _MissEstRules, \n            _MissEstCleanup\n        ], UntilDone, o),\n\n    eval := meth(self, s, _K)\n        local gath, scat, gf, sf, arrays, i;\n\n        gath := Reversed(Collect(s, _KeepGath));\n        scat := Reversed(Collect(s, _KeepScat));\n\n        arrays := [TArray(TUnknown, gath[1].func.range())];\n\n\t\t# PrintTo(\"accesses\", \"\\n\");\n\t\t# PrintTo(\"traverse\", \"\\n\");\n\n        # assign input/output arrays\n        for i in Range1(gath) do\n\n            # paranoia\n            # Constraint(gath[i].func.domain() = scat[i].func.domain());\n\n            gath[i].array := Last(arrays);\n\n\t\t\t# we can match any of the previous gather matrices.\n\t\t\tif scat[i].inplace <> false \n\t\t\t\tand ForAny(gath{[1..i]}, e -> e.inplace = scat[i].inplace) then\n\n\t\t\t\tscat[i].array := \n\t\t\t\t\tFiltered(gath{[1..i]}, e -> e.inplace = scat[i].inplace)[1].array;\n\t\t\telse\n\n                Add(arrays, TArray(TUnknown, scat[i].func.range()));\n                scat[i].array := Last(arrays);\n            fi;\n        od;\n         \n        # descending order by size of array\n        Sort(arrays, (a,b) -> a.size > b.size);\n\n        # mark offsets\n        arrays[1].offset := 0;\n\n        # propagate offsets\n        for i in [2..Length(arrays)] do\n            arrays[i].offset := arrays[i-1].offset + arrays[i-1].size;\n        od;\n\n        # traverse the spl expression.\n        return self.evalspl(s, rec(\n\t\t\tm := s.dims()[1], \n\t\t\tK := _K,\n\n\t\t\tcurrsize := s.dims()[1], \n\t\t\tvar:=[], \n\t\t\tval:=[], \n\t\t\tinnervar := [], \n\t\t\tjamvar:=[]\n\t\t));\n    end,\n));\n\n", "meta": {"hexsha": "772ccec91292b7ddab0100cf6a75b7510aa3603d", "size": 17145, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/cache/sim.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/cache/sim.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/cache/sim.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.3076923077, "max_line_length": 176, "alphanum_fraction": 0.5182268883, "num_tokens": 5132, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.31069438321455395, "lm_q2_score": 0.03789242269107747, "lm_q1q2_score": 0.011772962896509483}}
{"text": "Class(NewScalarProduct, BaseOperation, rec(\n  __call__ := (self, rv) >> SPL(WithBases(self, rec(\n    rv := rv,\n    _children := [rv]\n  ))),\n  dims := self >> [self.rv.element.domain(), V(1)],\n  from_rChildren := (self, rch) >> CopyFields(self, rec(_children := rch)),\n  doNotMarkBB := true,\n  print := (self, i, is) >> Print(\n        self.name, \"(\", self.rv, \")\")\n));\n\nClass(DenseScalarProduct, BaseOperation, rec(\n  __call__ := (self, rv) >> SPL(WithBases(self, rec(\n    rv := rv,\n    _children := [rv]\n  ))),\n  dims := self >> [self.rv.element.domain(), V(1)],\n  from_rChildren := (self, rch) >> CopyFields(self, rec(_children := rch)),\n  doNotMarkBB := true,\n  print := (self, i, is) >> Print(\n        self.name, \"(\", self.rv, \")\")\n));\n\nClass(SparseScalarProduct, BaseOperation, rec(\n  __call__ := (self, rv) >> SPL(WithBases(self, rec(\n    rv := rv,\n    _children := [rv]\n  ))),\n  dims := self >> [self.rv.element.domain(), V(1)],\n  from_rChildren := (self, rch) >> CopyFields(self, rec(_children := rch)),\n  doNotMarkBB := true,\n  print := (self, i, is) >> Print(\n        self.name, \"(\", self.rv, \")\")\n));\n\n\nDeclare(IsSparseT);\n\nClass(sparse_nth3, Loc, rec(\n    __call__ := (self, list, idx) >> WithBases(self,\n        rec(operations := NthOps,\n\t\t\tlist := list,\n            idx := toExpArg(idx))).setType().cfold(),\n\n    can_fold := self >> self.idx _is funcExp or (IsValue(self.idx) and\n                  (IsValue(self.list) or (IsVar(self.list) and IsBound(self.list.var)) or self.list _is apack)),\n    cfold := self >> When(self.can_fold(), self.eval(), self),\n \n    rChildren := self >> [self.list, self.idx],\n    rSetChild := rSetChildFields(\"list\", \"idx\"),\n\t\n\teval := meth(self)\n\t\tlocal result, iterator;\n\t\tresult := 0;\n\t\titerator := 1;\n\t\twhile iterator <= Length(self.list.var) and result = 0 do\n\t\t\tif self.idx = self.list.var[iterator].pair.first then\n\t\t\t\t#Print(\"if\\n\");\n\t\t\t\tresult := self.list.var[iterator].pair.second;\n\t\t\t\titerator := iterator + 1;\n\t\t\t\tbreak();\n\t\t\t\t#Print(iterator);\n\t\t\telse\n\t\t\t\t#Print(\"else\\n\");\n\t\t\t\tresult := V(0);\n\t\t\t\titerator := iterator + 1;\n\t\t\t\t#Print(iterator);\n\t\t\tfi;\n\t\tod;\n\t\treturn result;\n\t\tend,\n\t\t\n\t#\tresult := var.fresh_t(\"result\", TInt);\n\t#\tg := var.fresh_t(\"g\", TInt);\n\t#\tdecl[result, g], chain(\n\t#\tloopf(g, V(1), Length(fds.var),\n\t#\tchain(IF(eq(x, fds.var[g].pair.first), \n\t#\tassign(result,fds.var[g].pair.second), \n\t#\tassign(result,V(0))))), \n\t#\treturn result);\n\t#  end;\n\n    computeType := self >> Cond(\n\tIsArrayT(self.list.range()), self.list.range(),\n        ObjId(self.list.t) = TSym, TSym(\"Containee\"), #used with C++ container objects (EnvList)\n        self.list.t = TUnknown,  self.list.range(),\n\tError(\"Unknown types of 1st argument <self.list> in \", ObjId(self))\n    ),\n));\n\n\nClass(TStruct, CompositeTyp, rec(\n\t__call__ := arg >> let(\n\tself := arg[1],\n\tfields := CopyFields(arg[2]),\n\tWithBases(self,\n\trec(fields := fields, operations := TypOps))),\n    print := self >> Print(self.name,\"(\", self.fields.name, \", \", self.fields.key, \", \", self.fields.val, \")\"),\n));\n\nClass(TPair, TStruct, rec(\n   __call__ := arg >> let(\n   self := arg[1],\n   pair := CopyFields(arg[2]),\n   WithBases(self, \n   rec(pair := pair, operations := TypOps))),\n  \n   print := self >> Print(self.name,\"(\",self.pair.first,\", \", self.pair.second,\")\"),\n));\n\n\nClass(KVPair, CompositeTyp, rec(\n\t__call__ := (self, first ,second) >> WithBases(self,rec( \n\t\tfirst := first,\n\t\tsecond := second,\n\t\toperations := TypOps)),\n\t\t#t := Checked(IsType(t), t),\t\n\t\tfirst := self >> self.first,\n\t\tsecond := self >> self.second,\n\tprint := self >> Print(self.name,\"(\",self.first,\", \",self.second,\")\"),\n));\n\nSparseMatSPL := function ( S )\n  local M, t, v, i;\n  t := 0;\n  i := 1;\n  if IsSparseT(S.data_type) then\n\tM := NullMat(S.data_type.dims()[1], S.data_type.dims()[2]);\n\twhile t < S.data_type.size()-1 do \n\t\tPrint(t);\n\t\tif t = S.element[i][1] then\n\t\t\tM[1][t+1] := S.element[i][2];\n\t\t\tt := t + 1;\n\t\t\ti := i + 1;\n\t\telse\n\t\t\tM[1][t+1] := 0;\n\t\t\tt := t + 1;\n\t\tfi;\n  \tod;\n  fi;\n  return M;\n  end;\n\n#F sparse_nth(<loc>, <idx>) -- symbolic representation of array access\n#F\nClass(sparse_nth, Loc, rec(\n    __call__ := (self, loc, idx) >> WithBases(self,\n        rec(operations := NthOps,\n            loc := toExpArg(loc),\n            idx := toExpArg(idx))).setType().cfold(),\n\n    can_fold := self >> self.idx _is funcExp or (IsValue(self.idx) and\n                  (IsValue(self.loc) or (IsVar(self.loc) and IsBound(self.loc.value)) or self.loc _is apack)),\n    cfold := self >> When(self.can_fold(), self.eval(), self),\n\n    rChildren := self >> [self.loc, self.idx],\n    rSetChild := rSetChildFields(\"loc\", \"idx\"),\n\n    ev := self >> let(e := self.eval(),\n\tCond(IsBound(e.v), e.v, e)),\n\n    eval := self >> let(loc := self.loc.eval(), idx := self.idx.eval(),\n        Cond(IsList(loc),\n\t\t\t\t Cond(idx.v >= Length(loc), errExp(self.t), Cond(idx.v = loc[1][x][1], V(0), V(loc))),\n\t\t\t idx _is funcExp,\n                 self.t.value(idx.args[1]),\n             not IsValue(idx),\n                 self,\n             idx.v < 0,\n                 errExp(self.t),\n             loc _is apack,\n                 Cond(idx.v >= Length(loc.args), errExp(self.t), loc.args[idx.v+1]),\n             IsValue(loc),\n                 Cond(idx.v >= Length(loc.v), errExp(self.t), V(loc.v[idx.v+1])),\n             IsVar(loc) and IsBound(loc.value),\n                 Cond(idx.v >= Length(loc.value.v), errExp(self.t), V(loc.value.v[idx.v+1])),\n             self)),\n\n    computeType := self >> Cond(\n\tIsPtrT(self.loc.t) or IsArrayT(self.loc.t) or IsListT(self.loc.t), self.loc.t.t,\n        ObjId(self.loc.t)=TSym, TSym(\"Containee\"), #used with C++ container objects (EnvList)\n        self.loc.t = TUnknown,  self.loc.t,\n\tError(\"Unknown types of 1st argument <self.loc> in \", ObjId(self))\n    ),\n\n    isExpComposite := true\n));\n\n\n#IsSparseOfs := o -> IsRec(o) and IsBound(o.isSparseOfs) and o.isSparseOfs;\n\n#F FDataOfs(<datavar>, <len>, <ofs>)\n#\nClass(FDataSparseOfs, Function, rec(\n    #__call__ := (self, datavar, len, ofs) >> WithBases(self, rec(\n    #var := datavar,\n    #operations := PrintOps,\n    #ofs := toExpArg(ofs),\n    #len := Checked(IsPosIntSym(len), len)\n    #)),\n   __call__ := arg >> let(\n       self := arg[1],\n       object := arg[2],\n\t   len := arg[3],\n       ofs := toExpArg(arg[4]),\n\t   WithBases(self, rec(var := object, len := len, ofs := ofs, operations := PrintOps))),\n\n   print := self >> Print(self.name, \"(\", self.var, \", \", self.len, \", \", self.ofs, \")\"),\n   rChildren := self >> [ self.var, self.len, self.ofs ], #DOMAIN AND RANGE BROKEN\n   rSetChild := rSetChildFields(\"var\", \"len\", \"ofs\" ),\n\n# <-Daniele's changes\n#    rChildren := self >> [ self.var, self.len, self.ofs],\n#    rSetChild := rSetChildFields(\"var\", \"len\", \"ofs\"),\n\n#    rChildren := self >> [ self.var, self.len, self.ofs, self._domain, self._range],\n#    rSetChild := rSetChildFields(\"var\", \"len\", \"ofs\", \"_domain\", \"_range\"),\n#    from_rChildren := (self, rch) >> ObjId(self)(rch[1], rch[2], rch[3]).setDomain(rch[4]).setRange(rch[5]),\n# ->\n\n    #domain := self >> self.len,\n\n    #at := (self, n) >> When(IsInt(n) and IsValue(self.ofs) and IsBound(self.var.value),\n    #   self.var.value.v[n + self.ofs.v + 1],\n    #    nth(self.var, n + self.ofs)),\n\t#\n    #tolist := self >> List([0..EvalScalar(self.len-1)], i -> nth(self.var, self.ofs+i)),\n    #lambda := self >> let(x := Ind(self.domain()), Lambda(x, nth(self.var, self.ofs+x))),\n\n\tat := (self, n) >> When(IsInt(n) and IsValue(self.ofs) and IsBound(self.var.value),\n       self.var.value.v[n + self.ofs.v + 1],\n        sparse_nth3(self.var, n + self.ofs)),\n\t\n    tolist := self >> List([0..EvalScalar(self.len-1)], i -> sparse_nth3(self.var, self.ofs+i)),\n    lambda := self >> let(x := Ind(self.domain()), Lambda(x, sparse_nth3(self.var, self.ofs+x))),\n\n\n\n\trange := self >> When(self._range=false, self.var.t, self._range),\n    domain := self >> self.len,\n    #range := self >> When(self._range=false, self.var.t.t, self._range),\n    inline := true,\n    free := self >> self.ofs.free()\n));\n\n#F FDataSparse(<datavar>) -- symbolic function i -> datavar[i],\n#F\n#F domain = datavar.range\n#F range = datavar.t\n#F\n#F\nClass(FDataSparse, Function, rec(\n   __call__ := arg >> let(\n       self := arg[1],\n       object := arg[2],\n       var := Cond(IsList(arg[3]), arg[3], [arg[3]]),\n\t   WithBases(self, rec(var := var, object := object, operations := PrintOps))),\n\n   print := self >> Print(self.name, \"(\", self.object, \", \", self.var, \")\"),\n   rChildren := self >> [ self.var ],\n   rSetChild := rSetChildFields(\"var\"),\n\n   at := (self, n) >> self.lambda().at(n),\n   tolist := self >> self.lambda().tolist(),\n   lambda := self >> let(x := Ind(self.domain()), Lambda(x, sparse_nth3(self, x))),\n   \n   domain := self >> self.object.size,\n   range := self >> self.object.t,\n\n   inline := true,\n   free := self >> Set([]),\n   part := (self, len, ofs) >> FDataSparseOfs(self.var, len, ofs),\n));\n\nClass(FDataSparseMat, Function, rec(\n\t__call__ := arg >> let(\n       self := arg[1],\n       object := arg[2],\n       var := Cond(IsList(arg[3]), arg[3], [arg[3]]),\n\t   WithBases(self, rec(var := var, object := object, operations := PrintOps))),\n\t\n\tprint := self >> Print(self.name, \"(\", self.object, \", \", self.var, \")\"),\n\trChildren := self >> [self.var],\n\trSetChild := rSetChildFields(\"var\"),\n\n\tat := (self, n) >> self.lambda().at(n),\n\ttolist := self >> self.lambda().tolist(),\n\t#lambda := self >> let(k := Ind(object.expr.loc.loc.dims[1]))\n\tlambda := self >> let(k := Ind(self.domain()), u := Ind(self.domain()), Lambda(k, Lambda(u, self.object.at(k,u)))),\n\n\tdomain := self >> Length(self.var),\n\trange := self >> self.object.t.params[1],\n));\n\nClass(FDataSparseMatOfs, Function, rec(\n\t__call__ := arg >> let(\n       self := arg[1],\n       object := arg[2],\n\t   len := arg[3],\n       ofs := arg[4],\n\t   WithBases(self, rec(object := object, len := len, ofs := ofs, operations := PrintOps))),\n\t\n\tprint := self >> Print(self.name, \"(\", self.object, \", \", self.len, \", \", self.ofs, \")\"),\n   \trChildren := self >> [ self.object, self.len, self.ofs ],\n   \trSetChild := rSetChildFields(\"object\", \"len\", \"ofs\"),\n\n\n\tat := (self, n) >> When(IsInt(n) and IsValue(self.ofs) and IsBound(self.object.value),\n       self.object.value.v[n + self.ofs.v + 1],\n        nth(self.object, self.lambda().at(n))),\n\t\n\t#tolist := self >> self.lambda().tolist(),\n\ttolist := self >> List([0..EvalScalar(self.len-1)], i -> nth(self.object, self.ofs+i)),\n\tlambda := self >> let(k := Ind(self.domain()), u := Ind(self.domain()), Lambda(k, Lambda(u, self.object.at(k,u)))),\n\n\trange := self >> self.object.t,\n    domain := self >> self.len,\n\tinline := true,\n    free := self >> self.ofs.free()\n));\n\n\n\nDeclare(TSparse);\nDeclare(Ttrace);\n\n\n\nClass(sparse_nth2, BaseOperation, rec(\n\t__call__ := (self, sa, index) >> SPL(WithBases(self, rec(\n\t  sa := sa,\n\t  index := index,\n\t  _children := [index]\n\t  ))),\n\t  dims := self >> [self.index, V(1)],\n\t  from_rChildren := (self, rch) >> CopyFields(self, rec(_children := rch)),\n\t  doNotMarkBB := true,\n));\n\n\n#Class(GathPtr, Gath, rec(\n#    rChildren := self >> [self.ptr, self.func],\n#    rSetChild := rSetChildFields(\"ptr\", \"func\"),\n#    new := (self, ptr, func) >> SPL(WithBases(self, rec(\n#        ptr := ptr,\n#      \tfunc := Checked(IsFunction(func) or IsFuncExp(func), func)))).setDims()\n#));\n\n\nClass(TSparse2, SumsBase, BaseMat, rec(\n    _short_print := true,\n\trChildren := self >> [self.t, self.size1, self.list1, self.size2, self.list2],\n\trSetChild := rSetChildFields(\"t\",\"size1\", \"list1\", \"size2\", \"list2\"),\n\tdims := self >> [self.size1, self.size2],\n\n\tnew := (self, t, size1, list1, size2, list2) >> SPL(WithBases(self,\n\t\trec(dimensions := [size1, size2],\n\t\tsize1 := size1,\n\t\tsize2 := size2,\n\t\tt := t,\n\t\tlist1 := list1,\n\t\tlist2 := list2))),\n\t\n));\n\nClass(struct_nth, nth, rec(\n\t__call__ := (self, loc, elem, idx) >> WithBases(self, rec(\n\t\tloc := loc,\n\t\telem := elem,\n\t\tidx := idx,\n\t\tt := Cond(IsPtrT(loc) or IsSparseT(loc.t), loc.t.t, loc.t),\n\t\toperations := NthOps\n\t)),\n\trChildren := self >> [self.loc, self.elem, self.idx],\n\trSetChild := rSetChildFields(\"loc\", \"elem\", \"idx\"),\n\t\n\teval := self >> self,\n\t#print := (self, i, si) >> Print(self.name, \"\n\tisExpComposite := false\n));\n\nspiral.spl.RowVec.traversal := (self, sa, body) >> let(\n\t\t\titr := var.fresh_t(\"itr\", TInt),\n\t\t\tloopw(neq(struct_nth(sa, \"index\", itr), V(0)), chain(\n\t\t\t\tbody\n\t\t\t))\n\t);\n\nClass(RowVec2, RowVec, rec(\n\tinit := self >> let(\n\t\tresult := var.fresh_t(\"result\", TInt),\n\t\tassign(result, V(0))\n\t),\n\n\ttraversal := (self, sa, body) >> let(\n\t\t\titr := var.fresh_t(\"itr\", TInt),\n\t\t\tloopw(neq(struct_nth(sa, \"index\", itr), NULL(TInt)), chain(\n\t\t\t\tbody\n\t\t\t))\n\t),\n));\n\n\nClass(DAGNode, TaggedNonTerminal,  rec(\n    abbrevs :=  [ (nt, ylist, xlist) -> Checked(IsSPL(nt), [nt, When(IsList(ylist), ylist, [ylist]), When(IsList(xlist), xlist, [xlist])]) ],\n    #transpose := self >> ObjId(self)(self.params[1].transpose(), self.params[2], self.params[3]).withTags(self.getTags())\n));\n\nClass(DAG, TCompose, rec(\n    terminate := self >> Error(\"Not yet implemented.\"),\n    \n    from_rChildren := (self, rch) >> let(\n        len := Length(rch),\n        transposed := rch[len-1],\n        tags := rch[len],\n        t := ApplyFunc(ObjId(self), [rch{[1..len-2]}]),\n        tt := When(transposed, t.transpose(), t),\n        attrTakeA(tt.withTags(tags), self)\n    ),\n\n    rChildren := self >>\n        Concatenation(self.params[1], [self.transposed, self.tags]),\n\n    rSetChild := meth(self, n, newChild)\n        local l;\n        l := Length(self.params[1]);\n        if n <= l then\n            self.params[1][n] := newChild;\n        elif n = l+1 then\n            self.transposed := newChild;\n        elif n = l+2 then\n            self.tags := newChild;\n        else Error(\"<n> must be in [1..\", l+2, \"]\");\n        fi;\n        # self.canonizeParams(); ??\n        self.dimensions := self.dims();\n    end\n    \n));\n\nINF := arg -> Cond(\n   Length(arg)=0, Int(1000000),\n   Length(arg)=1, var.fresh(\"i\", TInt, toRange(Int(1000000))),\n   Error(\"Usage: INF() | INF(<range>)\")\n);\n\n\n#Class(INF, Value, rec(\n#\t__call__ := self >> SPL(WithBases(self, rec(\n#\t\tt := TInt,\n#\t\tv := V(1),\n#\t\toperations := ValueOps,\n#\t))),\n#\tisSPL := true,\n#\tdims := self >> self.v,\n#\teval := self >> self,\n#\tprint := (self, i, si) >> Print(self.name),\n#));\n\nIsMaskT := x ->  IsBound(x.isMaskT) and x.isMaskT;\nIsAccumT := x ->  IsBound(x.isAccumT) and x.isAccumT;\n\n\nClass(Mask, Diag, rec(\n\t__call__ := (self, func) >> SPL(WithBases(self, rec(\n\t\telement := func,\n\t\tvar := func.var,\n\t))),\n\tisMaskT := true,\n\tprint := (self, i, si) >> Print(self.name, \"(\", self.element, \")\"),\n\tindex := (self, i, j, dom) >> nth(self.var, add(mul(dom, i), j)),\n\t#find_index := (self, i, j, itr) >> decl([mitr], chain(assign(mitr, nth(m, @(2).val.var), loopw(logic_and()))))\n));\n\nClass(Accumulate, Diag, rec(\n\t__call__ := (self, func) >> SPL(WithBases(self, rec(\n\t\telement := func,\n\t\tvar := func.var,\n\t))),\n\tisAccumT := true,\n\tprint := (self, i, si) >> Print(self.name, \"(\", self.element, \")\"),\n));\n\nDeclare(SPLScope);\n\n\nClass(SPLScope, Buf, rec(\n\n\t__call__ := (self, spl, scope) >> SPL(WithBases(self, rec(\n\t\tspl := Checked(IsSPL(spl), spl),\n\t\tscope := scope,\n\t\t_children := [spl],\n\t\tdimensions := spl.dimensions,\n\t))),\n\tdims := self >> Dimensions(self.spl),\n\trChildren := self >> [self.spl, self.scope],\n\trSetChild := rSetChildFields(\"spl\", \"scope\"),\n\t#append := (self, L) >> Union(self.list, L),\n\n\t#freshScope := (self, inVar, outVar) >> SPL(WithBases(self, rec(\n\t#\t\tinput := inVar,\n\t#\t\toutput := outVar,\n\t#\t\t_children := [],\n\t#\t))),\n\n\tfreshScope := (self) >> var.fresh_t(\"t\", TPtr(TReal)),\n));\n\n\nClass(SpContainer, SumsBase, BaseContainer, rec(\n\tnew := (self, spl) >> SPL(WithBases(self, rec(\n\t\t_children := [spl]))).setDims(),\n\t\n\tdims := self  >> self.child(1).dims()\n));\n\n\nDeclare(TSparse_Matrix);\n\nClass(PreDstruct, BaseMat, rec(\n\t__call__ := (self, count) >> SPL(WithBases(self, rec(\n\t\tcount := count,\n\t\tdimensions := [count*count, count*count],\n\t\t_children := [count],\n\t))),\n\tisPermutaiton := False,\n\tisReal := True,\n\trChildren := self >> [self.count],\n\trSetChild := rSetChildFields(\"count\"),\n\tdoNotMarkBB := true,\n\tdims := self >> self.dimensions,\n\tprint :=  (self, i, si) >> Print(self.name, \"(\", self.count,\")\"),\n));\nClass(PostDstruct, BaseMat, rec(\n\t__call__ := (self, count) >> SPL(WithBases(self, rec(\n\t\tcount := count,\n\t\tdimensions := [count*count, count*count],\n\t\t_children := [count],\n\t))),\n\tisPermutaiton := False,\n\tisReal := True,\n\trChildren := self >> [self.count],\n\trSetChild := rSetChildFields(\"count\"),\n\tdoNotMarkBB := true,\n\tdims := self >> self.dimensions,\n\tprint :=  (self, i, si) >> Print(self.name, \"(\", self.count,\")\"),\n));\n\nClass(HyperSprase, BaseOperation, rec(\n\t__call__ := arg >> let(\n    self := arg[1],\n    vector := arg[2],\n\tmatrix := arg[3],\n\tWithBases(self, rec(vector := vector, matrix := matrix, _children := [vector, matrix], operations := PrintOps))),\n\t\n   \tisSparseT := true,\n   \tprint := self >> Print(self.name, \"(\", self.vector, \", \", self.matrix, \")\"),\n   \tdims := self >> self.vector.dims(),\n\n));\n\nClass(MatMul, BaseMat, rec(\n\t__call__ := (self, dimX, dimY) >> SPL(WithBases(self, rec(\n\t\tdimX := dimX,\n\t\tdimY := dimY,\n\t\tdimensions := [dimX*dimY, dimY*dimX],\n\t))),\n\tisPermutaiton := False,\n\tisReal := True,\n\n\trChildren := self >> [self.dimX, self.dimY],\n\trSetChild := rSetChildFields(\"dimX\", \"dimY\"),\n\n\tdims := self >> self.dimensions,\n\tprint :=  (self, i, si) >> Print(self.name, \"(\", self.dimX, \", \", self.dimY,\")\"),\n\n));\n\nClass(MakeDiag, Diag, rec(\n\tdims := self >> [self.element.domain(), self.element.domain()],\n));\n\n\nClass(Reduce, BaseMat, rec(\n\t__call__ := (self, traversal, size, t) >> SPL(WithBases(self, rec(\n\t\ttraversal := Checked(IsString(traversal), traversal),\n\t\tsize := size,\n\t\tt := Checked(IsType(t), t),\n\t\tdimensions := Cond(traversal = \"Col\", [1, size], [size, 1]),\n\t))),\n\t\n\trChildren := self >> [self.traversal, self.t],\n\trSetChild := rSetChildFields(\"traversal\", \"t\"),\n\n\tdims := self >> self.dimensions,\n\n\tprint :=  (self, i, si) >> Print(self.name, \"(\", self.traversal, \", \", self.size, \", \", self.t, \")\"),\n\n\tisPermutaiton := False,\n\tisReal := True,\n\n));\n\nClass(SparseBlk, SumsBase, Mat, rec(\n\tnew := (self, M) >> SPL(WithBases(self, rec(\n\t\t\tdata_type := M.object,\n            element := M.var,\n            TType   := Cond( # NOTE: add checks to M\n                            IsList(M.var),     UnifyTypes(List(Flat(M.var), InferType)),\n                             IsValue(M.var),    M.t.t,\n                           IsSymbolic(M.var), M.t.t),\n                       ))).setDims(),\n    area := self >> Length(Filtered(Flat(self.element), k -> k<>0)),\n    new  := (self, M) >> SPL(WithBases(self, rec(element := M))).setDims(),\n    dims := self >> Dimensions(self.element)\n));\n\n\n#Class(Trianglecount, TaggedNonTerminal, rec(\n#\tabbrevs := [(n) -> [n]],\n#\tisReal := self>>true,\n#\tdims := self >> [self.params[2]\n#))\n\nDeclare(RulesSPLScope);\nDeclare(RulesMask);\n\nClass(SpMV, TaggedNonTerminal, rec(\n\tabbrevs := [(n) -> [n]], \n\tisReal := self >> true,\n\tdims := self >> self.params[1],\n\tprint := (self, i , si) >> Print(self.name, \"(\", self.params[1], \")\")\n));\nClass(TVStack, TaggedNonTerminal, rec(\n\tabbrevs := [(n) -> [n]],\n));\nClass(TRowVec, TaggedNonTerminal, rec(\n\tabbrevs := [(n) -> [n]], \n));\n\nClass(TSparse_Mat, TaggedNonTerminal, rec(\n\tabbrevs := [(n) -> [n]],\n\tisReal := self>>true,\n\tdims := self >> [self.params[1], self.params[1]]\n)); \n\nClass(Trace, TaggedNonTerminal, rec(\n\tabbrevs := [(n) -> [n]],\n\tisReal := self >> true,\n\tdims := self >> self.params[1].dims()[1] * self.params[1].dims()[2],\n\tprint := (self, i , si) >> Print(self.name, \"(\", self.params[1], \")\")\n));\n\nClass(MatrixMultiply, TaggedNonTerminal, rec(\n\tabbrevs := [(n,n, p) -> [n,n, p]],\n\tisReal := self >> true,\n\tdims := self >> self.params[1] * self.params[2],\n\tprint := (self, i , si) >> Print(self.name, \"(\", self.params[1], \", \", self.params[2], Checked(self.params[3] <> \"\", Print(\", \", self.params[3])), \")\")\n));\n\nNewRulesFor(SpMV, rec(\n\tcolumn_reduce := rec(\n\t\t\tinfo := \"Column reduction based spmv\",\n\t\t\tmaxSize := false,\n\t\t\tapplicable := (self, nt) >> true,\n\t\t\tapply := (nt, c, cnt) -> let(i := Ind(3),\n\t\t\t\t\tts := TSparse(TArray(TInt, 3), TSemiring_Arithmetic(TInt)),\n\t\t\t\t\tfdataofs := FDataOfs(ts, 3, 0),\n\t\t\t\t\tmd := MakeDiag(fdataofs),\n\t\t\t\t\teye := I(i),\n\t\t\t\t\tsid := SUM(eye, md),\n\t\t\t\t\tmatmul := MatMul(3,3),\n\t\t\t\t\tspmv := matmul * sid, spmv)\n\t)\n));\n\n#NewRulesFor(MatrixMultiply, rec(\n#\t matmul := rec(\n#\t\t info := \"Matrix Multplication\",\n#\t\t maxSize := false,\n#\t\t applicable := (self, nt) >> Cond(nt.params[3] = \"\", true, false),\n#\t\t apply := (nt, c, cnt) -> let(i := Ind(3), j := Ind(3), scat := Scat(fTensor(fBase(i), fBase(j))), \n#\t\t gath := Gath(fStack(fTensor(fBase(i), fId(3)), fTensor(fId(3), fBase(j)))), scp := SPLScope.freshScope(),\n#\t\t kernel := scat * SPLScope(RowVec(FDataOfs(scp,6,V(3))), scp)  * gath, kernel2 := Rewrite(kernel, RulesSPLScope, opts), ISum(i, 3, ISum(j, 3, kernel2)))\n#\t ),\n#\t maskedmxm := rec(\n#\t\t info := \"Masked Matrix Multplication\",\n#\t\t maxSize := false,\n#\t\t applicable := (self, nt) >> Cond(IsSPL(nt.params[3]), IsMaskT(nt.params[3]), false),\n#\t\t apply := (nt, c, cnt) -> let(\n#\t\t\t\t\t\t\t\ti := Ind(3),\n#\t\t\t\t\t\t\t\tj := Ind(3),\n#\t\t\t\t\t\t\t\tscat := Scat(fTensor(fBase(i), fBase(j))), \n#\t\t\t\t\t\t\t\tgath := Gath(fStack(fTensor(fBase(i), fId(3)), fTensor(fId(3), fBase(j)))),\n#\t\t\t\t\t\t\t\tscp := SPLScope.freshScope(),\n#\t\t\t\t\t\t\t\tkernel := scat * SPLScope(RowVec(FDataOfs(scp,6,V(3))), scp) * gath,\n#\t\t\t\t\t\t\t\tmxm := ISum(i, 3, ISum(j, 3, kernel)),\n#\t\t\t\t\t\t\t\tmaskedmxm := Mask(FDataOfs(M, 9, 0)) * mxm,\n#\t\t\t\t\t\t\t\tmaskedmxm2 := Rewrite(maskedmxm, RulesMask, opts),\n#\t\t\t\t\t\t\t\tmaskedmxm3 := Rewrite(maskedmxm2, RulesSPLScope, opts), maskedmxm3)\n#\t )\n#));\n\n\nNewRulesFor(Trace, rec(\n\tcsr_trace := rec(\n\t\tinfo := \"Trace of CSR matrix\",\n\t\tmaxSize := false,\n\t\tapplicable := (self, nt) >> true,#nt.params[1].dims()[1] =1,\n\t\t#apply := (nt, c, cnt) -> let(i := Ind(4), ISumAcc(Ind(), 4, ScatAcc(fId(1)) * Gath(fTensor(fBase(i), fBase(i))))),\n\t\tapply := (nt, c, cnt) -> let(i := Ind(5), ISumAcc(i, 5, Gath(fTensor(fBase(i), fBase(i))))),\n\t)\n));\n\n\nNewRulesFor(TSparse_Mat, rec(\n\tcsr := rec(\n\t\tinfo := \"Vertical stack of Row Vectors\",\n\t\tmaxSize := false,\n\t\tapplicable := (self, nt) >> nt.params[1].dims()[1] = 1,\n\t\t#apply := (nt, c, cnt) -> VStack(nt.params[1]),\n\t\tapply := (nt, c, cnt) -> TSparse_Matrix(nt.params[1]),\n\t),\n\tcsc := rec(\n\t\tinfo := \"Horizontal stack of Column Vectors\",\n\t\tmaxSize := false,\n\t\tapplicable := (self, nt) >> nt.params[1].dims()[2] = 1,\n\t\tapply := (nt, c, cnt) -> HStack(nt.params[1]),\n\t)\n));\n\n\nClass(DStructKernel, Grp);\nClass(DStructKernelDot, Grp);\nClass(GrpKernel, Grp);\nClass(GrpKernel2, Grp);\nClass(MaskKernelAxpy, Grp);\nClass(MaskKernelDot, Grp);\nClass(AccumKernel, Grp, rec(doNotMarkBB := true));\nClass(TriCountKernel, Grp);\nClass(PushBFSKernel, Grp);\nClass(PullBFSKernel, Grp);\nClass(BFSKernel, Grp);\n\nTArrayBase.__call__ := (self, t, size) >>\n        WithBases(self, rec(\n        t    := Cond(Checked(IsType(t), IsSemiring(t)), t.t, t),\n\t\tring := Cond(IsSemiring(t), t, \"Error no ring\"),\n        size := Checked(IsPosInt0Sym(size), size),\n        operations := TypOps));\n\n#TArrayBase.rChildren := self >> Cond(IsBound(self.ring) and self.ring <> \"Error no ring\", [self.t, self.ring, self.size], [self.t, self.size]);\n#TArrayBase.rSetChild := self >> Cond(IsBound(self.ring) and self.ring <> \"Error no ring\", rSetChildFields(\"t\", \"ring\", \"size\"), rSetChildFields(\"t\", \"size\"));\n#TArrayBase.from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch);\n\n\nClass(Ttrace, BaseOperation, rec(\n\t__call__ := (self, object) >> WithBases(self, rec(\n        object := object,\n        t := object.t,\n        operations := TypOps)),\n\n\tprint := self >> Print(self.name, \"(\", self.object, \")\"),\n\t#size := self >> self.t.size,\n\tdims := self >> [1, 1],\n\trChildren := self >> [self.object],\n\trSetChild := rSetChildFields(\"object\"),\n));\n\nIsSparseT := x -> IsType(x) and IsBound(x.isSparseT) and x.isSparseT;\n\nClass(TSparse_Matrix, TArrayBase, rec(\n   #__call__ := arg >> let( \n\t#    size := arg[2],\n   #     element := TArray(arg[1], arg[2]),\n   #     t := arg[1].t,\n\t#\tprop := Cond(IsList(arg[3]), arg[3], [arg[3]]),\n   #     operations := TypOps,WithBases(self, rec()), \n\t\n\t__call__ := arg >> let(\n       self := arg[1],\n       size := arg[2].size(),\n\t   element := TArray(arg[2], size),\n       prop := Cond(IsList(arg[3]), arg[3], [arg[3]]),\n\t   t := element.t,\n\t   WithBases(self, rec(size := size, element := element, prop := prop, t := t, _children := [arg[2], prop], operations := PrintOps))),\n\t\n   \tisSparseT := true,\n   \tprint := self >> Print(self.name, \"(\", self.element, \", \", self.prop, \")\"),\n   \tdims := self >> [self.size, self.element.size],\n\n\trChildren := self >> [self.element.t, self.size],\n\trSetChild := rSetChildFields(\"t\", \"size\"),\n\n\trange := self >> self.element.t.t,\n\n\tget_var := self >> let(var.fresh_t(\"spr_mat\", TPtr(TInt))),\n\ttraverse_outer := (self, i, j, var, body) >>  loopf(j, nth(var,i), nth(var, add(i, V(1))), chain(body)),\n\tindex_row := (self, var, n, i) >> nth(var, add(n, add(V(1), i))),\n\tindex_val := (self, var, n, j) >> nth(var, add(n, add(nth(var, n), add(j, V(1))))),\n));\n\n\nDeclare(inref);\n\nClass(TSparse, TArrayBase, rec(\n\t__call__ := (self, t, ring) >> \n\t\t\tWithBases(self, rec(\n\t\t\tt    := Checked(IsType(t), t),\n\t\t\tring := ring,\n\t\t\tsize2 := Checked(IsPosIntSym(t.size), t.size),\n\t\t\toperations := TypOps)),\n    isSparseT := true,\n    vtype := (self, v) >> TSparse(self.t.vtype(v), self.size2/v),\n    toPtrType := self >> TPtr(self.t),\n    doHashValues := true,\n    #dims := self >> Cond(\n    #    ObjId(self.t)=TSparse, [self.size] :: self.t.dims(),\n    #    [self.size]),\n\tsize := self >> self.size2,\n\tdims := self >> [1, self.size2],\n\trChildren := self >> [self.t, self.ring],\n\trSetChild := rSetChildFields(\"t\", \"ring\"),\n#\tprint := self >> Print(self.__name__, \"(\", self.t, \", \", self.size1, \", \", self.list1, \", \", self.size2, \", \", self.list2, \", \", self.sa, \")\"),\t\n\trange := self >> self.t,\n\tprint := self >> Print(self.__name__, \"(\", self.t, \", \", self.ring, \")\"),\n\n    get_var := self >> let(var.fresh_t(\"spr_arr\", TPtr(TSparse(TArray(TInt,5), TSemiring_Arithmetic(TInt))))),\n\t\n\tlength := (self, x) >> struct_nth(inref(x), \"length\", \"\"),\n\n\tget_elem_index := (self, x, idx) >> struct_nth(inref(x), \"index\", idx),\n\n\tget_elem_value := (self, x, idx) >> struct_nth(inref(x), \"value\", idx),\n\n\ttraversal := (self, i, low, high, body) >> loopf(i, low, high, chain(body)),\n\n\t\n\n\t#num_nonzeros := (self, x) >> let( \n\t#\titr := var.fresh_t(\"itr\", TInt),\n\t#\tresult := var.fresh_t(\"result\", TInt),\n\t#\tdecl([itr, result], chain(\n\t#\tassign(result, V(0)),\n\t#\tloopw(neq(struct_nth(x,\"value\", itr), NULL(TInt)), chain(\n\t#\tif1(neq(struct_nth(x,\"value\", itr), V(0)), chain(\n\t#\t\tassign(result, add(result, V(1)))))))))),\n));\n\n\nClass(fItrStack, FuncClassOper, rec(\n\t__call__ := meth(arg)\n\t local self, children, lkup, res, h;\n        self := arg[1];\n        children := Flat(Drop(arg, 1));\n        if self.skipOneChild and Length(children)=1 then return children[1]; fi;\n\n        h := self.hash;\n        if h<>false then\n            lkup := h.objLookup(self, children);\n            if lkup[1]<>false then return lkup[1]; fi;\n        fi;\n        res := WithBases(self, rec(operations := RewritableObjectOps, _children := children));\n        if h<>false then return h.objAdd(res, lkup[2]);\n        else return res;\n        fi;\n    end,\n\n\tdomain := self >> self._children[2].domain() * self._children[1].range,\n    range := self >> self._children[2].range(),  \n    subdomainsDivisibleBy := (self, n) >> ForAll(self._children, x -> x.domain() mod n = 0),\n\n    #lambda := meth(self)\n    #    #local vals;\n    #    #vals := [];\n\t#\tfor i in [1..self.domain()] do \n\t#\tAdd(vals, self.child(2).lambda().at(add(idiv(sub(i,V(1)), add(self.range(),V(1))), mul(self.range(), imod(sub(i,V(1)), add(self.range(), V(1)))))));\n\t#\tod;\n\t#\treturn Lambda(self._children[1], vals);\n    #end\n\n\tlambda := meth(self)\n\t\tlocal v, j;\n\t\tv := Ind(self.range());\n\t\t#return Lambda(v, self.child(2).lambda().at(add(idiv(v, idiv(self.range(), self.domain())), mul(self.range(), imod(v, idiv(self.range(), self.domain()))))));\n\t\treturn let(l := Lambda(v, self.child(2).lambda().at(imod(v, self._children[2].domain()))), \n\t\t\t\t\t#c := Collect(l, @(1,var, e -> e.range = self._children[2].domain())),\n\t\t\t\t\t#c := Collect(l, @(1, add, e -> Error())),\n\t\t\t\t\ts := SubstVars(Copy(l), rec((self.child(1).id) := idiv(v, self.child(2).domain()))),\n\t\t\t\t\ts);\n\tend\n));\n\nClass(RulesSPLScope, RuleSet);\nClass(RulesINF, RuleSet);\nClass(RulesSymbol, RuleSet);\nClass(RulesTrace, RuleSet);\nClass(RulesMG, RuleSet);\nClass(RulesMR, RuleSet);\nClass(RulesMR2, RuleSet);\nClass(RulesMask, RuleSet);\nClass(RulesSparseMaskAxpy, RuleSet);\nClass(RulesSparseMaskDot, RuleSet);\nClass(RulesIDiag, RuleSet);\nClass(RulesMatMul, RuleSet);\nClass(RulesSigSPMV1, RuleSet);\nClass(RulesSigSPMV2, RuleSet);\nClass(RulesSigSPMV3, RuleSet);\nClass(RulesSigSPGEMM1, RuleSet);\nClass(RulesSigSPGEMM2, RuleSet);\nClass(RulesAccumulate, RuleSet);\nClass(RulesTriCount, RuleSet);\nClass(RulesScatRow, RuleSet);\n\nSPMVStrategy := [RulesIDiag, RulesMatMul, RulesSigSPMV1, RulesSigSPMV2];\nSPGEMMStrategy := [RulesSigSPGEMM1];\n\nClass(Tcsr, AtomicTyp);\n\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\tfdata := @(6).val.element.params[3],  spm := fdata.get_var(), inside := @(3).val._children[1], v1 := @(1).val.var,\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\tv2 := @(2).val.var, v3 := @(3).val.var, n := @(1).val.domain, \n#result := ISum(v1, n, ISum(v2, fdata.index_row(spm, n, v1), ISum(v3, nth(X, add(nth(spm, add(n, add(V(1), v2))), V(1))), inside))),\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\tresult\n\n\nRewriteRules(RulesTriCount, rec(\n\tadd_loop_bounds := Rule([@@(1,ISum),[@(2, ISum, e-> IsValue(e.domain) = true or IsInt(e.domain)), @(3,RowVec)]], (e,cx)->let(fdata := Collect(e, FDataSparseOfs)[1], v1 := e.var,v2 := @(2).val.var,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTriCountKernel(ISum(v1, cx.opts.symbol[1], ISum(v2, sub(opts.sparse_mat.index_row(X, cx.opts.symbol[1], nth(X,add(v1, V(1)))), opts.sparse_mat.index_row(X, cx.opts.symbol[1], nth(X,v1))), @(3).val))))),\n));\n\nRewriteRules(RulesSigSPGEMM1, rec(\n\tadd_icode_snippets := Rule([@@(1,ISum),[@(2,ISum), [@(3, ISum), [@(4, Compose), @(5,Scat), @(6, Diag, e->Length(Collect(e, FDataOfs)) > 0), @(7, Gath)]]]], (e,cx)->let(fdata := @(6).val.element.params[3],  spm := fdata.var.get_var(), Append(cx.opts.symbol, [spm]),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tv1 := e.var,v2 := @(2).val.var, v3 := @(3).val.var, n := cx.opts.symbol[1], \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnewfdata := FDataSparseOfs(fdata.var, fdata.len,fdata.var.index_val(spm, cx.opts.symbol[1], v2)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#d := Diag(fConst(v2.t, 1, fdata.var.index_val(spm, n, v2))),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td := Diag(fConst(v2.t, 1, newfdata)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfunc := fTensor(fBase(v3), fBase(v2)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsa := ScatAcc(func), g := Gath(func),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tres := Cond(cx.opts.YType.t = Tcsr, GrpKernel2(ISum(v1, n, ISum(v2, sub(nth(spm, add(v1, V(1))), nth(spm, v1)), ISum(v3, sub(nth(X, add(nth(spm, add(n, add(V(1), v2))), V(1))), nth(X, nth(spm, add(n, add(V(1), v2))))), sa * d * g)))), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGrpKernel(ISum(v1, n, ISum(v2, sub(nth(spm, add(v1, V(1))), nth(spm, v1)), ISum(v3, sub(nth(X, add(nth(spm, add(n, add(V(1), v2))), V(1))), nth(X, nth(spm, add(n, add(V(1), v2))))), sa * d * g))))),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tres)),\n));\n\n\nRewriteRules(RulesSigSPGEMM2, rec(\n\tadd_grpkernel := Rule([@(1,ISum),[@(2,ISum), [@(3, ISum), [@(4, Compose), @(5,ScatAcc), @(6, Diag), @(7, Gath)]]]], e -> ISum(@(1).val.var, @(1).val.domain, GrpKernel(@(2).val))),\n));\n\n\nRewriteRules(RulesIDiag, rec(\n\tconvert_I := ARule(SUM, [@(1,I), @(2, MakeDiag)], e-> [let(j := Ind(@(1).val.obj.size), ivs := IterVStack(j, @(2).val.element.len, Gath(fTensor(fId(@(2).val.element.len), fBase(j)))), SUM(ivs, @(2).val))]),\n));\n\nRewriteRules(RulesMatMul, rec(\n\tconsume_matmul := ARule(Compose, [@(1,MatMul), [@(2,SUM), @(3,IterVStack), @(4,MakeDiag)]], e->[let(f := @(4).val.element, i := @(3).val.var, g := @(3).val._children[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tIterVStack(i, f.len, Diag(fConst(i.t, f.len, f)) * g.toloop(1)))]),\n));\n\nRewriteRules(RulesSigSPMV1, rec(\n\tremove_extra_isum := Rule([@(1,Compose), @(2, ISum), @(3,ISum)], e->@(3).val),\n));\n\nRewriteRules(RulesSigSPMV2, rec(\n\t\trebuild_with_var := Rule([@@(1,ISum), [@(2,ISum), [@(3,Compose), @(4,Scat), @(5,Diag, e-> Length(Collect(e, FDataOfs)) > 0 and Length(Collect(e, TSparse)) > 0),@(6,Gath)]]], (e,cx)-> let(f := @(5).val.element.params[3], v1 := e.var, v2 := @(2).val.var, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tspa := f.var.get_var(),  Append(cx.opts.symbol, [spa]), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnewfdata := FDataSparseOfs(f.var, f.len, f.var.get_elem_value(spa, v1)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td := Diag(fConst(v2.t, 1, newfdata)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfunc := fTensor(fBase(v2), fBase(v1)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsa := ScatAcc(func), g := Gath(func), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresult := GrpKernel(ISum(v1, f.var.length(spa), ISum(v2, sub(nth(X, add(f.var.get_elem_index(spa, v1), V(1))), nth(X, f.var.get_elem_index(spa, v1))), sa * d * g))),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresult)),\n\t\trebuild_dense := Rule([@@(1,ISum), [@(2,ISum), [@(3,Compose), @(4,Scat), @(5,Diag, e-> Length(Collect(e, FDataOfs)) > 0 and Length(Collect(e, TSparse)) = 0),@(6,Gath)]]], (e,cx)-> let(f := @(5).val.element.params[3], v1 := e.var, v2 := @(2).val.var, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tspa := f.var,  Append(cx.opts.symbol, [spa]), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td := Diag(fConst(v2.t, 1, nth(spa, v1))),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfunc := fTensor(fBase(v2), fBase(v1)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsa := ScatAcc(func), g := Gath(func), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresult := GrpKernel(ISum(v1, f.len, ISum(v2, sub(nth(X, add(v1, V(1))), nth(X, v1)), sa * d * g))),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresult)),\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n));\n\nRewriteRules(RulesSigSPMV3, rec(\n\t\tadd_grpkernel := Rule([@(1,ISum), [@(2,ISum), [@(3,Compose), @(4,ScatAcc), @(5,Diag),@(6,Gath)]]], e-> GrpKernel(@(1).val)),\n));\n\nRewriteRules(RulesScatRow, rec(\n\t\tremove_scat := Rule([@(1,Compose), @(2,Scat), @(3, RowVec, e-> IsBound(e.element.var.t.ring) and e.element.var.t.ring <> \"Error no ring\")], e-> @(3).val),\n));\n\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfunc := fTensor(fId(1), fBase(@(1).val.var)), \n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsa := ScatAcc(func), g := Gath(func),\n#comments for rulesmxmtrace\n#cis := Rule([ISum, [ISum, @(1)]], e -> [let(rec(result := ISumAcc(e.var, e.domain, @(1).val)), result)]),\n#remove_trace := ARule(Compose, [@(1, RowVec), @(2, Gath), @(3,ISum)], e->[@(3).val]),\n#change_isum_isumacc := ARule(ISum, [@(1, SPLScope)], e -> [let(updom := e.var, inputs := e._children[1], isa := ISumAcc(updom, updom.range, inputs), isa)]),\n#change_move_scat := ARule(ISum, [@(1, SPLScope)], e -> [Error()]),\n#remove_trace := ARule(Compose, [@(1, RowVec), @(2, Gath), @(3,ISum)], e->[@(3).val]),\n#remove_trace := ARule(Compose, [@(1, Gath), [@(2, ISum), @(3, ISum, e -> let(s := Collect(Copy(e._children[1]._children), Scat), s[1].func.__name__ = \"fTensor\"\n\t#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand Length(s[1].func._children) = 2 and s[1].func._children[1].__name__ = \"fBase\" \n\t#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand s[1].func._children[2].__name__ = \"fBase\"))]], \n\t#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\te->[let(v1 := @(2).val.var, v2 := @(3).val.var, f := fBase(@(2).val.var), c := @(3).val._children[1], two := @(3).val._children[1]._children[2] * @(3).val._children[1]._children[3], \n\t#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(v1, v1.range, ISum(v2, v2.range, COND(fBase(v1), Scat(fBase(v1)) * two, O(c.dims()[1],1)))))]),\nRewriteRules(RulesMG, rec(\n\tmove_gath := ARule(Compose, [@(1, Gath), [@(2, ISum), @(3, ISum, e -> let(s := Collect(Copy(e._children[1]._children), Scat), Length(s) = 1))]], \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\te -> [let(exp := @(1).val * @(3).val._children[1], \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(2).val.var, @(2).val.var.range, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(3).val.var, @(3).val.var.range,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  \texp)))]),\n\n\tgath_scat_cond := ARule(Compose, [@(1, Gath), @(2, Scat)], e->[let(v1 := @(2).val.func._children[1].params[2], v2 := @(2).val.func._children[2].params[2], \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCOND(eq(v1, v2), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tScat(@(2).val.func._children[1]), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tO(@(2).val.func._children[1].params[1], 1)))]),\t\n));\n\n\nRewriteRules(RulesMR, rec(\n\tcollapse_loop_cond := Rule([@(1,ISum), [@(2,ISum), [@(3, Compose), @(4,COND),...]]], e->let(v1 := @(1).val.var, v2 := @(2).val.var, com := @(3).val,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcom2 := SubstTopDown(Copy(com), @(5, COND), g -> @(5).val._children[1]),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcom3 :=  SubstVars(Copy(com2), rec((v2.id) := v1)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(v1, v1.range, com3))),\n));\n\nRewriteRules(RulesMR2, rec(\n\tmove_rowvec := ARule(Compose, [@(1, RowVec), [@(2, ISum), [@(3, Compose), @(4,Scat), ...]]], e -> [let(v1 := @(2).val.var, s := @(3).val._children[2], f := @(3).val._children[3],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trv := RowVec(fCompose(@(1).val.element, @(4).val.func)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISumAcc(v1, v1.range, rv * s * f))]),\n));\n\n#e->[let(v1 := @(2).val.var, v2 := @(3).val.var, \n#inside := @(3).val._children[1], dom := @(2).val.domain,\n#con := COND(eq(@(1).val.index(v1,v2,dom), 1)))]),\n\nRewriteRules(RulesAccumulate, rec(\n\tadd_accumkernel := ARule(Compose, [@(1, Accumulate), @(2, [GrpKernel, ISum])], e->[AccumKernel(@(2).val)]),\n));\n\n\nRewriteRules(RulesSparseMaskAxpy, rec(\n\tmove_mask := ARule(Compose, [@(1,Mask, e->IsSparseT(e.element.var.t)), [@(2, GrpKernel), [@(3,ISum), [@(4,ISum), @(5,ISum)]]]], (e,cx)-> [let(exp := @(1).val * @(5).val._children[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(3).val.var, @(3).val.domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(4).val.var, @(4).val.domain, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texp)))]),\n\n\tmove_mask2 := ARule(Compose, [@(1,Mask, e->IsSparseT(e.element.var.t)), [@(2, GrpKernel2), [@(3,ISum), [@(4,ISum), @(5,ISum)]]]], (e,cx)-> [let(exp := @(1).val * @(5).val._children[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGrpKernel2(ISum(@(3).val.var, @(3).val.domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(4).val.var, @(4).val.domain, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texp))))]),\n\t#self.symbol := Concat(self.symbol, [self.sparse_mat.get_var()]), cx.opts.symbol := Concat(cx.opts.symbol,[spm2]),\n\tadd_mask_kernel := ARule(Compose, [@(1,Mask, e->IsSparseT(e.element.var.t)), @(2, ScatAcc), @(3,Diag), @(4, Gath)], e->[let(mask2 := Mask(FDataOfs(@(1).val.element.var.get_var(), @(1).val.element.len, @(1).val.element.ofs)), MaskKernelAxpy(mask2 * @(2).val * @(3).val * @(4).val))]),\n));\n\nRewriteRules(RulesSparseMaskDot, rec(\n\tconvert_mask := ARule(Compose, [@(1,Mask, e->IsSparseT(e.element.var.t)), [@(2,ISum), @(3,ISum)]], e->[let(mask2 := Mask(FDataOfs(@(1).val.element.var.get_var(), @(1).val.element.len, add(@(2).val.var, @(3).val.var))), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texp := mask2 * @(3).val._children[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(2).val.var, @(2).val.domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(3).val.var, @(3).val.domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tMaskKernelDot(exp))))]),\n));\n\nRewriteRules(RulesMask, rec(\n\tmove_mask := ARule(Compose, [@(1,Mask), [@(2, ISum), @(3, ISum)]], e -> [let(exp := @(1).val * @(3).val._children[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(2).val.var, @(2).val.var.range, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tISum(@(3).val.var, @(3).val.var.range,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texp)))]), \n\treplace_mask := Rule([@(1,ISum), [@(2,ISum), [@(3, Compose), @(4,Mask),...]]], e -> let(v1 := @(1).val.var, v2 := @(2).val.var, dom := @(2).val.domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinside := @(3).val, inside2 := SubstTopDown(Copy(inside), @(5, Mask), g -> I(@(5).val.element.len)),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcon := COND(eq(@(4).val.index(v1,v2,dom), 1), inside2, Scat(fTensor(fBase(v1), fBase(v2))) * O(1,1)), ISum(v1, v1.range, ISum(v2, v2.range, con)))),\n));\n\n#comments for rulestrace\t\n#change_fbase := ARule(fCompose, [@(1,itrfStack, e -> let(one := e._children[2]._children[1].domain(), two := e._children[2]._children[2].domain(), one = two)), @(2, fBase)], e -> [let(c := Collect(e, var), v2 := c[1], SubstTopDown(e, @(1,var, e-> var.range <> v2.range), e->v2))]),#[fCompose(@(1).val, @(1).val._children[2]._children[1])]),\nRewriteRules(RulesTrace, rec(\n\tchange_fbase := ARule(Gath, [@(1, fCompose, e -> let(length := Length(e._children), length = 2))],\n\t\t\t\t\t\t\t\t\t e -> [let(c := Collect(e, var), \n\t\t\t\t\t\t\t\t\t\t\t\tv2 := c[Length(c)],\n\t\t\t\t\t\t\t\t\t\t\t\tresult := SubstTopDown(Copy(e), @(1, var, e-> var.range <> v2), e -> v2),\n\t\t\t\t\t\t\t\t\t\t\t\tError())]),\n));\n\n#comments for RulesScope\n#newspl2 := SubstTopDown(Copy(newspl), @(1, var, p -> p = s.scope), e -> X),\n#rowvec_gath := ARule(Compose, [@(1, RowVec), @(2, Gath)],e -> [let(i := Ind(@(1).val.element._children[1].len), ISum(i, e._children[2].element._children[1].len, diagMul(e._children[2].element,e._children[3].func)))]),\n#[let(scat := e._children[1], s := e._children[2], g := e._children[3].func, newscope := SPLScope(RowVec(diagMul(fCompose(s.spl.element._children[1], g._children[2]))), s.scope), newscope * Gath(g._children[1]))]),\nRewriteRules(RulesSPLScope, rec(\n\tmove_inside_gath := ARule(Compose, [@(1, SPLScope, e-> \n\t\tlet(check1 := Collect(e.spl, FDataOfs), check2 := Collect(e.spl, @@(1, var, (s, cx) -> s = e.scope and cx.FDataOfs[1].var <> s)), Length(check1) > 0 and Length(check2) = 0)), \n\t\t[@(2,Gath, e-> Length(e.func._children) = 2 and e.func._children[1].domain() = e.func._children[2].domain()), @(3, fStack)]], \n\t\t\te -> [let(scat := e._children[1], \n\t\t\t\t\ts := e._children[2], \n\t\t\t\t\tg := e._children[3].func, \n\t\t\t\t\tfdataofs := FDataOfs(s.spl.element.var, s.spl.element.len/2, V(0)),\n\t\t\t\t\tnewspl := RowVec(fCompose(fdataofs, g._children[2])),\n\t\t\t\t\tnewscope := SPLScope(newspl * Gath(g._children[1]), s.scope),\n\t\t\t\t\tnewscope)]),\t\n\n\tmove_inside_scat := ARule(Compose, [@(1, Scat), @(2, SPLScope)], e-> [SPLScope(@(1).val * @(2).val.spl, @(2).val.scope)]),\n));\n\n\n\n\nRewriteRules(RulesStrengthReduce, rec(\n\tadd := ARule(add, [@1, INF()], e -> INF),\n\tfTen := ARule(fTensor, [@(1, Ind(INF()))], e -> V(1)),\n\tfBas := ARule(fBase, [@(1, Ind(INF()))], e -> V(1)),\n\tfI := ARule(fId, [@(1, Ind(INF()))], e -> V(1)),\n\tfSta := ARule(fStack, [@(1, Ind(INF()))], e -> V(1)),\n\t#Ind := ARule(Ind, [@(1, INF)], e -> V(1)),\n\t#fdo := ARule(FDataofs, [@(1, INF)], e -> V(1))\n));\n\n#RewriteRules(RulesSymbol, rec(\n#\taddsymbol := Cond(IsBound(opts.symbol), SubstTopDown(Copy(cs), [@(1,nth), ..., @(2,var, e-> e=X), ...], \n#    e -> nth(opts.symbol[1], e.idx)), cs);\n#));\n\n\nClass(T_Sparse, T_Type, rec(\n       t := TInt,\n));\n\nClass(NULL, Command, rec(\n__call__ := (self, t) >> WithBases(self, rec(\n\tt    := Checked(IsType(t), t),\n    operations := CmdOps\n  )),\n \trChildren := self >> [],\n\tprint := (self, i, si) >> Print(self.__name__)\n));\n\nClass(malloc, Command, rec(\n\t__call__ := (self, t, size) >> WithBases(self, rec(\n\t\tt := Checked(IsType(t), t),\n\t\tsize := size,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.t, self.size],\n\trSetChild := rSetChildFields(\"t\", \"size\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.t, \", \", self.size, \")\"),\n));\n\nClass(inref, nth, rec(\n\t__call__ := (self, loc) >> Inherited(loc, TInt.value(0)),\n    rChildren := self >> [self.loc],\n    rSetChild := rSetChildFields(\"loc\"),\n));\n\n\nClass(if4, Command, rec(\n  __call__ := (self, if_cond, if_cmd, else_cmd) >> WithBases(self, rec(\n    if_cond := toExpArg(if_cond),\n    if_cmd := Checked(IsCommand(if_cmd), if_cmd),\n    else_cmd := Checked(IsCommand(else_cmd), else_cmd),\n    operations := CmdOps\n  )),\n  rChildren := self >> [self.if_cond, self.if_cmd, self.else_cmd],\n  rSetChild := rSetChildFields(\"if_cond\", \"if_cmd\", \"else_cmd\"),\n  print := (self, i, si) >> Print(self.__name__, \"(\", self.if_cond, \",\\n\",\n        Blanks(i+si), self.if_cmd.print(i+si, si), \",\\n\",\n        Blanks(i+si), self.else_cmd.print(i+si, si), \"\\n\",\n        Blanks(i), \")\"\n  )\n));\n\nClass(add_to_sparse, Command, rec(\n\t__call__ := (self, yy, val, middle, idx, row) >> WithBases(self, rec(\n\t\tyy := yy,\n\t\tval := val,\n\t\tmiddle := middle,\n\t\tidx := idx,\n\t\trow := row,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.yy, self.val, self.middle, self.idx, self.row],\n  \trSetChild := rSetChildFields(\"yy\", \"val\", \"middle\", \"idx\", \"row\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.yy, \", \", self.val, \", \", self.middle, \", \", self.idx, \", \", self.row, \")\")\n));\n\n#For the data structure\nClass(Tdstruct, AtomicTyp);\nClass(Ttree, AtomicTyp);\nClass(next_ptr, Command, rec(\n\t__call__ := (self, var, value) >> WithBases(self, rec(\n\t\tvar := var,\n\t\tvalue := value,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.var, self.value],\n  \trSetChild := rSetChildFields(\"var\", \"value\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.var, \", \", self.value, \")\")\n));\nClass(allocate_ds, Command, rec(\n\t__call__ := (self, count) >> WithBases(self, rec(\n\t\tcount := count,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.count],\n  \trSetChild := rSetChildFields(\"count\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.count,\")\")\n));\nClass(insert_ds, Command, rec(\n\t__call__ := (self, dstruct, loc, val, root) >> WithBases(self, rec(\n\t\tdstruct := dstruct,\n\t\tloc := Cond(IsValue(loc), loc, V(loc)),\n\t\tval := Cond(IsValue(val), val, V(val)),\n\t\troot := root,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.dstruct, self.loc, self.val, self.root],\n  \trSetChild := rSetChildFields(\"dstruct\", \"loc\", \"val\", \"root\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.dstruct, \", \",\n        self.loc, \", \", self.val, \", \", self.root, Blanks(i), \")\")\n));\nClass(ds_to_csr, Command, rec(\n\t__call__ := (self, dstruct) >> WithBases(self, rec(\n\t\tdstruct := dstruct,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.dstruct],\n  \trSetChild := rSetChildFields(\"dstruct\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.dstruct, Blanks(i), \")\")\n));\nClass(dstructToTree, Command, rec(\n\t__call__ := (self, dstruct, count) >> WithBases(self, rec(\n\t\tdstruct := dstruct,\n\t\tcount := count,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.dstruct, self.count],\n  \trSetChild := rSetChildFields(\"dstruct\",\"count\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.count, \", \",\n        self.dstruct,\")\")\n));\nClass(destory_ds, Command, rec(\n\t__call__ := (self, dstruct, root) >> WithBases(self, rec(\n\t\tdstruct := dstruct,\n\t\troot := root,\n\t\toperations := CmdOps\n\t)),\n\trChildren := self >> [self.dstruct, self.root],\n  \trSetChild := rSetChildFields(\"dstruct\", \"root\"),\n\tprint := (self, i, si) >> Print(self.__name__, \"(\", self.dstruct, \", \", self.root, Blanks(i), \")\")\n));\n\n\nCUnparser.break := (self, o, i, is) >> Print(Blanks(i), \"break;\\n\");\n\n#only supports types with .ctype TInt TReal \nCUnparser.malloc := (self, o, i, is) >> Print(\"(\", o.t.ctype, \"*)malloc(\", o.size, \"*\", self(sizeof(o.t), i, is), \")\");\n\n#Unparser for data structure \nCUnparser.allocate_ds := (self, o, i, is) >> Print(\"allocate_ds(\", self(o.count, i, is), \")\");\nCUnparser.insert_ds := (self, o, i, is) >> Print(Blanks(i), \"insert_ds(\", o.dstruct, \", \", self(o.loc, i, is), \", \", self(o.val, i, is), \", \", o.root, \")\", \";\\n\");\nCUnparser.ds_to_csr := (self, o, i, is) >> Print(\"ds_to_csr(\", o.dstruct, \")\");\nCUnparser.destory_ds := (self, o, i, is) >> Print(Blanks(i), \"destory_ds(\", o.dstruct, \", \", o.root, \")\");\nCUnparser.dstructToTree := (self, o, i, is) >> Print(\"dstructToTree(\",self(o.dstruct, i, is), \", \", self(o.count, i, is), \")\");\nCUnparser.Tdstruct := (self,t, vars,i,is) >> Print(\"dstruct \", self.infix(vars, \", \",i+is));\nCUnparser.Ttree := (self,t, vars,i,is) >> Print(\"tree \", self.infix(vars, \", \",i+is));\nCUnparser.Tcsr := (self, t, vars, i, is) >> Print(\"struct csr\",self.infix(vars, \", \", i + is));\n\nCUnparser.inref := (self, o, i, is) >> Print(\"(*\", self(o.loc, i, is), \")\");\n\nCUnparser.TSparse := (self,t, vars,i,is) >> Print(Blanks(i),\n\t\"struct sparse_arr\", self.infix(vars, \", \", i + is));\n\n#CUnparser.sparse_nth3 := (self, o, i, is) >> o.list.get_elem_value(o.list.get_var(), o.idx);\n\nCUnparser.next_ptr := (self, o, i, is) >> Print(o.var, \"->\", o.value);\n\nCUnparser.add_to_sparse := (self, o, i, is) >> Print(Blanks(i), \"add_to_sparse(\", self(o.yy, i, is), \", \", o.val, \", \", o.middle, \", \", o.idx, \", \", o.row, \");\\n\");\n\nCUnparser.struct_nth := (self,o,i,is) >> Cond(o.idx <> \"\", Print(\n\tself(o.loc,i,is), \".\", o.elem, \"[\", o.idx, \"]\"), \n\tPrint(self(o.loc,i,is), \".\", o.elem));\n\nCUnparser.if4 := (self,o,i,is) >> Print(Blanks(i),\n    \"if (\", self(o.if_cond,i,is), \") {\\n\", self(o.if_cmd,i+is,is), Blanks(i), \"}\",\n    \" else {\\n\", self(o.else_cmd,i+is,is), Blanks(i), \"}\\n\");\n\nCUnparser.NULL := (self, o, i, is) >> Print(Blanks(i), \"NULL\");\n\nCUnparser.loopn := (self, o, i, is) >> Cond(IsBound(o.range.args) and Length(o.range.args) > 1 and Length(Collect(o.range, sub)) > 0, let(v := o.var.id, lo := o.range.args[2], hi := o.range.args[1],\n        Print(Blanks(i), \"for(\",self.declare(o.var.t, o.var, i, is), \" = \", self(lo,i,is), \"; \", v, \" < \", self(hi,i,is), \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")), let(v := o.var.id, lo := 0, hi := o.range,\n        Print(Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" < \", self(hi,i,is), \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")));\n\n#Class(sparse_nth, Command, rec(\n#  __call__ := (self, loc, idx) >> WithBases(self, rec(\n#\tloc := loc,\n#    idx := idx,\n#\toperations := CmdOps\n#  )),\n#  rChildren := self >> [self.if_cond, self.if_cmd, self.else_cmd],\n#  rSetChild := rSetChildFields(\"if_cond\", \"if_cmd\", \"else_cmd\"),\n#  print := (self, i, si) >> Print(self.__name__, \"(\", self.if_cond, \",\\n\",\n#        Blanks(i+si), self.if_cmd.print(i+si, si), \",\\n\",\n#        Blanks(i+si), self.else_cmd.print(i+si, si), \"\\n\",\n#        Blanks(i), \")\"\n#  )\n#));\n#\n#CUnparser.sparse_nth := (self,o,i,is) >> Print(Blanks(i),\n#    \"if (\", self(o.if_cond,i,is), \") {\\n\", self(o.if_cmd,i+is,is), Blanks(i), \"}\",\n#    \" else {\\n\", self(o.else_cmd,i+is,is), Blanks(i), \"}\\n\");\n\nDefaultSumsGen.DenseScalarProduct := (self, o, opts) >> o;\n\nDefaultSumsGen.SparseScalarProduct := (self, o, opts) >> o;\n\nDefaultSumsGen.NewScalarProduct := (self, o, opts) >> o;\n\nDefaultSumsGen.TSparse := (self, o, opts) >> o;\n\nDefaultSumsGen.sparse_nth2 := (self, o, opts) >> o;\n\nDefaultSumsGen.sparse_nth3 := (self, o, opts) >> o.element.get_elem_value(o.element.get_var(), o.idx);\n\n#DefaultSumsGen.RowVec := (self, o, opts) >> let(n := Ind(o.element._children[1].len), Error(), ISumAcc(n, o.element._children[1].len, ScatAcc(o.element)));\n#let(c := Collect(self, @(1,var, e -> IsSparseT(e))), Length(c) > 0)\nDefaultSumsGen.RowVec := (self, o, opts) >> Cond(opts.name = \"SparseOpts\" or Length(Collect(o, TSparse)) > 0 or IsBound(o.element.var) and IsBound(o.element.var.t.t) and IsSparseT(o.element.var.t.t), o, let(i := Ind(o.element.domain()), ISumAcc(i, o.element.domain(), Scat(fId(1)) * Blk1(o.element.at(i))) * Gath(fBase(i))));\n\nDefaultSumsGen.RowVec2 := (self, o, opts) >> o;\n\nDefaultSumsGen.Ttrace := (self, o, opts) >> o;\n\nDefaultSumsGen.TSpars_Matrix := (self, o, opts) >> o;\n\nDefaultSumsGen.HyperSprase := (self, o, opts) >> o;\n\nDefaultSumsGen.Reduce := (self, o ,opts) >> RowVec(fConst(o.t, o.size, 1));\n\nDefaultSumsGen.PreDstruct := (self, o, opts) >> o;\n\nDefaultSumsGen.PostDstruct := (self, o, opts) >> o;\n\n\nClass(DataStructureCodegenMixin, DefaultCodegen, rec(\n\tScat := meth(self, o, y, x, opts)\n\t\tlocal index_i, index_j, index_k, loc;\n\t\tindex_i := o.func._children[1].params[1];\n\t\tindex_j := o.func._children[2].params[2];\n\t\tindex_k := o.func._children[1].params[2];\n\t\t#first := add(index_j, nth(opts.symbol[4], index_i));\n\t\t#second := add(index_k, nth(X, opts.sparse_mat.index_row(opts.symbol[4], opts.symbol[1], first)));\n\t\tloc := opts.sparse_mat.index_row(X, opts.symbol[1], index_k);\n\t\treturn insert_ds(y, loc, nth(x,0), opts.symbol[3]);\n\tend\n));\n\n\n#DefaultSumsGen.IterVStack := (self, o, opts) >> Cond(let(c := Collect(o, TSparse), Length(c) > 0), o, let(\n#\tbkcols := Cols(o.child(1)),\n#\tbkrows := Rows(o.child(1)),\n#\tnblocks := o.domain,\n#\tcols := Cols(o), rows := Rows(o),\n#\tISum(o.var, o.domain,\n#\t    Scat(fTensor(fBase(nblocks, o.var), fId(bkrows))) *\n#\t    self(o.child(1), opts) *\n#\t    Gath(fId(bkcols)no))\n#    ));\n\n\nDefaultSumsGen.SPLScope := (self, o, opts) >> SPLScope(self(o.child(1), opts), o.scope);\n\n\nDefaultCodegen.SPLScope := (self, o, y, x, opts) >> \n\tdecl([o.scope], chain(assign(o.scope, x), self(o.child(1), y, x, opts)));\n\t\n\t#decl([o.scope], chain(assign(o.scope, x), self(o.child(1), o.scope, x, opts))); #return decl([o.scope], self(o.child(1)._children[1], o.scope.output, x, opts))); #(self(o.child(1), y, x, opts));\n\t#return decl([o.scope], chain(self(o.child(1)._children[2], o.scope, x, opts), self(o.child(1)._children[1], y, o.scope, opts))); #(self(o.child(1), y, x, opts));\n\n#Overridden Codegen from SpiralDefaults\nDefaultCodegen.ISumAcc := (self, o, y, x, opts) >> let(ii := Ind(), chain(loop(ii, Rows(o), assign(nth(y, ii), V(0))), loopf(o.var, V(0), o.domain, self._acc(self(o.child(1), y, x, opts), y))));\n\nDefaultCodegen.Diag := (self, o, y, x, opts) >> Cond(Length(Collect(o, TSparse)) > 0, \n   #let(elem := fConst(o.element.params[3].ofs.loc.t, 1, o.element.params[3].var.index_val(o.element.params[3].ofs.loc, opts.symbol[1], o.element.params[3].ofs.idx)),\n   let(elem := fConst(o.element.params[1], o.element.params[2], o.element.params[3].ofs),\n   ring := Collect(o.element, TSparse)[1].ring, i := Ind(),\n   elt := elem.lambda(),\n   loop(i, elt.domain(), assign(nth(y, i), ring.product(elt.at(i),nth(x, i))))),\n   Cond(Length(Collect(o, TSparse)) = 0 and IsBound(o.element.params[3].loc.t.ring),let(\n   ring := o.element.params[3].loc.t.ring,\n   elt := o.element.lambda(),\n   loop(i, elt.domain(), assign(nth(y, i), ring.product(elt.at(i),nth(x, i))))), \n   let(i := Ind(),\n   elt := o.element.lambda(),\n   loop(i, elt.domain(), assign(nth(y, i), elt.at(i) * nth(x, i))))));\n\n\nDefaultCodegen.IterVStack := meth(self, o, y, x, opts) \n\tlocal v, i, j, itr; \n\tv := o._children[1].element.var.get_var();\n\titr := var.fresh_t(\"itr\", TInt);\n\ti := Ind();\n\tj := Ind();\n\treturn decl([v,i,j,itr], chain(assign(itr, V(0)), o._children[1].element.var.traversal(i, V(0), opts.symbol[1], \n\t\t\t\tif1(eq(o._children[1].element.var.get_elem_index(v, itr), i), chain(  \n\t\t\t\t\topts.sparse_mat.traverse_outer(i,j,x,assign(nth(y, nth(x, add(opts.symbol[1], add(V(1), j)))), add(nth(y, nth(x, add(opts.symbol[1], add(V(1), j)))), \n\t\t\t\t\tmul(opts.sparse_mat.index_val(x,opts.symbol[1], j), o._children[1].element.var.get_elem_value(v, itr))))),\n\t\t\t\t\tassign(itr, add(itr, V(1))))))));\nend;\n\n\nDefaultCodegen.RowVec := (self, o, y, x, opts) >> Cond(let(c := Collect(o, TSparse), Length(c) > 0) and IsBound(opts.vec) and opts.vec = true and IsBound(opts.mat) and opts.mat = false, \n\tlet(i := Ind(), j := Ind(),v := o.element.var.get_var(), Append(opts.symbol, [v]), t := var.fresh_t(\"t\", TInt),\n\tdecl([i, j, t], chain(assign(t, V(0)), assign(i, V(0)), assign(j, V(0)), loopw(logic_and(lt(i, o.element.var.length(v)), lt(j, o.element.var.length(x))), \n\tif3(lt(o.element.var.get_elem_index(v, i), o.element.var.get_elem_index(x, j)),\n\t\t\tassign(i, add(i, V(1))), \n\t\t\tlt(o.element.var.get_elem_index(x, j), o.element.var.get_elem_index(v, i)), \n\t\t\tassign(j, add(j, V(1))), \n\t\t\tchain(assign(t, mul(o.element.var.get_elem_value(v, i), o.element.var.get_elem_value(x, j))), \n\t\t\tassign(i, add(i, V(1))), assign(j, add(j, V(1)))))), assign(nth(y, 0), t)))), \nlet(c := Collect(o, TSparse), Length(c) > 0) and IsBound(opts.vec) and opts.vec = false and IsBound(opts.mat) and opts.mat = false,\n\tlet(i := Ind(), v := o.element.var.get_var(), t := var.fresh_t(\"t\", TInt), \n\t\tdecl([v, i, t], chain(assign(t, V(0)), assign(i, V(0)), loopw(lt(i, o.element.var.length(v)), \n\t\tchain(assign(t, mul(o.element.var.get_elem_value(v, i), nth(x,o.element.var.get_elem_index(v, i)))), \n\t\tassign(i, add(i, V(1))))), assign(nth(y, 0), t)))), \nlet(c := Collect(o, TSparse), Length(c) = 0) and IsBound(opts.vec) and opts.vec = true and IsBound(opts.mat) and opts.mat = false, \n\tlet(i := Ind(), Cond((o.element.var in opts.symbol) = false, Append(opts.symbol, [o.element.var]), skip()), ring := Cond(IsBound(o.element.var.t.ring) and o.element.var.t.ring <> \"Error no ring\", o.element.var.t.ring, TSemiring_Arithmetic(o.element.var.t)),\n\t\tdecl([], chain(loopn(i, sub(nth(x, add(o.element.ofs,V(1))), nth(x,o.element.ofs)), chain(assign(deref(y), \n\t\tring.sum(deref(y), ring.product(opts.sparse_mat.index_val(x, opts.symbol[1], i),\n\t\tnth(o.element.var,opts.sparse_mat.index_row(x,opts.symbol[1],i)))))))))),\nlet(c := Collect(o, add), Length(c) > 0) or let(c2 := Collect(o, TSparse), Length(c2) > 0)  and IsBound(opts.mat) and opts.mat = true and IsBound(opts.vec) and opts.vec = false,\n\tlet(itr1 := var.fresh_t(\"itr\", TPtr(TInt)), itr2 := var.fresh_t(\"itr\", TPtr(TInt)), col1 := var.fresh_t(\"xcol\", TInt), \n\t\tcol2 := var.fresh_t(\"spmcol\", TInt), m2 := o.element.var.get_var(), When(y.id <> \"tempalg1\", Append(opts.symbol, [m2])), i := o.element.ofs.args[1], \n\t\tj := o.element.ofs.args[2], decl([itr1, itr2], chain(assign(itr1, add(x,i)), assign(itr2, add(m2, j)), \n\t\tloopw(logic_and(neq(itr1, add(x, add(i,V(1)))), neq(itr2,add(m2, add(j,V(1))))), decl([col1, col2], chain(assign(col1, opts.sparse_mat.index_row(x,opts.symbol[1], deref(itr1))),\n\t\tassign(col2,opts.sparse_mat.index_row(m2,opts.symbol[1], deref(itr2))), if3(gt(col1, col2), assign(itr2, add(itr2, V(1))), lt(col1, col2), assign(itr1, add(itr1, V(1))),\n\t\tchain(assign(nth(y, add(mul(i, opts.symbol[1]), j)), o.element.var.t.ring.sum(nth(y, add(mul(i, opts.symbol[1]), j)), o.element.var.t.ring.product(opts.sparse_mat.index_val(x, opts.symbol[1], deref(itr1)), opts.sparse_mat.index_val(m2, opts.symbol[1], deref(itr2))))),\n\t\tassign(itr1, add(itr1, V(1))), assign(itr2, add(itr2, V(1))))))))))),\nlet(i := Ind(), \n   \tfunc := o.element.lambda(),\n   \tt := TempVar(x.t.t),\n  \tchain(assign(t, 0), loop(i, func.domain(), assign(t, add(t, mul(func.at(i), nth(x, i))))), assign(nth(y, 0), t)))\n);\n\n#DefaultCodegen.RowVec2 := (self, o, y, x, opts) >> \n\n#\tv := var.fresh_t(\"v\", TArray(TInt, o.element.domain())),\n#\tt := TempVar(x.t.t),\n#\tdecl([v,t], chain(assign(t, 0), \n#\tloopw(lt(t, o.element.domain()), \n#\tchain(if1(logic_and(neq(nth(v, i), V(0)), neq(nth(x,i), V(0))), assign(t, add(t, mul(nth(v,i), nth(x,i))))) , assign(nth(y,0), t)))))), \n#\tlet(i := Ind(),\n#   func := o.element.lambda(),\n#   \tt := TempVar(x.t.t),\n#  \tchain(assign(t, 0), loop(i, func.domain(), assign(t, add(t, mul(func.at(i), nth(x, i))))), assign(nth(y, 0), t)))); \n\nDefaultCodegen.TSparse_Matrix := meth(self, o, y, x, opts)\n    local i, j, k, n, b;\n    i := Ind();\n    j := Ind();\n    k := Ind();\n    n := var.fresh_t(\"n\", TInt);\n    b := var.fresh_t(\"b\", TPtr(TInt));\n    return decl([], chain(\n            loopf(i, V(0), n, decl([], chain(\n                    loopf(j, deref(add(x,i)), deref(add(x, add(i, V(1)))), decl([], chain(\n                            loopf(k, nth(b, deref(add(x, add(n, add(V(1),j))))), nth(b, add(deref(add(x, add(n, add(V(1),j))),V(1)))), decl([], chain(\n                                assign(y, V(0))\n                                #assign(nth(y, add(nth(b,add(n,add(V(1),k))), mul(i, n))), V(0)),\n                                #assign(nth(y, add(nth(b,add(n,add(V(1),k))), mul(i, n))), add(nth(y, add(nth(b,add(n,add(V(1),k))), mul(i, n))), mul(deref(add(x, add(n, add(nth(x,n), add(V(1), j))))), deref(add(b, add(n, add(nth(b,n), add(V(1), k))))))))\n                            )))\n                    )))\n            )))\n    ));\n    end;\n\n\n\n\nDefaultCodegen.Ttrace := meth(self, o, y, x, opts)\n\tlocal i, j, n;\n\ti := Ind();\n\tj := Ind();\n\tn := var.fresh_t(\"n\", TInt);\n\treturn decl([], chain(\n\t\tloopf(i, V(0), sub(n,V(1)), decl([], chain(\n\t\t\tloopf(j, deref(add(x, i)), deref(add(x, add(i, V(1)))), decl([], chain(\n\t\t\t\tif1(eq(i, deref(add(x,add(n,j)))), assign(y, add(deref(y), deref(add(x, add(n, add(nth(x,n), add(V(1), j))))))))\n\t\t\t)))\n\t\t)))\n\t));\n\tend;\n\n\n\nDefaultCodegen.VStack := meth(self, o, y, x, opts)\n\tlocal iA, jA, v, i, j, n;\n\tiA := var.fresh_t(\"iA\", TPtr(TInt));\n\tjA := var.fresh_t(\"jA\", TPtr(TInt));\n\t#val := var.fresh_t(\"val\", TPtr(TInt));\n\tv := var.fresh_t(\"v\", TPtr(TInt));\n\ti := Ind();\n\tj := Ind();\n\tn := var.fresh_t(\"n\", TInt);\n\treturn decl([iA, jA], chain(\n\t\tassign(iA, x),\n\t\tassign(n, V(10)),\n\t\tassign(jA, add(x, add(n, V(1)))),\n\t\t#assign(val, add(IJ), add(n, add(1, nth(iA, n))))\n\t\tloopf(i, V(0), n, decl([v], chain(\n\t\t\tloopf(j, deref(add(iA, i)), deref(add(iA, add(i,V(1)))), chain(\n\t\t\t\t#assign(deref(add(y,i)), V(0))\n\t\t\t\tassign(deref(add(y,i)), add(deref(add(y,i)), mul(deref(add(jA, add(tcast(TInt, deref(add(iA,n))),j))), deref(add(v, deref(add(jA, j)))))))\n\t\t\t\t#assign(deref(add(y,i)), deref(add(y,i)), mul(deref(add(jA, add(nth(iA,n), j))), deref(add(v, deref(add(jA, j)))))))\n\t\t\t)))\n\t\t))\n\t));\n\tend;\n\n#DefaultCodegen.Gath := meth(self, o, y, x, opts)\n#\tlocal i, index_j;\n#\ti := Ind();\n#\tindex_j := o.func._children[1].params[2];\n#\treturn loop(i, o.func.domain(), assign(nth(y, i), nth(x, add(opts.symbol[1], add(nth(x,opts.symbol[1]), add(index_j, V(1)))))));\n#end;\n#DefaultCodegen.Scat := meth(self, o, y, x, opts)\n#\tlocal i, index_j;\n#\ti := Ind();\n#\tindex_j := o.func._children[1].params[2];\n#\treturn loop(i, o.func.domain(), assign(nth(y,nth(X, add(opts.symbol[1], add(V(1), index_j)))), nth(x, i)));\n#end;\n\nDefaultCodegen.PreDstruct := (self, o, y, x, opts) >>\n\tCond(IsBound(opts.init), opts.init(opts.symbol[2], opts.symbol[3], o.count), Error(\"Wrong opts\\n\"));\n\nDefaultCodegen.PostDstruct := (self, o, y, x, opts) >>\n\tCond(IsBound(opts.to_csr), opts.to_csr(opts.symbol[2]), Error(\"Wrong opts\\n\"));\n\n\nDefaultCodegen.DStructKernelAxpy := (self, o, y, x, opts) >> Cond(IsBound(opts.init) and IsBound(opts.to_csr), let(curr := var.fresh_t(\"curr\", TPtr(Tdstruct)), \n\t\t\t\t\t\t\t\t\t\t\t\t\tc1 := decl([curr], chain(opts.init(opts.symbol[2], opts.symbol[3], opts.symbol[1]), assign(curr, opts.symbol[2]))), \n\t\t\t\t\t\t\t\t\t\t\t\t\tc3 := opts.to_csr(y, opts.symbol[2]), c2 := self(o.child(1), curr, x, opts), newcmd := chain(c2.cmd, assign(curr, next_ptr(curr, \"next\"))),\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewc := loopn(c2.var, c2.range, newcmd), chain(c1,newc, c3)),  Error(\"Wrong opts\\n\"));\n\nDefaultCodegen.DStructKernelDot := (self, o, y, x, opts) >> Cond(IsBound(opts.init) and IsBound(opts.to_csr), let(temp := var.fresh_t(\"temp\", opts.YType), curr := var.fresh_t(\"curr\", TPtr(Tdstruct)), \n\t\t\t\t\t\t\t\t\t\t\t\t\tc1 := decl([curr], chain(opts.init(opts.symbol[2], opts.symbol[3], opts.symbol[1]), assign(curr, opts.symbol[2]))), \n\t\t\t\t\t\t\t\t\t\t\t\t\tc3 := opts.to_csr(y, opts.symbol[2]), c2 := self(o.child(1), temp, x, opts),\n\t\t\t\t\t\t\t\t\t\t\t\t\tbeg := Collect(c2, @(1,nth, e->e.loc = temp))[1], val := Collect(c2, @(1,mul, e->IsNth(e.args[1]) and e.args[1].loc = x))[1],\n\t\t\t\t\t\t\t\t\t\t\t\t\tresult := SubstTopDown(c2, @(1,assign, e->e.loc = beg), e-> insert_ds(curr, beg.idx, val, opts.symbol[3])),\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewcmd := chain(result.cmd, assign(curr, next_ptr(curr, \"next\"))),\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewc := loopn(c2.var, c2.range, newcmd), chain(c1,newc, c3)),  Error(\"Wrong opts\\n\"));\n\nDefaultCodegen.GrpKernel := (self, o, y, x, opts) >> Cond(opts.vec = true, \n\t\t\t\t\t\t\t\t\tCond(Length(Collect(o, TSparse)) > 0,\n\t\t\t\t\t\t\t\t\t\tlet(temp1 := var.fresh_t(\"temp\", opts.YType), temp2 := var.fresh_t(\"temp\", opts.XType), ring := Collect(o, TSparse)[1].ring,\n\t\t\t\t\t\t\t\t\tc := self(o.child(1), temp1, temp2, opts), new_val := o.child(1)._children[1].var, \n\t\t\t\t\t\t\t\t\tresult := SubstTopDown(c, @(1,nth, e->e.loc = temp2), e-> nth(x, add(opts.symbol[1], add(nth(x,opts.symbol[1]), add(new_val, V(1)))))),\n\t\t\t\t\t\t\t\t\tresult2_5 := SubstTopDown(result, @(1, assign_acc, e->IsNth(e.loc) and e.loc.loc = temp1), e->assign(e.loc, ring.sum(e.loc, e.exp))),\n\t\t\t\t\t\t\t\t\tresult2 := SubstTopDown(result2_5, @(1,nth, e->e.loc = temp1), e-> nth(y,nth(x, add(opts.symbol[1], add(V(1), new_val))))), result2),\n\t\t\t\t\t\t\t\t\t\tlet(temp1 := var.fresh_t(\"temp\", opts.YType), temp2 := var.fresh_t(\"temp\", opts.XType), ring := Collect(o, fConst)[1].params[3].loc.t.ring,\n\t\t\t\t\t\t\t\t\tc := self(o.child(1), temp1, temp2, opts), new_val := o.child(1)._children[1].var, \n\t\t\t\t\t\t\t\t\tresult := SubstTopDown(c, @(1,nth, e->e.loc = temp2), e-> nth(x, add(opts.symbol[1], add(nth(x,opts.symbol[1]), add(new_val, V(1)))))),\n\t\t\t\t\t\t\t\t\tresult2_5 := SubstTopDown(result, @(1, assign_acc, e->IsNth(e.loc) and e.loc.loc = temp1), e->assign(e.loc, ring.sum(e.loc, e.exp))),\n\t\t\t\t\t\t\t\t\tresult2 := SubstTopDown(result2_5, @(1,nth, e->e.loc = temp1), e-> nth(y,nth(x, add(opts.symbol[1], add(V(1), new_val))))), result2)),\n\t\t\t\t\t\t\t\t\topts.mat = true, \n\t\t\t\t\t\t\t\t\tlet(temp1 := var.fresh_t(\"temp\", opts.YType), temp2 := var.fresh_t(\"temp\", opts.XType), ring := Collect(o, TSparse)[1].ring,\n\t\t\t\t\t\t\t\t\tc := Cond(IsBound(opts.ds) and opts.ds = true, self(o.child(1), y, temp2, opts), self(o.child(1), temp1, temp2, opts)), sa := Collect(o, ScatAcc), \n\t\t\t\t\t\t\t\t\tresult := SubstTopDown(c, @(1,nth, e->e.loc = temp2), e-> opts.sparse_mat.index_val(x, opts.symbol[1], sa[1].func._children[1].params[2])),\n\t\t\t\t\t\t\t\t\tresult2_5 := SubstTopDown(result, @(1, assign_acc, e->IsNth(e.loc) and e.loc.loc = temp1), e->assign(e.loc, ring.sum(e.loc, e.exp))),\n\t\t\t\t\t\t\t\t\tresult2 := SubstTopDown(result2_5, @(1,nth, e->e.loc = temp1), e-> nth(y, add(mul(opts.sparse_mat.index_row(x, opts.symbol[1], sa[1].func._children[1].params[2]), opts.symbol[1]), o.child(1).var))), result2),\n\t\t\t\t\t\t\t\t\tself(o.child(1), y, x, opts));\n\nDefaultCodegen.GrpKernel2 := (self, o, y, x, opts) >> let(ring := Collect(o, TSparse)[1].ring, temp1 := var.fresh_t(\"temp\", opts.XType), temp2 := var.fresh_t(\"temp\", opts.XType), c := self(o.child(1), temp1, temp2, opts), \n\t\t\t\t\t\t\tidx := var.fresh_t(\"idx\", TInt), mid := var.fresh_t(\"mid\", opts.XType), lv := Ind(),\n\t\t\t\t\t\t\tresult := SubstTopDown(c, @(1,nth, e->e.loc = temp2 and Length(Collect(e, opts.symbol[1])) = 0 and Length(Collect(e, @(1,var, g-> g <> temp2))) > 1), e-> nth(x, add(opts.symbol[1], add(nth(x,opts.symbol[1]), add(o.child(1)._children[1]._children[1].var, V(1)))))), \n\t\t\t\t\t\t\tresultt := SubstTopDown(result, @(1, var, e->e = temp2), e->x),\n\t\t\t\t\t\t\tvarr := Cond(Length(Collect(resultt, loopn)) = 2, Collect(resultt, @(1, assign, e-> IsNth(e.exp) and Length(Collect(e, add)) = 2 and e.exp.loc = x))[1].loc, o.child(1)._children[1]._children[1].var),\n\t\t\t\t\t\t\tresult2 := Cond(Length(Collect(resultt, loopn)) = 2, SubstTopDown(resultt, @(1,nth, e->e.loc = temp1), e-> nth(temp1,varr)), SubstTopDown(resultt, @(1,nth, e->e.loc = temp1), e-> nth(temp1,opts.sparse_mat.index_row(x, opts.symbol[1], varr)))),\n\t\t\t\t\t\t\tresult2_5 := SubstTopDown(result2, @(1, assign_acc, e-> IsNth(e.loc) and e.loc.loc = temp1), e->assign(e.loc, ring.sum(e.loc, e.exp))), \n\t\t\t\t\t\t\tc2 := Cond(Length(Collect(resultt, loopn)) = 2, chain(assign(nth(mid, varr), V(1))),  chain(assign(nth(mid, opts.sparse_mat.index_row(x, opts.symbol[1], varr)), V(1)))), \n\t\t\t\t\t\t\tresult3 := SubstTopDown(result2_5, @(1, chain, e-> Length(Collect(e, assign)) >= 2 and Length(Collect(e, assign)) < 4), e-> chain(e.cmds, c2.cmds)),\n\t\t\t\t\t\t\tdecl([mid], chain(assign(mid, malloc(mid.t.t, opts.symbol[1])), loopf(lv, V(0), opts.symbol[1], assign(nth(mid, lv), V(0))), loopf(c.var, V(0), c.range, decl([temp1], chain(assign(temp1, malloc(temp1.t.t, opts.symbol[1])), result3.cmd, chain(add_to_sparse(addrof(y), mid, temp1, opts.symbol[1], c.var), loopf(lv, V(0), opts.symbol[1], assign(nth(mid, lv), V(0))))))))));\n\nDefaultCodegen.MaskKernelAxpy := (self, o, y, x, opts) >> let(itr1 := var.fresh_t(\"itr\", TInt), itr2 := var.fresh_t(\"itr\", TInt), col1 := var.fresh_t(\"xcol\", TInt), \n\t\tcol2 := var.fresh_t(\"spmcol\", TInt), m2 := o.child(1)._children[1].element.var, Append(opts.symbol, [m2]), i := o.child(1)._children[2].func._children[1].params[1], x2 := o.child(1)._children[3].element.params[3].ofs.loc, \n\t\tj := o.child(1)._children[3].element.params[3].ofs.idx, decl([itr1, itr2], chain(assign(itr1, nth(m2,i)), assign(itr2, nth(x, nth(x2, add(V(1), add(j, opts.symbol[1]))))), loopw(logic_and(neq(itr1, nth(m2, add(i,V(1)))), neq(itr2,nth(x, nth(x2, add(add(V(1), add(j, opts.symbol[1])),V(1)))))), decl([col1, col2], chain(assign(col1, opts.sparse_mat.index_row(m2,opts.symbol[1], itr1)),\n\t\tassign(col2,opts.sparse_mat.index_row(x,opts.symbol[1], itr2)), if3(gt(col1, col2), assign(itr2, add(itr2, V(1))), lt(col1, col2), assign(itr1, add(itr1, V(1))),\n\t\tchain(assign(nth(y, add(mul(opts.sparse_mat.index_row(x, opts.symbol[1], itr2), opts.symbol[1]),i)), add(nth(y, add(mul(opts.sparse_mat.index_row(x, opts.symbol[1], itr2), opts.symbol[1]), i)), mul(opts.sparse_mat.index_val(x, opts.symbol[1], itr2), opts.sparse_mat.index_val(x2, opts.symbol[1], j)))),\n\t\tassign(itr1, add(itr1, V(1))), assign(itr2, add(itr2, V(1)))))))))));\n\nDefaultCodegen.MaskKernelDot := (self, o, y, x, opts) >> let(c := self(o.child(1)._children[2], y, x, opts), mitr := var.fresh_t(\"mitr\", TInt), m2 := o.child(1)._children[1].element.var, Append(opts.symbol, [m2]), i := o.child(1)._children[1].element.ofs.args[1], \n\t\t\tj := o.child(1)._children[1].element.ofs.args[2], decl([mitr], chain(assign(mitr, nth(m2,i)), loopw(logic_and(lt(mitr, nth(m2, add(i, V(1)))), lt(opts.sparse_mat.index_row(m2, opts.symbol[1], mitr), j)), \n\t\t\tchain(assign(mitr, add(mitr, V(1))))), if1(logic_and(eq(opts.sparse_mat.index_row(m2, opts.symbol[1], mitr), j), eq(opts.sparse_mat.index_val(m2, opts.symbol[1], mitr), V(1))), c))));\n\nDefaultCodegen.AccumKernel := (self, o, y, x, opts) >> let(ring := Collect(o, TSparse)[1].ring, i := Ind(), j := Ind(), accum := var.fresh_t(\"accum\", TPtr(TInt)), create := decl([accum], chain(assign(accum, malloc(accum.t.t, opts.symbol[1])), \n\tloopf(i, V(0), opts.symbol[1], loopf(j, V(0), opts.symbol[1], assign(nth(accum, add(mul(i,opts.symbol[1]), j)), ring.zero()))))), c:= self(o.child(1), accum, x, opts), \n\tcopy := decl([], chain(loopf(i, V(0), opts.symbol[1], loopf(j, V(0), opts.symbol[1], assign_acc(nth(y, add(mul(i*opts.symbol[1]), j)), nth(accum, add(mul(i*opts.symbol[1]), j))))))), res := chain(create, c, copy), res);\n\nDefaultCodegen.TriCountKernel := (self, o, y, x, opts) >> let(tempalg := var.fresh_t(\"tempalg\", opts.YType), c:= self(o.child(1), tempalg, x, opts), v2 := o.child(1)._children[1].var, ring := Collect(o, TSparse)[1].ring, itr1 := Collect(c, @(1, var, e->e.id = \"itr1\"))[1],itr2 := Collect(c, @(1, var, e->e.id = \"itr2\"))[1],\n\txcol1 := Collect(c, @(1, var, e->e.id = \"xcol1\"))[1], spmcol1 := Collect(c, @(1, var, e->e.id = \"spmcol1\"))[1], res := SubstTopDown(c, @(1, assign, e-> e.loc = xcol1 and IsNth(e.exp)), e->skip()), \n\tres2 := SubstTopDown(res, @(1, assign, e-> e.loc = spmcol1 and IsNth(e.exp)), e->skip()), result := SubstVars(res2, rec((xcol1.id) := var.table.itr1)), result2 := SubstVars(result, rec((spmcol1.id) := var.table.itr2)), \n\ts := var.fresh_t(\"start\", opts.XType), ee := var.fresh_t(\"end\", opts.XType), se := chain(assign(s, add(x, add(opts.symbol[1], add(V(1), add(nth(x, o.child(1).var)))))), assign(ee, add(x, add(opts.symbol[1], add(V(1), add(nth(x, add(o.child(1).var, V(1))))))))),\n\tresult2_5 := SubstTopDown(result2, @(1, loopn, e->e.range=opts.symbol[1]), e-> loopn(e.var, e.range, decl([s,ee],chain(se, e.cmd)))), itr := var.fresh_t(\"i\", TPtr(TInt)),\n\tresult2_6 := SubstTopDown(result2_5, @(1, loopn, e->e.range<>opts.symbol[1]), e-> loopn(itr, sub(ee, s), e.cmd)), result2_7 := SubstBottomUp(result2_6,@(1,var, e->e.id=v2.id), e->itr), \n\tresult3 := SubstTopDown(result2_7, @(1, assign, e-> e.loc = itr2 and Length(Collect(e.exp,itr2)) = 0), e->assign(itr2, add(X, add(1, add(opts.symbol[1], nth(x,deref(itr))))))), \n\tresult3_5 := SubstTopDown(result3, @(1, assign, e-> e.loc = itr1 and Length(Collect(e.exp,itr1)) = 0), e->assign(itr1, s)),\n\ten2 := add(x, add(V(1), add(opts.symbol[1], nth(x,add(deref(itr), V(1)))))),\n\tresult4_1:= SubstTopDown(result3_5, @(1, gt), e-> gt(deref(e.args[1]), deref(e.args[2]))), result4_2:= SubstTopDown(result4_1, @(1, lt), e-> lt(deref(e.args[1]), deref(e.args[2]))),\n\tresult4 := SubstTopDown(result4_2, @(1, loopw, e->Length(Collect(e.cond, neq)) > 0), e-> loopw(logic_and(lt(itr1, ee), lt(itr2, en2)), e.cmd.cmd)), \n\tresult5 := SubstTopDown(result4, @(1, assign, e-> IsNth(e.loc) and e.loc.loc = tempalg), e-> assign_acc(deref(y), V(1))), result5); \n\t\n\t#let(c:= self(o.child(1), y, x, opts), ring := Collect(o, TSparse)[1].ring, itr1 := Collect(c, @(1, var, e->e.id = \"itr1\"))[1],itr2 := Collect(c, @(1, var, e->e.id = \"itr2\"))[1],\n\t#out1 := var.fresh_t(\"out\", itr1.t), out2 := var.fresh_t(\"out\", itr1.t), res := SubstTopDown(c, @(1, assign, e-> e.loc = itr1 and IsNth(e.exp)), e->assign(out1, e.exp)), v2 := o.child(1)._children[1].var,\n\t#res2 := SubstTopDown(res, @(1, assign, e-> e.loc = itr2 and IsNth(e.exp)), e->assign(out2, e.exp)),result := SubstVars(res2, rec((itr1.id) := var.table.xcol1)), result2 := SubstVars(result, rec((itr2.id) := var.table.spmcol1)), \n\t#result3 := SubstTopDown(result2, @(1, assign, e->IsBound(e.loc.id) and e.loc.id = \"xcol1\" and IsNth(e.exp)), e-> assign(e.loc, v2)), result3); #if3chain := chain(Collect(result2, if3)[1]),result3 := SubstTopDown(result2, @(1, chain, e-> Length(Collect(e, if3)) = 1 and Length(Collect(e, loopw)) = 0), e-> if3chain), result3);,\n\nDefaultCodegen.PushBFSKernel := (self, o, y, x, opts) >> let(front := Filtered(Collect(o, var), x-> x = opts.symbol[2])[1], c:= self(o.child(1), front, x, opts), expr := Collect(c, @(1,nth, e-> e.loc = x and Length(Collect(e.idx, add)) = 2))[1], \n\t\t\tif_cond := if1(logic_and(eq(nth(front, expr), V(1)), eq(nth(y, expr), add(opts.symbol[1], V(1)))), assign(nth(y, expr), c.var)),\n\t\t\tresult := SubstTopDown(c, @(1, chain, e-> Length(Collect(e, assign)) = 3), e-> chain(e.cmds, if_cond)), result);\n\t\t\t#result1 := SubstTopDown(c, @(1, assign, e-> IsNth(e.loc) and e.loc.loc = y and Length(Collect(e.exp, logic_or)) > 0), e-> SubstVars(e, rec(y := front))), \n\nDefaultCodegen.PullBFSKernel := (self, o, y, x, opts) >> let(c:= self(o.child(1), y, x, opts), front := Collect(o, FDataOfs)[1].var,\n\t\t\tresult1 := SubstTopDown(c, @(1, loopn, e-> Length(Collect(e.range, sub)) = 0), e->loopn(e.var, e.range, if1(eq(nth(y, c.var), add(opts.symbol[1], V(1))), e.cmd))), \n\t\t\tresult2 := SubstTopDown(result1, @(1, loopn, e1-> Length(Collect(e1.range, sub)) > 0), e-> loopn(e.var, e.range, if1(neq(nth(y, opts.sparse_mat.index_row(x, opts.symbol[1], e.var)), add(opts.symbol[1], V(1))), chain(assign(nth(front,opts.sparse_mat.index_row(x, opts.symbol[1], e.var)),V(1)), assign(nth(y, c.var), opts.sparse_mat.index_row(x, opts.symbol[1], e.var)), break())))),\n\t\t\tresult2);\n\nDefaultCodegen.BFSKernel := (self, o, y, x, opts) >> let(c:= self(o.child(1), y, x, opts), source := var.fresh_t(\"source\", TInt), Append(opts.symbol, [source]), front := Filtered(Collect(o, var), x-> x = opts.symbol[2])[1], i := Ind(), sum := var.fresh_t(\"sum\", TInt), rsum := var.fresh_t(\"rsum\", TInt),  \n\t\t\tdecorator := decl([sum, rsum], chain(assign(nth(y,source), source), assign(nth(front,source), V(1)), assign(sum, V(1)), assign(rsum, V(0)), loopw(neq(sum, rsum), chain(assign(sum, rsum), assign(rsum, V(0)),c, loopf(i, V(0), opts.symbol[1], chain(assign_acc(rsum, nth(front, i)))))))), decorator);\n#DefaultCodegen.AccumKernel := (self, o, y, x, opts) >> let(ring := Collect(o, TSparse)[1].ring, i := Ind(), j := Ind(), accum := var.fresh_t(\"accum\", TPtr(TInt)), create := decl([accum], chain(assign(accum, malloc(accum.t.t, opts.symbol[1])), \n#\tloopf(i, V(0), opts.symbol[1], loopf(j, V(0), opts.symbol[1], assign(nth(accum, add(mul(i,opts.symbol[1]), j)), ring.zero()))), self(o.child(1), accum, x, opts), decl([], chain(loopf(i, V(0), opts.symbol[1], loopf(j, V(0), opts.symbol[1], \n#\tassign_acc(nth(y, add(mul(i,opts.symbol[1]), j)), nth(accum, add(mul(i,opts.symbol[1]), j))))))))), create);\n\n#DefaultCodegen.Gath := meth(self, o, y, x, opts)\n#\tlocal i, index_i, index_j;\n#\ti := Ind();\n#\tindex_j := o.func._children[2].params[2];\n#\treturn decl([], chain(\n#\t\tloopf(i, nth(x, index_j), nth(x, add(index_j, V(1))), chain(\n#\t\t\tassign(nth(y, sub(i, nth(x, index_j))), nth(x, add(opts.symbol[1], add(nth(x,opts.symbol[1]), add(i, V(1))))))\n#\t\t))\n#\t));\n#end;\n#\n#DefaultCodegen.Scat := meth(self, o, y, x, opts) \n#\tlocal i, index_i, index_j;\n#\ti := Ind();\n#\tindex_j := o.func._children[2].params[2];\n#\treturn decl([], chain(\n#\t\tloopf(i, nth(x, index_j), nth(x, add(index_j, V(1))), chain(\n#\t\t\tassign(nth(y,nth(x, add(opts.symbol[1], add(V(1), i)))), nth(x, sub(i, nth(x, index_j))))\n#\t\t))\n#\t));\n#end;\n#\n#DefaultCodegen.RowVec2 := meth(self, o, y, x, opts)\n#\tlocal body, result, sa;\n#\tsa := var.fresh_t(\"sa\", TArray(TInt, o.element.object.size));\n#\tresult := var.fresh_t(\"result\", TInt);\n#\tbody := assign(y , itr);\n#\treturn decl([result, sa], chain(\n#\t\tassign(result, V(0)),\n#\t\to.traversal(sa, body)\n#\t));\n#\tend;\n#\nDefaultCodegen.NewScalarProduct := meth(self, o, y, x, opts) \n\tlocal itr, num_nz;\n\titr := o.rv.element.object.get_iterator();\n\tnum_nz := o.rv.element.object.num_nonzeros(\"sa2\");\n\t#return decl([itr], chain(\n\treturn decl([], chain(\n\t\tassign(y, V(0)),\n\t\tassign(itr, V(0)),\n\t\tloopw(lt(itr, o.rv.element.object.size), chain(\n\t\tif1(logic_and(neq(struct_nth(x, \"value\", itr), V(0)),neq(struct_nth(\"sa2\", \"value\", itr), V(0))), chain(\n\t\t\tassign(y, add(deref(y), mul(struct_nth(x, \"value\", itr), struct_nth(\"sa2\", \"value\", itr)))),\n\t\t\tassign(itr, add(itr, V(1)))))))));\t\n\tend;\n\n#if1(neq(struct_nth(x, \"value\", itr), V(0)), chain(\n#assign(y, add(deref(y), mul(\n\nDefaultCodegen.DenseScalarProduct := meth(self, o, y, x, opts)\n\tlocal arr, itr, size;\n\tarr := var.fresh_t(\"arr\", TArray(o.rv.element.object.t.t, o.rv.element.object.size));\n\titr := var.fresh_t(\"itr\", TInt);\n\treturn data(arr, V(o.rv.element.tolist()), decl([], chain(\n\t\tassign(y, V(0)),\n\t\tassign(itr, V(0)),\n\t\tloopw(lt(itr, o.rv.element.object.size),\n\t\tchain(\n\t\t\tif1(neq(nth(arr, itr), V(0)), chain(\n\t\t\tassign(y, add(deref(y), mul(nth(arr, itr), nth(x, itr)))),\n\t\t\tassign(itr, add(itr, V(1))))))))));\n\tend;\n\nDefaultCodegen.SparseScalarProduct := meth(self, o, y, x, opts)\n\tlocal arr, itr, size;\n\tarr := var.fresh_t(\"arr\", TArray(o.rv.element.object.t.t, o.rv.element.object.size));\n\titr := var.fresh_t(\"itr\", TInt);\n\treturn data(arr, V(o.rv.element.tolist()), decl([], chain(\n\t\tassign(y, V(0)),\n\t\tassign(itr, V(0)),\n\t\tloopw(lt(itr, o.rv.element.object.size),\n\t\tchain(\n\t\t\tif1(logic_and(neq(nth(arr, itr), V(0)),neq(nth(x, itr), V(0))), chain(\n\t\t\tassign(y, add(deref(y), mul(nth(arr, itr), nth(x, itr)))),\n\t\t\tassign(itr, add(itr, V(1))))))))));\n\tend;\n\nDefaultCodegen.TSparse := meth(self, o, y, x, opts) \n\tlocal row, values;\n\trow := var.fresh_t(\"row\", TArray(o.t, o.size1));\n\tvalues := var.fresh_t(\"values\", TArray(o.t, o.size2));\n\treturn data(row, o.list1, skip());\n\tend;\n\nDefaultCodegen.sparse_nth2 := meth(self, o, y, x, opts) \n\tlocal row, index;\n\trow := var.fresh_t(\"row\", TArray(o.sa.t, o.sa.size));\n\tindex := var.fresh_t(\"index\", TInt);\n\treturn decl([row, index], chain(\n\tif4(eq(deref(row + index), V(0)), assign(y, V(0)), assign(y, deref(row+index)))));\n\tend;\n\nDefaultCodegen.Formula := meth(self, o, y, x, opts)\n        local icode, datas, prog, params, sub, initsub, destroysub, io, t, initcode, initparams;\n        \n        o := SumsUnification(o.child(1), opts);\n\n        [x, y] := self.initXY(x, y, opts);\n\n        #o :=  Process_fPrecompute(o, opts);\n        \n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n\n        datas := Collect(o, FDataOfs);\n        [o,t] := UTimedAction(BlockSumsOpts(o, opts)); #PrintLine(\"BlockSums \", t);\n        [icode,t] := UTimedAction(self(o, y, x, opts)); #PrintLine(\"codegen \", t);\n        #[icode,t] := UTimedAction(ESReduce(icode, opts)); #PrintLine(\"ESReduce \", t);\n        icode := RemoveAssignAcc(icode);\n        Unbind(Compile.times);\n        [icode,t] := UTimedAction(BlockUnroll(icode, opts)); #PrintLine(\"BlockUnroll \", t);\n        #PrintLine(\"---compile--\");\n        #DoForAll([1..Length(Compile.times)], i -> PrintLine(i, \" \", Compile.times[i], \" \",\n        #        let(f:=opts.compileStrategy[i], When(IsFunc(f) or IsMeth(f), \"---\", f))));\n\n        # icode := PowerOpt(icode);\n        icode := DeclareHidden(icode);\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            icode := FixedPointCode(icode, opts.bits, opts.fracbits);\n        fi;\n\n        initparams := Copy(params);\n        if IsBound(opts.symbol) then\n          params := Concatenation(params, opts.symbol);\n        fi;\n\n        if IsBound(opts.accStrategy) then\n          icode.iy := y;\n          icode.iy.n := o.dims()[1];\n          icode.ix := x;\n          icode.ix.n := o.dims()[2];\n          icode.ivars := Concatenation(params, List(datas, x->x.var));\n          icode := opts.accStrategy(icode);\n        fi;\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        destroysub := Cond(IsBound(opts.subName), Concat(\"destroy_\", opts.subName), \"destroy\");\n        icode := func(TVoid, sub, Concatenation(io, params), Compile(icode, opts));\n\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n\t    initcode := chain(List(Filtered(datas, e -> IsBound(e.var.init)), x -> SReduce(x.var.init, opts)));\n            prog := program(\n                decl(List(datas, x->x.var),\n                    chain(\n                        func(TVoid, initsub, initparams :: Set(Collect(initcode, param)), initcode), \n                        icode,\n                        func(TVoid, destroysub, [], skip()) \n                    )));\n        else\n            prog := program( func(TVoid, initsub, params, chain()), icode);\n        fi;\n        prog.dimensions := o.dims();\n        return prog;\n    end;\n\n#CUnparser.TSparse := (self, o, i, is) >> Print(Blanks(i),\n#\to.t, \"row[\", o.size1, \"];\\n\", o.t, \"values[\", o.size2, \"];\\n\");\n\n\n\nSparseDefaults := CopyFields(SpiralDefaults, rec(\n  compileStrategy := GraphIndicesCS,\n  X := var(\"X\", TPtr(TInt)),\n  XType := TPtr(TInt),\n  arrayDataModifier := \"\",\n  arrayBufModifier := \"\",\n  Y := var(\"Y\", TPtr(TInt)),\n  matrix := TSparse_Matrix(TSparse(TArray(TInt, 5), TSemiring_Arithmetic(TInt)), []),\n  YType := TPtr(TInt),\n#  isCSR := true,\n#  includes := [\"<sparse.h>\"],\n#  #symbol := [\"struct_array sa2\"]\n));\n\nClass(SparseOpts, SpiralDefaults, rec(\n    tags := [],\n    operations := rec(Print := s -> Print(\"<Sparse options record>\")),\n    tagIt := (self, t) >> t.withTags(self.tags),\n\tname := \"SparseOpts\",\n\tarrayDataModifier := \"\",\n  \tarrayBufModifier := \"\",\n\tvec := false,\n\tmat := false,\n\tsparse_mat := TSparse_Matrix(TSparse(TArray(TInt, 5), TSemiring_Arithmetic(TInt)), []),\n\tsparse_vec := TSparse(TArray(TInt, 5), TSemiring_Arithmetic(TInt)),\n\t#createRuleTree := (self, t) >> let(t2 := ApplyStrategy(t, self.rewrite, UntilDone, self), RandomRuleTree(t2, self)),\n    search := (self, t) >> RandomRuleTree(t, self),\n    sumsRuleTree := (self, rt) >> let(spl := SPLRuleTree(rt), spl2 := ApplyStrategy(spl, self.rewrite, UntilDone, self), rt2 := RandomRuleTree(spl2, self),\n\t\t\t\t\t\t\t\t\t srt := ApplyStrategy(SumsRuleTree(rt2, self), self.rewrite, UntilDone, self), srt),\n    codeSums := meth(self, ss)\n        local c, X, Y, opts;\n        opts := self;\n        X := var(\"X\", self.XType);\n        Y := var(\"Y\", self.YType);\n\t\t#if self.vec = true then\n\t\t#\tself.symbol := Concat(self.symbol, [self.sparse_vec.get_var()]);\n\t\t#fi;\n\t\t#if self.mat = true then\n\t\t#\tself.symbol := Concat(self.symbol, [self.sparse_mat.get_var()]);\n\t\t#fi;\n\t\t#if IsBound(self.algo) and self.algo = true then\n\t\t#\tself.symbol := Sublist(self.symbol, [1..Length(self.symbol)-1]);\n\t\t#fi;\n        c := opts.codegen(Formula(ss), Y, X, opts);\n        c.cmds := Cond(IsBound(opts.postProcessCode), opts.postProcessCode(c.cmds), c.cmds);\n        c.ruletree := Cond(IsBound(ss.ruletree), ss.ruletree, rec());\n\t\tif self.vec = true then\n\t\t\tc := SubstTopDown(Copy(c), @(1, var, e-> IsBound(e.t.t) and e.t.t = self.symbol[Length(self.symbol)].t.t), e->self.symbol[Length(self.symbol)]);\n\t\tfi;\n\t\t#if self.mat = true then\n\t\t#\tc := SubstTopDown(Copy(c), @(1, var, e->IsBound(e.t.t) and e.t.t = self.sparse_mat.element.t), e->self.symbol[Length(self.symbol)]);\n\t\t#fi;\n        if IsBound(self.params) then\n            c := SubstBottomUp(c, @(1, func, e->e.id = \"transform\"),\n                e ->func(@(1).val.ret, @(1).val.id, @(1).val.params::self.params, @(1).val.cmd));\n        fi;\n        #if IsBound(opts.useBinSplit) and opts.useBinSplit then c:= BinSplit(c); fi;\n        return c;\n    end,\n    #prettyPrint := (self, c) >> PrintCode(c.ruletree.node.params[2].fname, c, self),\n\tprettyPrint := (self, c) >> PrintCode(self.name, c, self),\n    genSparse := (self, t) >> self.codeSums(self.sumsRuleTree(self.search(t))),\n    globalUnrolling := 0\n));\n\nBaseIndicesCS := [\n    c -> Compile.pullDataDeclsRefs(c),\n    c -> Compile.fastScalarize(c),\n    c -> UnrollCode(c), \n    c -> FlattenCode(c), \n    c -> UntangleChain(c), \n    (c, opts) -> CopyPropagate.initial(c, opts), \n    (c, opts) -> HashConsts(c, opts), \n    c -> MarkDefUse(c), \n    (c, opts) -> BinSplit(c, opts), \n    c -> MarkDefUse(c),\n    CopyPropagate, # does CSE\n];\n#\n#SparseIndicesCS := Concatenation(BaseIndicesCS, [\n#    c -> MarkDefUse(c), \n#    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n#    c -> MarkDefUse(c), \n#    (c, opts) -> CopyPropagate(c, CopyFields(opts, rec(autoinline := true))),\n#    (c, opts) -> Cond(opts.finalBinSplit, BinSplit(c, opts), c),\n#    (c, opts) -> Cond(IsBound(opts.scheduler), opts.scheduler(c, opts), c),\n#    c -> FixValueTypes(c),\n#    c -> Compile.declareVars(c)\n#]);\n\n\nDeclare(SparseDefaultConf);\nDeclare(SparseDataStructConf);\nDeclare(SparseStructOutConf);\n\n\nClass(SparseDefaultConf, LocalConfig, rec(\n    __call__ :=  arg -> CopyFields(SparseDefaultConf, \n        rec(\n        )),\n    getOpts := meth(self, t)\n        local opts, n;\n        opts := Copy(SparseOpts);\n\t\topts.compileStrategy := [c -> Compile.pullDataDeclsRefs(c), c -> Compile.fastScalarize(c), c -> FlattenCode(c), \n    \tc -> UntangleChain(c), c -> MarkDefUse(c), c -> FixValueTypes(c), c -> Compile.declareVars(c)];\n\t\topts.rewrite := [];\n        opts.XType := TPtr(TInt);\n        opts.YType := TPtr(TInt);\n        opts.useDeref := false;\n\t\tn := var.fresh_t(\"n\", TInt);\n\t\topts.symbol := [n];\n\t\topts.globalUnrolling := 0;\n        return opts;    \n    end,\n    operations := rec(Print := s -> Print(\"<Sparse Default Configuration>\")),\n));\n\n\nClass(SparseStructOutConf, LocalConfig, rec(\n    __call__ :=  arg -> CopyFields(SparseDefaultConf, \n        rec(\n        )),\n    getOpts := meth(self, t)\n        local opts, n;\n        opts := Copy(SparseOpts);\n\t\topts.compileStrategy := [c -> Compile.pullDataDeclsRefs(c), c -> Compile.fastScalarize(c), c -> FlattenCode(c), \n    \tc -> UntangleChain(c), c -> MarkDefUse(c), c -> FixValueTypes(c), c -> Compile.declareVars(c)];\n\t\topts.rewrite := [];\n        opts.XType := TPtr(TInt);\n        opts.YType := TPtr(Tcsr);\n        opts.useDeref := false;\n\t\tn := var.fresh_t(\"n\", TInt);\n\t\topts.symbol := [n];\n\t\topts.globalUnrolling := 0;\n\t\topts.postProcessCode := (self, c) >> let(t1 := var.fresh_t(\"iA\", TPtr(TInt)), t2 := var.fresh_t(\"jA\", TPtr(TInt)),  \n\t\t\tt3 := var.fresh_t(\"val\", TPtr(TInt)), n := var.fresh_t(\"n\", TInt), ts := T_Struct(\"csr\", [t1,t2,t3,n]), Append(c, [define([ts])]), Reversed(c));\n        return opts;    \n    end,\n    operations := rec(Print := s -> Print(\"<Sparse Struct Out Configuration>\")),\n));\n\nClass(SparseDataStructConf, SparseDefaultConf, rec(\n\t__call__ :=  arg -> CopyFields(SparseDefaultConf, \n        rec(\n        )),\n\t\tgetOpts := meth(self, t)\n        local opts, n, ds, root;\n        opts := Copy(SparseOpts);\n        opts.XType := TPtr(TInt);\n        opts.YType := TPtr(TPtr(TInt));\n        opts.useDeref := false;\n\t\topts.compileStrategy := [c -> Compile.pullDataDeclsRefs(c), c -> Compile.fastScalarize(c), c -> FlattenCode(c), \n    \tc -> UntangleChain(c), c -> MarkDefUse(c), c -> FixValueTypes(c), c -> Compile.declareVars(c)]; #No copy prop support for linked lists\n\t\topts.rewrite := [];\n\t\topts.ds := true;\n\t\topts.init := (self, ds, tree, value) >> let(itr := var.fresh_t(\"itr\", TPtr(Tdstruct)),\n\t\t decl([itr], chain(assign(ds, allocate_ds(value)), assign(itr, ds), assign(tree, dstructToTree(addrof(itr), value)))));\n\t\topts.to_csr := (self, out, ds) >> chain(assign(deref(out), ds_to_csr(ds)));\n\t\topts.destory_ds := (self, ds, root) >> chain(destory_ds(ds, root));\n\t\tn := var.fresh_t(\"n\", TInt);\n\t\tds := var.fresh_t(\"d\", TPtr(Tdstruct));\n\t\troot := var.fresh_t(\"root\", TPtr(Ttree));\n\t\topts.symbol := [n, ds, root];\n        opts.includes := [\"\\\"data_structure.h\\\"\"];\n\t\topts.globalUnrolling := 0;\n\t\topts.codegen := CopyFields(SpiralDefaults.codegen, DataStructureCodegenMixin);\n        return opts;    \n    end,\n\toperations := rec(Print := s -> Print(\"<Sparse DataStruct Configuration>\")),\n));\n", "meta": {"hexsha": "f67cc5c2d1c6b4763ee3d03cfad2648e921d8f06", "size": 89053, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/packages/graph/sparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "namespaces/packages/graph/sparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "namespaces/packages/graph/sparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.4120346762, "max_line_length": 386, "alphanum_fraction": 0.5815076415, "num_tokens": 29123, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4726834766204328, "lm_q2_score": 0.024798160826212043, "lm_q1q2_score": 0.011721680873126533}}
{"text": "#\n# MathInTheMiddle: Math-in-the-Middle functionality for GAP\n#\n# Type export to JSON for consumation by MMT import\n#\n# TODO: We need at some point advertise our abilities via\n#       OpenMath directly\n\n# Make GAP Type graph as a record\nInstallGlobalFunction(MitM_TypesInfo, function()\n    local res, lres, i, j, f, ff, a, meths, mpos, objs, m, mres, n, t, notcovered, v, op, loc,\n          flags, flagslist;\n\n    objs := NewDictionary(IsObject, true);\n    res := [ rec( name := \"IsObject\", type := \"Category\", implied := [] ) ];\n\n    Print(\"exporting operations...\\c\");\n    for i in [1..Length(OPERATIONS)] do\n        op := OPERATIONS[i];\n\n        lres := rec();\n        AddDictionary(objs, op, lres);\n\n        lres.type := TypeOfOperation(op);\n        lres.name := NameFunction(op);\n\n        # Locations in which this operation is declared\n        # There can be multiple locations with different filters\n        # We convert the GAP representation as a list of pairs\n        # into a list of records for the export\n        lres.locations := List( GET_DECLARATION_LOCATIONS(op)\n                              , x -> rec( file := x[1], line := x[2] ) );\n\n        # This is way too complicated\n        # if IsAttribute(op) then\n        # elif IsProperty(op) then\n        # else\n        lres.filters := [];\n\n        # This is a list if argument filters for every declaration\n        # for op\n        flagslist := GET_OPER_FLAGS(op);\n        if flagslist = fail then\n        # TODO, and filter? Synonym?\n            Print(\"Op: \", op, \" filters need some looking after\\n\");\n        else\n            # TODO: clean up\n            for flags in flagslist do\n                ff := Concatenation(List(flags, x -> List(TRUES_FLAGS(x), z -> FILTERS[z])));\n                ff := List(ff, NameFunction);\n            od;\n        fi;\n        lres.methods := rec( 0args := [], 1args := [], 2args := [],\n                             3args := [], 4args := [], 5args := [],\n                             6args := [] );\n\n        for a in [1..6] do\n            meths := MethodsOperation(op, a);\n\n            for j in meths do\n                mres := rec( filters := List(j.argFilt, x -> List(TRUES_FLAGS(x)\n                                                                 ,y -> NameFunction(FILTERS[y])))\n                           , rank := j.rank\n                           , comment := j.info );\n                # Methods are not bound to global variables directly (usually...)\n                # but some methods might be global functions\n                AddDictionary(objs, j.func, mres);\n                Add(lres.methods.(Concatenation(String(a),\"args\")), mres);\n            od;\n        od;\n\n        Add(res, lres);\n    od;\n    Print(\"   done\\n\");\n\n    Print(\"exporting global functions...\\c\");\n    for f in [1..Length(GLOBAL_FUNCTION_NAMES)] do\n        lres := rec();\n        lres.type := \"Function\";\n        lres.name := GLOBAL_FUNCTION_NAMES[f];\n        lres.location := rec();\n        AddDictionary(objs, ValueGlobal(GLOBAL_FUNCTION_NAMES[f]), lres);\n        Add(res, lres);\n    od;\n    Print(\"   done\\n\");\n\n    Print(\"collecting global variable references...\\c\");\n    notcovered := [];\n    for n in NamesGVars() do\n        if IsBoundGlobal(n) then\n            v := ValueGlobal(n);\n            t := LookupDictionary(objs, v);\n            if t <> fail then\n                if IsBound(t.aka) then\n                    Add(t.aka, n);\n                else\n                    t.aka := [n];\n                fi;\n            else\n                v := ValueGlobal(n);\n                if IsFilter(v) then\n                    lres := rec();\n                    lres.type := \"GAP_AndFilter\";\n                    ff := FLAGS_FILTER(v);\n                    if ff <> false then\n                        ff := TRUES_FLAGS(FLAGS_FILTER(v));\n                        ff := List(ff, function(f)\n                                      if IsBound(FILTERS[f]) then\n                                          return NameFunction(FILTERS[f]);\n                                      else\n                                          return \"<<unknown>>\";\n                                      fi;\n                                  end);\n                        lres.conjunction_of := ff;\n                        lres.name := (NameFunction(v));\n                        lres.aka := [n];\n                        AddDictionary(objs, v, lres);\n                        Add(res, lres);\n                    else\n                #        Print(\"strange: \", n, \" \", v);\n                    fi;\n                elif IsFunction(v) and not '_' in n and ForAny(\"abcdefghijklmnopqrstuvwxyz\", c -> c in n) then\n                    # Defined using BindGlobal, not InstallGlobalFunction\n                    # If it contains '_' or is all-caps it is probably internal\n                    lres := rec();\n                    lres.type := \"Function\";\n                    lres.name := n;\n                    lres.location := rec();\n                    AddDictionary(objs, v, lres);\n                    Add(res, lres);\n                else\n                    Add(notcovered, n);\n                fi;\n            fi;\n        fi;\n    od;\n    Print(\"   done\\n\");\n    return [res, notcovered];\nend);\n\n# Write the graph of type info to JSon file\nInstallGlobalFunction(MitM_TypesToJson,\nfunction(file)\n    local fd, n, typeinfo;\n\n    fd := IO_File(file, \"w\");\n    if fd = fail then\n        Error(\"Opening file \", file, \" failed\");\n    fi;\n    typeinfo := MitM_TypesInfo();\n    n := IO_Write(fd, GapToJsonString(typeinfo[1]));\n    IO_Close(fd);\n\n    return n;\nend);\n\n", "meta": {"hexsha": "712fd5ac0962083edc5f24304dbb87487a41afa8", "size": 5589, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/Export.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/Export.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/Export.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 35.5987261146, "max_line_length": 110, "alphanum_fraction": 0.4685990338, "num_tokens": 1235, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.47268347662043286, "lm_q2_score": 0.02479815839379606, "lm_q1q2_score": 0.01172167972336369}}
{"text": "LowercaseString(\"alphaBETA\");\nUppercaseString(\"alphaBETA\");\n", "meta": {"hexsha": "33d4c1c089fa99ede8356fd4f255c96ea56ba1bf", "size": 60, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/String-case/GAP/string-case.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/String-case/GAP/string-case.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/String-case/GAP/string-case.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 20.0, "max_line_length": 29, "alphanum_fraction": 0.8, "num_tokens": 18, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.3040416749665474, "lm_q2_score": 0.038466188160327285, "lm_q1q2_score": 0.01169532427784428}}
{"text": "Read(\"file\");\n", "meta": {"hexsha": "70e1d25a301ce5e5fcb33d6960a753032258341c", "size": 14, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Include-a-file/GAP/include-a-file.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Include-a-file/GAP/include-a-file.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Include-a-file/GAP/include-a-file.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 7.0, "max_line_length": 13, "alphanum_fraction": 0.5714285714, "num_tokens": 4, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3174262785020255, "lm_q2_score": 0.036769469110227285, "lm_q1q2_score": 0.01167159574215463}}
{"text": "#\n# flinting: FLINT in GAP\n#\n# Implementations\n#\n\n", "meta": {"hexsha": "87f241eeb7c916a2708e9fe2f26c0558a33fdd77", "size": 50, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/flinting.gi", "max_stars_repo_name": "markuspf/flinting", "max_stars_repo_head_hexsha": "4026ecbca6b0f148e5f5ac578f2749b55d187c5d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/flinting.gi", "max_issues_repo_name": "markuspf/flinting", "max_issues_repo_head_hexsha": "4026ecbca6b0f148e5f5ac578f2749b55d187c5d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/flinting.gi", "max_forks_repo_name": "markuspf/flinting", "max_forks_repo_head_hexsha": "4026ecbca6b0f148e5f5ac578f2749b55d187c5d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 7.1428571429, "max_line_length": 24, "alphanum_fraction": 0.66, "num_tokens": 17, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.3380771374883919, "lm_q2_score": 0.03358950311062484, "lm_q1q2_score": 0.011355843061297482}}
{"text": "#############################################################################\n##\n#W  example.gd\n##\n##  This file contains a sample of a GAP implementation file.\n##\n\n\n#############################################################################\n##\n#M  SomeOperation( <val> )\n##\n##  performs some operation on <val>\n##\nInstallMethod( SomeProperty,\n    \"for left modules\",\n    [ IsLeftModule ], 0,\n    function( M )\n    if IsFreeLeftModule( M ) and not IsTrivial( M ) then\n      return true;\n    fi;\n    TryNextMethod();\n    end );\n\n\n\n#############################################################################\n##\n#F  SomeGlobalFunction( )\n##\n##  A global variadic funfion.\n##\nInstallGlobalFunction( SomeGlobalFunction, function( arg )\n    if Length( arg ) = 3 then\n      return arg[1] + arg[2] * arg[3];\n    elif Length( arg ) = 2 then\n      return arg[1] - arg[2]\n    else\n      Error( \"usage: SomeGlobalFunction( <x>, <y>[, <z>] )\" );\n    fi;\n    end );\n\n\n#\n# A plain function.\n#\nSomeFunc := function(x, y)\n    local z, func, tmp, j;\n    z := x * 1.0;\n    y := 17^17 - y;\n    func := a -> a mod 5;\n    tmp := List( [1..50], func );\n    while y > 0 do\n        for j in tmp do\n            Print(j, \"\\n\");\n        od;\n        repeat\n            y := y - 1;\n        until 0 < 1;\n        y := y -1;\n    od;\n    return z;\nend;\n", "meta": {"hexsha": "941f7c586f9c8183d87b2bfe614d1b5dc2924bc7", "size": 1323, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "analyzer/libs/pygments/tests/examplefiles/example.gi", "max_stars_repo_name": "oslab-swrc/juxta", "max_stars_repo_head_hexsha": "481cd6f01e87790041a07379805968bcf57d75f4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 23, "max_stars_repo_stars_event_min_datetime": "2016-01-06T07:01:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-12T15:53:20.000Z", "max_issues_repo_path": "analyzer/libs/pygments/tests/examplefiles/example.gi", "max_issues_repo_name": "oslab-swrc/juxta", "max_issues_repo_head_hexsha": "481cd6f01e87790041a07379805968bcf57d75f4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-04-02T00:42:29.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-02T00:42:29.000Z", "max_forks_repo_path": "analyzer/libs/pygments/tests/examplefiles/example.gi", "max_forks_repo_name": "oslab-swrc/juxta", "max_forks_repo_head_hexsha": "481cd6f01e87790041a07379805968bcf57d75f4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2016-01-06T07:01:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-29T11:43:16.000Z", "avg_line_length": 20.671875, "max_line_length": 77, "alphanum_fraction": 0.4270597128, "num_tokens": 353, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.4649015713733885, "lm_q2_score": 0.02442309271693771, "lm_q1q2_score": 0.011354334181902303}}
{"text": "# Arrays are better called lists in GAP. Lists may have elements of mixed types, e$\nv := [ 10, 7, \"bob\", true, [ \"inner\", 5 ] ];\n# [ 10, 7, \"bob\", true, [ \"inner\", 5 ] ]\n\n# List index runs from 1 to Size(v)\nv[1];\n# 10\n\nv[0];\n# error\n\nv[5];\n# [ \"inner\", 5 ]\n\nv[6];\n# error\n\n# One can assign a value to an undefined element\nv[6] := 100;\n\n# Even if it's not after the last: a list may have undefined elements\nv[10] := 1000;\nv;\n# [ 10, 7, \"bob\", true, [ \"inner\", 5 ], 100,,,, 1000 ]\n\n# And one can check for defined values\nIsBound(v[10]);\n# true\n\nIsBound(v[9]);\n# false\n\n# Size of the list\nSize(v);\n# 10\n\n# Appending a list to the end of another\nAppend(v, [ 8, 9]);\nv;\n# [ 10, 7, \"bob\", true, [ \"inner\", 5 ], 100,,,, 1000, 8, 9 ]\n\n# Adding an element at the end\nAdd(v, \"added\");\nv;\n# [ 10, 7, \"bob\", true, [ \"inner\", 5 ], 100,,,, 1000, 8, 9, \"added\" ]\n", "meta": {"hexsha": "8dc56657b72c33847f98259c9b9ad96817561730", "size": 848, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Arrays/GAP/arrays.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Arrays/GAP/arrays.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Arrays/GAP/arrays.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 18.4347826087, "max_line_length": 83, "alphanum_fraction": 0.5683962264, "num_tokens": 330, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.33111973962899144, "lm_q2_score": 0.033589506012886725, "lm_q1q2_score": 0.011122148485253494}}
{"text": "InstallGlobalFunction(MitM_GAPToXML,\nobj -> MitM_OMRecToXML(MitM_GAPToOMRec(obj)));\n\nInstallGlobalFunction(MitM_XMLToGAP,\nstr -> MitM_OMRecToGAP(MitM_XMLToOMRec(str)));\n\nInstallGlobalFunction(MitM_RoundTripGAP,\nobj -> MitM_XMLToGAP(MitM_GAPToXML(obj)));\n\nInstallGlobalFunction(MitM_RoundTripXML,\nfunction(str)\n    local r;\n    r := MitM_XMLToGAP(str);\n    if r.success <> true then\n        return r;\n    fi;\n    return MitM_GAPToXML(r.result);\nend);\n\nInstallGlobalFunction(MitM_Print,\nfunction(obj)\n    Print(MitM_OMRecToXML(MitM_OMRecToOMOBJRec(MitM_GAPToOMRec(obj))), \"\\n\");\nend);\n\nInstallGlobalFunction(MitM_OMRecToOMOBJRec,\nr -> OMOBJ(r));\n", "meta": {"hexsha": "0aa89f35fe05791994ef5ecd7b4b1e770c50cffa", "size": 644, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/Misc.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/Misc.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/Misc.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 23.8518518519, "max_line_length": 77, "alphanum_fraction": 0.7608695652, "num_tokens": 203, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.2782567937024021, "lm_q2_score": 0.039638840660911584, "lm_q1q2_score": 0.011029776708385662}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#############################################################################\n#F\n#F  sched.g                    Bag of Schedulers                Ernest Chan\n#F\n##\n\n#############################################################################\n##\n##  Constants\n## \nPRINTDAG := false;\nRED := 0;           # INPUT NODES\nBLACK := 1;         # TEMP NODES\nBLUE := 2;          # OUTPUT NODES\nGREEN := 3;         # WEIRD! no pred and no succ\n\n\n############################################################################\n##\n##  Building the DAG\n##\n##  Node structure\n##    cmd:     the original statement\n##    pred:    a list of predecessors \n##    succ:    a list of successors \n##    id:      list of command outputs\n##\n\n############################################################################\n##\n#F  AddNode( <dag>, <cmd> ) . . makes a node for a variable/input/output\n## \nAddNode := function(dag, cmd)\n  local a;\n  a := rec(\n    id := Set(cmd.op_out() :: cmd.op_inout()),     # either var or nth\n    index := Length(dag),\n    pred := [],\n    succ := [],\n    cmd := cmd,\n  ); \n\n  Add(dag, a);\n\n  return a;\nend;\n\n############################################################################\n##  \n#F  GetNode( <dag> , <id> ) . . . . . . if node with the specified <id> is \n#F      in <dag>, then it is returned,  otherwise returns false\n##\nGetNode := function(dag, var)\n  local i;\n \n  i := Length(dag);\n  while i >= 1 do\n    if var in dag[i].id then\n      return dag[i];\n    fi;\n    i := i-1; \n  od;\n\n  return false;\nend;\n\n\n############################################################################\n##\n#F  AddEdges( <dag> , <cmd> ) . . . parses out the variables from \n#F      <exp>, and addes an edge from each of the variables to <node> in <dag> \n##\nAddEdges := function(dag, cmd) \n    local v, n, ops_in, node;\n    \n    ops_in := Set(cmd.op_in() :: cmd.op_inout());\n\n    node := AddNode(dag, cmd);\n\n    for v in ops_in do\n        n := GetNode(dag, v);\n        if n <> false then\n            Add(n.succ, node);\n            Add(node.pred, n);\n        fi;\n    od;\nend;\n\n\n##############################################################################\n##\n#F  BuildDag( <chain> ) . . . . builds the Dag by examining \n#F      each command statement in <chain>\n##\nBuildDag := function(chain_object) \n    local i, j, k, dag, newnode, old_id, newnode_name, f, objid, assignstmt, node;\n    if (ObjId(chain_object) = chain) then\n        dag := [];\n        for i in [1..Length(chain_object.cmds)] do\n            # for each assign statement, make appropriate changes to the Dag have to \n            #   1) add nodes if not in the graph\n            #   2) add edges            \n            AddEdges(dag, chain_object.cmds[i]);\n        od;\n        return dag;\n    else\n        Print(\"in function BuildDag: argument not a chain structure\");\n    fi;\nend;\n\n\n##############################################################################\n##\n#F  PrintDag ( <dag> , <bool> ) . . . . if true, prints the dag with its orders,\n#F      otherwise prints the dag with the names of the nodes                                  \n##\nPrintDag := function(dag, order)   \n  local count, _PrintDag, __PrintDag;\n\n  Print(\"digraph DAG {\\n\");     \n  \n  count := 0;\n\n  _PrintDag := function(dag, order) \n    local i,j,templist;\n\n    if Length(dag)<1 then return; fi;\n\n    if IsList(dag[1]) then\n      for i in [1..Length(dag)] do\n        Print(\"  subgraph cluster\");\n        Print(count);\n        count := count + 1;\n        Print(\" {\\n\");\n        _PrintDag(dag[i], order);\n        Print(\"  }\\n\");\n      od;\n    else \n      for i in [1..Length(dag)] do  \n        Print(\"  \");\n        if order then\n          Print(dag[i].order);\n        else\n          Print(\"\\\"\", dag[i].id, \"\\\"\");\n        fi;\n      od;\n      Print(\"\\n\");\n    fi;\n  end;\n\n  _PrintDag(dag, order);\n\n\n  __PrintDag := function(dag,order)\n    local i,j;\n   \n    if Length(dag)<1 then return; fi;\n \n    if IsList(dag[1]) then\n      for i in [1..Length(dag)] do\n        __PrintDag(dag[i], order);\n      od;         \n    else \n      for i in [1..Length(dag)] do\n        for j in [1..Length(dag[i].succ)] do\n          Print(\"  \");\n          if order then\n            Print(dag[i].order);\n          else \n            Print(\"\\\"\", dag[i].id, \"\\\"\"); \n          fi;\n          Print(\" -> \");\n          if order then\n            Print(dag[i].succ[j].order);\n          else \n            Print(\"\\\"\", dag[i].succ[j].id, \"\\\"\");        \n          fi;\n          Print(\"\\n\");\n        od;\n      od;\n    fi;\n  end;\n\n  __PrintDag(dag, order);\n\n  Print(\"}\\n\");\nend;\n\n\n\n##############################################################################\n##\n#F  OutputDag( <dag> , <string> ) . . . . . . . outputs a postscript file for \n#F      the dag with filename <string>.ps\n##\nOutputDag := function(dag, file)\n  if PRINTDAG then \n    PrintTo(\"temp\", PrintDag(dag, false));\n    SYS_EXEC(Concat(\"dot -Tps -o\",file,\" temp\"));   \n    SYS_EXEC(\"rm temp\");\n  fi;\nend;\n\n\n##############################################################################\n##\n#F  InitColor ( <dag> )  . . . . . . . . initialize color of nodes in a dag\n##\nInitColor := function(dag)\n  local i, j, pred_exists, succ_exists;\n\n  for i in [1..Length(dag)] do\n    pred_exists := Filtered(dag[i].pred, e->e in dag) <> [];\n    succ_exists := Filtered(dag[i].succ, e->e in dag) <> [];\n\n    if pred_exists then\n      if succ_exists then\n        dag[i].color := BLACK;  \n      else \n        dag[i].color := BLUE;\n      fi;\n    else\n      if succ_exists then\n        dag[i].color := RED;  \n      else \n        Error(\"Not a DAG\");\n      fi;\n    fi;\n  od;    \n  \nend;\n\n###############################################################################\n##\n#F  ColorPhase ( <dag> , <color> ) . . advances one step in the coloring phase\n##\nColorPhase := function(dag, color)\n  local i, j, pos, all_has_color, colorlist;\n\n  colorlist := [];\n\n  if color=RED then\n    for i in [1..Length(dag)] do\n      if dag[i].color = BLACK then \n        all_has_color := true;\n        for j in dag[i].pred do\n          if j in dag then\n            if j.color<>RED then\n              all_has_color := false;\n            fi;\n          fi;\n        od;\n        if all_has_color then\n          Add(colorlist, i);\n        fi;\n      fi;\n    od;\n  elif color=BLUE then\n    for i in [1..Length(dag)] do\n      if dag[i].color = BLACK then \n        all_has_color := true;\n        for j in dag[i].succ do\n          if j in dag then\n            if j.color<>BLUE then\n              all_has_color := false;\n            fi;\n          fi;\n        od;\n        if all_has_color then\n          dag[i].color := BLUE;\n        fi;\n      fi;\n    od;\n  fi;\n\n  for i in [1..Length(colorlist)] do\n    dag[colorlist[i]].color := color;  \n  od;\n\nend;\n\n\n###############################################################################\n##\n#F  SplitDag( <dag> ) . . . . . splits a dag into two (roughly equal) halves\n##\nSplitDag := function(dag)\n  local getComponent, set, newset, temp, answer, i;\n\n  getComponent := function(dag, set, node)\n    local i, j, pred, succ, tempset;\n   \n    pred := Filtered(node.pred, e->e in dag);\n    succ := Filtered(node.succ, e->e in dag);\n \n    if not node in set then\n      Add(set, node);\n      node.taken := true;\n    fi;\n    for i in pred do\n      if not i in set then \n        Add(set, i); \n        i.taken := true;\n        set := getComponent(dag, set, i);\n      fi;\n    od;\n    for i in succ do\n      if not i in set then \n        Add(set, i); \n        i.taken := true;\n        set := getComponent(dag, set, i);   \n      fi;\n    od;\n    return set;\n  end;\n\n  answer := [];\n  for i in dag do\n    i.taken := false;\n  od;\n \n  while not Length(Filtered(dag, x -> not x.taken)) = 0  do\n    set := Filtered(dag, x -> not x.taken);\n    temp := getComponent(dag, [], set[1]);\n    Add(answer, temp);\n  od;\n   \n  if Length(answer) = 1 then\n    return rec(graph := answer[1], modified := false);\n  else\n    return rec(graph := answer, modified := true);\n  fi;\nend; \n\n###############################################################################\n## \n#F  BreakDeps ( <dag> )  . . . . . . . . .  breaking one-to-many dependencies\n##\n\nBreakDeps := function (dag)\n  local subset, split, graph, i;\n  subset := List([1..Length(dag)], i -> rec( \n    node_index := i,\n    pred := Filtered(List(dag[i].pred, e->Position(dag, e)), e->e <> false),\n    succ := Filtered(List(dag[i].succ, e->Position(dag, e)), e->e <> false)));\n  split := Filtered(subset, r -> let( max := Maximum0(List(r.succ, i->Length(subset[i].succ))),\n             Length(r.pred)=0 and Length(r.succ) > 0 and max > 0 and Length(r.succ) > 2*max));\n  split := List(split, e->e.node_index);\n  if Length(split) > 0 then\n    graph := [[],[]];\n    for i in [1..Length(dag)] do\n      if i in split then\n        Add(graph[1], dag[i]);\n      else\n        Add(graph[2], dag[i]);\n      fi;\n    od;\n    return rec(graph := graph, modified := true);\n  else\n    return rec(graph := dag, modified := false);\n  fi;\nend;\n\n###############################################################################\n## \n#F  PartitionDag ( <dag> )  . . . . . . . . . . . . returns a partitioned dag \n##\nPartitionDag := function(dag)\n  local hasBlackNode, bBlackNodes, i, redlist, bluelist, serial;\n\n  serial := BreakDeps(dag);\n  if serial.modified then\n    return List(serial.graph, x->PartitionDag(x));\n  else \n    serial := SplitDag(dag);\n    if serial.modified then\n      return List(serial.graph, x->PartitionDag(x));\n    else\n    \n    # Parallel Split\n    if Length(dag)>=2 then\n      \n      InitColor(dag);\n      bBlackNodes := false;\n      while (Length(Filtered(dag, x -> x.color = BLACK))>0) do\n        bBlackNodes := true;\n        ColorPhase(dag, RED);\n        ColorPhase(dag, BLUE);     \n      od;\n  \n      if bBlackNodes then\n        redlist := Filtered(dag, x->x.color=RED);\n        bluelist := Filtered(dag, x->x.color=BLUE);\n        return [PartitionDag(redlist), PartitionDag(bluelist)];\n      fi;\n    fi; \n    return dag;\n    fi;\n  fi;\nend;\n\n##########################################################################\n##\n#F  ScheduleDag( <partitioned_dag> ) . . . . schedules a paritioned dag\n##\nScheduleDag := function(pdag)\n  local f, newlist, bigorder; \n\n  newlist := [];\n  bigorder := 0;\n \n  f := function(pdag)\n    local i,j,k,m;     \n    if Length(pdag)>0 then\n      if IsRec(pdag[1]) then          # use bfs for the order of the nodes        \n        for j in pdag do j.taken := false; j.order:=0; od;\n        while Length(Filtered(pdag, x->not x.taken))>0 do\n          k := Filtered(pdag, x -> not x.taken);\n          # want all nodes not taken, with preds either outside pdag or taken\n          for j in k do\n            m := true;\n            for i in j.pred do\n              if (i in pdag) and (not i.taken) then\n                m := false;\n              fi;\n            od; \n            if m then \n               j.taken := true; \n               Add(newlist, j.cmd); \n               bigorder := bigorder + 1;\n               j.order := bigorder;  \n            fi;\n          od;\n        od;\n      elif IsList(pdag[1]) then\n        for i in [1..Length(pdag)] do\n           f(pdag[i]);\n        od;        \n      fi;\n    fi; \n  end;\n\n  f(pdag);\n  return newlist;\n  \nend;\n\n\n\n###############################################################################\n##  \n#F  RandomScheduleDag( <dag> ) . . . . . . schedules a dag in a random manner\n##\nRandomScheduleDag := function(dag)\n  local f, newlist, bigorder, list_of_recs; \n\n  newlist := [];\n  bigorder := 0;\n \n  f := function(dag)\n    local i,j,k,m;     \n    if Length(dag)>0 then\n      if IsRec(dag[1]) then         \n        for j in dag do j.taken := false; j.order:=0; od;\n        while Length(Filtered(dag, x->not x.taken))>0 do\n          k := Filtered(dag, x -> not x.taken);\n          list_of_recs := [];   \n          # want all nodes not taken, with preds either outside dag or taken\n          for j in k do\n            m := true;\n            for i in j.pred do\n              if (not i.taken) then\n                m := false;\n              fi;\n            od; \n            if m then \n              Add(list_of_recs, j);\n            fi;\n          od;   \n          j := Random(list_of_recs);\n          j.taken := true; \n          Add(newlist, j.cmd); \n          bigorder := bigorder + 1;\n          j.order := bigorder;  \n        od;\n      fi;\n    fi; \n  end;\n\n  f(dag);\n  return chain(Filtered(newlist, x -> x <> 0));\n  \nend;\n\n\n\n###############################################################################\n##\n#F  GetCompleteSchedules( <dag>, <int_limit> ) . . . . . get complete set of \n#F      schedules of a given dag, with the number of limit of the number of \n#F      schedules\n##\nGetCompleteSchedules := function(dag, limit)\n  local f, newlist, bigorder, li, dag_length, j; \n\n  newlist := [];\n  dag_length := Length(dag);\n \n  f := function(dag, li, bigorder)\n    local i,j,k,m, sel, newdag, li2;\n\n    if Length(newlist) >= limit then\n      return;\n    fi; \n      \n    if Length(li) = dag_length then\n      m := Filtered(li, x -> x<>0);\n      if Length(Filtered(newlist, x->x=m))<=0 then\n        Add(newlist, m);\n      fi;\n    elif Length(dag)>0 then\n      if IsRec(dag[1]) then          # use bfs for the order of the nodes        \n        newdag := Copy(dag);          \n        # want all nodes not taken, with preds either outside dag or taken\n        for j in [1..Length(dag)] do\n          if not dag[j].taken  then\n            m := true;\n            for i in dag[j].pred do\n              if (not i.taken) then\n                m := false;\n              fi;\n            od; \n            if m then\n              dag[j].taken := true; \n              li2 := Copy(li);\n              if dag[j].cmd <> 0 then\n                Add(li2, j); \n              else \n                Add(li2, 0);\n              fi;\n              dag[j].order := bigorder;  \n              newdag := Copy(dag);\n              f(newdag, li2, bigorder + 1); \n              dag[j].order := 0;\n              dag[j].taken := false;          \n            fi;\n          fi;\n        od;         \n      fi;\n    fi; \n  end;\n\n  for j in dag do j.taken := false; j.order:=0; od;\n  f(dag, [], 0);\n\n  newlist := List(newlist, x -> chain(List(x, y -> dag[y].cmd)));\n\n  return newlist;  \nend;\n\n\n\n\n\n\n###############################################################################\n##\n#F  FFTWScheduleAssignments( <chain> ) . . . schedule assignments \n#F      using FFTW's scheduler\n##\nFFTWScheduleAssignments := function(chain_obj)\n  local dag, pdag, schedule;\n  \n  dag := BuildDag(chain_obj);\n  pdag := PartitionDag(dag); #SplitDagByDataType(dag);\n\n  schedule := chain(ScheduleDag(pdag));\n\n  if PRINTDAG then   \n    PrintTo(\"SA_dag\", PrintDag(dag, false));\n    SYS_EXEC(\"dot -Tps -odag.ps SA_dag\");\n    SYS_EXEC(\"rm SA_dag\");\n\n    PrintTo(\"SA_dag\", PrintDag(dag, true));\n    SYS_EXEC(\"dot -Tps -oorder.ps SA_dag\");\n    SYS_EXEC(\"rm SA_dag\");\n\n    PrintTo(\"SA_pdag\", PrintDag(pdag, false));\n    SYS_EXEC(\"dot -Tps -opdag.ps SA_pdag\");\n    SYS_EXEC(\"rm SA_pdag\");\n\n    PrintTo(\"SA_oldschedule\", chain_obj);\n    PrintTo(\"SA_newschedule\", schedule);  \n\n    PrintTo(\"SA_order\", PrintDag(pdag, true));\n    SYS_EXEC(\"dot -Tps -oporder.ps SA_order\");\n    SYS_EXEC(\"rm SA_order\");\n  fi;\n\n  return schedule; \nend;\n\n###############################################################################\n##\n#F  RandomScheduleAssignments(<chain>, <int>) . . . generates a random schedule\n##\nRandomScheduleAssignments := function(chain_obj)\n  local dag, schedule;\n  \n  dag := BuildDag(chain_obj);\n\n  schedule := RandomScheduleDag(dag);\n\n  if PRINTDAG then \n    PrintTo(\"SA_dag\", PrintDag(dag, false));\n    SYS_EXEC(\"dot -Tps -ordag.ps SA_dag\");\n    SYS_EXEC(\"rm SA_dag\");\n\n    PrintTo(\"SA_oldschedule\", chain_obj);\n    PrintTo(\"SA_newschedule\", schedule);  \n\n    PrintTo(\"SA_dag\", PrintDag(dag, true));\n    SYS_EXEC(\"dot -Tps -ororder.ps SA_dag\");\n    SYS_EXEC(\"rm SA_dag\");\n\n  fi;\n\n  return schedule; \nend;\n\n###############################################################################\n##\n#F  CompleteScheduleAssignments (<chain>, <int_limit>) . . . \n#F      generates all the schedules (with limit as the number of schedules \n#F      generated)\n##\nCompleteScheduleAssignments := function(chain_obj, number)\n  local dag;\n  \n  dag := BuildDag(chain_obj);\n  return GetCompleteSchedules(dag, number);\n\nend;\n\n\n###############################################################################\n##\n#F  EdwardScheduleAssignments( <chain>, <int_reg>) . . . using\n#F      Edward's scheduling algorithm, generate a schedule\n##\nEdwardScheduleAssignments := function(chain_obj, n)\n  local dag,i,j,k,l,m,mincost,minindex,readylist, final, registers, getcost, costlist;\n  \n  dag := BuildDag(chain_obj);\n\n  # init readylist and taken\n  readylist := Filtered(dag, x -> x.pred=[]);    \n  for i in dag do\n    i.taken := false;\n  od;\n  \n  \n  final := [];\n  registers := List([1..n], x->1);\n\n  getcost := function(node)\n    local i,j;\n    i:=0;\n    for j in node.pred do\n      if not (i in registers) then\n        i:=i+2; \n      else\n        i:=i-1;\n      fi;\n    od;\n    return i;  \n  end;\n\n  while (Length(readylist)>0) do\n     # for each node in readylist, determine which to pick \n     #   among the nodes in the readylist, pick one with   \n     #   least cost\n     #   1) determine cost\n     #   2) determine min\n     #   3) take min\n     #\n     #   N.B. maintain registers\n     costlist := List(readylist, x->getcost(x));\n     minindex := 1;\n     mincost := costlist[1];\n#     Print(costlist, \"\\n\");\n#     Print(\"reg = \", Length(Filtered(registers, x->x<>1)), \"\\n\");\n\n     for i in [1..Length(costlist)] do \n       if mincost > costlist[i] then\n         minindex := i;\n         mincost := costlist[i];\n       fi; \n     od; \n\n     k := readylist[i];\n#     Print(k.original, \"\\n\");\n\n     # update registers\n     if k in registers then\n       i := Position(registers, k);\n       j := [k];\n       for l in [1..i-1] do\n         Add(j, registers[l]);  \n       od; \n       for l in [i+1..n] do\n         Add(j, registers[l]);  \n       od; \n       registers := j;\n     else\n       j := [k];\n       for l in [1..n-1] do\n         Add(j, registers[l]);  \n       od; \n       registers := j; \n     fi; \n\n     readylist := Filtered(readylist, x -> not x=k);\n     Add(final, k.cmd);\n     k.taken := true;\n\n     for i in k.succ do\n       if not i.taken then \n         l := true;\n         for j in i.pred do\n           if not j.taken then\n             l := false;\n           fi;\n         od;\n         if l then  \n           Add(readylist, i);\n         fi;\n       fi;\n     od;\n\n\n  od;\n  \n\n  return chain(Filtered(final, x->x<>0));  \n\nend;\n\n###############################################################################\n##\n#F  ImFFTWScheduleAssignments( <chain> ) . . . using an algorithm\n#F      similar to Edwards scheduler, generate a schedule\n##\nImFFTWScheduleAssignments := function(chain_obj)\n  local dag, first_level, second_level, output_nodes,i,j,k, color, color_no, li;\n  \n  dag := BuildDag(chain_obj);\n\n  # label second level nodes\n  for i in dag do\n    i.level := 3;        # OTHER LEVEL\n  od;\n  first_level := Filtered(dag, x -> x.pred=[]);    \n  second_level := [];\n  for i in first_level do\n    i.level:= 1;         \n    for j in i.succ do\n      j.level:= 2;\n      if not (j in second_level) then\n        Add(second_level, j);\n      fi;\n    od;\n  od;     \n\n  # get outputnodes;\n  output_nodes := Filtered(dag, x->x.succ = []);\n \n  # color output nodes\n  for i in dag do\n    i.color := 0;  # means uninitialized\n  od;\n  color := function(node, c)\n    local i;\n    if not node.color = 0 then\n      return;\n    elif node.level=3 then\n      node.color := c;\n      for i in node.pred do\n        color(i, c);\n      od;\n      for i in node.succ do\n        color(i, c);\n      od;\n    elif node.level = 2 then\n      if node.color = 0 then\n        node.color := c;\n      fi;\n    fi;\n  end;\n\n  color_no := 0;\n  for i in output_nodes do\n    if i.color=0 then\n      color_no := color_no + 1;\n      color(i, color_no);\n    fi;\n  od;  \n  \n\n  # for each color, schedule graph\n  li := [];\n  for i in [1..color_no] do\n    j := Filtered(dag, x -> x.color=i);\n    j := ScheduleDag(j);    \n    for k in [1..Length(j)] do\n      Add(li, j[k]);\n    od;\n  od;\n  \n\n  # output statements;\n  return chain(li);  \nend;\n\n\n# tochain := x -> Cond(IsChain(x), Copy(x), chain(Copy(x)));\n\n# bsplit := function(code)\n#     local dims;\n#     dims := code.dimensions;\n#     code := When(IsBound(code.cmd), code.cmd, code);\n#     code := FlattenCode(BinSplit(tochain(code)));\n#     code := Compile.declareVars(code);\n#     code.dimensions := dims;\n#     return code;\n# end;\n\n# sched := function(code)\n#     local dims;\n#     dims := code.dimensions;\n#     code := When(IsBound(code.cmd), code.cmd, code);\n#     code := FFTWScheduleAssignments(tochain(code));\n#     code := Compile.declareVars(code);\n#     code.dimensions := dims;\n#     return code;\n# end;\n\n# sched2 := function(code)\n#     local dims;\n#     dims := code.dimensions;\n#     code := When(IsBound(code.cmd), code.cmd, code);\n#     code := EdwardScheduleAssignments(tochain(code), 8);\n#     code := Compile.declareVars(code);\n#     code.dimensions := dims;\n#     return code;\n# end;\n\n# randsched := function(code)\n#     local dims;\n#     dims := code.dimensions;\n#     code := When(IsBound(code.cmd), code.cmd, code);\n#     code := RandomScheduleAssignments(tochain(code));\n#     code := Compile.declareVars(code);\n#     code.dimensions := dims;\n#     return code;\n# end;\n\n\n\n", "meta": {"hexsha": "90a67023572686cc41565d13a8ee778dd19ddf64", "size": 21636, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/sched.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/sched.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/sched.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 24.7268571429, "max_line_length": 95, "alphanum_fraction": 0.4878443335, "num_tokens": 5860, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.30735800417608683, "lm_q2_score": 0.03567854780163102, "lm_q1q2_score": 0.010966087244210422}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n########################################################################\n# If RulesXYOffset correctly takes out base addresses out of H into RecursStep\n# we can use the following hack to pass into the function only the stride\n#\n# H.codeletParNums := [4];\n# H.signature := self >> [IntVar(\"s\")];\n# H.mkCodelet := self >> let(ss := self.signature(), H(self.params[1], self.params[2], 0, ss[1]));\n#\n#########################################################################\n\nCollectRecursSteps := s -> Collect(s, RecursStep);\n\n#F Shape(<obj>) - returns a LISP-style structural list, i.e. add(1,2) -> [add, 1, 2]\n#F\nShape := x-> Cond(IsRec(x) and IsBound(x.shape), x.shape(),  x);\n\nClassSPL.shape := self >> Concatenation([ObjId(self)],\n    List(self.rChildren(), Shape));\n\nExp.shape := self >> Concatenation([ObjId(self)],\n    List(self.rChildren(), Shape));\n\nRTWrap.shape := self >> self.rt.node.shape();\n\n#F CodeletShape(<obj>) - returns a LISP-style structural list for a codelet\n#F    In this case parameters that are passed into a codelet functions do not\n#F    show up, i.e. Scat(H(16,2,0,1))*DFT(16)*... -> [Compose, [Scat, H], DFT, ...]\n#F\nCodeletShape := x-> Cond(IsRec(x) and IsBound(x.codeletShape), x.codeletShape(),  x);\nClassSPL.codeletShape := self >> Concatenation([ObjId(self)],\n    List(self.rChildren(), CodeletShape));\nFuncClassOper.codeletShape := ClassSPL.codeletShape;\nRTWrap.codeletShape := self >> CodeletShape(self.rt.node);\nNonTerminal.codeletShape := self >> Concatenation(\n    [ObjId(self)],\n    List(self.params, CodeletShape),\n    When(self.transposed, [\"T\"], []));\n\n#F CodeletSignature(<obj>) - codelet function signature\n#F\nCodeletSignature := x-> Cond(IsRec(x) and IsBound(x.signature), x.signature(),\n    IsRec(x), Error(\".signature() field missing (objid = \", ObjId(x), \")\"), []);\nClassSPL.signature := self >> Concatenation(List(self.rChildren(), CodeletSignature));\nFuncClassOper.signature := ClassSPL.signature;\nRTWrap.signature := self >> CodeletSignature(self.rt.node);\nValue.signature := self >> [];\n\n#F CodeletParams(<obj>) - codelet function call params\n#F\nCodeletParams := x-> Cond(IsRec(x) and IsBound(x.codeletParams), x.codeletParams(),\n    IsRec(x), Error(\".codeletParams() field missing (objid = \", ObjId(x), \")\"), []);\nClassSPL.codeletParams := self >> Concatenation(List(self.rChildren(), CodeletParams));\nFuncClassOper.codeletParams := ClassSPL.codeletParams;\nRTWrap.codeletParams := self >> CodeletParams(self.rt.node);\nValue.codeletParams := self >> [];\n\n#F MkCodelet(<obj>) - generalize <obj> by changing codelet params to be variables\n#F\nMkCodelet := x -> Cond(IsRec(x) and IsBound(x.mkCodelet), x.mkCodelet(),\n    IsRec(x), Error(\".mkCodelet() field missing (objid = \", ObjId(x), \")\"), x);\n#ClassSPL.codeletParams := self >> Concatenation(List(self.rChildren(), CodeletParams));\nClassSPL.mkCodelet := self >> ApplyFunc(ObjId(self),\n    List(self.rChildren(), MkCodelet));\nFuncClassOper.mkCodelet := BaseOperation.mkCodelet;\nRTWrap.mkCodelet := self >> self;\nNonTerminal.mkCodelet := self >> self;\nValue.mkCodelet := self >> self;\n\n#F CodeletName(<shape>)\n#F\nCodeletName := shape -> Cond(\n    IsInt(shape),\n        When(shape < 0, Concat(\"_n\", String(-shape)), Concat(\"_\",String(shape))),\n    IsRat(shape),\n        Concat(When(shape < 0, \"_n\", \"_\"), StringInt(AbsInt(Numerator(shape))), \"d\", StringInt(Denominator(shape))),\n    IsValue(shape),\n        CodeletName(shape.v),\n\n    IsRec(shape), Concat(When(IsBound(shape.codeletNameNo_), \"\", \"_\"),\n    When(IsBound(shape.codeletName), shape.codeletName, shape.name)),\n    IsString(shape),\n        shape,\n\n    IsList(shape) and not (Length(shape) > 2 and IsRec(shape[1]) and IsBound(shape[1].codeletNameInfix)),\n        When(Length(shape)=2 and not (IsRec(shape[2]) or IsList(shape[2])),\n         Concat(\"\", CodeletName(shape[1]), String(shape[2])),\n         Concat(\"\", Concatenation(List(shape, CodeletName)))),\n\n    IsList(shape), let(cc := shape{[2..Length(shape)-1]}, op := shape[1].codeletName,\n        Concat(\n        ConcatList(cc, x->Concat(CodeletName(x), \"_\", op)), CodeletName(Last(shape)))),\n\n    IsFunc(shape), \"GAPFunc\",\n\n    Concat(\"_\", String(shape)));\n\n####################################################################################\nCompose.codeletNameNo_ := true;\nScat.codeletNameNo_ := true;\nfTensor.codeletNameNo_ := true;\nCompose.codeletName := \"\";\nfId.codeletName := \"I\";\nfTensor.codeletName := \"x\";\nDiag.codeletName := \"D\";\nRCDiag.codeletName := \"RD\";\nGath.codeletName:= \"G\";\nScat.codeletName:= \"S\";\n\nH.codeletShape     := self >> ObjId(self);\nFList.codeletShape := self >> Concatenation([ObjId(self)], self.list);\nFData.codeletShape := self >> ObjId(self);\nFDataOfs.codeletShape := self >> ObjId(self);\n#RCDiag.codeletShape:= self >> ObjId(self);\n\nH.signature     := self >> List([\"b\", \"s\"], IntVar);\nRM.signature    := self >> List([\"N\", \"phi\", \"g\"], IntVar);\nFData.signature := self >> [ var.fresh_t(\"D\", TPtr(self.var.t.t)) ];\nFDataOfs.signature := self >> [ var.fresh_t(\"D\", TPtr(self.var.t.t)) ];\nFList.signature := self >> [];\n\nFuncClass.codeletParams := self >> self.params{self.codeletParNums};\nFuncClass.codeletParNums := [];\nFuncClass.mkCodelet := self >> let(sig := self.signature(), ApplyFunc(ObjId(self),\n    List([1..Length(self.params)], i -> let(parnums := self.codeletParNums,\n    When(i in parnums, sig[Position(parnums,i)], self.params[i])))));\nSym.mkCodelet := FuncClass.mkCodelet;\nSym.codeletParNums := [];\n\nH.codeletParNums    := [3, 4];\nRM.codeletParNums   := [1, 3, 4];\n\nFList.codeletParams := self >> [];\nFData.codeletParams := self >> [self.var];\nFData.mkCodelet := self >> FDataOfs(self.signature()[1], self.domain(), 0);\n\nFDataOfs.codeletParams := self >> When(self.ofs=0, [self.var], [self.var+self.ofs]);\nFDataOfs.mkCodelet := self >> FDataOfs(self.signature()[1], self.len, 0);\nFList.mkCodelet := self >> self;\n\n#\n# Here we set some fields required by libgen for objects defined in transforms.*\n# This system will change in the future to require less fields, and be\n# more streamlined.\n#\n# Note: This code fragment depends on transforms. NOTE.\n#\nDFT.codeletShape := self >> When(self.params[2]=1, [ObjId(self), self.params[1]],\n                                  [ObjId(self), self.params[1], self.params[2]]);\n\nBHD.codeletShape := self >> ObjId(self);\nBHD.mkCodelet    := self >> self; # NOTE?\n\nTwid.signature  := self >> [ ];\nTwid.codeletShape  := self >> [ObjId(self), self.params[1], self.params[2], self.params[3]];\nTwid.codeletParams := self >> [];\n\nBH.signature    := self >> List([\"R\", \"b\", \"s\"], IntVar);\nBH.codeletShape    := self >> ObjId(self);\nBH.codeletParNums  := [2, 4, 5];\n\nRCData.signature  := self >> self.func.signature();\nRCData.codeletShape  := self >> [ObjId(self), CodeletShape(self.func)];\nRCData.codeletParams := self >> self.func.codeletParams();\nRCData.mkCodelet := self >> ObjId(self)(self.func.mkCodelet());\n\nFConj.signature  := self >> self.func.signature();\nFConj.codeletShape  := self >> [ObjId(self), CodeletShape(self.func)];\nFConj.codeletParams := self >> self.func.codeletParams();\nFConj.mkCodelet := self >> ObjId(self)(self.func.mkCodelet());\n\nTyp.signature := self >> [];\nTyp.codeletShape := self >> [ObjId(self)];\nTyp.codeletParams := self >> [];\nTyp.mkCodelet := self >> self;\n", "meta": {"hexsha": "27d5562f32f5bb433dba7035e880e311afe35423", "size": 7361, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/libgen/signature.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/libgen/signature.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/libgen/signature.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 40.8944444444, "max_line_length": 116, "alphanum_fraction": 0.645156908, "num_tokens": 2030, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.37754066879814546, "lm_q2_score": 0.028870907259630017, "lm_q1q2_score": 0.01089994163560995}}
{"text": "{\"grid\":{\"rows\":8,\"cols\":10,\"cellmem\":[[[1,true],[2,true],[3,true],[4,true],[5,true],[6,true],[7,true],[8,true],[9,true],[0,true],[7,true]],[[2,true],[3,true],[4,true],[5,true],[6,true],[7,true],[8,true],[9,true],[0,true],[1,true],[3,true]],[[3,true],[4,true],[5,true],[6,true],[7,true],[8,true],[9,true],[0,true],[1,true],[2,true],[1,true]],[[4,true],[5,true],[6,true],[4,true],[8,true],[9,true],[0,true],[1,true],[2,true],[3,true],[2,true]],[[5,true],[6,true],[7,true],[8,true],[9,true],[0,true],[1,true],[4,true],[3,true],[4,true],[5,true]],[[6,true],[7,true],[8,true],[9,true],[0,true],[1,true],[2,true],[3,true],[4,true],[5,true],[9,true]],[[7,true],[8,true],[9,true],[0,true],[1,true],[2,true],[3,true],[4,true],[5,true],[6,true],[7,true]],[[8,true],[9,true],[0,true],[1,true],[2,true],[3,true],[4,true],[5,true],[6,true],[7,true],[8,true]]],\"blocks\":[[1,3],[6,3],[2,5],[1,7],[1,1],[4,3]]},\"robo\":[[{\"roboname\":\"r1.rbt\",\"allowBrick\":true,\"robomem\":4},[4,7]]]}", "meta": {"hexsha": "a02fcee973bf47725b59c455c3a4a5d684eab5bc", "size": 965, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "src/result.gi", "max_stars_repo_name": "HelloSunilSaini/RoboSONE", "max_stars_repo_head_hexsha": "981d095013d0b95dd81da9d2f647e45849d95b42", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/result.gi", "max_issues_repo_name": "HelloSunilSaini/RoboSONE", "max_issues_repo_head_hexsha": "981d095013d0b95dd81da9d2f647e45849d95b42", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/result.gi", "max_forks_repo_name": "HelloSunilSaini/RoboSONE", "max_forks_repo_head_hexsha": "981d095013d0b95dd81da9d2f647e45849d95b42", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 965.0, "max_line_length": 965, "alphanum_fraction": 0.5398963731, "num_tokens": 354, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4416730203630095, "lm_q2_score": 0.024423092006849553, "lm_q1q2_score": 0.010787020813268917}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# helps translate VTensorInd(Scat(f), i) -> VScat_sv(f \\tensor_i fId(i.range))\n_fTensorInd := function(fnc, idx)\n    local ds, irng, fdom, nidx, lambda;\n    irng := idx.range;\n\n    if not (idx in fnc.free()) then\n        return fTensor(fnc, fId(irng));\n    fi;\n\n    fdom := fnc.domain();\n    nidx := Ind(irng*fdom);\n\n    lambda := Lambda(nidx, imod(nidx, irng)+V(irng)*Lambda(idx, fnc.at(idiv(nidx, irng))).at(imod(nidx, irng))).setRange(V(fnc.range())*V(irng));\n    return lambda;\nend;\n\n#prevent VRC Rules from introducing VRCL/VRCR in the wrong spot\nDontNeedSpecialVRC := e->not ForAny(e.children(), f->IsBound(f.needSpecialVRC) and f.needSpecialVRC());\n\n# Test for VRCs that, for any construct, has a needSeparateVRC set\nanyNeedSeparateVRC := e->ForAny(e.children(), f->IsBound(f.needSeparateVRC) and f.needSeparateVRC());\n\n# Test for VRCs that for all constructs, cannot change data formats\nTotallyNonChangeable := function(e)\n    if ObjId(e)=Compose or ObjId(e)=ComposeDists then\n      return(ForAll(e.children(), f->IsBound(f.totallyCannotChangeDataFormat) and f.totallyCannotChangeDataFormat()));\n    else\n      return(IsBound(e.totallyCannotChangeDataFormat) and e.totallyCannotChangeDataFormat());\n    fi;\nend;\n\n# Test for VRCs that have at least one construct that cannot change data formats\nHasNonchangeable := function(e)\n    if ObjId(e)=Compose or ObjId(e)=ComposeDists then\n      return(ForAny(e.children(), f->IsBound(f.cannotChangeDataFormat) and f.cannotChangeDataFormat()));\n    else\n      return(IsBound(e.cannotChangeDataFormat) and e.cannotChangeDataFormat());\n    fi;\nend;\n\nNoSpecialOrNonchangeableVRC := e->(DontNeedSpecialVRC(e) and not HasNonchangeable(e));\nNoSpecialAndChangeableVRC   := e->(DontNeedSpecialVRC(e) and     HasNonchangeable(e));\n\nHandleCannotChangeDataFormatVRC := function(vrc, ch, v)\n    local remch, ele, left, right, i, vrc1, vrc2;\n\n    remch := Compose(Drop(ch, 1));\n    #Error(\"BP: cannotChangeDataFormatVRC\");\n\n    if vrc=VRC then\n        # NOTE: How do we handle this?\n        # If ALL children cannot change data format, simply distribute the VRC amongst them\n\n        if TotallyNonChangeable(Compose(ch)) then\n            return( Compose(VRC(ch[1], v), VRC(remch,v)) );\n        fi;\n\n        # if any of the children NOTE: this is inefficient: what we really\n        # should to is to bunch together the children that needSeparateVRC, and\n        # the children that are regular, and handle them separately. For now,\n        # this hack works because we should have no cases where such children\n        # will be mixed together.\n\n        if anyNeedSeparateVRC(Compose(ch)) then\n            return( Compose(VRC(ch[1], v), VRC(remch,v)) );\n        fi;\n\n\n        # If not, we must do a VRCR/VRCL split\n        # Find the rightmost child that can change dataformats. That and\n        # everything right of that becomes a VRCL. Everything left of that is a VRCR.\n\n        # Bad (but good:)) HACK: for things of the form S*A*G, where S and G\n        # cannot change data formats, stuff the VRC into A, and hope that A is\n        # big enough to handle it.\n\n        if Length(ch)=3 and TotallyNonChangeable(ch[1]) and TotallyNonChangeable(ch[3]) then\n          return(Compose( VRC(ch[1], v), VRC(ch[2], v), VRC(ch[3], v) ));\n        fi;\n\n        for i in Reversed([1..Length(ch)]) do\n          if not TotallyNonChangeable(ch[i]) then\n            # We found the rightmost child\n            #Error(\"VRC: BP\");\n            left  := Compose(List([1..(i-1)], e->ch[e]));\n            right := Compose(List([i..Length(ch)], e->ch[e]));\n            #Error(\"VRC: BP\");\n            return( Compose( VRCR(left, v), VRCL(right, v) ) );\n          fi;\n        od;\n\n        #Error(\"BP: cannotChangeDataformatVRC: VRC needs to be split into VRCL/VRCR\");\n    fi;\n\n    if vrc=VRCLR then\n        # This should really be handled as if the cannotChangeDataformat doesn't exist.\n        #Error(\"VRCLR: BP\");\n        vrc1 := [[VRCL, VRCR], [VRCLR, VRCLR]];\n        vrc2 := When(NeedInterleavedRight(ch[1]) or NeedInterleavedLeft(ch[2]), vrc1[1], vrc1[2]);\n        #Error(\"VRCLR: BP\");\n        return( Compose(vrc2[1](ch[1], v), vrc2[2](Compose(Drop(ch, 1)), v)) );\n    fi;\n\n    if vrc=VRCL then\n        # Find the first child from the right that is capable of making a\n        # format change. We then have 2 cases.\n\n        # Note: we really have 3 cases to be general: VRCL -> (VRCLR, VRCL, VRC)\n        # Sometimes, the LR won't exist, and sometimes, the VRC won't exist\n        # But it's easier to code if we only always break down to 2 cases\n\n        for i in Reversed([1..Length(ch)]) do\n          if not TotallyNonChangeable(ch[i]) then\n            # We found the child that will do the dataformat change (VRCL)\n            # We now have 2 cases.\n            #   Case 1: VRCL -> (VRCL,  VRC)   (found child is not rightmost)\n            #   Case 2: VRCL -> (VRCLR, VRCL)  (found child is rightmost)\n\n            if i <> Length(ch) then # Case 1\n              left  := Compose(List([1..i],              e->ch[e]));\n              right := Compose(List([(i+1)..Length(ch)], e->ch[e]));\n              #Error(\"BP:VRCL1\\n, ---------VRCL(left)---------\", left, \"\\n---------VRC(right)--------\", right);\n              return( Compose( VRCL(left, v), VRC(right, v) ) );\n            else                    # Case 2\n              left  := Compose(List([1..(i-1)], e->ch[e]));\n              right := ch[i];\n              #Error(\"BP:VRCL2\\n, ---------VRCLR(left)---------\", left, \"\\n---------VRCL(right)--------\", right);\n              return( Compose( VRCLR(left, v), VRCL(right, v) ) );\n            fi;\n          fi;\n        od;\n        Error(\"cannotChangeDataFormatVRC/L: Didn't find an appropriate child\");\n    fi;\n\n    if vrc=VRCR then\n        # Find the first child from the left that is capable of making a\n        # format change. We then have 2 cases.\n\n        for i in [1..Length(ch)] do\n          if not TotallyNonChangeable(ch[i]) then\n            # We found the child that will do the dataformat change (VRCR)\n            # We now have 2 cases.\n            #   Case 1: VRCR -> (VRC,  VRCR)   (found child is not leftmost)\n            #   Case 2: VRCR -> (VRCR, VRCLR)  (found child is leftmost)\n\n            if i <> 1 then # Case 1\n              left  := Compose(List([1..(i-1)],      e->ch[e]));\n              right := Compose(List([i..Length(ch)], e->ch[e]));\n              #Error(\"BP:VRCR1\\n, ---------VRC(left)---------\", left, \"\\n---------VRCR(right)--------\", right);\n              return( Compose( VRC(left, v), VRCR(right, v) ) );\n            else                    # Case 2\n              left  := ch[i];\n              right := Compose(List([(i+1)..Length(ch)], e->ch[e]));\n              #Error(\"BP:VRCR2\\n, ---------VRCR(left)---------\", left, \"\\n---------VRCLR(right)--------\", right);\n              return( Compose( VRCR(left, v), VRCLR(right, v) ) );\n            fi;\n          fi;\n        od;\n        Error(\"cannotChangeDataFormatVRC/R: Didn't find an appropriate child\");\n\n    fi;\n\n    Error(\"cannotChangeDataFormat: I don't know what to do with this one. None of the cases matched.\");\n\n#            vrc=VRCL and     HasNonchangeable(ch1) and not HasNonchangeable(ch2), Compose(VRCLR(ch1, v), VRCL(remch, v) ),\n#            vrc=VRCL and not HasNonchangeable(ch1) and     HasNonchangeable(ch2), Compose(VRCL(ch1, v),  VRC(remch,v)   ),\n#            vrc=VRCL and     HasNonchangeable(ch1) and     HasNonchangeable(ch2),\n#                When(NeedInterleavedRight(ch1) or NeedInterleavedLeft(ch2), Compose(VRCL(I(ch1.dims()[1]),v),  VRC(ch,v)),\n#                                                                            ComposeVRCLR(ch,v), VRCL(I(ch1.dims()[1]),v)),\n#\n#            vrc=VRCR and     HasNonchangeable(ch1) and not HasNonchangeable(ch2), Compose(VRC(ch1, v),   VRCR(remch, v) ),\n#            vrc=VRCR and not HasNonchangeable(ch1) and     HasNonchangeable(ch2), Compose(VRCR(ch1, v),  VRCLR(remch,v) ),\n#            vrc=VRCR and     HasNonchangeable(ch1) and     HasNonchangeable(ch2),\n#                When(NeedInterleavedRight(ch1) or NeedInterleavedLeft(ch2), Compose(VRCL(I(ch1.dims()[1]),v),  VRC(ch,v)),\n#                                                                            ComposeVRCLR(ch,v), VRCL(I(ch1.dims()[1]),v))\n#          )\n#        )\n#    ),\n\nend;\n\n\n\nScat.needInterleavedLeft:=False;\nScat.needInterleavedRight:=False;\n\n# NOTE: Why were these set to False???\nGath.needInterleavedLeft:=True;\nGath.needInterleavedRight:=True;\n\nVBlk.needInterleavedLeft:=False;\nVBlk.needInterleavedRight:=False;\n\n# NOTE: remove Diag here\nDiag.needInterleavedLeft:=False;\nDiag.needInterleavedRight:=False;\n\nInplace.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nInplace.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nInplace.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nInplace.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nBB.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nBB.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nBB.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nBB.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nVContainer.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nVContainer.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nVContainer.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nVContainer.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nNoDiagPullin.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nNoDiagPullin.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nNoDiagPullin.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nNoDiagPullin.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nNoDiagPullinLeft.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nNoDiagPullinLeft.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nNoDiagPullinLeft.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nNoDiagPullinLeft.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nNoDiagPullinRight.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nNoDiagPullinRight.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nNoDiagPullinRight.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nNoDiagPullinRight.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nSymSPL.needInterleavedRight := self >> self.child(1).needInterleavedRight();\nSymSPL.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nSymSPL.cannotChangeDataFormat := self >> self.child(1).cannotChangeDataFormat();\nSymSPL.totallyCannotChangeDataFormat := self >> self.child(1).totallyCannotChangeDataFormat();\n\nVGath_sv.rcVariant := RCVGath_sv;\nVScat_sv.rcVariant := RCVScat_sv;\n\nRCVGath_sv.vecVariant := (f,v)->VGath(f,v);\nRCVScat_sv.vecVariant := (f,v)->VScat(f,v);\n\nScatGath.needInterleavedLeft:=True;\nScatGath.needInterleavedRight:=True;\n\nSMPBarrier.needInterleavedLeft := (self) >> self.child(1).needInterleavedLeft();\nSMPBarrier.needInterleavedRight := (self) >> self.child(1).needInterleavedRight();\n\n_VRCFamily := [VRC, VRCL, VRCR, VRCLR];\n\nClass(RulesVRC, RuleSet);\nRewriteRules(RulesVRC, rec(\n    VRC_VContainer := Rule([@(1, _VRCFamily), @(2, VContainer)], \n\te -> let(cont := @(2).val, \n\t    VContainer(ObjId(@(1).val)(cont.child(1), @(1).val.v), cont.isa))),\n\n    VRC_ISum := Rule([@(1, _VRCFamily), @(2, [ISum, SMPSum, SMPBarrier, SUM])], e->let(s := @(2).val,\n    CopyFields(s, rec(_children := List(s.children(), c->ObjId(@(1).val)(c, @(1).val.v)),\n                  dimensions := @(1).val.dimensions)))),\n\n    VRC_Container := Rule([@(1, _VRCFamily),  @(2, [BB,Buf,Inplace,RecursStep,NoDiagPullin, NoDiagPullinLeft, NoDiagPullinRight])],\n        e -> ObjId(@(2).val)(ObjId(@(1).val)(@(2).val.child(1), @(1).val.v))),\n\n    VRC_Data := Rule([@(1, _VRCFamily), @(2, Data)], \n\te -> Data(@(2).val.var, @(2).val.value, ObjId(e)(@(2).val.child(1)))),\n\n#   VRC_SymSPL := Rule([@(1, _VRCFamily), @(2, SymSPL)],\n#        e -> ObjId(@(1).val)(@(2).val.child(1), @(1).val.v)),\n\n   VRC_Compose := Rule([@(1, _VRCFamily), @(2, [Compose,ComposeStreams]).cond(NoSpecialOrNonchangeableVRC)], # Use with VRC_ComposeNonchangeable below\n        e->let(v := @(1).val.v, ch := @(2).val.children(), vrc := ObjId(@(1).val),\n        vrc1 := Cond(\n                 vrc=VRC,   [[VRC,  VRC ], [VRCR,  VRCL ]],\n                 vrc=VRCLR, [[VRCL, VRCR], [VRCLR, VRCLR]],\n                 vrc=VRCL,  [[VRCL, VRC ], [VRCLR, VRCL ]],\n                 vrc=VRCR,  [[VRC,  VRCR], [VRCR,  VRCLR]]),\n        vrc2 := When(NeedInterleavedRight(ch[1]) or NeedInterleavedLeft(ch[2]), vrc1[1], vrc1[2]),\n            Compose(vrc2[1](ch[1], v), vrc2[2](Compose(Drop(ch, 1)), v)))),\n\n    # NOTE: When building the format-change I() below, ch1.dims()[1] is\n    #        always used. This is probably incorrect in some cases.\n    VRC_ComposeNonchangeable := Rule([@(1, _VRCFamily), @(2, Compose).cond(NoSpecialAndChangeableVRC)],\n        e->let(v     := @(1).val.v,\n               ch    := @(2).val.children(),\n               vrc   := ObjId(@(1).val),\n               HandleCannotChangeDataFormatVRC(vrc, ch, v)\n        )\n    ),\n\n    #VRC_ComposeStreams := Rule([@(1, VRC), @(2, ComposeStreams)],\n    #    e->let(v := @(1).val.v, ch := @(2).val.children(),\n    #        ComposeStreams( VRC(ch[1], v), VRC(ComposeStreams(Drop(ch,1)), v) )\n    #        )\n    #),\n\n    VRCLR_VRCDiag:= Rule([@(1, _VRCFamily), @(2, VRCDiag)], e -> ObjId(@(1).val)(@(2).val.toloop().sums(), @(1).val.v)),\n\n    VRCLR_VBlk:= Rule([@(1, VRCLR),@(2, VBlk)], e -> VBlk(RealVMatComplexVMat(@(2).val.element), @(2).val.v)),\n\n    VRCLR_VGath_zero:= Rule([@(1, VRCLR),@(2, VGath_zero)], e -> let(g:=@(2).val,\n        VRCLR(VGath(fAdd(g.N, g.n, 0), getV(g)), getV(g)))),\n\n    VRCLR_VGathScat := Rule([@(1, VRCLR), @(2, [VGath, VScat, VScatAcc])],\n        e -> ObjId(@(2).val)(fTensor(@(2).val.func, fId(2)), @(2).val.v)),\n\n    VRCLR_GathScat := Rule([@(1, VRCLR), @(2, [Gath, Scat, ScatAcc])],\n        e -> ObjId(@(2).val)(fTensor(@(2).val.func, fId(2)))),\n\n    VRC_VGathVScat := Rule([@(1, VRC), @(2, [VGath, VScat, VScatAcc])],\n        e -> ObjId(@(2).val)(fTensor(@(2).val.func, fId(2)), @(2).val.v)),\n\n    VRCLR_VGathScat_sv := Rule([@(1, VRCLR), @(2, [VGath_sv, VScat_sv])], e->  # NOTE: acc variant missing\n        @(2).val.rcVariant(@(2).val.func, @(2).val.v, @(2).val.sv, @(2).val.rem)),\n\n    VRCLR_VTensor := Rule([@(1, VRCLR), @(2, VTensor)],\n        e -> VTensor(RC(@(2).val.child(1)), @(2).val.vlen)),\n\n    VRCLR_Diag := Rule([@(1, VRCLR), @(2, [Diag, VDiag])],\n        e -> let(d := @(2).val.element, n := d.domain(), v := @(1).val.v,\n            VRCDiag(VData(fCompose(RCData(d), fTensor(fId(n / v), L(2*v, 2))), v), v))),\n\n    VRC_BlockVPerm := Rule([@(1, _VRCFamily), @(2, [BlockVPerm, BlockVPerm2])],\n        e->let(bd := @(2).val.child(1), vrc := ObjId(@(1).val),\n            BlockVPerm(@2.val.n, @2.val.vlen, vrc(bd, @(1).val.v),\n            MatSPL(vrc(@2.val.perm, @1.val.v))))),\n\n    fPrecompute_VData := Rule([VData, [fPrecompute, @(1)], @(2)], e -> fPrecompute(VData(@(1).val, @(2).val))),\n    fPrecompute_VDup := Rule([VDup, [fPrecompute, @(1)], @(2)], e -> fPrecompute(VDup(@(1).val, @(2).val))),\n\n    RCVScat_sv__fId := Rule(@(1,RCVScat_sv,e->IsInt(2*e.func.domain()/getV(e)) and ObjId(e.func) = fId),\n        e->let(v:=getV(@(1).val), When(Cols(@(1).val)<>2*@(1).val.func.domain(),\n            VGath_zero(Cols(@(1).val)/v, 2*@(1).val.func.domain()/v, v), VGath(fId(2*@(1).val.func.domain()/v), v))))\n));\n\nClass(RulesVRCTermDiag, RuleSet);\nRewriteRules(RulesVRCTermDiag, rec(\n    VRCLR_VDiag_x_I := Rule([@(1, VRCLR), @(2, VDiag_x_I)], e->VTensor(RC(Diag(@(2).val.element)), @(2).val.v))\n));\n\nClass(RulesVRCTerm, RulesVRCTermDiag);\nRewriteRules(RulesVRCTerm, rec(\n    VIxL := Rule(VIxL, (e, cx) -> e.implement(cx.opts.vector.isa)),\n    VL := Rule(VL, (e, cx) -> e.implement(cx.opts.vector.isa)),\n#--\n### Rules for SAR -- to be moved and fixed...\n\n    Term_VTensorInd_ScatGath := Rule([@(1, VTensorInd), @(2, ScatGath), @(3)],\n        e->ScatGath(_fTensorInd(@(2).val.sfunc, @(3).val), _fTensorInd(@(2).val.gfunc, @(3).val))),\n\n    RC_ScatGath := Rule([@@(1, RC), @(2, ScatGath)], (e,cx)->@(2).val.toloopRCVec(@(2).val.maxBkSize(), Last(cx.VContainer).isa.getV())),\n##    VRCLR_ScatGath := Rule([@(1, VRCLR), @(2, ScatGath)], e->@(2).val.toloopRCVec(@(2).val.maxBkSize(), @(1).val.v)),\n\n    RCVGathRCSVcat_sv_fTensor := Rule([@(1, [RCVGath_sv, RCVScat_sv]),\n                            [@(2,fTensor), ..., [fId, @(3).cond(e -> Gcd(@(1).val.v/@(1).val.sv, EvalScalar(e)) = @(1).val.v)]]],\n     e -> let(v := @(1).val.v, sv := @(1).val.sv,\n          n := EvalScalar(@(3).val),   gcd := Gcd(v / sv, n),\n          @(1).val.vecVariant(fTensor(DropLast(@(2).val.children(), 1), fId(2*n/gcd)), v))),\n\n#    Id_RCV1 := Rule([@(1,[RCVScat_sv,RCVGath_sv]), @(2,fId,e->(IsValue(e.n) or IsInt(e.n)) and IsInt(EvalScalar(e.n/@(1).val.v)))], e->I(EvalScalar(@(2).val.n))),\n#\n#    Term__VScat_ScatGath := ARule(Compose, [@(1, VScat), @@(2, ScatGath, (e,cx)->not ForAny(_VRCFamily, i->IsBound(cx.(i.name)) and cx.(i.name) <> []))],\n#        e->[@(1).val * @@(2).val.toloopVec(@@(2).val.maxBkSize(), @(1).val.v)]),\n#\n#    # in the precond of this rule there was a guard on VRCXX, but that was never matching due to an error. so I dont know if it was needed at all...\n#    Term__ScatGath := Rule(@@(1, ScatGath, (e,cx)->not ForAny([VTensor, VTensorInd], i->IsBound(cx.(i.name)) and cx.(i.name) <> []) and\n#        (IsBound(cx.VContainer) and cx.VContainer <> [])),\n#        (e,cx)->@@(1).val.toloopVec(@@(1).val.maxBkSize(), Last(cx.VContainer).isa.getV())),\n#\n    Term_NeedInterleavedComplex_VRC := Rule([@(1, VRC), @(2, NeedInterleavedComplex)], e->RC(@(2).val.child(1))),\n#    Term_NeedInterleavedComplex_RC := Rule([@(1, RC), @(2, NeedInterleavedComplex)], e->DRC(@(2).val.child(1))),\n#\n#    RC_GathScat_sv_fTensor := Rule([@(1, [VGath_sv, VScat_sv]), [@(2,fTensor), ..., [fId, 2]]],\n#        e -> let(v := @(1).val.v, sv := @(1).val.sv,\n#            @(1).val.rcVariant(fTensor(DropLast(@(2).val.children(), 1)), v, sv))),\n#\n    RC_XXX := Rule([@(1, RC), @(2, [VGath, VScat, VScatAcc])], e->ObjId(@(2).val)(fTensor(@(2).val.func, fId(2)), @(2).val.v)),\n#    RC_XXX_sv := Rule([@(1, RC), @(2, [VGath_sv, VScat_sv])], e->@(2).val.rcVariant(@(2).val.func, @(2).val.v, @(2).val.sv)),\n### end SAR\n#--\n#   these rules are buggy, as Scat_sv does zero padding.\n#    RCVScat_sv_toVScat := Rule(@(1, RCVScat_sv, e->e.sv=1 and e.v=2), e -> VScat(e.func, e.v)),\n#    RCVGath_sv_toVGath := Rule(@(1, RCVGath_sv, e->e.sv=1 and e.v=2), e -> VGath(e.func, e.v)),\n\n#-- VPrm_x_I --\n\n    #NOTE: Check if this rule is correct!\n    #VRC_VPrm_x_I := Rule([@(1, VRC), @(2, VPrm_x_I)], e->let(p := @(2).val, v := p.v, b := p.dims()[1]/v,\n    #    Compose(\n    #        Tensor(I(2), VTensor(Prm(p.func), v)).sums().unroll()\n    #    ))),\n\n\n    # YSV: we use NoDiagPullin to prevent diagonals from going into the loops resulting from Tensor(I(2),...)\n    #      because in some cases they can't be sucked in completely and one ends up with multiple Scat * Diag * Scat\n    #      sequences inside a SUM, which overlap, implying that it is a SUMAcc. However, Spiral does not know\n    #      that, and generates invalid code. I don't know of a better way to handle this at the moment.\n    VRCLR_VPrm_x_I := Rule([@(1, [VRCLR, VRC]), @(2, VPrm_x_I)], e->let(p := @(2).val, v := p.v, b := p.dims()[1]/v,\n        Compose(\n            VTensor(Prm(L(2*b, b)), v),\n            NoDiagPullin(Tensor(I(2), VTensor(Prm(p.func), v)).sums().unroll()),\n            VTensor(Prm(L(2*b, 2)), v)\n        ))),\n\n    VRCL_VPrm_x_I := Rule([@(1, VRCL), @(2, VPrm_x_I)], e->let(p := @(2).val, v := p.v, b := p.dims()[1]/v,\n        Compose(\n            VIxL(b, 2, v),\n            VTensor(Prm(L(2*b, b)), v),\n            NoDiagPullin(Tensor(I(2), VTensor(Prm(p.func), v)).sums().unroll()),\n            VTensor(Prm(L(2*b, 2)), v)\n        ))),\n\n    VRCR_VPrm_x_I := Rule([@(1, VRCR), @(2, VPrm_x_I)], e->let(p := @(2).val, v := p.v, b := p.dims()[1]/v,\n        Compose(\n            VTensor(Prm(L(2*b, b)), v),\n            NoDiagPullin(Tensor(I(2), VTensor(Prm(p.func), v)).sums().unroll()),\n            VTensor(Prm(L(2*b, 2)), v),\n            VIxL(b, v, v)\n        ))),\n\n#-- VGath ------------------\n    VRCL_VGath := Rule([@(1, VRCL), @(2, VGath)], e->let(v := @(2).val.v,\n        Compose(\n            VIxL(@(2).val.func.domain(), 2, v),\n            VGath(fTensor(@(2).val.func, fId(2)), v)\n        ))),\n\n    VRCL_VScat := Rule([@(1, VRCL), @(2, [VScat, VScatAcc])], e->let(v := @(2).val.v,\n        Compose(\n            ObjId(@(2).val)(fTensor(@(2).val.func, fId(2)), v),\n            VIxL(@(2).val.func.domain(), 2, v)\n        ))),\n\n    VRCL_VGath_sv := Rule([@(1, VRCL), @(2, VGath_sv)], e->let(v := @(2).val.v, sv := @(2).val.sv,\n        Compose(\n            VIxL(Rows(@(2).val)/v, 2, v),\n            RCVGath_sv(@(2).val.func, v, sv, @(2).val.rem)\n        ))),\n\n    VRCL_IxVGath_pc := Rule([@(1, VRCL), @(2, IxVGath_pc)], e -> let(\n\tg := @(2).val, v := g.v,\n        Compose(\n            VIxL(g.k * _roundup(g.n, g.v) / v, 2, v),\n            IxRCVGath_pc(g.k, g.N, g.n, g.ofs, v)\n        ))),\n\n    VRCLR_IxVGath_pc := Rule([@(1, VRCLR), @(2, IxVGath_pc, x->x.N*x.k mod x.v=0)], e -> let(\n\tg := @(2).val, v := g.v,\n        Compose(\n            VIxL(g.k * _roundup(g.n, v) / v, 2, v),\n            IxRCVGath_pc(g.k, g.N, g.n, g.ofs, v),\n            VIxL(g.k * g.N / v, v, v)\n        ))),\n\n    VRCL_VStretchGath := Rule([@(1, VRCL), @(2, VStretchGath)], e -> let(\n\tg := @(2).val, \n\tv := g.v,\n\t#XXX  Cond(???,\n            Compose(\n\t\tVIxL(_roundup(Rows(g), v) / v, 2, v),\n\t\tRCVStretchGath(g.func, g.part, v))\n\n\t#XXX    VStretchGath( \n\t#XXX\tfCompose(fTensor(fId(g.func.domain()/v), L(2*v, v)), fTensor(g.func, fId(2))),\n\t#XXX\t...,\n\t#XXX\t...)\n\n        )),\n\n    VRCR_VGath_zero:= Rule([@(1, VRCR),@(2, VGath_zero)], e -> let(g:=@(2).val,\n        VGath_zero(2*g.N, 2*g.n, g.v) * VIxL(g.N, g.v, g.v))),\n\n#-- VScat ------------------\n    VRCR_VScat := Rule([@(1, VRCR), @(2, [VScat, VScatAcc])], e->let(v := @(2).val.v,\n        Compose(\n            ObjId(@(2).val)(fTensor(@(2).val.func, fId(2)), v),\n            VIxL(@(2).val.func.domain(), v, v)\n        ))),\n\n    VRCR_VScat_sv := Rule([@(1, VRCR), @(2, VScat_sv)], e->let(v := @(2).val.v, sv := @(2).val.sv, # NOTE: acc variant missing\n        Compose(\n            RCVScat_sv(@(2).val.func, v, sv, @(2).val.rem),\n            VIxL(Cols(@(2).val)/v, v, v)\n        ))),\n\n    VRCR_IxVScat_pc := Rule([@(1, VRCR), @(2, IxVScat_pc)], e->let(s:=@(2).val, v := s.v, # NOTE: acc variant missing\n        Compose(\n            IxRCVScat_pc(s.k, s.N, s.n, s.ofs, v),\n            VIxL(s.k*_roundup(s.n, v)/v, v, v)\n        ))),\n\n    VRCLR_IxVScat_pc := Rule([@(1, VRCLR), @(2, IxVScat_pc, x->x.N*x.k mod x.v=0)], e -> let(\n        s := @(2).val, v := s.v,\n        Compose(\n            VIxL(s.k * s.N / v, 2, v),\n            IxRCVScat_pc(s.k, s.N, s.n, s.ofs, v),\n            VIxL(s.k*_roundup(s.n, v)/v, v, v)\n        ))),\n\n    VRCR_VStretchScat := Rule([@(1, VRCR), @(2, VStretchScat)], e->let(s:=@(2).val, v := s.v,\n        Compose(\n            RCVStretchScat(s.func, s.part, v),\n            VIxL(_roundup(Cols(s), v)/v, v, v)\n        ))),\n\n#----------------------------\n    VRCLR_VPerm := Rule([@(1, VRCLR), @(2, VPerm)], e->let(p := @(2).val, v := p.vlen, b := p.dims()[1]/v,\n        Compose(\n            VTensor(Prm(L(2*b, b)), v),\n            Tensor(I(2), p).sums().unroll(),\n            VTensor(Prm(L(2*b, 2)), v)\n        ))),\n\n    VRCL_VPerm := Rule([@(1, VRCL), @(2, VPerm)], e->let(p := @(2).val, v := p.vlen, b := p.dims()[1]/v,\n        Compose(\n            VTensor(Prm(L(2*b, b)), v),\n            Tensor(I(2), p).sums().unroll(),\n            VTensor(Prm(L(2*b, 2)), v),\n            VIxL(b, 2, v)\n        ))),\n\n    VRCR_VPerm := Rule([@(1, VRCR), @(2, VPerm)], e->let(p := @(2).val, v := p.vlen, b := p.dims()[1]/v,\n        Compose(\n            VIxL(b, v, v),\n            VTensor(Prm(L(2*b, b)), v),\n            Tensor(I(2), p).sums().unroll(),\n            VTensor(Prm(L(2*b, 2)), v)\n        ))),\n\n#----------------------------\n    VRCLR_Perm := Rule([@(1, VRCLR), @(2, Prm)], e->let(p := @(2).val, v := getV(@1.val), b := p.dims()[1]/v, n := @(2).val.dims()[2]/v,\n        Compose(\n            VIxL(n, 2, v),\n            RCVScat_sv(fId(p.func.domain()), v, 1),\n            RCVGath_sv(p.func, v, 1),\n            VIxL(n, v, v)\n        ))),\n\n    VRC_Perm := Rule([@(1, VRC), @(2, Prm)], e->let(p := @(2).val, v := getV(@1.val), b := p.dims()[1]/v, n := @(2).val.dims()[2]/v,\n            Compose (RCVScat_sv(fId(p.func.domain()), v, 1),\n            RCVGath_sv(p.func, v, 1))\n        )),\n\n    VRCL_Split := Rule([@(1, VRCL), @(2, [VDiag, VTensor])], e->let(v := getV(@(2).val),\n        Compose(\n            VRCLR(@(2).val, v),\n            VIxL(@(2).val.dims()[2]/v, 2, v)\n        ))),\n\n    VRCR_Split := Rule([@(1, VRCR), @(2, [VDiag, VTensor])], e->let(v := getV(@(2).val),\n        Compose(\n            VIxL(@(2).val.dims()[1]/v, v, v),\n            VRCLR(@(2).val, v)\n        ))),\n\n    VRC_VTensor := Rule([@(1, VRC), @(2, [VTensor])], e->let(v := getV(@(2).val),\n        Compose(\n            VIxL(@(2).val.dims()[1]/v, v, v),\n            VRCLR(@(2).val, v),\n            VIxL(@(2).val.dims()[2]/v, 2, v)\n        ))),\n\n    VRC_VDiag := Rule([@(1, VRC), @(2, [VDiag])], e->let(\n       v := getV(@(2).val), d := @(2).val.dims()[1],\n       Cond(@(2).val.element.isReal(),\n\t   VDiag(diagTensor(@(2).val.element, fConst(TReal, 2, 1)), @(2).val.v),\n\t   VIxL(d/v, v, v) * VRCLR(@(2).val, v) * VIxL(d/v, 2, v)))),\n\n    VRC_Blk := Rule([@(1, VRC), @(2, Blk)], e->RC(@(2).val)),\n\n    VRCLR_VScat_zero := Rule([@(1, VRCLR), @(2, VScat_zero)], e->let(s:=@(2).val, VScat_zero(2*s.N, 2*s.n, s.v))),\n\n    VRC_Gath := Rule([@(1, VRC), @(2, Gath)], e->let(g := @(2).val, v := getV(@1.val), b := g.dims()[1]/v, n := @(2).val.dims()[2]/v,\n            Compose (VRCLR(VScat_sv(fId(g.func.domain()), v, 1), v),\n            VRCLR(VGath_sv(g.func, v, 1), v))\n        )),\n\n    FormatPrm_Term := Rule([FormatPrm, @(1)], e -> Prm(@(1).val)),\n));\n\nClass(RulesSplitComplex, RuleSet);\nRewriteRules(RulesSplitComplex, rec(\n    VRCR_IxVScat_pc := ARule(Compose, [[@(1,[Prm, FormatPrm]), @(4,L,e->e.params[2]=2)], [@(2,VRCR), @(3,IxVScat_pc)]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val,\n                    [IxVScat_pc(2*s.k, s.N, s.n, s.ofs, v), VPrm_x_I(L(2*c/v, 2), v)])),\n\n    VRCL_IxVGath_pc := ARule(Compose, [[@(2,VRCL), @(3,IxVGath_pc)], [@(1,[Prm, FormatPrm]), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val,\n                    [VPrm_x_I(L(2*r/v, r/v), v), IxVGath_pc(2*g.k, g.N, g.n, g.ofs, v)])),\n\n    VRCR_VStretchScat := ARule(Compose, [[@(1,[FormatPrm,Prm]), @(4,L,e->e.params[2]=2)], [@(2,VRCR), @(3,VStretchScat)]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val,\n                    [VStretchScat(fTensor(fId(2), s.func), 2*s.part, v), VPrm_x_I(L(2*c/v, 2), v)])),\n\n    VRCL_VStretchGath := ARule(Compose, [[@(2,VRCL), @(3,VStretchGath)],[@(1,[FormatPrm,Prm]), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val,\n                    [VPrm_x_I(L(2*r/v, r/v), v), VStretchGath(fTensor(fId(2), g.func), 2*g.part, v)])),\n\n    VRCR_VScat_sv := ARule(Compose, [[@(1,[FormatPrm,Prm]), @(4,L,e->e.params[2]=2)], [@(2,VRCR), @(3,VScat_sv)]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val,\n                    [VStretchScat(fTensor(fId(2), s.func), 2, v), VPrm_x_I(L(2*c/v, 2), v)])),\n\n    VRCL_VGath_sv := ARule(Compose, [[@(2,VRCL), @(3,VGath_sv)],[@(1,[FormatPrm,Prm]), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val,\n                    [VPrm_x_I(L(2*r/v, r/v), v), VStretchGath(fTensor(fId(2), g.func), 2, v)])),\n\n    VRCR_VScat := ARule(Compose, [[@(1,[Prm, FormatPrm]), @(4,L,e->e.params[2]=2)], [@(2,VRCR), @(3,[VScat, VScatAcc])]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val,\n                    [ObjId(@(3).val)(fTensor(fId(2), s.func), v), VPrm_x_I(L(2*c/v, 2), v)])),\n\n    VRCL_VGath := ARule(Compose, [[@(2,VRCL), @(3,VGath)],[@(1,[Prm, FormatPrm]), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val,\n                    [VPrm_x_I(L(2*r/v, r/v), v), VGath(fTensor(fId(2), g.func), v)])),\n\n    VRCL_VScat := ARule(Compose, [[@(2,VRCL), @(3,[VScat, VScatAcc])],[@(1,Prm), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val,\n                    [VPrm_x_I(L(2*r/v, r/v), v), ObjId(@(3).val)(fTensor(fId(2), g.func), v)])),\n\n    VRCR_VTensor1 := ARule(Compose, [[@(1, [FormatPrm, Prm]), @(4,L,e->e.params[2]=2)], [@(2,VRCR), @(3,VTensor)]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val,\n                    [VPrm_x_I(L(2*c/v, 2), v), VRCLR(s, v)])),\n\n    VRCR_VTensor1a := ARule(Compose, [[@(1, [FormatPrm, Prm]), @(4,L,e->e.params[2]=2)], [@(2,VRC), @(3,VTensor)]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val,\n                    [VPrm_x_I(L(2*c/v, 2), v), VRCL(s, v)])),\n\n    VRCL_VTensor2 := ARule(Compose, [[@(2,VRCL), @(3,VTensor)],[@(1, [FormatPrm, Prm]), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, c:=Cols(@(3).val), g:=@(3).val,\n                    [VRCLR(g,v), VPrm_x_I(L(2*c/v, c/v), v)])),\n\n    VRCL_VTensor2a := ARule(Compose, [[@(2,VRC), @(3,VTensor)],[@(1, [FormatPrm, Prm]), @(4,L,e->e.params[2]=e.params[1]/2)]],\n                e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val,\n                    [VRCR(g,v), VPrm_x_I(L(2*r/v, r/v), v)])),\n\n#    VRCLR_VGath_split := Rule([@(1, VRCLR), @(2, VGath_sv)],\n#                e -> let(g := @(2).val, v:= g.v, func := g.func, n := func.domain(), N:= func.range(),\n#                        VGath_sv(fCompose(fTensor(L(2*N/v,2), fId(v)), fTensor(fId(2), func), fTensor(L(2*n/v,n/v), fId(v))), v, g.sv))),\n#\n#    VRCLR_VScat_split := Rule([@(1, VRCLR), @(2, VScat_sv)],\n#                e -> let(g := @(2).val, v:= g.v, func := g.func, n := func.domain(), N:= func.range(),\n#                        VScat_sv(fCompose(fTensor(L(2*N/v,2), fId(v)), fTensor(fId(2), func), fTensor(L(2*n/v,n/v), fId(v))), v, g.sv)))\n#\n    VGath_FormatPrm := ARule(Compose, [[@(1, VGath), [fTensor, fBase, @(2, fId)]],\n            [@(3, FormatPrm), [fTensor, fId, @(4, L, e->IsInt(@(2).val.domain()/e.domain()))]]],\n        e->[FormatPrm(fTensor(fId(Rows(@(1).val)/@(4).val.domain()), @(4).val)), @(1).val]),\n\n    FormatPrm_VScat := ARule(Compose, [[@(1, FormatPrm), [fTensor, fId, @(2, L)]],\n            [@(3, [VScat, VScatAcc]), [fTensor, fBase, @(4, fId, e->IsInt(e.domain()/@(2).val.domain()))]]],\n        e->[@(3).val, FormatPrm(fTensor(fId(Cols(@(3).val)/@(2).val.domain()), @(2).val))]),\n\n    VRCL_VGath_fIdxL := ARule(Compose, [[@(2,VRCL), @(3,VGath)], [@(1,FormatPrm), [@(4,fTensor), fId, @(5, L, e->e.params[1]=2*e.params[2])]]],\n        e -> let(v:=@(2).val.v, r:=Rows(@(3).val), g:=@(3).val, [VGath(fTensor(g.func, fId(2)), v)])),\n\n    VRCR_VScat_fIdxL := ARule(Compose, [[@(1, FormatPrm), [@(4,fTensor), fId, @(5, L, e->e.params[2]=2)]], [@(2,VRCR), @(3,[VScat, VScatAcc])]],\n        e -> let(v:=@(2).val.v, c:=Cols(@(3).val), s:=@(3).val, [ObjId(@(3).val)(fTensor(s.func, fId(2)), v)]))\n\n));\n\nClass(RulesVBlkInt, RuleSet);\nRewriteRules(RulesVBlkInt, rec(\n    Merge_RulesVBlkInt_VRC_rt := ARule(Compose, [@(1, VBlkInt), @(2, VRC)],\n                e -> let(v1 := @(1).val, v2 := @(2).val, v := v1.v, [ VIxL(Rows(v1)/(2*v), v, v), v1.child(1), VRCL(v2.child(1), v) ])),\n\n    Merge_RulesVBlkInt_VRC_lft := ARule(Compose, [@(2, VRC), @(1, VBlkInt)],\n                e -> let(v1 := @(1).val, v2 := @(2).val, v := v1.v, [ VRCR(v2.child(1), v), v1.child(1), VIxL(Rows(v1)/(2*v), 2, v) ])),\n\n    Merge_RulesVBlkInt_vRC_rt := ARule(Compose, [@(1, VBlkInt), @(2, vRC)],\n                e -> let(v1 := @(1).val, v := v1.v, [ VIxL(Rows(v1)/(2*v), v, v), v1.child(1), VIxL(Cols(v1)/(2*v), 2, v), @(2).val ])),\n\n    Merge_RulesVBlkInt_vRC_lft := ARule(Compose, [@(2, vRC), @(1, VBlkInt)],\n                e -> let(v1 := @(1).val, v := v1.v, [ @(2).val, VIxL(Rows(v1)/(2*v), v, v), v1.child(1), VIxL(Rows(v1)/(2*v), 2, v) ])),\n));\n", "meta": {"hexsha": "a9b6acf77d5340962e428e88229282579dd771bb", "size": 33032, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/vector/rewrite/vrc.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/vector/rewrite/vrc.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/vector/rewrite/vrc.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 49.0817236256, "max_line_length": 163, "alphanum_fraction": 0.5428372487, "num_tokens": 11703, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.5, "lm_q2_score": 0.021287353500946907, "lm_q1q2_score": 0.010643676750473454}}
{"text": "#############################################################################\n####\n##\n#W  ace.gi                     ACE Package                   Alexander Hulpke\n#W                                                                Greg Gamble\n##\n##  `Head' file for the GAP interface to the ACE (Advanced Coset Enumerator),\n##  by George Havas and Colin Ramsay.  The original interface was written  by \n##  Alexander Hulpke and extensively modified by Greg Gamble.\n##    \n#Y  Copyright (C) 2000  Centre for Discrete Mathematics and Computing\n#Y                      Department of Information Technology & Electrical Eng.\n#Y                      University of Queensland, Australia.\n##\n\n\n#############################################################################\n####\n##\n#V  ACEData . . . . . . . record used by various functions of the ACE package\n##\n##  The fields of ACEData are:\n##\n##    \"binary\"  . . the path of the ACE binary\n##    \"tmpdir\"  . . the path of the temporary directory for ACE i/o files\n##    \"ni\"  . . . . record for a non-interactive process\n##    \"io\"  . . . . list of data records for ACEStart IO Streams\n##    \"infile\"  . . the path of the ACE input file\n##    \"outfile\" . . the path of the ACE output file\n##    \"version\" . . the version of the current ACE binary\n##\nInstallValue( ACEData,\n  rec( binary := ExternalFilename(DirectoriesPackagePrograms(\"ace\"), \"ace\"),\n       tmpdir := DirectoryTemporary(),\n       ni     := rec(),\n       io     := [] # Initially no ACEStart IO Streams\n       )\n);\nACEData.infile  := Filename(ACEData.tmpdir, \"in\"); \nACEData.outfile := Filename(ACEData.tmpdir, \"out\");\n\nPrintTo(ACEData.infile, \"\\n\");\n# Fire up ACE with a null input (ACEData.infile contains only a \"\\n\")\n# ... to generate a banner (which has ACE's current version)\nExec(Concatenation(ACEData.binary, \"<\", ACEData.infile, \">\", ACEData.outfile));\nACEData.version := StringFile( ACEData.outfile );\nACEData.scratch := PositionSublist(ACEData.version, \"ACE\") + 4;\nACEData.version := ACEData.version{[ACEData.scratch ..\n                                    Position(ACEData.version, ' ', \n                                             ACEData.scratch) - 1]};\nUnbind(ACEData.scratch); # We don't need ACEData.scratch, anymore.\n\n#############################################################################\n##  \n#I  InfoClass\n##\n# Set the default level of InfoACE\nSetInfoLevel(InfoACE, 1);\n\n#############################################################################\n####\n##\n#V  ACEIgnoreUnknownDefault . . . . . . . . . . . .  the default value of the \n##  . . . . . . . . . . . . . . . . . . . . . . . . `aceignoreunknown' option\n##\nACEIgnoreUnknownDefault := true;\n\n#############################################################################\n####\n##  Ensure no zombie ACE processes from interactive (ACEStart)  sessions  are \n##  . . . . .  . . . . . . . . . . . .  left lying around when user quits GAP\n##\nInstallAtExit( ACEQuitAll );\n\n#E  ace.gi . . . . . . . . . . . . . . . . . . . . . . . . . . . .  ends here \n", "meta": {"hexsha": "0946c226b18b747e19005f0178bbcf0384cc745e", "size": 3039, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/ace.gi", "max_stars_repo_name": "isuruf/ace", "max_stars_repo_head_hexsha": "7d285d9e82178ef36d9923611425b2c629a8bb77", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/ace.gi", "max_issues_repo_name": "isuruf/ace", "max_issues_repo_head_hexsha": "7d285d9e82178ef36d9923611425b2c629a8bb77", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/ace.gi", "max_forks_repo_name": "isuruf/ace", "max_forks_repo_head_hexsha": "7d285d9e82178ef36d9923611425b2c629a8bb77", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.9868421053, "max_line_length": 79, "alphanum_fraction": 0.5047713064, "num_tokens": 719, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3106943959796865, "lm_q2_score": 0.034100421908547486, "lm_q1q2_score": 0.01059480998752863}}
{"text": "BindGlobal(\"MitM_rnams\", [\"name\", \"attributes\", \"content\"]);\n\n# OM elements - known as \"omel\" in the specification\nBindGlobal(\"MitM_OMel\", [ \"OMS\", \"OMV\", \"OMI\", \"OMB\", \"OMSTR\", \"OMF\",\n                          \"OMA\", \"OMBIND\", \"OME\", \"OMATTR\", \"OMR\"]);\n\n#\n# ValidXSD: a collection of functions to check some XML string types\n#\nBindGlobal(\"MitM_ValidXSD\", rec());\n\nMitM_ValidXSD.Empty := function(str)\n    if not IsEmpty(str) then\n        return \"must be empty\";\n    fi;\n    return true;\nend;\n\nMitM_ValidXSD.Text := function(str)\n    if '<' in str then\n        return \"XML strings cannot contain '<'\";\n    elif Number(str, c -> c = '&') > Number(str, c -> c = ';') then\n        return \"there is a '&' character without a closing ';'\";\n    fi;\n    # Perhaps we could check some other simple XML things?\n    return true;\nend;\n\nMitM_ValidXSD.NCName := function(str)\n    local result, char;\n    result := MitM_ValidXSD.Text(str);\n    if result <> true then\n        return result;\n    elif IsEmpty(str) then\n        return \"must not be the empty string\";\n    elif IsDigitChar(str[1]) or str[1] = '-' or str[1] = '.' then\n        return \"must start with a letter or underscore\";\n    fi;\n    for char in str do\n        if not (IsAlphaChar(char) or IsDigitChar(char)\n                or char = '_' or char = '-' or char = '.') then\n            return Concatenation(\"must not contain the character \\\"\",\n                                 String(char), \"\\\"\");\n        fi;\n    od;\n    return true;\nend;\n\n# Checking ID uniqueness is difficult, but we may want to do it in the future\nMitM_ValidXSD.ID := MitM_ValidXSD.Text;\n\n# Validating URIs is difficult, but we may want to do it in the future\nMitM_ValidXSD.AnyURI := MitM_ValidXSD.Text;\n\nMitM_ValidXSD.Base64Binary := function(str)\n    local len, nreq, i;\n    str := ShallowCopy(str);\n    RemoveCharacters(str, \" \\n\\t\\r\"); # ignore whitespace\n    len := Length(str);\n    if len mod 4 <> 0 then\n        return \"must have length divisible by 4\";\n    fi;\n    nreq := 0;\n    if str[len] = '=' then\n        nreq := 1;\n        if str[len - 1] = '=' then\n            nreq := 2;\n            if not str[len - 2] in \"AQgw\" then\n                return \"one of [AQgw] must come before '=='\";\n            fi;\n        elif not str[len - 1] in \"AEIMQUYcgkosw048\" then\n            return \"one of [AEIMQUYcgkosw048=] must come before '='\";\n        fi;\n    fi;\n    for i in [1 .. len - nreq] do\n        if str[i] = '=' then\n            return \"only 1 or 2 '=' characters allowed, and only at the end\";\n        elif not (IsAlphaChar(str[i]) or IsDigitChar(str[i])\n                  or str[i] = '+' or str[i] = '/') then\n            return Concatenation(\"cannot contain character '\", str{[i]}, \"'\");\n        fi;\n    od;\n    return true;\nend;\n\n#\n# ValidAttr: each object type's valid attributes,\n#            along with functions to check their values\n#\nBindGlobal(\"MitM_ValidAttr\",\nrec(\n     OMOBJ := rec(cdbase := MitM_ValidXSD.AnyURI,\n                  version := MitM_ValidXSD.Text),\n     OMS := rec(name := MitM_ValidXSD.NCName,\n                cd := MitM_ValidXSD.NCName,\n                cdbase := MitM_ValidXSD.AnyURI),\n     OMV := rec(name := MitM_ValidXSD.NCName),\n     OMI := rec(),\n     OMB := rec(),\n     OMSTR := rec(),\n     OMF := rec(dec := function(str)\n                   if str = \"INF\" or str = \"-INF\" or str = \"NaN\" then\n                       return true;\n                   elif Float(str) = fail then\n                       return Concatenation(str, \" is not a valid float\");\n                   fi;\n                   return true;\n                end,\n                hex := function(str)\n                    local valid_chars, char, err;\n                    if Length(str) <> 16 then\n                        return \"must be 16 characters long\";\n                    fi;\n                    valid_chars := \"0123456789ABCDEF\";\n                    for char in str do\n                        if not char in valid_chars then\n                            err := \"contains non-hex character '\";\n                            Add(err, char);\n                            Add(err, ''');\n                            if char in \"abcdef\" then\n                                Append(err, \" (not capital)\");\n                            fi;\n                            return err;\n                        fi;\n                    od;\n                    return true;\n                end),\n     OMA := rec(cdbase := MitM_ValidXSD.AnyURI),\n     OMBIND := rec(cdbase := MitM_ValidXSD.AnyURI),\n     OME := rec(),\n     OMATTR := rec(cdbase := MitM_ValidXSD.AnyURI),\n     OMR := rec(),\n     OMBVAR := rec(),\n     OMATP := rec(cdbase := MitM_ValidXSD.AnyURI),\n     common := rec(id := MitM_ValidXSD.ID)\n));\n\n#\n# RequiredAttr: a list of required attributes for each object type\n#\nBindGlobal(\"MitM_RequiredAttr\",\nrec(\n     OMOBJ := [],\n     OMS := [\"cd\", \"name\"],\n     OMV := [\"name\"],\n     OMI := [],\n     OMB := [],\n     OMSTR := [],\n     OMF := [],\n     OMA := [],\n     OMBIND := [],\n     OME := [],\n     OMATTR := [],\n     OMR := [],\n     OMBVAR := [],\n     OMATP := []\n));\n\n#\n# ValidCont: a function to check content for each object type\n#\nBindGlobal(\"MitM_ValidCont\",\nrec(\n     OMOBJ := function(content)\n       if Length(content) <> 1 then\n         return \"must be precisely one object\";\n       elif not (MitM_OMRec(content[1]) and MitM_Tag(content[1]) in MitM_OMel) then\n         return \"must be an OM element\";\n       fi;\n       return MitM_IsValidOMRec(content[1]);\n     end,\n\n     OMS := MitM_ValidXSD.Empty,\n\n     OMV := MitM_ValidXSD.Empty,\n\n     OMI := function(content)\n         local str, pos, valid_chars;\n         if not (Length(content) = 1 and IsString(content[1])) then\n             return \"must be only a string\";\n         fi;\n         str := ShallowCopy(content[1]);\n         RemoveCharacters(str, \" \\n\\t\\r\"); # ignore whitespace\n         pos := 1;\n         if str[pos] = '-' then\n             Remove(str, 1);\n         fi;\n         if str[pos] = 'x' then\n             Remove(str, 1);\n             valid_chars := \"0123456789ABCDEF\";\n         else\n             valid_chars := \"0123456789\";\n         fi;\n         if ForAny(str, char -> not char in valid_chars) or Length(str) = 0 then\n             return Concatenation(content[1], \" is not an integer\");\n         fi;\n         return true;\n     end,\n\n     OMB := function(content)\n         if IsEmpty(content) then\n             return true;\n         elif not (Length(content) = 1 and IsString(content[1])) then\n             return \"must be only a string\";\n         fi;\n         return MitM_ValidXSD.Base64Binary(content[1]);\n     end,\n\n     OMSTR := function(content)\n         if IsEmpty(content) then\n             return true;\n         elif not (Length(content) = 1 and IsString(content[1])) then\n             return \"must be only a string\";\n         fi;\n         return MitM_ValidXSD.Text(content[1]);\n     end,\n\n     OMF := MitM_ValidXSD.Empty,\n\n     OMA := function(content)\n         local item, result;\n         if Length(content) = 0 then\n             return \"must not be empty\";\n         fi;\n         for item in content do\n             if not MitM_OMRec(item) then\n                 return \"must only contain OM elements\";\n             elif not MitM_Tag(item) in MitM_OMel then\n                 return Concatenation(\"cannot contain \", MitM_Tag(item), \" objects\");\n             fi;\n             result := MitM_IsValidOMRec(item);\n             if result <> true then\n                 return result;\n             fi;\n         od;\n         return true;\n     end,\n\n     OMBIND := function(content)\n         local item, result;\n         if not (Length(content) = 3\n                 and ForAll(content, MitM_OMRec)\n                 and MitM_Tag(content[1]) in MitM_OMel\n                 and MitM_Tag(content[2]) = \"OMBVAR\"\n                 and MitM_Tag(content[3]) in MitM_OMel) then\n             return \"must be [OM elm, OMBVAR, OM elm] (in that order)\";\n         fi;\n         for item in content do\n             result := MitM_IsValidOMRec(item);\n             if result <> true then\n                 return result;\n             fi;\n         od;\n         return true;\n     end,\n\n     OME := function(content) return \"not implemented\"; end,\n\n     OMATTR := function(content)\n         local i, result;\n         if Length(content) <> 2 then\n             return \"must contain precisely two objects\";\n         elif not (MitM_OMRec(content[1]) and MitM_Tag(content[1]) = \"OMATP\") then\n             return \"first object must be OMATP\";\n         elif not (MitM_OMRec(content[2]) and MitM_Tag(content[2]) in MitM_OMel) then\n             return \"second object must be an OM element\";\n         fi;\n         for i in [1 .. Length(content)] do\n             result := MitM_IsValidOMRec(content[i]);\n             if result <> true then\n                 return result;\n             fi;\n         od;\n         return true;\n     end,\n\n     OMR := function(content) return \"not implemented\"; end,\n\n     OMBVAR := function(content)\n         local item, result;\n         if IsEmpty(content) then\n             return \"must not be empty\";\n         fi;\n         for item in content do\n             if not (MitM_OMRec(item) and MitM_Tag(item) = \"OMV\") then\n                 return \"must only contain OMV objects\";\n                 # ... or attvar objects in the full spec\n             fi;\n             result := MitM_IsValidOMRec(item);\n             if result <> true then\n                 return result;\n             fi;\n         od;\n         return true;\n     end,\n     \n     OMATP := function(content)\n         local i, result;\n         if Length(content) = 0 then\n             return \"must not be empty\";\n         elif Length(content) mod 2 <> 0 then\n             return \"must contain an even number of objects\";\n         fi;\n         for i in [1, 3 .. Length(content) - 1] do\n             if not (MitM_OMRec(content[i]) and MitM_Tag(content[i]) = \"OMS\") then\n                 return StringFormatted(\"item {} must be an OMS object\", i);\n             elif not (MitM_OMRec(content[i + 1]) \n                       and MitM_Tag(content[i + 1]) in MitM_OMel) then\n                 # TODO: allow OMFOREIGN\n                 return StringFormatted(\"item {} must be an OM element\", i + 1);\n             fi;\n             result := MitM_IsValidOMRec(content[i]);\n             if result <> true then\n                 return result;\n             fi;\n             result := MitM_IsValidOMRec(content[i + 1]);\n             if result <> true then\n                 return result;\n             fi;\n         od;\n         return true;\n     end\n));\n\n#\n# IsValidOMRec: the function we call on an object to check its validity\n#\nInstallGlobalFunction(MitM_IsValidOMRec,\nfunction(tree)\n    local rnam, attr, result;\n    # Check that this is a proper object\n    if not MitM_OMRec(tree) then\n        return \"<tree> must be an OM record\";\n    elif not MitM_Tag(tree) in RecNames(MitM_ValidAttr) then\n        return Concatenation(MitM_Tag(tree), \" is not a valid OM object name\");\n    fi;\n    for rnam in NamesOfComponents(tree) do\n        if not rnam in MitM_rnams then\n            return Concatenation(\"invalid XML: \", rnam, \" should not exist\");\n        fi;\n    od;\n\n    # Validate the attributes\n    for attr in RecNames(MitM_Attributes(tree)) do\n        if attr in RecNames(MitM_ValidAttr.(MitM_Tag(tree))) then\n            result := MitM_ValidAttr.(MitM_Tag(tree)).(attr)(MitM_Attributes(tree).(attr));\n        elif attr in RecNames(MitM_ValidAttr.common) then\n            result := MitM_ValidAttr.common.(attr)(MitM_Attributes(tree).(attr));\n        else\n            return Concatenation(attr, \" is not a valid attribute of \",\n                                 MitM_Tag(tree), \" objects\");\n        fi;\n        if result <> true then\n            return StringFormatted(\"{} attribute of {} object: {}\",\n                                   attr, MitM_Tag(tree), result);\n        fi;\n    od;\n\n    # Check required attributes\n    for attr in MitM_RequiredAttr.(MitM_Tag(tree)) do\n        if not attr in RecNames(MitM_Attributes(tree)) then\n            return Concatenation(MitM_Tag(tree), \" objects must have the \",\n                                 attr, \" attribute\");\n        fi;\n    od;\n\n    # Check antirequisite attributes - just one of these\n    if MitM_Tag(tree) = \"OMF\" then\n        if MitM_Attributes(tree) = fail\n               or not (IsBound(MitM_Attributes(tree).dec)\n                       or IsBound(MitM_Attributes(tree).hex)) then\n            return \"OMF objects must have either the dec or the hex attribute\";\n        elif IsBound(MitM_Attributes(tree).dec) and IsBound(MitM_Attributes(tree).hex) then\n            return \"OMF objects cannot have both the dec and the hex attribute\";\n        fi;\n    fi;\n\n    # Validate the content\n    if MitM_Content(tree) <> fail then\n        result := MitM_ValidCont.(MitM_Tag(tree))(MitM_Content(tree));\n    else\n        result := MitM_ValidCont.(MitM_Tag(tree))([]);\n    fi;\n    if result <> true then\n        return Concatenation(MitM_Tag(tree), \" contents: \", result);\n    fi;\n    return true;\nend);\n", "meta": {"hexsha": "da465df4ac28da743712e24e234d41d1e04202ae", "size": 13086, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/Validation.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/Validation.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/Validation.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 33.6401028278, "max_line_length": 91, "alphanum_fraction": 0.5324774568, "num_tokens": 3230, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2877678157610531, "lm_q2_score": 0.036769462909030076, "lm_q1q2_score": 0.010581068028038642}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n\nClass(OLBase, SumsBase, rec(\n    isOL := true,\n    visitAs := \"OLBase\",\n));\n\n## Multiplication operator\n## OLMultiplication(1, n) is I(n)\n## OLMultiplication(2, n) is a point-wise multiplication of two vectors of size n\nClass(OLMultiplication, RewritableObject, BaseMat, OLBase, rec(\n    dims := self >> [self.rChildren()[2], StripList(Replicate(self.rChildren()[1], self.rChildren()[2]))],\n));\n\n## OLConjMultiplication(n) is a point-wise multiplication of two vectors of size n where second vector is complex conjugated\n##\nClass(OLConjMultiplication, RewritableObject, BaseMat, OLBase, rec(\n    dims := self >> [self.rChildren()[2], StripList(Replicate(self.rChildren()[1], self.rChildren()[2]))],\n));\n\n#F RCOLMultiplication is RC(OLMultiplication(..))\n#F\nClass(RCOLMultiplication, RewritableObject, BaseMat, OLBase, rec(\n    dims := self >> [2*self.rChildren()[2], StripList(Replicate(self.rChildren()[1], 2*self.rChildren()[2]))],\n));\n\n## RCOLConjMultiplication(n) is RC(OLConjMultiplication(n))\n##\nClass(RCOLConjMultiplication, RewritableObject, BaseMat, OLBase, rec(\n    dims := self >> [2*self.rChildren()[2], StripList(Replicate(self.rChildren()[1], 2*self.rChildren()[2]))],\n));\n\n\nClass( 2DI, SumsBase, RewritableObject, AttrMixin, rec(\n   isSPL := true,\n   isIdentity := True,\n   advdims := self >> let(a:=self.rChildren(), [[a], [a]]),\n   dims := self >> let(a:=Product(self.rChildren()), [a, a]),\n   rng := self >> [ TArray(TUnknown, Product(self.rChildren()))],\n   dmn := self >> [ TArray(TUnknown, Product(self.rChildren()))],\n   children := self >> [],\n   arity := ClassSPL.arity,\n   updateParams := meth(self)\n       self.func := fId(Product(self.params));\n       Inherited();\n   end,\n));\n\nClass(LeftOver, RewritableObject, ClassSPL, rec(\n    isSums := true,\n    isSPL := true,\n\n    __call__ := (self, cond, spl) >> Cond(\n\tcond=true, spl,\n\tcond=false, let(d := spl.dims(), VirtualPad(d[1], d[2], I(0))),\n\tInherited(cond, spl)),\n\n    rng := self >> self.params[2].rng(),\n    dmn := self >> self.params[2].dmn(),\n    dims := self >> [ StripList(List(self.rng(), (l) -> l.size)), StripList(List(self.dmn(), (l) -> l.size)) ],\n    advdims := self >> self.params[2].advdims(),\n\n    isInplace := self >> self.params[2].isInplace(),\n    transpose := self >> ObjId(self)(self.params[1], self.params[2].transpose()),\n    conjTranspose := self >> ObjId(self)(self.params[1], self.params[2].conjTranspose()),\n\n    isReal := self >> self.params[2].isReal(),\n\n    a := rec(),\n\n    print:= arg >> let(\n\tself := arg[1],\n\ti := Cond(Length(arg)>=3, arg[2], 0), \n\tis := Cond(Length(arg)>=3, arg[3], 4), \n\tPrint(self.__name__, \"(\", self.params[1], \"\\n\", \n\t    Blanks(i+is), self.params[2].print(i+is, is), \"\\n\", Blanks(i), \")\"))\n));\n\n\nClass( OLDup, RewritableObject, BaseMat, OLBase, rec(\n    dims := self >> [Replicate(self.params[1], self.params[2]), self.params[2]],\n));\n\n# ParSeqWrap is a helper class used dduring codegen stage to ease code generation\n#\n\nClass(ParSeqWrap, BaseContainer, rec(\n    __call__ := (self, p, ci, y, x) >> \n        WithBases(self, rec(p := p, ci := ci, y := y, x := x, dimensions := [p.dimsCompL(p.child(ci)), p.dimsCompR(p.child(ci))])),\n    dims := self >> self.dimensions,\n    children := self >> [self.p.child(self.ci)],\n));\n\n#  ParSeq(<N>, <spl>, <spl>, ...) operator implements simultaneous sequentional (first <N> inputs/outputs) and \n#    parallel (all other inputs/outputs) data flow:\n#  \n#        +----+-<- +\n#        |    |\n#  * <- A <- B <- *\n#        |    |\n#  + <---+----+\n#\n# For example: ParSeq(1, Addition(2,1), Addition(2,1), Addition(2,1));\n#              Y[0] := X1[0] + X2[0] + X2[0] + X2[0];\n\nClass(ParSeq, SumsBase, BaseOperation, rec(\n    area := self >> Sum(self.children(), x->x.area()),\n    abbrevs := [ arg -> Checked( Length(arg)>1 and IsPosInt0(arg[1]),\n                                 [ arg[1], Flat(Drop(arg, 1)) ] )\n               ],\n\n    # filter list leaving elements with positions of Compose inputs/outputs\n    filtCompL := (self, lst) >> lst{[1..self.fb_cnt]},\n    filtCompR := (self, lst) >> lst{[1..self.fb_cnt]},\n    filtSUML  := (self, lst) >> lst{[self.fb_cnt+1..Length(lst)]},\n    filtSUMR  := (self, lst) >> lst{[self.fb_cnt+1..Length(lst)]},\n\n    dimsCompL := (self, child) >> self.filtCompL(Flat([self.dims()[1]])),\n    dimsCompR := (self, child) >> self.filtCompR(Flat([self.dims()[2]])),\n    dimsSUML  := (self, child) >> self.filtSUML(Flat([self.dims()[1]])),\n    dimsSUMR  := (self, child) >> self.filtSUMR(Flat([self.dims()[2]])),\n\n    checkDimsCompose := (self) >> let(chdims := List(self._children, c -> [self.dimsCompL(c), self.dimsCompR(c)]),\n        DoForAll([1..Length(chdims)-1], i ->\n            DoForAll(Zip2(chdims[i][2], chdims[i+1][1]), x->\n                When( not(IsSymbolic(x[1]) or IsSymbolic(x[2])) and (x[1] <> x[2]),\n                      Error(\"Dimensions of children \",i,\" and \",i+1,\" do not match (\",x[1],\" <> \",x[2],\") in \", self._children), 0)))),\n\n    checkDimsSUM := (self) >> let(\n        chdims := TransposedMat(List(self._children, c -> [self.dimsSUML(c), self.dimsSUMR(c)])),\n        dims := List(TransposedMat(chdims[1]) :: TransposedMat(chdims[2]), d -> Set(Filtered(d, e -> not IsSymbolic(e)))),\n        When(not ForAll(dims, d -> Length(d) in [0,1]),\n            Error(\"Dimensions of summands do not match\"), 0)),\n\n    #-----------------------------------------------------------------------\n    new := meth(self, fb_cnt, C)\n        local dims, obj, a;\n        Constraint(Length(C) >= 1); Constraint(ForAll(C, IsSPL));\n        a := C[1].arity();\n        Constraint(ForAll(C, e -> e.arity()=a));\n        Constraint(IsInt(fb_cnt) and fb_cnt>=0 and fb_cnt <= a[1] and fb_cnt <= a[2]);\n\n        if Length(C) = 1 then return C[1]; fi;\n        if fb_cnt=a[1] and a[1]=a[2] then return Compose(C); fi;\n        if fb_cnt=0 then return SUM(C); fi;\n\n        # check 'Compose' dims\n        obj := SPL(WithBases(self, rec( _children := C, fb_cnt := fb_cnt)));\n        obj.checkDimsCompose();\n        obj.checkDimsSUM();\n        return obj.setDims();\n    end,\n    \n    rng:= self >> self._children[1].rng(),\n    dmn:= self >> Last(self._children).dmn(),\n\n    isPermutation := self >> false,\n\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), [self.fb_cnt] :: rch).appendAobj(self),\n\n    print := (self, i, is) >> self._print([self.fb_cnt] :: self.rChildren(), i, is),\n\n));\n\n\n", "meta": {"hexsha": "a28bff900c9a7635ba0c4b845c624f81f410ac13", "size": 6471, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/ol.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/ol.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/ol.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 38.0647058824, "max_line_length": 135, "alphanum_fraction": 0.5838355741, "num_tokens": 1966, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.38121956625614994, "lm_q2_score": 0.027585280028364554, "lm_q1q2_score": 0.010516048487467572}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#\n# AVX conversion bridges\n#\n\n\nISA_Bridge.add(Class(CVT_SSE_4x32f_AVX_8x32f, ISA_Bridge_I, rec(\n    isa_from    := AVX_8x32f,\n    isa_to      := SSE_4x32f(T_Real(32)),\n    props       := [],\n    code := (self, y, x, opts) >> let( t := var.fresh_t(\"c\", self.isa_from.t), \n        decl( [t], chain(\n            assign(t, self._x(x,0)),\n            assign(self._y(y,0), vextract_4l_8x32f(t, [0])), \n            assign(self._y(y,1), vextract_4l_8x32f(t, [1]))\n        )))\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_AVX_4x64f, ISA_Bridge_I, rec(\n    isa_from    := AVX_4x64f,\n    isa_to      := AVX_8x32f,\n    props       := [],\n    code := (self, y, x, opts) >>\n        assign(self._y(y,0), vpermf128_8x32f(vcvt_8x32f_4x64f(self._x(x,0)), vcvt_8x32f_4x64f(self._x(x,1)), [1,3]))\n)));\n\nISA_Bridge.add(Class(CVT_AVX_4x64f_SSE_4x32f, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Real(32)),\n    isa_to      := AVX_4x64f,\n    props       := [],\n    code := (self, y, x, opts) >>\n        assign(self._y(y,0), vcvt_4x64f_4x32f(self._x(x,0)))\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_SSE_4x32i, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Int(32)),\n    isa_to      := AVX_8x32f,\n    props       := [],\n    code := (self, y, x, opts) >>\n        assign(self._y(y,0), vcvt_8x32f_8x32i(vinsert_4l_8x32f(vinsert_4l_8x32f(self.isa_to.t.zero(), self._x(x,0), [0]), self._x(x,1), [1])))\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_AVX_8x32f_round, ISA_Bridge_I, rec(\n    isa_from    := AVX_8x32f,\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [\"round\"],\n    code := (self, y, x, opts) >> let( t := var.fresh_t(\"c\", TVect(T_Int(32), 8)),\n        decl([t], chain(\n            assign(t, vcvt_8x32i_8x32f(self._x(x,0))),\n            assign(self._y(y,0), vextract_4l_8x32f(t, [0])), \n            assign(self._y(y,1), vextract_4l_8x32f(t, [1]))\n        )))\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_AVX_8x32f_trunc, ISA_Bridge_I, rec(\n    isa_from    := AVX_8x32f,\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [\"trunc\"],\n    code := (self, y, x, opts) >> let( t := var.fresh_t(\"c\", TVect(T_Int(32), 8)),\n        decl([t], chain(\n            assign(t, vcvtt_8x32i_8x32f(self._x(x,0))),\n            assign(self._y(y,0), vextract_4l_8x32f(t, [0])), \n            assign(self._y(y,1), vextract_4l_8x32f(t, [1]))\n        )))\n)));\n\nISA_Bridge.add(Class(CVT_AVX_4x64f_SSE_4x32i, ISA_Bridge_I, rec(\n    isa_from    := SSE_4x32f(T_Int(32)),\n    isa_to      := AVX_4x64f,\n    props       := [],\n    code := (self, y, x, opts) >>\n        assign(self._y(y,0), vcvt_4x64f_4x32i(self._x(x,0)))\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_AVX_4x64f_round, ISA_Bridge_I, rec(\n    isa_from    := AVX_4x64f,\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [\"round\"],\n    code := (self, y, x, opts) >>\n        assign(self._y(y,0), vcvt_4x32i_4x64f(self._x(x,0))),\n)));\n\nISA_Bridge.add(Class(CVT_SSE_4x32i_AVX_4x64f_trunc, ISA_Bridge_I, rec(\n    isa_from    := AVX_4x64f,\n    isa_to      := SSE_4x32f(T_Int(32)),\n    props       := [\"trunc\"],\n    code := (self, y, x, opts) >> \n        assign(self._y(y,0), vcvtt_4x32i_4x64f(self._x(x,0))),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_8x32f_clip32i, ISA_Bridge_I, rec(\n    isa_from    := AVX_8x32f,\n    isa_to      := AVX_8x32f,\n    props       := [\"saturation\"],\n    range       := (self) >> RangeT(self.clip.min, self.clip.max, T_Real(32).range().eps),\n    clip        := rec( min := T_Int(32).range().min, max := T_Int(32).range().max ),\n    code := (self, y, x, opts) >> assign( self._y(y,0), min(max(self._x(x,0), self.isa_from.t.value(self.clip.min)), self.isa_from.t.value(self.clip.max)) ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_8x32f_clip32ui, CVT_AVX_8x32f_8x32f_clip32i, rec(\n    clip        := rec( min := T_UInt(32).range().min, max := T_UInt(32).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_8x32f_clip16i, CVT_AVX_8x32f_8x32f_clip32i, rec(\n    clip        := rec( min := T_Int(16).range().min,  max := T_Int(16).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_8x32f_clip16ui, CVT_AVX_8x32f_8x32f_clip32i, rec(\n    clip        := rec( min := T_UInt(16).range().min, max := T_UInt(16).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_8x32f_clip8i, CVT_AVX_8x32f_8x32f_clip32i, rec(\n    clip        := rec( min := T_Int(8).range().min,  max := T_Int(8).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_8x32f_8x32f_clip8ui, CVT_AVX_8x32f_8x32f_clip32i, rec(\n    clip        := rec( min := T_UInt(8).range().min, max := T_UInt(8).range().max ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_4x64f_4x64f_clip32i, ISA_Bridge_I, rec(\n    isa_from    := AVX_4x64f,\n    isa_to      := AVX_4x64f,\n    props       := [\"saturation\"],\n    range       := (self) >> RangeT(self.clip.min, self.clip.max, T_Real(32).range().eps),\n    clip        := rec( min := T_Int(32).range().min, max := T_Int(32).range().max ),\n    code := (self, y, x, opts) >> assign( self._y(y,0), min(max(self._x(x,0), self.isa_from.t.value(self.clip.min)), self.isa_from.t.value(self.clip.max)) ),\n)));\n\nISA_Bridge.add(Class(CVT_AVX_4x64f_4x64f_clip32ui, CVT_AVX_4x64f_4x64f_clip32i, rec(\n    clip        := rec( min := T_UInt(32).range().min, max := T_UInt(32).range().max ),\n)));\n\n", "meta": {"hexsha": "a6f2ec872dcfc7e2f419e5fcfa2f0f49a092edd5", "size": 5300, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/avx/cvt.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/avx/cvt.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/avx/cvt.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 38.6861313869, "max_line_length": 157, "alphanum_fraction": 0.600754717, "num_tokens": 2068, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.411110869232168, "lm_q2_score": 0.025565214201678794, "lm_q1q2_score": 0.010510137432558735}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImport(compiler, code, fpgen);\n\n# temporary fix to declare variables used in _mm_loadl_xx/_mm_loadh_xx\nCellCompileStrategyVector := Concatenation(\n#    [ c -> vref.setNoScalar(c) ], # must be at the begin; otherwise subvector access breaks\n    BaseCS,\n    [\n    BinSplit, CSE,\n    # MarkDefUse, FFTWScheduleAssignments, CopyPropagate, <- NOTE: breaks\n#    MarkDefUse, DFSChain, # currently not used\n    CopyPropagate,\n    Compile.declareVars,\n    (c,opts) -> opts.vector.isa.fixProblems(c, opts),\n    (c, opts) -> ESReduce(c, opts)\n#    c -> DeadCodeElim(c),\n#    c -> vref.resetNoScalar(c) # must be at the end right before declaring the missing vars!!\n    #DeclareVars\n]);\n\nCellCompileStrategyVectorFP := (bits, fracbits) -> Concatenation(\n    CellCompileStrategyVector,\n    [ c -> FixedPointCode(c, bits, fracbits) ]\n);\n", "meta": {"hexsha": "5c8171b1c9e3ccfa8898b2ce65e7d898506f64f1", "size": 906, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/vmx/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/vmx/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/vmx/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.2413793103, "max_line_length": 94, "alphanum_fraction": 0.6986754967, "num_tokens": 255, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.341582499438317, "lm_q2_score": 0.030675802929152386, "lm_q1q2_score": 0.010478317436817116}}
{"text": "Walk := function(name, op)\n\tlocal dir, file, e;\n\tdir := Directory(name);\n\tfor e in SortedList(DirectoryContents(name)) do\n\t\tfile := Filename(dir, e);\n\t\tif IsDirectoryPath(file) then\n\t\t\tif not (e in [\".\", \"..\"]) then\n\t\t\t\tWalk(file, op);\n\t\t\tfi;\n\t\telse\n\t\t\top(file);\n\t\tfi;\n\tod;\nend;\n\n# This will print filenames\nWalk(\".\", Display);\n", "meta": {"hexsha": "f0a3a38c0c01dfb58b896ecbc203c0d8f3f105c1", "size": 328, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Walk-a-directory-Recursively/GAP/walk-a-directory-recursively.gap", "max_stars_repo_name": "mullikine/RosettaCodeData", "max_stars_repo_head_hexsha": "4f0027c6ce83daa36118ee8b67915a13cd23ab67", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Walk-a-directory-Recursively/GAP/walk-a-directory-recursively.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Walk-a-directory-Recursively/GAP/walk-a-directory-recursively.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 18.2222222222, "max_line_length": 48, "alphanum_fraction": 0.612804878, "num_tokens": 96, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.23091976292927183, "lm_q2_score": 0.04535258248977614, "lm_q1q2_score": 0.01047280759676935}}
{"text": "InstallGlobalFunction(MitM_SCSCPServerHandshake,\nfunction(in_stream, out_stream)\n    local msg, get, pi, client_versions, versions, version;\n    # Send connection initiation message (5.1.1)\n    msg := Concatenation(\"<?scscp service_name=\\\"{}\\\" service_version=\\\"{}\\\" \",\n                         \"service_id=\\\"{}\\\" scscp_versions=\\\"{}\\\" ?>\");\n    msg := StringFormatted(msg,\n                           \"gap\", \"4.10dev\", String(IO_getpid()),\n                           JoinStringsWithSeparator(MitM_SCSCPVersions, \" \"));\n    WriteLine(out_stream, msg);\n    # TODO: we are required to support SCSCP v1.0\n\n    # Version negotiation (5.1.2)\n    get := MitM_ReadToPI(in_stream);\n    if get.success = false then\n        Info(InfoMitMSCSCP, 2,\n             \"Version negotiation failed: no version request from client\");\n        return fail;\n    fi;\n    pi := Concatenation(\"<\", get.pi, \">\");\n    pi := GetSTag(pi, 2);\n    if not IsBound(pi.attributes.version) then\n        Info(InfoMitMSCSCP, 2,\n             \"Version negotiation failed: no version request from client\");\n        return fail;\n    fi;\n    client_versions := SplitString(pi.attributes.version, \"\", \" \\n\\r\\t\");\n    versions := Filtered(client_versions, v -> v in MitM_SCSCPVersions);\n    if IsEmpty(versions) then\n        Info(InfoMitMSCSCP, 2,\n             Concatenation(\"Version negotiation failed: client requested \",\n                           Concatenation(client_versions),\n                           \", none of which is supported\"));\n        WriteLine(out_stream,\n                  \"<?scscp quit reason=\\\"not supported version\\\" ?>\");\n        return fail;\n    fi;\n    version := Maximum(versions); # choose the highest lexicographically\n    WriteLine(out_stream, Concatenation(\"<?scscp version=\\\"\",\n                                        version, \"\\\" ?>\"));\n    # Successful handshake, now ready for procedure calls\n    return version;\nend);\n\nInstallGlobalFunction(MitM_SCSCPClientHandshake,\nfunction(in_stream, out_stream)\n    local get, pi, start, finish;\n    # Get connection initiation message (5.1.1)\n    get := MitM_ReadToPI(in_stream);\n    if not get.success then\n        Info(InfoMitMSCSCP, 2,\n             \"Initiation failed: no processing instruction received\");\n        return false;\n    fi;\n    # Use XML parser to get at the information\n    pi := Concatenation(\"<\", get.pi, \">\");\n    pi := GetSTag(pi, 2);\n    if pi.name <> \"scscp\" then\n        Info(InfoMitMSCSCP, 2,\n             \"Initiation failed: no SCSCP instruction received\");\n        return false;\n    elif Set(RecNames(pi.attributes)) <> [\"scscp_versions\",\n                                          \"service_id\",\n                                          \"service_name\",\n                                          \"service_version\"] then\n        Info(InfoMitMSCSCP, 2,\n             \"Initiation failed: bad connection initiation message received\");\n        return false;\n    elif not \"1.3\" in SplitString(pi.attributes.scscp_versions, \"\", \" \") then\n        # TODO: we are required to support SCSCP v1.0\n        Info(InfoMitMSCSCP, 2,\n             \"Initiation failed: server offers no SCSCP version we know\");\n        return false;\n    fi;\n\n    # Version negotiation (5.1.2)\n    WriteLine(out_stream, \"<?scscp version=\\\"1.3\\\" ?>\");\n    get := MitM_ReadToPI(in_stream);\n    if not get.success then\n        Info(InfoMitMSCSCP, 2,\n             \"Version negotiation failed: no valid response from server\");\n        return false;\n    elif PositionSublist(get.pi, \"quit\") <> fail then\n        Info(InfoMitMSCSCP, 2,\n             \"Version negotiation failed: server quit with following message:\");\n        start := Position(get.pi, '\\\"');\n        finish := Position(get.pi, '\\\"', start);\n        Info(InfoMitMSCSCP, 2, get.pi{[start..finish]});\n        return false;\n    fi;\n    pi := Concatenation(\"<\", get.pi, \">\");\n    pi := GetSTag(pi, 2);\n    if not IsBound(pi.attributes.version) then\n        Info(InfoMitMSCSCP, 2,\n             \"Version negotiation failed: server sent no version number\");\n        return false;\n    elif pi.attributes.version <> \"1.3\" then\n        Info(InfoMitMSCSCP, 2,\n             Concatenation(\"Version negotiation failed: server chose version \",\n                           pi.attributes.version,\n                           \", which is not supported\"));\n        return false;\n    fi;\n\n    # Successful handshake, now ready for procedure calls\n    return true;\nend);\n\nInstallGlobalFunction(MitM_ReadSCSCP,\nfunction(stream)\n    local get, pi, r;\n    # Get first processing instruction\n    get := MitM_ReadToPI(stream);\n    # It should be an SCSCP start instruction\n    if not get.success then\n        return MitM_Error(\"no processing instruction found\");\n    fi;\n    pi := get.pi;\n    pi := SplitString(pi, \"\", \" \\n\\r\\t\");\n    if pi[1] <> \"scscp\" or pi[2] <> \"start\" or Length(pi) > 2 then\n        return MitM_Error(\"no SCSCP start instruction found\");\n    fi;\n    # Read to the end instruction\n    get := MitM_ReadToPI(stream);\n    if not get.success then\n        return MitM_Error(\"only one processing instruction found\");\n    fi;\n    pi := get.pi;\n    pi := SplitString(pi, \"\", \" \\n\\r\\t\");\n    if pi[1] <> \"scscp\" or pi[2] <> \"end\" or Length(pi) > 2 then\n        return MitM_Error(\"no SCSCP end instruction found\");\n    fi;\n    # The in-between stuff should be an OMOBJ\n    r := MitM_XMLToOMRec(get.pre);\n    if MitM_Tag(r) <> \"OMOBJ\" then\n        return MitM_Error(\"no OMOBJ object found\");\n    fi;\n    return MitM_Result(r);\nend);\n\nInstallGlobalFunction(MitM_ReadToPI,\nfunction(stream)\n    local pre, len, char, byte, error, lastchar, pi;\n    pre := \"\";\n    len := 0;\n    char := fail;\n    repeat\n        byte := ReadByte(stream);\n        if byte = fail then\n            return rec(success := false, pre := pre,\n                       error := \"stream ended before an XML PI was found\");\n        fi;\n        lastchar := char;\n        char := CharInt(byte);\n        len := len + 1;\n        pre[len] := char;\n    until lastchar = '<' and char = '?';\n    Remove(pre);\n    Remove(pre);\n    pi := \"\";\n    len := 0;\n    repeat\n        byte := ReadByte(stream);\n        if byte = fail then\n            return rec(success := false, pre := pre, pi := pi,\n                       error := \"stream ended in middle of XML PI\");\n        elif byte = 60 then\n            return rec(success := false, pre := pre, pi := pi,\n                       error := \"'<' character illegal inside XML PI\");\n        fi;\n        lastchar := char;\n        char := CharInt(byte);\n        len := len + 1;\n        if len > 4092 then # max length 4094 including \"<?\"\n            return rec(success := false, pre := pre, pi := pi,\n                       error := \"XML PI cannot be longer than 4094 characters\");\n        fi;\n        pi[len] := char;\n    until lastchar = '?' and char = '>';\n    Remove(pi);\n    Remove(pi);\n    return rec(success := true, pre := pre, pi := pi);\nend);\n", "meta": {"hexsha": "0fe918f68e85961f9d04a79c7b0328c502b369b7", "size": 6903, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/Stream.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/Stream.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/Stream.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 37.5163043478, "max_line_length": 80, "alphanum_fraction": 0.5714906562, "num_tokens": 1657, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.33111973962899144, "lm_q2_score": 0.031618768637422405, "lm_q1q2_score": 0.010469598438612627}}
{"text": "EW schwarz,1,Projekt\t\t//This line defines the kind of character to be created (EW=cube schwarz=black,1=size?,Projekt is not used)\r\n  T(1,0,0)\t\t\t//relocaded to (x,y,z)\r\n  T(1,0,0)\t\t\t//relocated to (x,y,z)\r\nEW schwarz,1,Projekt\t\t//This line defines the kind of character to be created (EW=cube schwarz=black,1=size?,Projekt is not used)\r\n  S(2,2,2)\t\t\t//redefines size of edges to (x,y,z)\r\n", "meta": {"hexsha": "f4b49d989e81e4765aa4d893cb01fbe2a35f3013", "size": 387, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "HowGAMfileswork/cubes.gap", "max_stars_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_stars_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-03-14T08:02:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-14T08:02:54.000Z", "max_issues_repo_path": "HowGAMfileswork/cubes.gap", "max_issues_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_issues_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HowGAMfileswork/cubes.gap", "max_forks_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_forks_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 64.5, "max_line_length": 130, "alphanum_fraction": 0.684754522, "num_tokens": 142, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.41489884579676883, "lm_q2_score": 0.025178841746320235, "lm_q1q2_score": 0.010446672379047764}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nUnifyPair := (aa,bb) -> let(\n    # NOTE: this converts 2->TInt, this is a hack\n    a := Cond(IsInt(aa) or IsSymbolic(aa), TInt, ObjId(aa)=TFunc, _convType(aa), aa),\n    b := Cond(IsInt(bb) or IsSymbolic(bb), TInt, ObjId(bb)=TFunc, _convType(bb), bb), \n    aid := ObjId(a),    bid := ObjId(b),  avec := IsVecT(aa), bvec := IsVecT(bb), \n    Cond(\n\n     # YSV: this handles subtraction of pointers (=integer index)\n     #      addition of pointers is not valid\n#     aid=TPtr and bid=TPtr, TInt, \n\n     a=b, a,\n     a = TUnknown and b <> TUnknown, b,\n     b = TUnknown and a <> TUnknown, a,\n\n#     aid in [TPtr, TArray] and (b=TInt or bid in [T_Int, T_UInt]), TPtr(a.t, When(aid=TArray, [], a.qualifiers), When(aid=TArray, ptrAligned, a.alignment)),\n#     bid in [TPtr, TArray] and (a=TInt or aid in [T_Int, T_UInt]), TPtr(b.t, When(bid=TArray, [], b.qualifiers), When(bid=TArray, ptrAligned, b.alignment)),\n     #NOTE: this looks like an horrible hack but how else can it be done?\n     #isn't this a fundamental weakness of C/C++ ?\n\n#     aid=TPtr and bid=TArray, a,\n#     aid=TArray and bid=TPtr, b,\n \n     avec and bvec and a.size<>b.size,     TVect(UnifyPair(a.t, b.t), Maximum(a.size, b.size)),\n     avec and bvec, Checked(a.size=b.size, TVect(UnifyPair(a.t, b.t), a.size)),\n     avec, TVect(UnifyPair(a.t, b), a.size),\n     bvec, TVect(UnifyPair(a, b.t), b.size),\n\n     aid=TFixedPt and bid=TFixedPt,\n        When(a = b, a, Error(\"Can't unify fixed point types of different bit width\")),\n\n     a=TComplex and b in [TReal, TComplex, TInt, TUInt], TComplex,\n     b=TComplex and a in [TReal, TComplex, TInt, TUInt], TComplex,\n\n     (aid=T_Real or a=TReal) and (bid in [T_UInt, T_Int] or b in [TReal, TInt, TUInt]), a,\n     (bid=T_Real or b=TReal) and (aid in [T_UInt, T_Int] or a in [TReal, TInt, TUInt]), b,\n\n     a=TInt and b in  [TInt,TBool,TUInt], TInt,\n     a in [TInt,TUInt,TBool] and b=TInt,  TInt,\n\n     aid=T_Complex and b in [TComplex, TReal, TInt], a,\n     bid=T_Complex and a in [TComplex, TReal, TInt], b,\n\n     aid in [T_Real, T_Int] and b=TComplex, T_Complex(a),\n     bid in [T_Real, T_Int] and a=TComplex, T_Complex(b),\n\n     aid=T_Complex and bid=T_Complex, T_Complex(UnifyPair(a.params[1], b.params[1])),\n     aid=T_Complex and bid in [TFixedPt, T_Real, T_UInt, T_Int], \n         T_Complex(UnifyPair(a.params[1], b)),\n     bid=T_Complex and aid in [TFixedPt, T_Real, T_UInt, T_Int], \n         T_Complex(UnifyPair(a, b.params[1])),\n\n     a=TComplex and bid = TFixedPt, T_Complex(b), \n     b=TComplex and aid = TFixedPt, T_Complex(a), \n\n     aid=T_Real and bid=T_Real, T_Real(Maximum(a.params[1], b.params[1])),\n\n     aid in [T_Int, T_UInt] and b in [TInt, TUInt], a,\n     a in [TInt, TUInt] and bid in [T_Int, T_UInt], b,\n\n     aid=T_UInt and bid=T_UInt, T_UInt(Maximum(a.params[1], b.params[1])),\n     aid in [T_Int, T_UInt] and bid in [T_Int, T_UInt], T_Int(Maximum(a.params[1], b.params[1])),\n     \n\n     aid=TFixedPt, a,\n     bid=TFixedPt, b,\n\n     a=TDummy or b=TDummy, TDummy,\n\n     IsArrayT(a) and IsArrayT(b), Checked(a.size=b.size, TArray(UnifyPair(a.t, b.t), a.size)),\n     IsArrayT(a), TArray(UnifyPair(a.t, b), a.size),\n     IsArrayT(b), TArray(UnifyPair(a, b.t), b.size),\n\n     IsBound(a.unifyWith), a.unifyWith(b),\n     IsBound(b.unifyWith), b.unifyWith(a),\n\n     #MRT handles addition/subtraction of pointers and ints.\n     aid = TPtr and b = TInt, b,\n     a = TInt and bid = TPtr, a,\n     #MRT END\n\n     Error(\"Can't unify \", a, \" and \", b)));\n\n#F UnifyTypes(<types>) - given a list of types returns a\n#F   most general type\n#F   NOTE: complete this.\n#F\nUnifyTypes := function(types)\n    local t, l, i, a, b;\n    l := Length(types);\n    \n    if   l=0 then return TUnknown; \n    elif l=1 then return types[1]; \n    fi;\n\n    [i, t] := [2, types[1]];\n    while i <= l do\n        t := UnifyPair(t, types[i]); \n\ti := i+1;\n    od;\n    return t;\nend;\n\nUnifyTypesL := function(args)\n    local t, l, i, a, b;\n    l := Length(args);\n    \n    if   l=0 then return TUnknown; \n    elif l=1 then return args[1].t; \n    fi;\n\n    [i, t] := [2, args[1].t];\n    while i <= l do\n        t := UnifyPair(t, args[i].t); \n\ti := i+1;\n    od;\n    return t;\nend;\n\nDeclare(InferType);\n\nUnifyTypesV := values -> UnifyTypes(List(values, InferType));\n\nInferType := v -> let(gt := BagType(v),\n   Cond(\n       IsInt(v),\n           TInt,\n       gt = T_RAT or gt = T_DOUBLE,\n           TReal,\n       gt = T_CPLX,\n           TComplex,\n       gt = T_CYC,\n           When(Im(v)=0, TReal, TComplex),\n       gt = T_CHAR,\n           TChar,\n       gt = T_BOOL,\n           TBool,\n       IsString(v),\n           TString,\n       IsExp(v) or IsValue(v),\n           When(IsBound(v.t), v.t, TUnknown),\n\n       gt = T_RANGE, Checked(Length(v) >= 0,\n       TArray(TInt, Length(v))),\n\n       IsList(v), Checked(Length(v) >= 0,\n       TArray(UnifyTypes(List(v, InferType)), Length(v))),\n\n       Error(\"Can't infer the type of \", v)));\n\n#NOTE: when 'v' is a list with expressions inside it will create TArray value which is wrong\nV := v -> Cond(IsValue(v), v,\n               IsExp(v), v.eval(),\n               InferType(v).value(v));\n", "meta": {"hexsha": "ae5f2feedf7f1c901f33a13a356308e64b682559", "size": 5198, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/unify.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/unify.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/unify.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 32.4875, "max_line_length": 157, "alphanum_fraction": 0.5890727203, "num_tokens": 1699, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.4532618480153861, "lm_q2_score": 0.022977369157350488, "lm_q1q2_score": 0.010414764806792418}}
{"text": "\n# Copyright 2018-2019, Carnegie Mellon University\n# See LICENSE for details\n\nClass(cos, AutoFoldExp, rec(\n  computeType := (self) >> TReal,\n  \n));\n\nClass(sin, AutoFoldExp, rec(\n  computeType := (self) >> TReal,\n));\n\nClass(tan, AutoFoldExp, rec(\n  computeType := (self) >> TReal,\n));\n\n\n\nClass(TIVReal, AtomicTyp, rec(\n    hash := (_val, size) -> let(val := When(IsList(_val), _val, [_val, _val]),\n        h := DoubleRep64(val[1]) + DoubleRep64(val[2]),\n        1 + (h mod size)),\n    check := v -> Cond(IsDouble(v) or IsList(v) and Length(v) = 2 and v[1] <= v[2], v, Error(\"<v> must be a Double or an ordered list of length 2\")),\n    realType    := self >> self,\n    print := self >> Print(self.__name__, \"(\", self.t, \")\"),\n    base_t := self >> self.t,\n    zero := self >> self.value(0.0),\n    one := self >> self.value(1.0),\n    __call__ := (self, t) >>\n        WithBases(self, rec(\n        t    := Checked(IsType(t), t),\n        operations := TypOps))\n));\n\nClass(TIVBool, AtomicTyp, rec(\n    hash := (val, size) -> 1 + (InternalHash(val) mod size),\n    check := v -> Cond(IsInt(v) and v in [0, 1, -1], v, Error(\"<v> must be in [-1, 0, 1]\")),\n    zero := self >> self.value(0),\n    one := self >> self.value(1)\n));\n\nClass(ivenv, chain);\n\n\nClass(RulesHCOLIVArithType, RuleSet, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesHCOLIVArithType, rec(  \n\tivenv_prop_types_bools := ARule(ivenv, [[@(1, assign), @(2,var).cond(e->e.t<>TInt), \n\t\t@(3).cond(e-> e.t<>@(2).val.t and e.t=TBool)], @(4)], \n        e->let( \t\t\t\t\t\t\n\t\tnvar := var.fresh_t(\"n\", TInt), \n\t\t#Print(\"New Type 2: \", @(1).val,\"(\",@(2).val, \",\",@(3).val,\")\\n\", @(2).val.t, \" <> \", @(3).val.t, \"\\n New Var Type: \", nvar, \",\",nvar.t,\" \\n\"),\n\t  [decl([nvar], SubstVars(chain(assign(nvar, @(3).val), @(4).val), rec((@(2).val.id) := nvar )))] ) ),\n\n    ivenv_prop_types := ARule(ivenv, [[@(1, assign), @(2,var), \n\t\t@(3).cond(e-> e.t<>@(2).val.t and not (e.t in [TVect(T_Real(64), 2), TIVReal, TBool]))], @(4,...)], \n        e->let( \t\t\t\t\t\t\n\t\tnvar := var.fresh_t(\"n\", @(3).val.t), \n\t\t#Print(\"New Type: \", @(1).val,\"(\",@(2).val, \",\",@(3).val,\")\", @(2).val.t, \" <> \", @(3).val.t, \" \", nvar, \"\\n\", @(4).val, \"\\n\"),\n\t  [decl([nvar], SubstVars(chain(assign(nvar, @(3).val), @(4).val), rec((@(2).val.id) := nvar )))] ) ),\n\n));\n\nClass(RulesHCOLIVArith, RuleSet, rec(inType := \"iCode\", outType := \"iCode\"));\nRewriteRules(RulesHCOLIVArith, rec(\n    ivenv_chain := Rule(@(1, ivenv, e->ForAny(e.cmds, f->ObjId(f) = chain)),\n        e->ApplyFunc(ivenv, Flat(List(@(1).val.cmds, j->When(ObjId(j)=chain, j.cmds, j))))),\n    ivenv_xyz_decl := ARule(ivenv, [@(1), @(2, decl)], \n        e->[decl(@(2).val.vars, chain(@(1).val, @(2).val.cmd))]),\t\n    ivenv_decl := Rule(@(1, ivenv, e->ObjId(e.cmds[1])=decl), \n        e -> decl(@(1).val.cmds[1].vars, ivenv(Concat([@(1).val.cmds[1].cmd], Drop(@(1).val.cmds, 1))))),\n    ivenv_drop_selfassign := ARule(ivenv, [@(1, assign, e->IsVar(e.loc) and IsVar(e.exp) and e.exp=e.loc), @(2)], \n        e->[@(2).val]), \n    ivenv_creturn := Rule(@(1, ivenv, e->ObjId(Last(e.cmds))=creturn),\n        e->chain(ivenv(DropLast(@(1).val.cmds, 1)), Last(@(1).val.cmds))),\n    loop_pull_const_array_tcast := Rule([@(1, loop), @(2),  @(3), [@(4, chain), [@(5, assign), @(6,var), [@(7, tcast), @(8), @(9,nth, e->IsValue(e.idx))]],...]], \n        e->let(#Print(e, \"\\n\"), \n\t\tchain(@(5).val, loop(@(1).val.var, @(1).val.range, chain(Drop(@(4).val.cmds,1)))))),\n    ivenv_state := Rule([@(1, tcast), @(2), @@(3, nth, (e, cx)->IsBound(cx.opts.state) and e.loc.id=cx.opts.state.id)], \n        (e, cx)->nth(cx.opts.ivstate, e.args[2].idx) )\n));\n\n\n\nRulesCodeUnrollHACMIVArth := CopyFields(MergedRuleSet( RulesHCOLIVArith, RulesUnrollHCOL, RulesStrengthReduce,  RulesCodeHCOL), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\nRulesCodeHACMIVArth := CopyFields(MergedRuleSet(RulesStrengthReduce, RulesCodeHCOL, RulesHCOLIVArith), \n    rec(inType:=\"iCode\", outType := \"iCode\"));\n\nRulesCodeUnrollHACMIVArthType := CopyFields(MergedRuleSet(RulesCodeUnrollHACMIVArth, RulesHCOLIVArithType), \n\trec(inType :=\"iCode\", outType:=\"iCode\"));\n\t\nClass(IVArithMixin, rec(\n    precision := \"double\", \n    TRealCtype := \"double\",\n    IVRealType := TIVReal(T_Real(64)),\n    IVBoolType := TInt,\n    IVValueType := TIVReal(T_Real(64)),\n    codeRuleSet := RulesCodeUnrollHACMIVArth\n));\n\nClass(ivExp, errExp);\n\nClass(RealEPS, errExp);\n\nClass(RealMPS, errExp);\n\n\nClass(IVArith, SumsBase, BaseContainer, rec(\n    rng := meth(self) return self._children[1].rng(); end,\n    dmn := meth(self) return self._children[1].dmn(); end,\n    toOperator := self >> (vec -> self.child(1).toOperator()(vec))\n));\n\nClass(TIVArith, Tagged_tSPL_Container, rec(\n    abbrevs :=  [ s -> Checked(IsSPL(s), [s]) ],\n    transpose := self >> CopyFields(self, rec(transposed := not self.transposed)),\n    dims := self >> [self.params[1].dims()[1], self.params[1].dims()[2]],\n    isReal := True,\n    toOperator := self >> (vec -> let(r := self.params[1].toOperator()(vec), List(r, i->ivExp(i))))\n));\n\nNewRulesFor(TIVArith, rec(\n    TIVArith_Base := rec(\n        applicable := True,\n        forTransposition := false,\n        children := nt -> [[nt.params[1]]],\n        apply := (t, C, Nonterms) -> IVArith(C[1])\n    ) \n));\n\nHCOLSumsGen.IVArith := (self, o, opts) >> IVArith(self(o.child(1), opts));\n\nClass(TypeUpdate, HierarchicalVisitor, rec(\n\t__call__ := meth(arg)\n        local res;\n        res := ApplyFunc(arg[1].visit, arg{[2..Length(arg)]});\n        return res;\n    end,\n\tfunc := (self, o, opts) >> let(func(o.ret, o.id, o.params, self(o.cmd, opts))),    \n\tdecl := (self, o, opts) >>  decl(o.vars, self(o.cmd, opts)),\n\tchain := (self, o, opts) >> chain(List(o.cmds, i-> self(i, opts))),\n    ivenv := (self, o, opts) >> ivenv(List(o.cmds, i-> self(i, opts))),\n    loop := (self, o, opts) >>  loop(o.var, o.range, self(o.cmd, opts)),\n\t\n\tassign := (self, o, opts) >> assign(o.loc, self(o.exp, opts)),\n\tadd := (self, o, opts) >> add(self(o.args[1], opts), self(o.args[2], opts)),\t\n\tsub := (self, o, opts) >> sub(self(o.args[1], opts), self(o.args[2], opts)),\n\tmul := (self, o, opts) >> mul(self(o.args[1], opts), self(o.args[2], opts)),\n\tdiv := (self, o, opts) >> div(self(o.args[1], opts), self(o.args[2], opts)),\n\tcond := (self, o, opts) >> cond(o.args[1], self(o.args[2], opts), self(o.args[3], opts)),\n\tabs := (self, o, opts) >> abs(self(o.args[1], opts)),\t\t\n\tlogic_and := (self, o, opts) >> logic_and(self(o.args[1], opts), self(o.args[2], opts)),\n\tlogic_or := (self, o, opts) >> logic_or(self(o.args[1], opts), self(o.args[2], opts)),\n\tgt  := (self, o, opts) >> gt(self(o.args[1], opts), self(o.args[2], opts)),\n\tlt  := (self, o, opts) >> lt(self(o.args[1], opts), self(o.args[2], opts)),\n\tgeq  := (self, o, opts) >> geq(self(o.args[1], opts), self(o.args[2], opts)),\n\tleq  := (self, o, opts) >> leq(self(o.args[1], opts), self(o.args[2], opts)),\n\tmin := (self, o, opts) >> min(self(o.args[1], opts), self(o.args[2], opts)),\n\tmax := (self, o, opts) >> max(self(o.args[1], opts), self(o.args[2], opts)),\n\t\n\tnth := (self, o, opts) >> o,\n\tValue := (self, o, opts) >> o,\t\t  \n\tvar := (self, o, opts) >> o, \n\t\n\tskip := (self, o, opts) >> o,\t\n\ttcast := (self, o, opts) >> o,\n\t\n\tcreturn := (self, o, opts) >> o,\n\tcreturnCond := (self, o, opts) >> o,\n\t\n\teq := (self, o, opts) >> eq(self(o.args[1], opts), self(o.args[2], opts)),\n));\n\nHCOLCodegen.IVArith := (self, o, y, x, opts) >> let(    \n\t#Generate non interval code\n    cc := opts.codegen.OLCompose(o.child(1), y, x, opts),\n\t\n\t#Collect array of bools and make them into arrays of ints\n\tba_vars := Filtered(FoldL(Collect(cc, var), (a,b)->When(not b.id in List(a, i->i.id), Concat([b],a), a), []), \n    \t    e->ObjId(e.t) = TArray and e.t.base_t()=TBool),\n    ba_nvars := List(ba_vars, c-> [c, var.fresh_t(\"U\", TArray(TInt, c.t.size))] ),\n    ba_svars := FoldL(ba_nvars, (b, a)->CopyFields(rec((a[1].id):= a[2]), b), rec()),\n    ba_cc1 := decl(List(ba_nvars, c->c[2]), SubstVars(cc, ba_svars)),\n\t\n\t#Cast bools variables into ints but make sure that they are not part of the input parameters\n\tb_vars :=Unique(Collect(ba_cc1, @(1,var).cond(e->e.t = TBool))),\n\tb_local_vars := Difference(b_vars, opts.params),\n\tb_global_vars := Difference(b_vars, b_local_vars),\t\n\tb_no_global := SubstBottomUp(ba_cc1, @(1,var).cond(e->e.t=TBool), f->let(Print(@(1).val.id, \"\\n\"), \n\t\t\t\t\t\t\ttcast(TInt, @(1).val))),\n\t\n\t#Cast pointers to bools into pointers to ints\n\tb_cc2 := b_no_global,\n\t\n\t#Convert boolean constants into ints\n\tb_cc3 := SubstBottomUp(b_cc2, @(1,Value).cond(e->e.t=TBool), \n        f->let(#Print(@(1).val, \"\\n\"), \n\t\t\tCond(@(1).val=V_true,  V(1), \n\t\t\t     @(1).val=V_false, V(0),\n\t\t\t\t\t\t   @(1).val))),\n\t\n\t#Collect array variables make them into arrays of intervals\n    vars := Filtered(FoldL(Collect(b_cc3, var), (a,b)->When(not b.id in List(a, i->i.id), Concat([b],a), a), []), \n    \t    e->ObjId(e.t) = TArray and e.t.base_t() in [TReal, TDouble, T_Real(32), T_Real(64)]),\n    nvars := List(vars, c-> [c, var.fresh_t(\"U\", TArray(TIVReal(c.t.base_t()), c.t.size))] ),\n    svars := FoldL(nvars, (b, a)->CopyFields(rec((a[1].id):= a[2]), b), rec()),\n    cc1 := decl(List(nvars, c->c[2]), SubstVars( cc, svars)),\n\n\t#Cast doubles and reals variables into intervals\n    cc11 := SubstBottomUp(cc1, @(1,var).cond(e->e.t in [TReal, TDouble, T_Real(32), T_Real(64)]), f->tcast(opts.IVRealType, @(1).val)),\n\n\t#Cast pointers to doubles and reals into intervals\n    cc2 := SubstBottomUp(cc11, [@(1,nth), @(2, var, e->ObjId(e.t) = TPtr and e.t.base_t() in [TReal, TDouble, T_Real(32), T_Real(64)]), @(3)], f->tcast(opts.IVRealType, @(1).val)),\n\t\n\t#Cast constants into intervals\n    cc3 := SubstBottomUp(cc2, @(1,Value).cond(e->e.t in [TReal, TDouble, T_Real(32), T_Real(64)]), \n        f->let(tcast(opts.IVValueType, @(1).val))),\n\n\tresult := ivenv(cc3),\n\t\n\tresult2 := TypeUpdate(result, opts),\n\t\n\tresult2\n);\n\nHCOLUnparser.RealEPS := (self,o,i,is) >> Print(Cond(o.args[1] = T_Real(64), \"DBL_MIN\", o.args[1] = T_Real(32), \"FLT_MIN\", \"UNKNOWN_MIN\"));\nHCOLUnparser.RealMPS := (self,o,i,is) >> Print(Cond(o.args[1] = T_Real(64), \"DBL_MAX\", o.args[1] = T_Real(32), \"FLT_MAX\", \"UNKNOWN_MAX\"));\nHCOLUnparser.ivenv := (self,o,i,is) >> self(chain(o.cmds), i, is);\n\nHCOLUnparser.TIVReal := (self, t, vars, i, is) >> \t\n\t\tPrint(\"interval_t \", self.infix(vars, \", \", i + is));\nHCOLUnparser.TVect := (self, t, vars, i, is) >> Print(\"abc_interval_t \", self.infix(vars, \", \", i + is));\n\n\n\n\n\nHCOLSSEUnparser.ivenv := (self,o,i,is) >> Print(Blanks(i), \"{\\n\",\n    Blanks(i+is), \"unsigned _xm = _mm_getcsr();\\n\",\n    Blanks(i+is), \"_mm_setcsr(_xm & 0xffff0000 | 0x0000dfc0);\\n\",\n    self(chain(o.cmds),i+is,is),\n    Blanks(i+is), \n    Cond(IsBound(self.opts.compiler) and self.opts.compiler = \"IntelC\", \"__asm nop;\\n\", \n        IsBound(self.opts.compiler) and self.opts.compiler = \"GnuC\", \"asm volatile(\\\"\\\":::\\\"memory\\\");\\n\",\n        \"// BASIC BLOCK BARRIER\\n\"\n    ),\n    Blanks(i+is), \"if (_mm_getcsr() & 0x0d) {\\n\",\n    Blanks(i+2*is), \"_mm_setcsr(_xm);\\n\",\n\tBlanks(i+2*is),\n    Cond(self.opts.useCReturn, \"return -1;\\n\", \"Y[0] = -1;\\n\"),\n    Blanks(i+is), \"}\\n\",\n    Blanks(i+is), \"_mm_setcsr(_xm);\\n\",\n    Blanks(i), \"}\\n\");\n\t\nHCOLSSEUnparser.RealEPS := HCOLUnparser.RealEPS;\nHCOLSSEUnparser.RealMPS := HCOLUnparser.RealMPS;\n\n\nDeclare(ToIVArithBasic);\n\nClass(ToIVArithBasic_Base, HierarchicalVisitor, rec(\n    __call__ := meth(arg)\n        local res;\n        res := ApplyFunc(arg[1].visit, arg{[2..Length(arg)]});\n        trace_log.addConversion(ObjId(arg[2]), arg[2], res, var);\n       return res;\n    end,\n    func := (self, o, opts) >> let(Print(\"CONVERSION\\n\\n\"), \n\t\tfunc(o.ret, o.id, FoldL(o.params, (a, b)->Concat(a, When(IsBound(opts.state) and b=opts.state, [opts.ivstate], [b])), []), self(o.cmd, opts))),\n    creturn := (self, o, opts) >> o,\n\tcreturnCond := (self, o, opts) >> o,\n    decl := (self, o, opts) >> let(\n        ovars := Filtered(o.vars, e->ObjId(e.t) = TIVReal),\n        svars := FoldR(ovars, (b,a)->CopyFields(rec((a.id):=var.fresh_t(\"u\", TVect(T_Real(64), 2))), b), rec()),\n        vars := Filtered(o.vars, e->ObjId(e.t) <> TIVReal)::List(Filtered(RecFields(svars), i->not i in SystemRecFields), i->svars.(i)),\n        cmd := SubstVars(o.cmd, svars),\n        decl(vars, self(cmd, opts))),\n    chain := (self, o, opts) >> chain(List(o.cmds, i-> self(i, opts))),\n    ivenv := (self, o, opts) >> ivenv(List(o.cmds, i-> ToIVArithBasic(i, opts))),\n    loop := (self, o, opts) >> loop(o.var, o.range, self(o.cmd, opts)),\n    nth := (self, o, opts) >> o,\n\t\n    Value := (self, o, opts) >> let(\n        When(ObjId(o.t) = TIVReal, \n          TVect(T_Real(64), 2).value([-o.v, o.v]), \n          o)),\n\t\t  \n\tskip := (self, o, opts) >> o,\n\t\n\ttcast := (self, o, opts) >> o,\n\tlogic_and := (self, o, opts) >> o,\n\tlogic_or := (self, o, opts) >> o,\n\tassign := (self, o, opts) >> o, \n));\n\nClass(ToIVArithBasic, HierarchicalVisitor, rec(\n    __call__ := meth(arg)\n        local res;\n        res := ApplyFunc(arg[1].visit, arg{[2..Length(arg)]});\n        trace_log.addConversion(ObjId(arg[2]), arg[2], res, var);\n       return res;\n    end,\n    func := (self, o, opts) >> let(Print(\"CONVERSION\\n\\n\"), \n\t\tfunc(o.ret, o.id, FoldL(o.params, (a, b)->Concat(a, When(IsBound(opts.state) and b=opts.state, [opts.ivstate], [b])), []), self(o.cmd, opts))),\n    creturn := (self, o, opts) >> o,\n\tcreturnCond := (self, o, opts) >> o,\n    decl := (self, o, opts) >> let(\n        ovars := Filtered(o.vars, e->ObjId(e.t) = TIVReal),\n        svars := FoldR(ovars, (b,a)->CopyFields(rec((a.id):=var.fresh_t(\"u\", TVect(T_Real(64), 2))), b), rec()),\n        vars := Filtered(o.vars, e->ObjId(e.t) <> TIVReal)::List(Filtered(RecFields(svars), i->not i in SystemRecFields), i->svars.(i)),\n        cmd := SubstVars(o.cmd, svars),\n        decl(vars, self(cmd, opts))),\n    chain := (self, o, opts) >> chain(List(o.cmds, i-> self(i, opts))),\n    ivenv := (self, o, opts) >> ivenv(List(o.cmds, i-> self(i, opts))),\n    loop := (self, o, opts) >> loop(o.var, o.range, self(o.cmd, opts)),\n    nth := (self, o, opts) >> o,\n\t\n    Value := (self, o, opts) >> let(\n        When(ObjId(o.t) = TIVReal, \n          TVect(T_Real(64), 2).value([-o.v, o.v]), \n          o)),\n\t\t  \n\tskip := (self, o, opts) >> o,\n\t\n\ttcast := (self, o, opts) >> o,\n   \t\t\n\tlogic_and := (self, o, opts) >> cond(eq(o.args[1],o.args[2]), o.args[1], mul(o.args[1], o.args[2])),\n\tlogic_or := (self, o, opts) >> cond(logic_or(eq(o.args[1], 1), eq(o.args[2],1)), 1, min(o.args[1], o.args[2])),\n\n    assign := (self, o, opts) >> let( \t  \n\t  Cond(\n\t    ObjId(o.exp) = var, \n\t\t\tlet(\n\t\t\t\tchain(\n\t\t\t\t\tassign(o.loc[1], tcast(o.loc[1].t,o.exp)),\n\t\t\t\t\tassign(o.loc[2], tcast(o.loc[2].t,o.exp))\n\t\t\t\t)\t\t\t\t\n\t\t\t),\t\t\t\n\t    ObjId(o.exp) = tcast and (o.exp.args[1] = TIVReal or o.exp.args[1] = TVect(T_Real(64), 2)),\n\t\t\t\tCond(\t\t\t\t\t\n\t\t\t\t\to.exp.args[2].t = T_Real(32), \n\t\t\t\t\t\tlet(\n\t\t\t\t\t\t\tx0 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\t\t\t\tx1 := var.fresh_t(\"x\", T_Real(64)), \t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdecl([x0, x1], chain(\n\t\t\t\t\t\t\t\tself(assign([x0,x1], o.exp.args[2]), opts), \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tassign(o.loc[1], x0+RealEPS(T_Real(32))),\n\t\t\t\t\t\t\t\tassign(o.loc[2], x1-RealEPS(T_Real(32)))\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t),\n\t\t\t\t\tIsDouble(o.exp.args[2]), \n\t\t\t\t\t\tlet(\n\t\t\t\t\t\t\tx0 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\t\t\t\tx1 := var.fresh_t(\"x\", T_Real(64)), \t\t\n\t\t\t\t\t\t\tdecl([x0, x1], chain(\n\t\t\t\t\t\t\t\tself(assign([x0,x1], o.exp.args[2]), opts), \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tassign(o.loc[1], x0),\n\t\t\t\t\t\t\t\tassign(o.loc[2], -x1)\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t),\n\t\t\t\t\tError(\"Don't know how to convert <o.args[2]> to an interval.\")),\n\t\tObjId(o.exp) = lt and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(\n\t\t\t\tx10 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx11 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx20 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx21 := var.fresh_t(\"x\", T_Real(64)), \t\t\t\t\n                decl([x10, x11, x20, x21], chain(\n\t\t\t\t\tself(assign([x10, x11], o.exp.args[1]), opts),\n\t\t\t\t\tself(assign([x20, x21], o.exp.args[2]), opts),\t\t\t\t\t\n\t\t\t\t\tassign(o.loc, tcast(TInt, cond(lt(x10, x21), V(1), cond(lt(x20,x11), V(0),V(-1)))))\n                ))\n            ),\n\t\tObjId(o.exp) = gt and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(x10 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx11 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx20 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx21 := var.fresh_t(\"x\", T_Real(64)), \t\t\t\t\n                decl([x10, x11, x20, x21], chain(\n\t\t\t\t\tself(assign([x10, x11], o.exp.args[1]), opts),\n\t\t\t\t\tself(assign([x20, x21], o.exp.args[2]), opts),\t\t\t\t\t\n\t\t\t\t\tassign(o.loc, tcast(TInt, cond(gt(x11, x20), V(1), cond(gt(x21, x10), V(0), V(-1)))))\n                ))\n            ),\n\t\n\t\tObjId(o.exp) = add  and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n\t\t\tlet(x10 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx11 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx20 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx21 := var.fresh_t(\"x\", T_Real(64)), \t\t\t\t\n\t\t\t\tdecl([x10, x11, x20, x21], chain(\n\t\t\t\t\tself(assign([x10, x11], o.exp.args[1]), opts),\n\t\t\t\t\tself(assign([x20, x21], o.exp.args[2]), opts),\t\t\t\t\t\n\t\t\t\t\tassign(o.loc[1], add(x11, x21)),\n\t\t\t\t\tassign(o.loc[2], add(x10, x20)) \n\t\t\t\t)) \n\t\t  ),\n\t\tObjId(o.exp) = sub  and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n\t\t\tlet(x10 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx11 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx20 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx21 := var.fresh_t(\"x\", T_Real(64)), \t\t\t\t\n\t\t\t\tdecl([x10, x11, x20, x21], chain(\n\t\t\t\t\tself(assign([x10, x11], o.exp.args[1]), opts),\n\t\t\t\t\tself(assign([x20, x21], o.exp.args[2]), opts),\n\t\t\t\t\tassign(o.loc[1], sub(x11, x20)), \n\t\t\t\t\tassign(o.loc[2], sub(x10, x21))\n\t\t\t\t)) \n\t\t\t),\n\t\tObjId(o.exp) = abs  and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(\t\t\t\t\n\t\t\t\tx10 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx11 := var.fresh_t(\"x\", T_Real(64)),\n\t\t\t\tx2 := var.fresh_t(\"x\", T_Real(64)), \n\t\t\t\tx3 := var.fresh_t(\"x\", T_Real(64)),\n                decl([x10, x11, x2, x3], chain(\n\t\t\t\t\tself(assign([x10, x11], o.exp.args[1]), opts),\n\t\t\t\t\tassign(x2, abs(x10)),\n\t\t\t\t\tassign(x3, abs(x11)),\n\t\t\t\t\tassign(o.loc[1], max(x2, x3)),\n\t\t\t\t\tassign(o.loc[2], min(x2, x3))\n                ))\n            ),\t\t\n\t\tassign(o.loc, self(o.exp, opts)) \n    )),\t\t\n));\n\n\nClass(ToIVArithSSE, HierarchicalVisitor, rec(\n    __call__ := meth(arg)\n        local res;\n        res := ApplyFunc(arg[1].visit, arg{[2..Length(arg)]});\n        trace_log.addConversion(ObjId(arg[2]), arg[2], res, var);\n       return res;\n    end,\n    func := (self, o, opts) >> let(#Print(\"CONVERSION\\n\\n\"), \n\t\tfunc(o.ret, o.id, FoldL(o.params, (a, b)->Concat(a, When(IsBound(opts.state) and b=opts.state, [opts.ivstate], [b])), []), self(o.cmd, opts))),\n    creturn := (self, o, opts) >> o,\n\tcreturnCond := (self, o, opts) >> o,\n    decl := (self, o, opts) >> let(\n        ovars := Filtered(o.vars, e->ObjId(e.t) = TIVReal),\n        svars := FoldR(ovars, (b,a)->CopyFields(rec((a.id):=var.fresh_t(\"u\", TVect(T_Real(64), 2))), b), rec()),\n        vars := Filtered(o.vars, e->ObjId(e.t) <> TIVReal)::List(Filtered(RecFields(svars), i->not i in SystemRecFields), i->svars.(i)),\n        cmd := SubstVars(o.cmd, svars),\n        decl(vars, self(cmd, opts))),\n    chain := (self, o, opts) >> chain(List(o.cmds, i-> self(i, opts))),\n    ivenv := (self, o, opts) >> ivenv(List(o.cmds, i-> self(i, opts))),\n    loop := (self, o, opts) >> loop(o.var, o.range, self(o.cmd, opts)),\n    nth := (self, o, opts) >> o,\n    Value := (self, o, opts) >> let(\n        When(ObjId(o.t) = TIVReal, \n          TVect(T_Real(64), 2).value([-o.v, o.v]), \n          o)),\n    var := (self, o, opts) >> o,\n\tskip := (self, o, opts) >> o,\n    tcast := (self, o, opts) >> Cond(\n        IsDouble(o.args[2]), vpack(-o.args[2], o.args[2]),\t\n\tIsValue(o.args[2]), TVect(T_Real(64), 2).value([-o.args[2].v, o.args[2].v]),\n        o.args[2].t = T_Real(32), addsub_2x64f(vcvt_64f32f(vdup(RealEPS(T_Real(32)), 4)), vcvt_64f32f(vdup(o.args[2], 4))),\n        o.args[2].t = T_Real(64), addsub_2x64f(vdup(RealEPS(T_Real(64))+RealEPS(T_Real(64)), 2), vdup(o.args[2], 2)),\n\to.args[2].t = TIVReal(T_Real(64)),  TVect(T_Real(64),2).value(o.args[2]),\n        Error(\"Don't know how to convert <o.args[2]> to an interval.\")),\n\t\t\n\tlogic_and := (self, o, opts) >> cond(eq(o.args[1],o.args[2]), o.args[1], mul(o.args[1], o.args[2])),\n\tlogic_or := (self, o, opts) >> cond(logic_or(eq(o.args[1], 1), eq(o.args[2],1)), 1, min(o.args[1], o.args[2])),\n\n    testc_4x32i:= (self, o, opts) >> o, \n\n    assign := (self, o, opts) >> Cond(\n\t    ObjId(o.exp) = add and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n\t\t  let(\n\t\t\tx1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n\t\t\tdecl([x1, x2], chain(\n\t\t\t\tcomment(\"addition\"),\n\t\t\t\tself(assign(x1, o.exp.args[1]), opts), \n\t\t\t\tself(assign(x2, o.exp.args[2]), opts), \n\t\t\t\tassign(o.loc, add(x1, x2)) ) ) \n\t\t  ),\n\t\tObjId(o.exp) = sub and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n\t\t  let(\n\t\t\tx1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n\t\t\tdecl([x1, x2], chain(\n\t\t\t\tcomment(\"sub\"),\n\t\t\t\tself(assign(x1, o.exp.args[1]), opts), \n\t\t\t\tself(assign(x2, o.exp.args[2]), opts), \n\t\t\t\tassign(o.loc, add(x1, vushuffle_2x64f(x2, vparam([2,1])))) ) ) \n\t\t  ),\n        ObjId(o.exp) = mul and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n            let(u := var.fresh_t(\"x\", TVect(T_Real(64), 2)), a := var.fresh_t(\"x\", TVect(T_Real(64), 2)), \n                b := var.fresh_t(\"x\", TVect(T_Real(64), 2)), c := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                decl([u, a, b, c, x1, x2], chain(\n\t\t\t\t\tcomment(\"mul\"),\n\t\t\t\t\tself(assign(x1, o.exp.args[1]), opts),\n\t\t\t\t\tself(assign(x2, o.exp.args[2]), opts),\n                    assign(u, addsub_2x64f(TVect(T_Real(64), 2).zero(), x1)),\n                    assign(a, mul(u, x2)),\n                    assign(b, mul(vushuffle_2x64f(u, vparam([2,1])), x2)),\n                    assign(c, neg(min(a, b))),\n                    assign(o.loc, add(max(max(a, b), vushuffle_2x64f(c, vparam([2,1]))), vdup(RealEPS(T_Real(64)), 2)))\n                ))\n            ),\n        ObjId(o.exp) = abs and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n            let(u := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                decl([u, x1], chain(\n\t\t\t\t\tcomment(\"abs\"),\t\n                    self(assign(x1, o.exp.args[1]), opts),\n                    assign(u, vushuffle_2x64f(x1, vparam([2,1]))),\n                    assign(o.loc, vshuffle_2x64f(min(x1, u), max(x1, u), vparam([1,2])))\n                ))\n            ),\n\t\tObjId(o.exp) = pow and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)) and IsValue(o.exp.args[2]) and o.exp.args[2].v = 2, \n\t\t\tlet( x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n\t\t\t\tdecl([x1], chain(\n\t\t\t\t\tself(assign(x1, mul(o.exp.args[1],o.exp.args[1])), opts),\n\t\t\t\t\tassign(o.loc, x1)\n\t\t\t\t))\n\t\t\t),\n\t\tObjId(o.exp) = pow and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)) and IsValue(o.exp.args[2]) and IsInt(o.exp.args[2].v) and o.exp.args[2] > 2, \n\t\t\tlet( x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n\t\t\t\tdecl([x1], chain(\n\t\t\t\t\tself(assign(x1, mul(o.exp.args[1], pow(o.exp.args[1],o.exp.args[2].v-1))), opts),\n\t\t\t\t\tassign(o.loc, x1)\n\t\t\t\t))\n\t\t\t),\t\t\t\t\t\t\t\n\t\t\t\n\t\tObjId(o.exp) = div and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)) and not IsValue(o.exp.args[1]),\t\t\n\t\t\tlet( \n\t\t\tPrint(\"DIVISION - PART 1\\n\"),\n\t\t\t  x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\t\t\t \n\t\t\t  decl([x1], chain(\n\t\t\t\tself(assign(x1, mul(o.exp.args[1], 1.0/o.exp.args[2])), opts),\n\t\t\t\tassign(o.loc, x1)\n\t\t\t  ))\n\t\t\t),\n\t\t\t\n\t\tObjId(o.exp) = div and <#o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)) and #>IsValue(o.exp.args[1]),\n\t\t\tlet( \t\t\t\n\t\t\t\tx1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\t\t\t \n\t\t\t\tdecl([x1], chain(\t\t\t\t\n\t\t\t\t\tassign(x1, vdiv_2x64f(TVect(T_Real(64), 2).value([-o.exp.args[1].v,o.exp.args[1].v]), o.exp.args[2])),\n\t\t\t\t\tassign(o.loc, vshuffle_2x64f(x1, x1, vparam([2,1])))\n\t\t\t\t))\n\t\t\t),\n\t\tObjId(o.exp) = neg and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n\t\t    let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n\t\t\t\tdecl([x1], chain(\n\t\t\t\t\tself(assign(x1, TVect(T_Real(64), 2).value([0,0]), opts)),\n\t\t\t\t\tself(assign(x2, sub(x1, o.exp.args[1])), opts),\n\t\t\t\t\tassign(o.loc, x2)\n\t\t\t\t))\n\t\t\t),\t\t\t\n        ObjId(o.exp) = max and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n            let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                decl([x1, x2], chain(\t\t\t\t\t\n                    self(assign(x1, o.exp.args[1]), opts),\n                    self(assign(x2, o.exp.args[2]), opts),\n                    assign(o.loc, vshuffle_2x64f(min(x1, x2), max(x1, x2), vparam([1, 2])))\n                ))\n            ),\t\t \n         ObjId(o.exp) = min and (o.loc.t = TIVReal or o.loc.t = TVect(T_Real(64), 2)),\n            let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                decl([x1, x2], chain(\n                    self(assign(x1, o.exp.args[1]), opts),\n                    self(assign(x2, o.exp.args[2]), opts),\n                    assign(o.loc, vshuffle_2x64f(max(x1, x2), min(x1, x2), vparam([1, 2])))\n                ))\n            ),\t\t\n        ObjId(o.exp) = geq <#and (o.loc.t = TBool or o.loc.t = TInt)#> and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), u := var.fresh_t(\"x\", TVect(T_Real(64), 2)), \n                decl([x1, x2, u], chain(\n\t\t\t\t\tcomment(\"geq\"),\t\n                    assign(x1, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[1], opts))),\n                    assign(x2, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[2], opts))),\n                    assign(u, cmpge_2x64f(x1, vushuffle_2x64f(x2, vparam([2, 1])))),\n                    assign(o.loc, sub(\n                        testc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\"))), \n                        testnzc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\")))))\n                ))\n            ),\n        ObjId(o.exp) = leq <#and o.loc.t = TBool#> and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), u := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                decl([x1, x2, u], chain(\n                    assign(x1, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[1], opts))),\n                    assign(x2, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[2], opts))),\n                    assign(u, cmple_2x64f(x1, vushuffle_2x64f(x2, vparam([2, 1])))),\n                    assign(o.loc, sub(\n                        testc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\"))), \n                        testnzc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\")))))\n                ))\n            ),\n\t\tObjId(o.exp) = gt <#and (o.loc.t = TBool or o.loc.t = TInt)#> and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), u := var.fresh_t(\"x\", TVect(T_Real(64), 2)), \n                decl([x1, x2, u], chain(\n                    assign(x1, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[1], opts))),\n                    assign(x2, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[2], opts))),\n                    assign(u, cmpgt_2x64f(x1, vushuffle_2x64f(x2, vparam([2, 1])))),\n                    assign(o.loc, sub(\n                        testc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\"))), \n                        testnzc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\")))))\n                ))\n            ),\n        ObjId(o.exp) = lt <#and o.loc.t = TBool#> and ForAll(o.exp.args, i->i.t = TIVReal or i.t = TVect(T_Real(64), 2)),\n            let(x1 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), x2 := var.fresh_t(\"x\", TVect(T_Real(64), 2)), u := var.fresh_t(\"x\", TVect(T_Real(64), 2)),\n                decl([x1, x2, u], chain(\n                    assign(x1, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[1], opts))),\n                    assign(x2, addsub_2x64f(TVect(T_Real(64), 2).zero(), self(o.exp.args[2], opts))),\n                    assign(u, cmplt_2x64f(x1, vushuffle_2x64f(x2, vparam([2, 1])))),\n                    assign(o.loc, sub(\n                        testc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\"))), \n                        testnzc_4x32i(tcast(TVect(T_Int(32), 4), u), vhex(Replicate(4, \"0xffffffff\")))))\n                ))\n            ),\t\t\t\t\n\t\tObjId(o.exp) = eq,\n\t\t\tlet(Error(\"Eq not implemented for interval arithmetic.\")),\n\t\tObjId(o.exp) = neq,\n\t\t\tlet(Error(\"Neq not implemented for interval arithmetic.\")),\n\t\t\t\n        assign(o.loc, self(o.exp, opts))\n    ),\t\t\t\t\t\t\t\t   \t\n    mul := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n    abs := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n    max := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n\tadd := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n\tsub := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n    geq := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n    leq := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n\tgt  := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n    lt  := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n\tpow := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n\tdiv := (self, o, opts) >> ApplyFunc(ObjId(o), List(o.args, i-> self(i, opts))),\n));\n\nHCOLSSEUnparser.TIVReal := (self, t, vars, i, is) >> Print(\"__m128d \", self.infix(vars, \", \", i + is));\n\nCoSynthesizeStrategies.IVArithSSE := [ (t, opts) -> RandomRuleTree(t, opts), \n        (rt, opts) -> SPLRuleTree(rt),\n        (s, opts) -> SumsSPL(s, opts),\n        (s, opts) -> Rewrite(s, [RulesSumsHCOLv2a, RulesTerminateReductionHCOL, RulesSumsHCOLv2b], opts),\n        (s, opts) -> HCOLProof_Codegen(s, opts),\n        (c, opts) -> Rewrite(c, RulesCodeUnrollHACMIVArth, opts),\n        (c, opts) -> HCOLProof_CodeConversion(c, ToIVArithSSE, opts),\n        (c, opts) -> Rewrite(c, RulesCodeUnrollHACMIVArthType, opts) ];\n\n\t\t\nCoSynthesizeStrategies.IVArithBasic := [ (t, opts) -> RandomRuleTree(t, opts), \n        (rt, opts) -> SPLRuleTree(rt),\n        (s, opts) -> SumsSPL(s, opts),\n        (s, opts) -> Rewrite(s, [RulesSumsHCOLv2a, RulesTerminateReductionHCOL, RulesSumsHCOLv2b], opts),\n        (s, opts) -> HCOLProof_Codegen(s, opts),\n        (c, opts) -> Rewrite(c, RulesCodeUnrollHACMIVArth, opts),\n        (c, opts) -> HCOLProof_CodeConversion(c, ToIVArithBasic_Base, opts),\n        (c, opts) -> Rewrite(c, RulesCodeUnrollHACMIVArth, opts) ];\t\t\n\t\t\nHCOLSSEUnparser.addsub_2x64f := (self, o, i, is) >> Checked(Length(o.args) = 2,\n        CondPat(o,\n           [addsub_2x64f, @TReal, @TVect], self(addsub_2x64f(vdup(o.args[1],o.t.size), o.args[2]), i, is),\n           [addsub_2x64f, @TVect, @TReal], self(addsub_2x64f(o.args[1], vdup(o.args[2], o.t.size)), i, is),\n           [addsub_2x64f, @TInt,  @TVect], self(addsub_2x64f(vdup(_toReal(o.args[1]), o.t.size), o.args[2]), i, is),\n           [addsub_2x64f, @TVect, @TInt],  self(addsub_2x64f(o.args[1], vdup(_toReal(o.args[2]), o.t.size)), i, is),\n           [addsub_2x64f, @TVect, @TVect], self.printf(\"_mm_addsub_pd($1, $2)\", o.args),\n           [addsub_2x64f, @TVect, @(1).cond(e->e.t=TIVReal)], self.printf(\"_mm_addsub_pd($1, $2)\", o.args),\n           [addsub_2x64f, @(1).cond(e->e.t=TIVReal), @TVect], self.printf(\"_mm_addsub_pd($1, $2)\", o.args),\n           Error(\"Don't know how to unparse <o>. Unrecognized type combination\")\n    ));\n\nHCOLSSEUnparser.max := (self, o, i, is) >> let(n := Length(o.args), When(\n\tIsVecT(o.t) and n >2, self.printf(\"_mm_max_$1($2, $3)\", [self.ctype_suffix(o.t, _isa(self)), o.args[1],\n\t\tApplyFunc(max, Drop(o.args, 1))]), \n\tCondPat(o, \n\t\t[max, @TVect, @TVect], self.prefix(\"_mm_max_\" :: self.ctype_suffix(o.t, _isa(self)),o.args),\n\t    [max, @TVect, @(1).cond(e->e.t=TIVReal)], self.printf(\"_mm_max_pd($1, $2)\", o.args),\n        [max, @(1).cond(e->e.t=TIVReal), @TVect], self.printf(\"_mm_max_pd($1, $2)\", o.args),\n\t\tInherited(o, i, is))\n));\n\nHCOLSSEUnparser.min := (self, o, i, is) >> let(\n\tCondPat(o, \n\t\t[min, @TVect, @TVect], self.prefix(\"_mm_min_\" :: self.ctype_suffix(o.t, _isa(self)),o.args),\n\t    [min, @TVect, @(1).cond(e->e.t=TIVReal)], self.printf(\"_mm_min_pd($1, $2)\", o.args),\n        [min, @(1).cond(e->e.t=TIVReal), @TVect], self.printf(\"_mm_min_pd($1, $2)\", o.args),\n\t\tInherited(o, i, is))\n);\n\n\ngeq.computeType := self >> TBool;\nleq.computeType := self >> TBool;\t\neq.computeType := self >> TBool;\npow.computeType := (self) >> self.args[1].t;\nneq.computeType := (self) >> TBool;\n\t\t\t\nmin.computeType := self >> let(\n\t\ttypes := List(self.args, e->e.t),\n\t\tWhen(Length(Collect(types, TIVReal))>0, \n\t\t\tTIVReal(UnifyTypes(List(Collect(types, TIVReal), i->i.t))),   <# TVect(T_Real(64),2),  #>\n\t\t\tUnifyTypes(List(self.args, x->x.t)))\n\t);\nmax.computeType := self >> let(\n\t\ttypes := List(self.args, e->e.t),\n\t\tWhen(Length(Collect(types, TIVReal))>0, \n\t\t\tTIVReal(UnifyTypes(List(Collect(types, TIVReal), i->i.t))),   <# TVect(T_Real(64),2),  #>\n\t\t\tUnifyTypes(List(self.args, x->x.t)))\n\t);\n\n\t\nVecExp.computeType := self >> let(\n        t       := self.args[1].t,\n        deref_t := When(IsPtrT(t), t.t, t),\n        el_t    := Cond(IsVecT(deref_t), deref_t.t, deref_t),\n\ttest    := Cond(el_t = TIVReal, el_t.t, el_t),\n        TVect(test, self.v));\n\nadd.computeType := meth(self)\n\t    local len, t, ptr_args, other_args, sum;\n\t    len := Length(self.args);\n\t    if   len=0  then return TInt;\n\t    elif len=1  then return self.args[1].t;\n\t    else\n            [ptr_args, other_args] := SplitBy(self.args, x->IsPtrT(x.t) or IsArrayT(x.t));\n            if Length(ptr_args)=0 then\n\t       if (self.args[1].t = TIVReal or self.args[2].t = TIVReal) then\n\t         return TIVReal(T_Real(64));\n\t       else\n\t         return UnifyTypesL(self.args);\n               fi;\n            elif Length(ptr_args)=1 then\n                sum := Sum(other_args);\n                if other_args<>[] and not IsIntT(sum.t) then Error(\"Can't add non-integer to a pointer\"); fi;\n\t\t   return self._ptrPlusOfs(ptr_args[1].t, sum);\n            elif Length(other_args)=0 then\n                return self._addPtrT(ptr_args);\n            else\n                return Error(\"Addition of more than one pointer and integers is not defined\");\n            fi;\n\t    fi;\n    end;\n\t\nsub.computeType := meth(self)\n\t    local len, t, ptr_args, other_args, sum;\n\t    len := Length(self.args);\n\t    if   len=0  then return TInt;\n\t    elif len=1  then return self.args[1].t;\n\t    else\n            [ptr_args, other_args] := SplitBy(self.args, x->IsPtrT(x.t) or IsArrayT(x.t));\n            if Length(ptr_args)=0 then\n\t       if (self.args[1].t = TIVReal or self.args[2].t = TIVReal) then\n\t         return TIVReal(T_Real(64));\n\t       else\n\t         return UnifyTypesL(self.args);\n               fi;\n            elif Length(ptr_args)=1 then\n                sum := Sum(other_args);\n                if other_args<>[] and not IsIntT(sum.t) then Error(\"Can't add non-integer to a pointer\"); fi;\n\t\t   return self._ptrPlusOfs(ptr_args[1].t, sum);\n            elif Length(other_args)=0 then\n                return self._addPtrT(ptr_args);\n            else\n                return Error(\"Addition of more than one pointer and integers is not defined\");\n            fi;\n\t    fi;\n    end;\n\n\nmul.computeType := meth(self)\n        local len, t, ptr_t, ptr_args, other_args, prod, args;\n\targs := self.args;\n\n\tlen := Length(args);\n\tif   len=0  then return TInt;\n\telif len=1  then return args[1].t;\n\telse\n\t    [ptr_args, other_args] := SplitBy(args, x->IsPtrT(x.t));\n\t    if Length(ptr_args)=0 then\n\t        if (self.args[1].t = TIVReal or self.args[2].t = TIVReal) then\n  \t\t  return TIVReal(T_Real(64));\n\t\telse\n\t\t  return UnifyTypesL(args);\n\t\tfi;\n\t    elif Length(ptr_args) > 1 then Error(\"Can't multiply pointers\");\n\t    else\n\t\tprod := Product(other_args);\n\t\tif other_args<>[] and not IsIntT(prod.t) then Error(\"Can't multiply a pointer by a non-integer\"); fi;\n\t\treturn  self._ptrMul(ptr_args[1].t, prod);\n\t    fi;\n\tfi;\n    end;\n\t\ndiv.computeType := self >> When(self.args[1].t = TIVReal or self.args[2].t = TIVReal, TIVReal(T_Real(64)), UnifyTypes(List(self.args, x->x.t)));\n\t\nTempArrayType := (child, y, x, index) ->\nlet(When(IsBound(child.a.t_in), child.a.t_in[index], \n\t\tlet( X := Flat([x])[1], Y:= Flat([y])[1],\n\t\t\tCond(\n\t\t\t\tIsBound(X.t.t) and X.t.t = TComplex, \t\tTComplex,\n\t\t\t\tIsBound(Y.t.t) and Y.t.t = TComplex, \t\tTComplex,\n\t\t\t\tObjId(child) = ISumReduction, \t\t\t\tWhen(IsRec(child.idval), child.idval.t, TReal),\n\t\t\t\tObjId(child) = PointWise, \t\t\t\t\tchild.op.expr.t,\n\t\t\t\tX.t.t))));\nTempArray := (y, x, child) -> let(cols := Flat([ Cols(child) ]),\n\tnewType := TempArrayType(child, y, x, 1),\n      StripList(\n        List([ 1 .. Length(cols) ], (i) -> TempVec(TArray(TempArrayType(child,\n               y, x, i), cols[i])))) );\t\n\t\n\t\n\n\t\t\t\t\n", "meta": {"hexsha": "1f40dc1b010332d6b97728baa604487b14850fb7", "size": 37679, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "ivarith.gi", "max_stars_repo_name": "spiral-software/spiral-package-hcol", "max_stars_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ivarith.gi", "max_issues_repo_name": "spiral-software/spiral-package-hcol", "max_issues_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ivarith.gi", "max_forks_repo_name": "spiral-software/spiral-package-hcol", "max_forks_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-26T05:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T05:21:02.000Z", "avg_line_length": 46.5172839506, "max_line_length": 180, "alphanum_fraction": 0.5504392367, "num_tokens": 13194, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.48047867804790706, "lm_q2_score": 0.02161533028098803, "lm_q1q2_score": 0.010385705318978025}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(param);\n\n#Special ordering for parameters\n#Allows control on the interfaces of autolib\nClass(ParamOps, ExpOps, rec(\n   \\<   := (e1,e2) -> Cond(\n       IsRec(e1) and IsRec(e2) \n       and IsBound(e1.sort_weight) \n       and IsBound(e2.sort_weight) \n       and e1.sort_weight<>e2.sort_weight,\n       e1.sort_weight < e2.sort_weight,\n       ObjId(e1) <> ObjId(e2), ObjId(e1) < ObjId(e2),\n       e1.rChildren() < e2.rChildren())\n));\n\n# Autolib coldness constants. \n# pcCold -  parameter must be available at plan time;\n# pcHot - parameter available at compute time only;\n# pcAny - parameter can be hot or cold (default);        \n#\n\nClass(pcCold, ConstClass);\nClass(pcHot,  ConstClass);\nClass(pcAny,  ConstClass);\n\n#F param(<type>, <id>, [sort weight, [coldness]])  - symbolic representation of a parameter \n#F                        (eg. of a codelet)\n#F Fields: .t  - types\n#F         .id - name of the parameter\n#F         .sort_weight - weight during sorting\n#F         .coldness - parameter coldness in autolib interfaces\nClass(param, Loc, rec(\n    isParam := true,\n    __call__ := (arg) >> let( \n                    self := arg[1],\n                    type := arg[2],\n                    id   := arg[3],\n                    WithBases(self, Checked(IsString(id), IsType(type), rec( \n                            operations := ParamOps,\n                            id := id,\n                            t := type,\n                            sort_weight := When(Length(arg)>=4, arg[4], 0),\n                            coldness := When(Length(arg)>=5, arg[5], pcAny))))),\n\n    print := self >> Print(self.name, \"(\", self.t, \", \\\"\", self.id, \"\\\")\"),\n    rChildren := self >> [self.t, self.id],\n    rSetChild := rSetChildFields(\"t\", \"id\"),\n    from_rChildren := (self, rch) >> CopyFields(ObjId(self)(rch[1], rch[2]), \n            rec(sort_weight := self.sort_weight, coldness := self.coldness)),\n    eval := self >> self,\n    can_fold := False,\n\n    computeType := self >> self.t,\n    setRange := meth(self, r) # when used as a loop counter variable\n       self.range := r;\n       return self;\n    end,\n));\n\nIsParam := x -> IsRec(x) and IsBound(x.isParam) and x.isParam;\n\nClass(in_param, param);\n\nClass(Unk, Exp, rec(\n    __call__ := (self, t) >> Checked(IsType(t),\n\tWithBases(self, rec(operations := ExpOps, args:=[t], t := t))),\n    computeType := self >> self.args[1],\n\n   isUnk := true, \n));\n\nIsUnk := x -> IsRec(x) and IsBound(x.isUnk) and x.isUnk;\n\nClass(UnkInt, Unk(TInt), rec(print := self >> Print(self.__name__)));\n\n\n#F allocate(<var>, <type>) -- equivalent of malloc()\n#F See also: deallocate(), zallocate()\nClass(allocate, assign);\n\n#F zero-allocate(<var>, <type>) -- equivalent of calloc()\n#F See also: deallocate(), allocate()\nClass(zallocate, assign);\n\n#F deallocate(<var>, <type>) -- equivalent of free()\n#F See also: allocate(), zallocate()\nClass(deallocate, assign);\n\n\n# fld(<type>, <loc>, <field_id>)\nClass(fld, Loc, rec(\n    __call__ := (self, type, loc, id) >> Checked(IsString(id), IsType(type), IsLoc(loc),\n\tWithBases(self, rec(\n\t\toperations := ExpOps, \n\t\tloc := loc, \n\t\tid := id,\n\t\tt := type))),\n    computeType := self >> self.t,\n    print := self >> Print(self.name, \"(\", self.t, \", \", self.loc, \", \\\"\", self.id, \"\\\")\"),\n    rChildren := self >> [self.t, self.loc, self.id],\n    rSetChild := rSetChildFields(\"t\", \"loc\", \"id\"),\n    eval := self >> self,\n    can_fold := False,\n));\n\n# ufld(<loc>, <field_id>)\nClass(ufld, fld, rec(\n    __call__ := (self, loc, id) >> Checked(IsString(id), IsLoc(loc),\n\tWithBases(self, rec(\n\t\toperations := ExpOps, \n\t\tloc := loc, \n\t\tid := id,\n\t\tt := TUnknown))),\n    print := self >> Print(self.name, \"(\", self.loc, \", \\\"\", self.id, \"\\\")\"),\n    rChildren := self >> [self.loc, self.id],\n    rSetChild := rSetChildFields(\"loc\", \"id\"),\n    eval := self >> self\n));\n\n# struct(<id>, <fields>)\n#   <id> is the string that gives the name of the structure\n#   <fields> is a list of <param>s or <var>s that go into the structure\n#\nClass(struct, Command, rec(\n    __call__ := (self, id, fields) >> Checked(IsString(id), IsList(fields), WithBases(self, \n\trec(operations := CmdOps,\n\t    id := id,\n\t    fields := fields))),\n    rChildren := self >> [self.id, self.fields],\n    rSetChild := rSetChildFields(\"id\", \"fields\"),\n    print := (self, i, si) >> Print(self.name, \"(\\\"\", self.id, \"\\\", \", self.fields, \")\"),\n));\n\nClass(ret, ExpCommand);\n\n\nSubstParams := (s,bindings) -> \n    SubstTopDownNR(s, @(1, param, e -> IsBound(bindings.(e.id))), e -> bindings.(e.id));\n\nSubstParamsCustom := (s,bindings,objid_list) -> \n    SubstTopDownNR(s, @(1, objid_list, e -> IsBound(bindings.(e.id))), e -> bindings.(e.id));\n\nSubstVarsSafe := (s,bindings) -> \n    SubstTopDownNR(s, @(1, var, e -> IsBound(bindings.(e.id))), e -> bindings.(e.id));\n", "meta": {"hexsha": "ec610bb4fe489c41754e624a48cb811848740c46", "size": 4860, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/code/param.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/code/param.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/code/param.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 32.4, "max_line_length": 93, "alphanum_fraction": 0.5767489712, "num_tokens": 1400, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3738758367247084, "lm_q2_score": 0.02758528272643216, "lm_q1q2_score": 0.01031347066063247}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nSetLinuxX86Profile:=function(opts, p, use_openmp)\n   opts.profile:=Copy(default_profiles.linux_x86_icc);\n   SetMakeOptsAffinity(opts);\n   SetMakeOptsLibgen(opts);\n   SetMakeOptsAssembly(opts);\n   opts.includes := Concat(opts.includes, [ \"<string.h>\"]);\n \n   if IsBound(opts.vector) then\n       SetMakeOptsSSE(opts);\n   fi;\n\n   if p>1 then\n       if (use_openmp) then\n           SetMakeOptsOpenMP(opts);\n       else\n           SetMakeOptsPThreads(opts);\n       fi;\n   fi;\nend;\n\nSetOLOptions:=function(isa, p, use_openmp)\n   local opts, MixedUnparser;\n\n   if (isa = false) or (IsString(isa)) then\n       opts := Copy(SpiralDefaults);\n       if (IsString(isa)) then opts := InitDataType(opts,isa); fi;\n   else\n       if (isa = true) then isa:=SIMD_ISA_DB.active()[1]; fi;\n       opts := SIMDGlobals.getOpts(isa);\n   fi;\n\n   if not IsBound(opts.profile) then\n       SetLinuxX86Profile(opts, p, use_openmp);\n   else\n#Hack Cell profile\n       opts.profile := default_profiles.linux_cellSPU_gcc_MMM;\n       opts.profile.stubopts.ROWS := 1;\n       opts.profile.stubopts.COLUMNS := 1;\n       opts.includes := Concat(opts.includes, [ \"<mm_malloc.h>\", \"<string.h>\"]);\n       opts.includes := Filtered(opts.includes, x->x<>\"<omega32.h>\");\n   fi;\n\n   if p>1 then\n       if (use_openmp) then\n           opts.unparser:=Class(MixedUnparser,OpenMP_UnparseMixin,opts.unparser);\n       else\n           opts.unparser:=Class(MixedUnparser,SMP_UnparseMixin,opts.unparser);\n           opts.subParams := [var(\"num_threads\", TInt), var(\"tid\", TInt)];\n       fi;\n   fi;\n\n   #OL specific\n   opts.codegen := OLCodegen;\n\n   opts.formulaStrategies.sigmaSpl := OLDefaultStrategy;\n\n   opts.formulaStrategies.postProcess := [\n              OLVectorPropagateRuleset,\n              OLPushScatQuestionMarkInRuleset,\n              OLAlreadyInitializedScatQuestionMarkRuleset, \n              OLCrossPullInRuleset,\n              OLAfterCrossPullInRuleset,\n              OLVectorPropagateRuleset,\n              OLSingleComposeRuleset,\n              (s, opts) -> compiler.BlockSumsOpts(s, opts)\n          ];\n\n   #Unrolling\n   opts.markBlock := MarkBlocksOps;\n   opts.globalUnrolling := 300;\n\n   #compile options\n   opts.compileStrategy :=IndicesCS2;\n   opts.useDeref := true;\n   opts.propagateNth := false;\n   opts.doScalarReplacement := true;\n\n   #Libgen requires full spec of perms\n   VPerm.print:=VPerm.printl;\n\n   #ScatAcc requires full zero allocation for now\n   opts.zeroallocate := true;\n\n   #final code options\n   opts.subName:=\"multi\";\n   opts.subInitName:=\"init_multi\";\n\n   return opts;\nend;\n\nSetSAROptions:=function(isa, p, use_openmp)\n  local tags,opts;\n  opts := SetOLOptions(isa, p, use_openmp); \n  opts.codegen := OLCodegen;\n  opts.zeroallocate := false;\n  opts.InputTypes := [TDouble,TDouble,TDouble,TDouble];\n  opts.OutputTypes := [TDouble,TDouble];\n  opts.generateComplexCode := true;\n  opts.TRealCType := \"complex\";\n  opts.TRealCtype := \"complex\";\n  opts := InitDataType(opts,\"f64c\");\n  opts.formulaStrategies.sigmaSpl := OLDefaultStrategy;\n  opts.breakdownRules.TTensorI_OL := [TTensorI_OL_Base, TTensorI_OL_Parrallelize_AParFirst, TTensorI_OL_Vectorize_AVecLast];\n  opts.breakdownRules.SAR := [SAR_Base,SAR_MatchFilter,SAR_MatchFilterSMP,SAR_MatchFilterVec,SAR_MatchFilterVecBase];\n  opts.breakdownRules.ExpandMult := [ExpandMult_Base, ExpandMult_One];\n  opts.breakdownRules.SAR_Interpolation := [SAR_Interpolation_One];\n  tags:=[];\n\n  if (p>1) then\n      Add(tags,AParSMP(p));\n  fi;\n  opts.formulaStrategies.postProcess := [\n        OLVectorPropagateRuleset,\n \t      OLScatQuestionMarkToScat,\n              OLPushScatAccRuleset,\n              OLCrossPullInRuleset,\n              OLAfterCrossPullInRuleset,\n\n              OLVectorPropagateRuleset,\n              \n              OLSingleComposeRuleset,\n\t      (s, opts) -> compiler.BlockSumsOpts(s, opts)];\n  \n  #Unrolling\n  opts.markBlock := MarkBlocksOps;\n  opts.globalUnrolling := 300;\n\n  #compile options\n  opts.compileStrategy :=IndicesCS2;\n  opts.useDeref := true;\n  opts.doNotScalarize := false;\n  opts.propagateNth := false;\n  opts.doScalarReplacement := true;\n\n  #ScatAcc requires full zero allocation for now\n  opts.zeroallocate := false;\n\n  #final code options\n  opts.subName:=\"multi\";\n  opts.subInitName:=\"init_multi\";\n\n \n  return opts;\n\n\nend;\n\n", "meta": {"hexsha": "b4563cff84194c754124c3935ea768a1b20ed6d8", "size": 4368, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/nontransforms/ol/defaults.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/nontransforms/ol/defaults.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/nontransforms/ol/defaults.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.5490196078, "max_line_length": 124, "alphanum_fraction": 0.6730769231, "num_tokens": 1191, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2751297119360208, "lm_q2_score": 0.03676946990186955, "lm_q1q2_score": 0.010116373662141557}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# ==========================================================================\n# BaseOperation\n# ==========================================================================\nClass(BaseOperation, ClassSPL, rec(\n    #-----------------------------------------------------------------------\n    child       := (self, n) >> self._children[n],\n    children    := self >> self._children,\n    numChildren := self >> Length(self.children()),\n    isReal      := self >> ForAll(self.children(), IsRealSPL),\n    setChild := meth(self, n, what) self._children[n] := what; end,\n    # -------- Transformation rules support ---------------------------------\n    rChildren := ~.children, \n    rSetChild := ~.setChild, \n));\n\n", "meta": {"hexsha": "41c8071236586c076cf0792662e04fbcfbbc8c88", "size": 786, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/BaseOperation.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/BaseOperation.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/BaseOperation.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 37.4285714286, "max_line_length": 77, "alphanum_fraction": 0.4134860051, "num_tokens": 149, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.19193277720287888, "lm_q2_score": 0.051845472509812494, "lm_q1q2_score": 0.009950845524203823}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nTempArrayOL:=function(y,x,child)\n  local y1,x1,mytype,accu;\n  return StripList(List(child.dmn(),l->TempVec(l)));\nend;\n\n#Class(OLCodegen,VectorCodegen, rec(\nClass(OLCodegen, RecCodegenMixin, SMPCodegenMixin, VectorCodegen, rec(\n\n    LinkIO := (self, o, y, x, opts) >> self(o.params[1], y, x, opts),\n\n    Compose := meth(self, o,y,x,opts)\n        local ch, numch, vecs, allow, i, j, indices, output, chcomp, veclen, rveclen, dmnoffset, rngoffset, outvar, cc;\n\n    ch := Filtered(o.children(), i-> not i.name in [\"DMPGath\",\"DMPScat\"]);\n    numch := Length(ch);\n    vecs := [y];\n    allow := (x<>y);\n\n    for i in [1..numch-1] do\n        if allow and ObjId(ch[i])=Inplace then \n            vecs[i+1] := vecs[i];\n        else \n            vecs[i+1] := TempArrayOL(y,x,ch[i]);\n        fi;\n    od;\n    vecs[numch+1] := x;\n    for i in Reversed([1..numch]) do\n            if allow and ObjId(ch[i])=Inplace\n        then vecs[i] := vecs[i+1]; fi;\n    od;\n\n        # everything was inplace, make it go from x -> y as expected\n    if vecs[1] = vecs[numch+1] then vecs[1] := y; fi;\n    if vecs[1] = vecs[numch+1] then vecs[numch+1] := x; fi;\n\n    #Error(\"Codegn-Compose -> Wire\");\n    #Start from the most right and handle Wire\n\n    i := numch;\n    cc:=ch[i];\n    if ObjId(cc)=BB then\n\tcc:=cc._children[1];\n    fi;\n\n    while (i>1 and (ObjId(cc)=Wire or ObjId(cc) = Cross)) do\n    \n        if ObjId(cc) = Wire then\n        #Variable length\n            if not IsList(vecs[i+1]) then\n                veclen := 1;\n                indices := Compacted([1..veclen]);\n                output := List(cc.params[2]*indices,x->vecs[i+1]);\n            else\n                veclen := Length(vecs[i+1]);\n                indices := Compacted([1..veclen]);\n                output := List(cc.params[2]*indices,x->vecs[i+1][x]);\n\tfi;\n\tvecs[i] := output;\n    else\n    # Wires in Cross\n        dmnoffset := 0;\n        rngoffset := 0;\n        for chcomp in cc._children do\n\t    if ObjId(cc)=BB then\n\t       cc:=cc._children[1];\n\t    fi;\n\n        if (ObjId(chcomp) = Wire) then\n            if not IsList(chcomp.dims()[2]) then\n                veclen := 1;\n            else\n                veclen := Length(chcomp.dims()[2]);\n            fi;\n            if not IsList(chcomp.dims()[1]) then\n                rveclen := 1;\n            else\n                rveclen := Length(chcomp.dims()[1]);\n            fi;\n            indices := Compacted([1..veclen]);\n            output := List(chcomp.params[2]*indices,x->vecs[i+1][x+dmnoffset]);\n            j:=1;\n            for outvar in output do\n                vecs[i][rngoffset + j] := outvar;\n                j:=j+1;\n            od;\n            dmnoffset:=dmnoffset+veclen;\n            rngoffset:=rngoffset+rveclen;\n        fi;\n    od;\n\n    fi;\n        i:=i-1;\n        cc:=ch[i];\n        if ObjId(cc)=BB then\n\t  cc:=cc._children[1];\n\tfi;\n    od;\n\n\n\n#    for i in [1..numch-1] do\n#      if ObjId(ch[i])=Wire then\n#          indices := Compacted([1..Length(vecs[i])]);\n#          output := List(ch[i].params[2]*indices,x->vecs[i][x]);\n#          vecs[i+1]:=output;\n#      fi;\n#    od;\n\n    ## HACK For the A Cross I that were I is not computed\n    ## Could be (advantageously) replaced by a Wire(Id) when\n    ## the new system will be around\n\n    # Disabled by Hao because it is broken in some way#\n    for i in [2..numch] do\n       if ObjId(ch[i])=Cross then\n           for j in [1..Length(ch[i]._children)] do\n              if (ObjId(ch[i]._children[j])=Prm and\n                          ObjId(ch[i]._children[j].func)=fId and\n                          ObjId(vecs[i][j].t)=TArray)or\n                      (ObjId(ch[i]._children[j])=BB and\n                          ObjId(ch[i]._children[j]._children[1])=Prm and\n                          ObjId(ch[i]._children[j]._children[1].func)=fId and\n                          ObjId(vecs[i][j].t)=TArray) or\n                      (ObjId(ch[i]._children[j])=BB and\n                          ObjId(ch[i]._children[j]._children[1])=I and\n                          ObjId(vecs[i][j].t)=TArray) then\n\t      skip();\n              #vecs[i][j]:=vecs[i+1][j];\n          fi;\n           od;\n       fi;\n    od;\n\n    [vecs, ch] := [Reversed(vecs), Reversed(ch)];\n    return decl( Difference(Flat(vecs{[2..Length(vecs)-1]}), Flat([x,y])),\n        chain( List([1..numch], i -> When(vecs[i+1]=vecs[i],\n            self(ch[i], vecs[i],   vecs[i], CopyFields(opts, rec(_inplace:=true))),\n            self(ch[i], vecs[i+1], vecs[i], opts)))));\n    end,\n\n    ScatInit := (self, o, y, x, opts) >> let(ii := Ind(),\n    condition := When(Length(o.cond)=0,V(1),FoldL1(List(o.cond,x->eq(x,V(0))),logic_and)),\n    chain(\n    IF(condition,\n        loop(ii, o.func.domain(), assign(nth(y,o.func.at(ii)), When(ObjId(y)=var,y.t.t.zero(),y.t.zero()))),\n        skip()),\n    self(o._children,y,x,opts))\n    ),\n\n    Wire := (self, o, y, x, opts) >> skip(),\n\n    ScatAcc := (self, o, y, x, opts) >>\n        self._acc(self(Scat(o.func),y,x,opts),y),\n\n    ICScatAcc := meth(self,o,y,x,opts)\n      local i, func;\n      i := Ind(); func := o.func.lambda();\n      return loop(i, o.func.domain(), chain(assign_acc(nth(y,func.at(i)), nth(x, i)),\n                        assign_acc(nth(y,add(func.at(i),1)),nth(x,add(i,1)))));\n    end,\n\n\n     # NOTE: handle unaligned case - IsUnalignedPtrT(y)\n     VScatAcc := (self, o, y, x, opts) >>\n         self._acc(self(VScat(o.func,o.v),y,x,opts),y),\n\n     VTensor_OL := meth(self, o, y, x, opts)\n       local CastToVect;\n       CastToVect:=x->tcast(TPtr(TVect(x.t.t, o.vlen)), x);\n       return self(o.child(1), StripList(List(Flat([y]),t->CastToVect(t))), StripList(List(Flat([x]),t->CastToVect(t))), opts);\n     end,\n\n\n##########\n### to FIX: this Multiplication implicitely takes 2 inputs\n    Multiplication:= meth(self, o, y, x, opts)\n    local iterator;\n\n    iterator:=Ind();\n    return loop(iterator, [ 0 .. o.element[2]-1 ],\n            assign(nth(StripList(y), iterator), mul(nth(x[1], iterator),nth(x[2], iterator))));\n    end,\n\n    ICMultiplication:=meth(self,o,y,x,opts)\n    local len,iterator;\n\n    iterator:=Ind();\n    len := When(o.element[2] = 2,1,o.element[2]);\n    len := When(Length(o.element) = 3,len/2,len);\n    return loop(iterator, [ 0 .. (len)- 1 ],\n            chain(\n                assign(nth(StripList(y),mul(iterator,2)),sub(mul(nth(x[1], mul(iterator,2)),nth(x[2],mul(iterator,2))),\n                                 mul(nth(x[1], add(mul(iterator,2),1)),nth(x[2], add(mul(iterator,2),1))))),\n                assign(nth(StripList(y), add(mul(iterator,2),1)),add(mul(nth(x[1], mul(iterator,2)),nth(x[2], add(mul(iterator,2),1))),\n                                             mul(nth(x[1], add(mul(iterator,2),1)),nth(x[2],mul(iterator,2)))))));\n\n    end,\n\n    Addition:= meth(self, o, y, x, opts)\n        local iterator;\n        iterator:=Ind();\n        return loop(iterator, [ 0 .. _unwrap(o.element[2])-1 ],\n            assign(nth(StripList(y), iterator), add(nth(x[1], iterator),nth(x[2], iterator))));\n    end,\n\n   Subtraction:= meth(self, o, y, x, opts)\n        local iterator;\n        iterator:=Ind();\n        return loop(iterator, [ 0 .. o.element[2]-1 ],\n            assign(nth(StripList(y), iterator), sub(nth(x[1], iterator),nth(x[2], iterator))));\n    end,\n\n    Codelet := meth(self, o, y, x, opts)\n        local code,inputlist,outputlist,outputTypes,inputTypes;\n\n    o := o.child(1);\n        o := SubstBottomUp(o,BB,e->e.rChildren()[1]);\n        o := OLQuickAndDirtyHackForCodelet(o);\n\n        o:=ApplyStrategy(o,opts.formulaStrategies.postProcess, UntilDone, opts);\n        o := OLRulesBufferFinalize(o);\n        outputTypes := opts.OutputTypes;\n        inputTypes := opts.InputTypes;\n        inputlist :=[];\n        outputlist :=[];\n        for i in [1..DimLength(o.dims()[1])] do\n          Append(outputlist, [TPtr(outputTypes[i])]);\n        od;\n        for i in [1..DimLength(o.dims()[2])] do\n          Append(inputlist, [TPtr(inputTypes[i])]);\n        od;\n        Unification(o, StripList(inputlist));\n\n        if List(outputlist,l->l.t)<>List(o.rng(),l->l.t) then\n          Error(\"Unification of final output failed\");\n        fi;\n\n    ## Generating code : main body\n#        o := BlockSums(opts.libgen.basesUnrolling, o);\n    code := SReduce(self(o, y, x, opts), opts);\n        code := ESReduce(code, opts);\n    code := RemoveAssignAcc(code);\n    code := BlockUnroll(code, opts);\n    code := DeclareHidden(code);\n    return code;\n    end,\n\n   Formula := meth(self, o, y, x, opts)\n        local code, init_code, datas, prog, params, sub, inputTypes, outputTypes,\n    initsub,i,inputlist,outputlist,smp, num_threads, buffers, bufalloc, dalloc, dvars, map,ignore, codelet_codes, codelet_recs, chash;\n\n    o := o.child(1);\n        o := OLRulesBufferFinalize(o);\n    o := OLRulesCode(o);\n\n\n    params := Set(Collect(o, param));\n    smp := Collect(o, SMPSum);\n    num_threads := When(smp=[], 1, smp[1].p);\n    if not ForAll(smp, x->x.p=num_threads) then Error(\"Non-uniform num_threads in SMPSum's\"); fi;\n        outputTypes := opts.OutputTypes;\n        inputTypes :=  opts.InputTypes;\n    inputlist :=[];\n    outputlist :=[];\n    for i in [1..DimLength(o.dims()[1])] do\n      Append(outputlist, [TPtr(outputTypes[i])]);\n    od;\n    for i in [1..DimLength(o.dims()[2])] do\n      Append(inputlist, [TPtr(inputTypes[i])]);\n    od;\n    Unification(o, StripList(inputlist));\n\n    if List(outputlist,l->l.t)<>List(o.rng(),l->l.t) then\n      Error(\"Unification of final output failed\");\n    fi;\n\n    inputlist :=[];\n    outputlist :=[];\n    for i in [1..DimLength(o.dims()[1])] do\n      Append(outputlist, [var(ConcatenationString(\"Y\",String(i)), TPtr(outputTypes[i]))]);\n    od;\n    for i in [1..DimLength(o.dims()[2])] do\n      Append(inputlist, [var(ConcatenationString(\"X\",String(i)), TPtr(inputTypes[i]))]);\n    od;\n\n        #We're dropping y and x right away because previous stuff is backward compatibility\n    y:=StripList(outputlist);\n        x:= StripList(inputlist);\n\n\n        ## HACK for the unroll of ROIs\n        if IsBound(opts.libgen) then\n            chash:=spiral.libgen.CreateCodeletHashTable();\n            for i in Flat(opts.libgen.codeletTab.entries) do\n                if Collect(i.data.sums,Multiplication)=[] then\n                    i.data.unrolling:=300;         #this is the unrolling threshold for non kernels\n                fi;\n                HashAdd(chash,i.key, i.data);\n            od;\n            opts.libgen.codeletTab:=chash;\n        elif Collect(o,Multiplication)=[] then\n            o := SubstBottomUp(o,BB,e->e.rChildren()[1]);\n            SubstTopDownNR(o, @(1).cond(IsMarkedBlock),\n                function(e)\n                    local f;\n                    f:=@(1).val;\n                    f.isBlock:=false;\n                    return f;\n                end);\n            o := compiler.BlockSumsOpts(o,CopyFields(opts,rec(globalUnrolling:=32)));\n        fi;\n\n    ## Generating code : codelets\n    codelet_recs := spiral.libgen.CompileCodelets(o, opts);\n    codelet_codes := List(codelet_recs,\n            function(clrec)\n              local inputs, outputs, myf;\n              outputs:=StripList(List([1..Length(Flat([clrec.sums.dims()[1]]))],x->var(Concat(\"Y\",When(x>1,String(x),\"\")), TPtr(outputTypes[x]))));\n              inputs:=StripList(List([1..Length(Flat([clrec.sums.dims()[2]]))],x->var(Concat(\"X\",When(x>1,String(x),\"\")), TPtr(inputTypes[x]))));\n              myf:=func(TVoid, clrec.name, Concatenation(Flat([outputs, inputs]), clrec.params), clrec.code);\n              myf.inline:=true;\n              return myf;\n            end\n        );\n\n    map := tab();\n    ## Generating code : main body\n    datas := Collect(o, FDataOfs);\n        code := self(o, y, x, opts);\n    code := SReduce(code, opts);\n        code := ESReduce(code, opts);\n    code := RemoveAssignAcc(code);\n    code := BlockUnroll(code, opts);\n#   code := SimplifySingularArray(code);\n        # code := PowerOpt(code);\n    code := DeclareHidden(code);\n    if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n        code := FixedPointCode(code, opts.bits, opts.fracbits);\n    fi;\n    [buffers, bufalloc, code] := spiral.libgen.AllocBuffersSMP(\"buf\", code, map, opts);\n\n    ## Generating code : initialization\n    [dvars, dalloc, ignore] := spiral.libgen.AllocBuffersSMP(\"dat\", decl(datas, skip()), map, opts);\n\n    # NOTE: is there a better way?\n    sub := opts.subName;\n    initsub := opts.subInitName;\n    code := func(TVoid, sub, Concatenation(params,\n                When(IsBound(opts.subParams), opts.subParams, []), [y,x]), code);\n\n        init_code := func(TVoid, initsub, [],\n            chain(bufalloc, dalloc, List(datas, x -> SReduce(x.var.init, opts))));\n\n        prog := SubstVars(chain(init_code, code), map);\n\n        if Length(Filtered(opts.subParams,x->x.id=\"num_threads\"))>0 then\n            prog := data(var(\"NUM_THREADS\", TInt), V(num_threads),prog);\n        fi;\n\n        prog := program(\n            codelet_codes,\n            decl(Concatenation(dvars, buffers, List(datas, x->x.var)),\n        prog));\n\n        prog:= GenerateBench(o, prog,opts);\n\n    return FlattenCode(prog);\n    end,\n));\n\n\nDefaultCodegen.ExpDiag := (self, o, y, x, opts) >> let(\n   i   := Ind(),     d := o.d,\n   elt := o.element, s := Length(elt.vars),\n   xx  := List([0..s-1], j -> nth(x, i*s + j)),\n   loop(i, d, \n       assign(nth(y,i), elt.at(xx)))\n);\n\n\n", "meta": {"hexsha": "e9ac0ec206f290cb24d8b679003334a93686f091", "size": 13440, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/nontransforms/ol/codegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/nontransforms/ol/codegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/nontransforms/ol/codegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.8186528497, "max_line_length": 147, "alphanum_fraction": 0.5424107143, "num_tokens": 3878, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3522017684487511, "lm_q2_score": 0.027585285224643135, "lm_q1q2_score": 0.009715586239282517}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 1).withTags([ AVecReg(MACRO_2xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(MACRO_2xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 1).withTags([ AVecReg(MACRO_2xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(1, 1, 1, 2).withTags([ AVecReg(MACRO_2xf) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(MACRO_2xf) ]) ),\n      origtree := IxLxI_vtensor( TL(1, 1, 1, 2).withTags([ AVecReg(MACRO_2xf) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 2).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 6.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 12.4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 1, 1).withTags([ AVecReg(MACRO_4xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 1, 1).withTags([ AVecReg(MACRO_4xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 1, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 1, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 2).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases2( TL(8, 2, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases2( TL(8, 2, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 4, 1, 1).withTags([ AVecReg(MACRO_4xf) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 4, 1, 1).withTags([ AVecReg(MACRO_4xf) ]),\n          SIMD_ISA_Bases2( TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 2).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_4xf) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_4xf) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 4).withTags([ AVecReg(MACRO_4xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 1).withTags([ AVecReg(MACRO_4xf) ]) ) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 1).withTags([ AVecReg(MACRO_4xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 1, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 1, 1).withTags([ AVecReg(MACRO_4xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 2, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 8, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 8, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(32, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n                SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n              IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n                SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n            IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 8, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(32, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n                SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n              IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n                IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n                SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n            IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 24,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 0.90000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 8, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 8, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 8, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 7.2000000000000002,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 32, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(64, 32, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(64, 32, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 4, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 4, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_kmn_km( TL(32, 4, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 4, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_kmn_km( TL(32, 4, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 8, 2, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 8, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 8, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(16, 8, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(16, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(16, 8, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 4,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 2, 2, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 2, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 2, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(8, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 4, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_IxLxI_up( TL(16, 4, 4, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_IxLxI_up( TL(16, 4, 4, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 16, 2, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_IxLxI_up( TL(16, 4, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_IxLxI_up( TL(16, 4, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      origtree := IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n          SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 4,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 1.8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(32, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ) ),\n      origtree := IxLxI_kmn_n( TL(32, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n            IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(32, 4, 2, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_km( TL(32, 4, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_kmn_km( TL(32, 4, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 2, 1, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 2,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(64, 16, 1, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_kmn_n( TL(64, 16, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_kmn_n( TL(64, 16, 1, 1).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_km( TL(32, 16, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(8, 4, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_kmn_km( TL(8, 4, 1, 8).withTags([ AVecReg(MACRO_8xf) ]),\n              IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n              IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n          IxLxI_kmn_km( TL(32, 16, 2, 1).withTags([ AVecReg(MACRO_8xf) ]),\n            SIMD_ISA_Bases1( TL(16, 8, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 10000 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_IxLxI_up( TL(16, 4, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_kmn_n( TL(16, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 2, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 16,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(4, 2, 4, 2).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 3.6000000000000001,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := IxLxI_vtensor( TL(4, 2, 1, 16).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 0,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      origtree := SIMD_ISA_Bases1( TL(16, 2, 4, 1).withTags([ AVecReg(MACRO_8xf) ]) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\nSIMD_ISA_DB.hashAdd(TL(16, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]), [ rec(\n      ruletree := IxLxI_IxLxI_up( TL(16, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      origtree := IxLxI_IxLxI_up( TL(16, 4, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n          IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ),\n          IxLxI_kmn_n( TL(16, 2, 1, 2).withTags([ AVecReg(MACRO_8xf) ]),\n            IxLxI_vtensor( TL(4, 2, 1, 8).withTags([ AVecReg(MACRO_8xf) ]) ),\n            SIMD_ISA_Bases1( TL(8, 2, 2, 2).withTags([ AVecReg(MACRO_8xf) ]) ) ) ),\n      measured := 8,\n      globalUnrolling := 8 ) ]);\n", "meta": {"hexsha": "9ba02a6e4c5e84d51225ed21b1b4aeb3764d1d3a", "size": 34224, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/_macro_generated1.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/_macro_generated1.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/_macro_generated1.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 67.7702970297, "max_line_length": 87, "alphanum_fraction": 0.581171108, "num_tokens": 15733, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.476579651063676, "lm_q2_score": 0.020332354492818717, "lm_q1q2_score": 0.009689986409490509}}
{"text": "#############################################################################\n####\n##\n#W  anupqhead.gi               ANUPQ package                    Werner Nickel\n#W                                                                Greg Gamble\n##\n##  `Head' file for the GAP interface to the ANU pq binary by Eamonn O'Brien.\n##    \n#Y  Copyright (C) 2006  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany\n##\n\n#############################################################################\n##\n#V  ANUPQData . . record used by various functions of the ANUPQ package\n##\n##  The fields of ANUPQData are:\n##\n##    \"binary\"  . . the path of the pq binary\n##    \"tmpdir\"  . . the path of the temporary directory for pq i/o files\n##    \"io\"  . . . . list of data records for PqStart IO Streams\n##    \"outfile\" . . the path of the pq output file\n##    \"SPimages\"  . the path of the pq GAP_library file\n##    \"version\" . . the version of the current pq binary\n##\nInstallValue( ANUPQData,\n  rec( binary := Filename( DirectoriesPackagePrograms( \"anupq\" ), \"pq\" ),\n       tmpdir := DirectoryTemporary(),\n       ni := rec(), # record for non-interactive functions\n       io := []     # list of records for PqStart IO Streams,\n                    #  of which, there are initially none\n       )\n);\nANUPQData.outfile  := Filename( ANUPQData.tmpdir, \"PQ_OUTPUT\" );\nANUPQData.SPimages := Filename( ANUPQData.tmpdir, \"GAP_library\" );\n\n# Fire up the pq binary to get its version\nANUPQData.version := \"\";\nProcess( DirectoryCurrent(), ANUPQData.binary, InputTextNone(),\n         OutputTextString( ANUPQData.version, false ), [ \"-v\" ] );\nANUPQData.version := \n    ANUPQData.version{[PositionSublist( ANUPQData.version, \"Version\" ) + 8 ..\n                       Length(ANUPQData.version) - 1] };\n\n#############################################################################\n##  \n#I  InfoClass\n##\n# Set the default level of InfoANUPQ\nSetInfoLevel( InfoANUPQ, 1 );\n\n#############################################################################\n##\n#V  ANUPQWarnOfOtherOptions . if true user is warned of non-ANUPQ-f'n options\n##\nANUPQWarnOfOtherOptions := false;\n\n#############################################################################\n##\n##  Ensure no zombie `pq' processes from interactive (`PqStart') sessions are \n##  left lying around when user quits GAP.\n##\nInstallAtExit( PqQuitAll );\n\n#E  anupqhead.gi . . . . . . . . . . . . . . . . . . . . . . . . .  ends here \n", "meta": {"hexsha": "6e50b0863b3ce1709920d68ac73f87af513f4988", "size": 2450, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/anupqhead.gi", "max_stars_repo_name": "gap-system/anupq", "max_stars_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_stars_repo_licenses": ["Artistic-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/anupqhead.gi", "max_issues_repo_name": "gap-system/anupq", "max_issues_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_issues_repo_licenses": ["Artistic-2.0"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2015-03-04T12:41:28.000Z", "max_issues_repo_issues_event_max_datetime": "2015-09-27T22:17:27.000Z", "max_forks_repo_path": "lib/anupqhead.gi", "max_forks_repo_name": "gap-system/anupq", "max_forks_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_forks_repo_licenses": ["Artistic-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.6923076923, "max_line_length": 78, "alphanum_fraction": 0.513877551, "num_tokens": 606, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3007455914759599, "lm_q2_score": 0.03210070463358554, "lm_q1q2_score": 0.00965414540182277}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#-----------------------------------------------------------------------------\n# Cell SMP Paradigm (preferred)\n#-----------------------------------------------------------------------------\n\n#F SymSPL = Symmetric SPL. In this particular case, we know about the symmetry\n#F of this SymSPL, so we can remove it.\nClass(KillSymSPL, RuleSet);\nRewriteRules(KillSymSPL, rec(\n     kill_symspl := Rule([@(1,SymSPL), ISum], e -> @(1).val.child(1)),\n));\n\n\nNewRulesFor(GT, rec(\n#F For cases where p doesn't divide n nicely. (eg: Parallelize (I6 x A) across 4 processors\n    GT_Cell_nonmultiple := rec(\n        maxSize       := false,\n        minSize       := false,\n\n        requiredFirstTag := ParCell,\n\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                rank = 1\n                  and let(its := t.params[4][1],\n                    PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                    # Only do IxA for now\n                    and t.params[2] = GTPar and t.params[3] = GTPar\n                    and IsPosInt(idiv(its, procs).v)\n                    and IsPosInt(imod(its, procs).v)\n                  )\n        ),\n        children := (self, t) >> let(\n            spl     := t.params[1],\n            g       := t.params[2],\n            s       := t.params[3],\n            its     := t.params[4][1],\n            procs   := t.firstTag().params[1],\n            pksize  := t.firstTag().params[2],\n            remits  := imod(its, procs).v,\n            parits  := its - remits,\n            origtags:= t.getTags(),\n            partag  := t.firstTag(),\n            tags    := Drop(t.getTags(), 1),\n            When(remits > 1,\n                [ [ GT(spl, g, s, [parits]).withTags(origtags), GT(spl, g, s, [remits]).setTags(Concatenation(ParCell(remits, pksize), tags)) ] ],\n                [ [ GT(spl, g, s, [parits]).withTags(origtags), spl.withTags(tags) ] ]\n            )\n        ),\n\n        apply := (self, t, C, Nonterms) >> let(\n                 DirectSum(C[1], C[2])\n        ) #apply\n    ), #GT_Cell_nonmultiple\n\n\n    GT_Cell := rec(\n        maxSize       := false,\n        minSize       := false,\n\n        requiredFirstTag := ParCell,\n\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                pkSize := t.firstTag().params[2],\n                rank = 1\n                  and let(its := t.params[4][1],\n                    PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                    # The (IxA) construct doesn't need the pkSize constraint that\n                    # the (AxI) construct (and (IxA)L, L(IxA)) does:\n                    and When(t.params[2] = GTPar and t.params[3] = GTPar,\n                                IsPosInt(its/(procs)),\n                                IsPosInt(its/(procs*pkSize))\n                        )\n                  )\n        ),\n\n        children := (self, t) >> let(\n            spl    := t.params[1],\n            g      := t.params[2],\n            s      := t.params[3],\n            its    := t.params[4][1],\n            procs  := t.firstTag().params[1],\n            remits := its/procs,\n            tags   := Drop(t.getTags(), 1), # Eat up tag at topmost level. NOTE: Nested parallelism not considered for now\n            When(remits > 1,\n            [ [ GT(spl, g, s, [its / procs]).withTags(tags), ] ],\n            [ [ spl.withTags(tags) ] ])\n        ),\n\n        apply := (self, t, C, Nonterms) >> let(\n            spl     := t.params[1],\n            g       := t.params[2],\n            s       := t.params[3],\n            its     := t.params[4][1],\n            gg      := When(g=GTVec, XChain([0,1,2]), XChain([1,2,0])),\n            ss      := When(s=GTVec, XChain([0,1,2]), XChain([1,2,0])),\n            procs   := t.firstTag().params[1],\n            pkSize  := t.firstTag().params[2],\n            i       := var(\"spuid\", TInt, procs),\n            #z := Error(\"Breakpoint\\n\"),\n\n            # NOTE: There is a degree of freedom in allocating packet sizes for\n            # ScatDist and GathDist. Here's how we handle things:\n            \n            # When we do on-chip exchanges, we \"combine\" ScatSends with\n            # GathDists (and vice versa). So we want the packet size of the\n            # ScatSends and GathDists (and vice versa) to match across multiple\n            # factors of the transform (like the DFT). So we issue a ScatDist\n            # here with a matching packet size.\n\n            # However, when we do off-chip stuff, we compose ScatDists with\n            # ScatMems instead. Here, we want the highest packet size possible\n            # for our ScatDists and GathDists.\n\n            # We need to find a universal solution that works neatly for\n            # everything. Perhaps issue the largest available pkSize for\n            # ScatDist here, and then step it down if needed in the rewrite\n            # rules (since we know it's a ScatDist and that this is possible).\n\n            cscatter:= When(s = GTPar,\n                        #ScatDist(ss.part(1, i, Rows(spl), [procs, its/(procs*pkSize)]).range(), pkSize, procs, i),\n                        ScatDist(procs, its*Rows(spl)/procs, procs, i),\n                        ScatSend(ss.part(1, i, Rows(spl), [procs, its/(procs*pkSize)]),         pkSize, procs, i)),\n            cgather := When(g = GTPar,\n                        #GathDist(gg.part(1, i, Cols(spl), [procs, its/(procs*pkSize)]).range(), pkSize, procs, i),\n                        GathDist(procs, its*Rows(spl)/procs, procs, i),\n                        GathRecv(gg.part(1, i, Cols(spl), [procs, its/(procs*pkSize)]),         pkSize, procs, i)),\n\n            DistSum(procs, i, procs, cscatter * C[1] * cgather)\n        ) #apply\n    ), #GT_Cell\n\n\n    GT_Cell_auto := rec(\n        minPkSize := 4, # Hardcoded for real single precision (4 real elements == 16 bytes)\n        requiredFirstTag := ParCell_auto,\n\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                rank = 1\n                  and let(its := t.params[4][1],\n                    PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                    # The (IxA) construct doesn't need the pkSize constraint that\n                    # the (AxI) construct (and (IxA)L, L(IxA)) does:\n                    and When(t.params[2] = GTPar and t.params[3] = GTPar,\n                                IsPosInt(its/(procs)),\n                                IsPosInt(its/(procs * self.minPkSize)) #Need a packet size of at least 4\n                        )\n                  )\n        ),\n\n        children := (self, t) >> let(\n            spl    := t.params[1],\n            g      := t.params[2],\n            s      := t.params[3],\n            n      := t.params[4][1],\n            p      := t.firstTag().params[1],\n            r      := n/p,\n            tags   := Drop(t.getTags(), 1), # Eat up tag at topmost level. NOTE: Nested parallelism not considered for now\n            When(r > 1,\n            [ [ GT(spl, g, s, [n/p]).withTags(tags) ] ],\n            [ [ spl.withTags(tags) ] ])\n        ),\n\n        apply := (self, t, C, Nonterms) >> let(\n#           z := Error(\"Breakpoint\\n\"),\n            spl     := t.params[1],\n            g       := t.params[2],\n            s       := t.params[3],\n            n       := t.params[4][1],\n            gg      := When(g.params[1]=[0,1], XChain([0,1,2]), XChain([1,2,0])),\n            ss      := When(s.params[1]=[0,1], XChain([0,1,2]), XChain([1,2,0])),\n            p       := t.firstTag().params[1],\n            pkSize  := n/p,       # Automatically use up the remaining stuff for pkSize\n                       # NOTE: pkSize is WRONG! Will be different for Par and Vec!\n            i       := var(\"spuid\", TInt, p),\n            cscatter:= When(s.params[1]=[1,0],\n                        ScatDist(ss.part(1, i, Rows(spl), [p, n/(p*pkSize)]).range(), pkSize, p, i),\n                        ScatSend(ss.part(1, i, Rows(spl), [p, n/(p*pkSize)]),         pkSize, p, i)),\n            cgather := When(g.params[1]=[1,0],\n                        GathDist(gg.part(1, i, Cols(spl), [p, n/(p*pkSize)]).range(), pkSize, p, i),\n                        GathRecv(gg.part(1, i, Cols(spl), [p, n/(p*pkSize)]),         pkSize, p, i)),\n\n            DistSum(p, i, p, cscatter * C[1] * cgather)\n        ) #apply\n    ), #GT_Cell\n));\n\n\n#-----------------------------------------------------------------------------\n# Cell DMP Paradigm\n#-----------------------------------------------------------------------------\nNewRulesFor(GT, rec(\n    # Converts (In x A) to A DistSum (parallel loop)\n    GT_CellDMP_base_old := rec(\n        maxSize       := false,\n        minSize       := false,\n\n        requiredFirstTag := ParCellDMP_old,\n\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                rank = 1\n                  and let(its := t.params[4][1],\n                    PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                    and IsPosInt(its/(procs)))\n                  and (t.params[2]=GTPar and t.params[3]=GTPar)\n\n        ),\n\n        children := (self, t) >> let(\n            spl    := t.params[1],\n            g      := t.params[2],\n            s      := t.params[3],\n            its    := t.params[4][1],\n            procs  := t.firstTag().params[1],\n            tags  := Drop(t.getTags(), 1),  # Children don't need tags since we parallelize only at the topmost level\n            [ [ GT(spl, g, s, [its / procs]).withTags(tags), InfoNt(procs) ] ]\n        ),\n\n        apply := (self, t, C, Nonterms) >> let(\n            spl     := t.params[1],\n            g       := t.params[2],\n            s       := t.params[3],\n            its     := t.params[4][1],\n            gg      := When(g.params[1]=[0,1], XChain([0,1,2]), XChain([1,2,0])),\n            ss      := When(s.params[1]=[0,1], XChain([0,1,2]), XChain([1,2,0])),\n            procs   := t.firstTag().params[1],\n            i       := var(\"spuid\", TInt, procs),\n            cscatter:= ScatDist(ss.part(1, i, Rows(spl), [procs, its/(procs)]).range(), 1, procs, i),\n            cgather := GathDist(gg.part(1, i, Cols(spl), [procs, its/(procs)]).range(), 1, procs, i),\n\n            DistSum(procs, i, procs, cscatter * C[1] * cgather)\n\n        ) #apply\n    ), #GT_CellDMP_Base\n\n    # Converts all other TTensor constructs (IxA)L, L(IxA), (AxI) into L's and (IxA)s\n    # The L's are factorized to PTensor * Comm_Cell * PTensor\n    GT_CellDMP_gen_old := rec(\n        maxSize    := false,\n        minSize    := false,\n        forTransposition := false,\n\n        requiredFirstTag := ParCellDMP_old,\n\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                rank = 1\n                  and let(its := t.params[4][1],\n                    PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                    and IsPosInt(its/(procs))\n                    )\n                  and not(t.params[2]=GTPar and t.params[3]=GTPar)\n             ),\n\n        children := (self, t) >> let(\n            spl    := t.params[1],\n            g      := t.params[2],\n            s      := t.params[3],\n            its    := t.params[4][1],\n            procs  := t.firstTag().params[1],\n            tags   := t.getTags(),\n            m      := Rows(spl),\n            n      := its,\n\n            Cond(g = GTVec and s = GTPar, # L(IxA) case\n                  [ [\n                      TCompose([\n                         GT(spl, GTPar, GTPar, t.params[4]),\n                         TL(m*n, n)\n                      ]).withTags(tags),\n                  ] ],\n\n                  g = GTPar and s = GTVec, # (IxA)L case\n                  [ [\n                      TCompose([\n                         TL(m*n, m),\n                         GT(spl, GTPar, GTPar, t.params[4]),\n                      ]).withTags(tags),\n                  ] ],\n\n                  g = GTVec and s = GTVec, # AxI case\n                  [ [\n                      TCompose([\n                         TL(m*n, m),\n                         GT(spl, GTPar, GTPar, t.params[4]),\n                         TL(m*n, n)\n                      ]).withTags(tags),\n                  ] ]\n            )\n        ),\n\n        apply := (self, t, C, Nonterms) >> C[1]\n    ) #GT_CellDMP_gen\n\n));\n\nNewRulesFor(TL, rec(\n   TL_CellDMP_old := rec(\n       maxSize       := false,\n       minSize       := false,\n       forTransposition := false,\n\n       requiredFirstTag := ParCellDMP_old,\n\n       applicable := (self, t) >> let(\n           mn := t.params[1],\n           m  := t.params[2],\n           p  := t.firstTag().params[1],\n           n  := mn/m,\n           p2 := p*p,\n           IsPosInt(m/p) and IsPosInt(mn/p2) and IsPosInt(n) and (n>p)\n       ),\n\n       # Note: TLs with a ParCellDMP tag should never have either of the Ix set (Should always be I1 x L x I1)\n       children := (self, t) >> let(\n           mn := t.params[1],\n           m  := t.params[2],\n           p  := t.firstTag().params[1],\n           n  := mn/m,\n           p2 := p*p,\n\n           # Eat up the parallel (ParCellDMP) tag.\n           tags  := Drop(t.getTags(), 1),\n\n           [ [ TL(mn/p, m/p).withTags(tags), TL(n, p, 1, m/p).withTags(tags), InfoNt(m,n,p) ] ]\n       ),\n\n       apply := (self, t, C, Nonterms) >> let(\n           m   := Nonterms[3].params[1],\n           n   := Nonterms[3].params[2],\n           p   := Nonterms[3].params[3],\n           p2  := p*p,\n           mn  := m*n,\n\n           PTensor(C[1], p) * Comm_Cell(p, mn/p2) * PTensor(C[2], p)\n       )\n   ) #TL_CellDMP\n));\n\n\nsetStandAlone := function(tags)\n   local i, retval;\n   retval := Copy(tags);\n\n   for i in retval do \n      i.isEdge := true;\n   od;\n   return(retval);\nend;\n\n\n\n#-----------------------------------------------------------------------------#-----------------------------------------------------------------------------#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------\n#-----------------------------------------------------------------------------\n# Cell DMP Paradigm - new\n#-----------------------------------------------------------------------------\nNewRulesFor(GT, rec(\n    GT_StickyL := rec(\n        requiredFirstTag := StickyL,\n        applicable := (self, t) >> true,\n        children   := (self, t) >> [[ t.withoutFirstTag() ]],\n        apply := (self, t, C, Nonterms) >> C[1]\n    ),\n\n    # Converts (In x A) to A DistSum (parallel loop)\n    GT_CellDMP_base := rec(\n        maxSize       := false,\n        minSize       := false,\n\n        requiredFirstTag := ParCellDMP,\n\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                rank = 1\n                  and let(its := t.params[4][1],\n                    PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                    and IsPosInt(its/(procs)))\n                  and (t.params[2]=GTPar and t.params[3]=GTPar)\n\n        ),\n\n        children := (self, t) >> let(\n            spl    := t.params[1],\n            g      := t.params[2],\n            s      := t.params[3],\n            its    := t.params[4][1],\n            procs  := t.firstTag().params[1],\n            tags  := Drop(t.getTags(), 1),  # No nested parallelism for now\n            [ [ GT(spl, g, s, [its / procs]).withTags(tags), InfoNt(procs) ] ]\n        ),\n\n        apply := (self, t, C, Nonterms) >> let(\n            spl     := t.params[1],\n            g       := t.params[2],\n            s       := t.params[3],\n            its     := t.params[4][1],\n            gg      := When(g.params[1]=[0,1], XChain([0,1,2]), XChain([1,2,0])),\n            ss      := When(s.params[1]=[0,1], XChain([0,1,2]), XChain([1,2,0])),\n            procs   := t.firstTag().params[1],\n            i       := var(\"spuid\", TInt, procs),\n            cscatter:= ScatDist(ss.part(1, i, Rows(spl), [procs, its/(procs)]).range(), 1, procs, i),\n            cgather := GathDist(gg.part(1, i, Cols(spl), [procs, its/(procs)]).range(), 1, procs, i),\n\n            DistSum(procs, i, procs, cscatter * C[1] * cgather)\n\n        ) #apply\n    ), #GT_CellDMP_Base\n\n    # Converts all other TTensor constructs (IxA)L, L(IxA), (AxI) into L's and (IxA)s\n    # The L's are factorized to PTensor * Comm_Cell * PTensor\n    GT_CellDMP_gen := rec(\n        maxSize    := false,\n        minSize    := false,\n        forTransposition := false,\n\n        requiredFirstTag := ParCellDMP,\n\n        # NOTE: Ensure applicability for vectorized distributed algo\n        applicable := (self, t) >> let(\n                rank   := Length(t.params[4]),\n                procs  := t.firstTag().params[1],\n                v      := When(Length(t.firstTag().params)>1, t.firstTag().params[2], 1),\n                n      := t.params[4][1],\n                rank = 1\n                and PatternMatch(t, [GT, @(1), @(2,XChain), @(3,XChain), ...], empty_cx())\n                and IsPosInt((n/v) / procs)\n                and not(t.params[2]=GTPar and t.params[3]=GTPar)\n                #and t.params[2]=GTVec and t.params[3]=GTVec #NOTE: remove this later\n             ),\n\n        children := (self, t) >> let(\n            spl    := t.params[1],\n            g      := t.params[2],\n            s      := t.params[3],\n            n      := t.params[4][1],\n            procs  := t.firstTag().params[1],\n            v      := When(Length(t.firstTag().params)>1, t.firstTag().params[2], 1),\n            tags   := t.getTags(),\n\n            ltags  := When(tags[1].leftChild(),  setStandAlone(tags), tags),\n            rtags  := When(tags[1].rightChild(), setStandAlone(tags), tags),\n\n           # Error(\"BP\"),\n\n            m      := Rows(spl),\n            #splnew := When(v=1, spl, GT(spl.withTags([StickyL(v)]), g, s, [v])),\n            splnew := When(v=1, spl, GT(spl, g, s, [v])),\n\n            Cond(s = GTPar and g = GTVec, # (IxA)L case\n                  [ [\n                         GT(splnew, GTPar, GTPar, [n/v]).withTags(tags),\n                         TL(m*n/v, n/v, 1, v).withTags(rtags)\n                  ] ],\n\n                  # TEMP: commenting this out. We shouldn't see this case\n                  s = GTVec and g = GTPar, # L(IxA) case\n                  Error(\"WTF?\"),\n                  #[ [\n                  #       TL(m*n/v, m, 1, v).withTags(ltags),\n                  #       GT(splnew, GTPar, GTPar, [n/v]).withTags(tags)\n                  #] ],\n\n                  s = GTVec and g = GTVec, # AxI case\n                  [ [\n                         TL(m*n/v, m, 1, v).withTags(ltags),\n                         GT(splnew, GTPar, GTPar, [n/v]).withTags(tags),\n                         TL(m*n/v, n/v, 1, v).withTags(rtags)\n                  ] ]\n            )\n        ),\n\n        apply := (self, t, C, Nonterms) >> When(Length(C)=2, C[1]*C[2], C[1]*C[2]*C[3])\n    ) #GT_CellDMP_gen\n\n));\n\nNewRulesFor(TL, rec(\n   TL_CellDMP := rec(\n       maxSize       := false,\n       minSize       := false,\n       forTransposition := false,\n\n       requiredFirstTag := ParCellDMP,\n\n       applicable := (self, t) >> let(\n           mn := t.params[1],\n           m  := t.params[2],\n           p  := t.firstTag().params[1],\n           n  := mn/m,\n           p2 := p*p,\n           IsPosInt(m/p) and IsPosInt(mn/p2) and IsPosInt(n) and (n>p)\n       ),\n\n       children := (self, t) >> let(\n           mnByv := t.params[1],\n           m     := t.params[2],\n           v     := t.params[4],\n           p     := t.firstTag().params[1],\n           nByv  := mnByv/m,\n           p2    := p*p,\n\n           # Eat up the parallel (ParCellDMP) tag.\n           tags  := Drop(t.getTags(), 1),\n           #When(IsBound(tags[1].isEdgeTL), Error(\"Edge\"), Print(\"\")),\n\n           [ [ TL(mnByv/p, m/p, 1, v).withTags(tags), TL(nByv, p, 1, (m*v)/p).withTags(tags), InfoNt(m,nByv,p,v) ] ]\n       ),\n\n       apply := (self, t, C, Nonterms) >> let(\n           m      := Nonterms[3].params[1],\n           nByv   := Nonterms[3].params[2],\n           p      := Nonterms[3].params[3],\n           v      := Nonterms[3].params[4],\n           p2     := p*p,\n           tags   := t.getTags(),\n\n\n           # Hacking RulesTerm inside here was done by ff.\n           #fl     := PTensor(paradigms.vector.rewrite.RulesTerm(C[1]), p),\n           #fr     := PTensor(paradigms.vector.rewrite.RulesTerm(C[2]), p),\n\n           #fl     := When(tags[1].leftEdge(),   LeftEdge(PTensor(C[1], p)), PTensor(C[1], p)),\n           #fr     := When(tags[1].rightEdge(), RightEdge(PTensor(C[2], p)), PTensor(C[2], p)),\n\n           # Works, but need to terminate blockvperm\n           #Cond(tags[1].leftEdge(),  (LeftEdge(fl) * Comm_Cell(p, (m*nByv*v)/p2) * fr),\n           #     tags[1].rightEdge(), (    fl  * Comm_Cell(p, (m*nByv*v)/p2) * RightEdge(fr)),\n           #                          (    fl  * Comm_Cell(p, (m*nByv*v)/p2) *      fr ))\n\n           frules := MergedRuleSet(RulesSums, RulesFuncSimp, KillSymSPL, RulesVec, RulesTerm, RulesPropagate),\n\n           csums := frules(C[2].sums()),\n           sg := ScatGath(fTensor(fId(csums.dimensions[1]/csums.v), fId(csums.v)), fTensor(csums.func, fId(csums.v)) ),\n           sgnew := frules(sg.toloop(csums.v)),\n\n           csums1 := frules(C[1].sums()),\n           sg1 := ScatGath(fTensor(fId(csums1.dimensions[1]/csums1.v), fId(csums1.v)), fTensor(csums1.func, fId(csums1.v)) ),\n           sgnew1 := frules(sg1.toloop(csums1.v)),\n\n\n\n           fl     := When(tags[1].leftEdge(), \n                     #PTensor(csums1, p),\n                     PTensor(sgnew1, p),\n                     PTensor(C[1], p)),\n\n           fr     := When(tags[1].rightEdge(),\n                     #PTensor(csums, p),\n                     PTensor(sgnew, p),\n                     PTensor(C[2], p)),\n\n           #Error(\"BP0\"),\n\n           fl * Comm_Cell(p, (m*nByv*v)/p2) * fr\n\n       )\n   ) #TL_CellDMP\n));\n", "meta": {"hexsha": "cdfc2479bab77a32d911d806feae38ac6026fa61", "size": 22334, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/distributed/breakdown.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/distributed/breakdown.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/distributed/breakdown.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 39.0454545455, "max_line_length": 313, "alphanum_fraction": 0.4294349422, "num_tokens": 6173, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.38121956625614994, "lm_q2_score": 0.025178840329050534, "lm_q1q2_score": 0.0095986665890735}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nImport(paradigms.distributed);\n\n# local functions and variables are prefixed with an underscore.\n\n_WriteStub := function(code, opts)\n    local outstr, s, stub, i, testvec, multiline;\n    \n    # build the generic stub info\n    stub := CopyFields(rec(\n        MEM_SIZE := When(IsBound(code.dimensions), EvalScalar(code.dimensions[1]) * 4, 0),\n        DATATYPE := Concat(\"\\\"\", DeriveScalarType(opts), \"\\\"\"),\n        DATATYPE_NO_QUOTES := DeriveScalarType(opts),\n        PAGESIZE := 4096,\n        INITFUNC := \"init_sub\",\n        FUNC := \"sub\",\n        DESTROYFUNC := \"destroy_sub\",\n        DATATYPE_SIZEINBYTES := Cond(DeriveScalarType(opts) = \"float\", 4, Cond(DeriveScalarType(opts) = \"double\", 8, 0)),\n        NUMTHREADS := When(IsBound(opts.smp) and IsInt(opts.smp.numproc), opts.smp.numproc, 1),\n        RADIX :=      When(IsBound(opts.smp) and IsInt(opts.smp.numproc) and IsBound(code.dimensions), (code.dimensions[1]/(2 * opts.smp.numproc)), 2),\n        QUICKVERIFIER := When(IsBound(opts.quickverifier), opts.quickverifier, \"nulltransform\")\n    ));\n\t\n    if IsBound(code.dimensions) then\n        stub.ALLOCATE_MEMORY := \"1\";\n        stub.ROWS := EvalScalar(code.dimensions[1]);\n        stub.COLUMNS := EvalScalar(code.dimensions[2]);\n    else\n        stub.ALLOCATE_MEMORY := \"0\";\n    fi;\n\n    outstr := opts.unparser.generated_by;\n    for s in UserRecFields(stub) do\n        if s <> \"operations\" then\n            if IsList(stub.(s)) and not IsString(stub.(s)) then\n                outstr := Concat(outstr, \"#define \", s, \" { \");\n                for i in [1..Length(stub.(s))-1] do\n                   outstr := Concat(outstr, String(stub.(s)[i]), \", \");\n                od;\n                outstr := Concat(outstr, String(Last(stub.(s))), \" }\\n\");\n            else\n                outstr := Concat(outstr, \"#define \", s, \" \", String(stub.(s)), \"\\n\");\n            fi;\n        fi;\n    od;\n\n    Print(outstr);\n\n    ##  add extern function declarations ... required for cuda\n    Print(\"\\nextern void INITFUNC();\\n\");\n    Print(\"extern void DESTROYFUNC();\\n\");\n    Print(\"extern void FUNC( \", DeriveScalarType(opts), \" *out, \", DeriveScalarType(opts), \" *in );\\n\");\n    \n\t#add testvector if specified in opts\n\t\n\tif IsBound(opts.testvector) then\n\t\ttestvec := opts.testvector;\n\t\tmultiline := false;\n\t\tif not IsVector(testvec) then\n\t\t\tError(\"opts.testvector must be a valid vector\");\n\t\tfi;\n\t\tPrint(\"\\n\\nstatic \", DeriveScalarType(opts), \" testvector[] = {\");\n\t\tif Length(testvec) > 10 then\n\t\t\tPrint(\"\\n    \");\n\t\tfi;\n\t\tfor i in [1 .. Length(testvec)] do\n\t\t\tif i > 1 then\n\t\t\t\tPrint(\", \");\n\t\t\t\tif Mod(i, 10) = 1 then\n\t\t\t\t\tPrint(\"\\n    \");\n\t\t\t\t\tmultiline := true;\n\t\t\t\tfi;\n\t\t\tfi;\n\t\t\tPrint(testvec[i]);\n\t\tod;\n\t\tif multiline then\n\t\t\tPrint(\"\\n\");\n\t\tfi;\n\t\tPrint(\"};\\n\");\n\tfi;\n\t\nend;\n\n\n_MakeOutDirString := function(opts)\n\tlocal tmp;\n\t\n\ttmp := GetEnv(\"SPIRAL_TEMP_OUT_PATH\");\n\tif (tmp = \"\") then\n        tmp := \"/tmp\";\n    fi;\n    return Concat(\n\t\tCond(IsBound(opts.outdir), opts.outdir, tmp),\n\t\t\"/\",\n\t\tString(GetPid()));\nend;\n\n\n#\n## _MakeOutDir\n#\n# create the output directory.\n#\n\n_MakeOutDir := function(opts)\n    local outdir;\n\n    outdir := _MakeOutDirString(opts);\n\n    if '~' in outdir or '$' in outdir then\n        Error(\"No shell vars are allowed at the moment.\");\n    fi;\n\n    MakeDir(outdir);\n\n    return outdir;\nend;\n\n\n_CallProfiler := function(request, code, opts)\n    local outdir, fullcmd, errorvalue, retval, target, outputFile, operations;\n\t\n\tif (request = \"\") then\n\t\trequest := \"time\";\n\tfi;\n\n    outdir := _MakeOutDir(opts);\n    \n    # output the spiral 'code' representation to the output dir.\n    PrintTo(Concat(outdir, \"/code.g\"), code);\n\n    # output the full options and profile info\n    # PrintRec would be great if it didn't freeze the second time you call it for some reason\n    if IsBound( opts.operations )  then\n        operations := opts.operations;\n    fi;\n    Unbind(opts.operations);\n    PrintTo(Concat(outdir, \"/opts.g\"), Print(opts));\n    if IsBound( operations )  then\n        opts.operations := operations;\n    fi;\n\n    # generate C code to testcode file\n    PrintTo(Concat(outdir, \"/testcode.c\"), opts.unparser.gen(\"sub\", code, opts));\n    \n    # write testcode.h\n    PrintTo(Concat(outdir, \"/testcode.h\"), _WriteStub(code, opts));\n\n    target := When(IsBound(opts.target), opts.target, rec());\n    outputFile := Concat(outdir, \"/\", request, \".txt\");\n    fullcmd := Concat(\"spiralprofiler -d \", outdir);\n    fullcmd := Concat(fullcmd, \" -r \", request);\n    \n    if IsBound(target.forward) then\n        fullcmd := Concat(fullcmd, \" -f \", String(target.forward));\n    fi;\n    \n    if IsBound(target.name) then\n        fullcmd := Concat(fullcmd, \" -t \", String(target.name));\n    fi;\n\n    if IsBound(target.prefix) then\n        fullcmd := Concat(fullcmd, \" -P \", String(target.prefix));\n\telse\n\t\tfullcmd := Concat(fullcmd, \" -P \", String(GetPid()), \"_\");\n    fi;\n\n    # Exec the profiler\n\t# uncomment following line to hide profiler debug and error messages\n\t#fullcmd := Concat(fullcmd, \" 2> NUL\");\n\t\n\tPrintLine(fullcmd);\n\t\n\terrorvalue := IntExec(fullcmd);\n    \n    if (errorvalue <> 0) then\n        Print(\"Profiler failed with error value \", errorvalue, \":\\n\", fullcmd, \"\\n\");\n        return 1e100;\n    fi;\n\n\tretval := ReadVal(outputFile);\n\t\n    return retval;\nend;\n\n\n## CMeasure(code, opts)\n##\n## Call profiler to time transform implemented by code\n\nCMeasure := (code, opts) -> _CallProfiler(\"time\", code, opts);\n\n## CMatrix(code, opts)\n##\n## Call profiler to generate matrix equivalent of transform implemented by code\n\nCMatrix := function(code, opts)\n\tlocal retmat;\n\tretmat := _CallProfiler(\"matrix\", code, opts);\n\treturn Cond(IsMat(retmat), TransposedMat(retmat), retmat);\nend;\n\n## CVector(code, vector, opts)\n##\n## Call profiler to apply transform implemented by code to vector\n\nCVector := function (code, vector, opts)\n\tlocal retvec;\n\topts.testvector := vector;\n\tretvec :=  _CallProfiler(\"vector\", code, opts);\n\treturn retvec;\nend;\n\n\n#F Find maximum memory requirement of all arrays\n#F Used to determine memory arena size (for temp array reuse)\nfindMaxMemReq := function(c)\n   local i, maxOfChildren, thisChild, myMem, arrays, other;\n\n   if not IsRec(c) or not IsBound(c.rChildren) then\n      return 0;\n   fi;\n\n   # Catch init functions and return 0\n   if ObjId(c) = func and c.id = \"init\" then\n      return 0;\n   fi;\n\n   # Determine the mem requirements of each of our children recursively, and\n   # take the max of this.\n   maxOfChildren := 0;\n   for i in c.rChildren() do\n      thisChild := findMaxMemReq(i);\n      if (thisChild > maxOfChildren) then\n         maxOfChildren := thisChild;\n      fi;\n   od;\n\n   # Determine our own memory requirements (recursion leaf also)\n   myMem := 0;\n   if ObjId(c) = decl then\n      [arrays, other] := SplitBy(c.vars, x->IsArray(x.t));\n      for i in arrays do\n        #HACK to exclude twiddles\n        if i.id[1] <> 'D' then\n           myMem := myMem + (i.t.size * When(IsBound(i.t.t) and ObjId(i.t.t)=TVect, i.t.t.size, 1));\n        fi;\n      od;\n   fi;\n\n   #Print(ObjId(c), \" myMem = \", myMem, \". maxOfChildren = \", maxOfChildren, \"\\n\");\n   return(myMem + maxOfChildren);\nend;\n\n#F This function is exclusively for the Cell\nBuildStubOpts := function (code, opts)\n    local arena_size, dist_loops, mbuf_its, memloop_its, parallel_its;\n    if IsBound(opts.useMemoryArena) and opts.useMemoryArena then\n       arena_size := findMaxMemReq(code);\n       if ObjId(arena_size) = Value then arena_size := arena_size.v; fi;\n       opts.profile.stubopts.ARENA_SIZE := arena_size;\n    else\n       opts.profile.stubopts.ARENA_SIZE := 1;\n    fi;\n\n    # # For the Cell: add parallelization param to profile.\n    # if IsBound(opts.spus) then\n    #    opts.profile.stubopts.SPUS := opts.spus;\n    # fi;\n    # NOTE (clean this up)\n    # Override spus with info extracted from code - for DP to work properly.\n    dist_loops := Collect(code, dist_loop);\n    if Length(dist_loops) >=1 then\n       opts.profile.stubopts.SPUS := dist_loops[1].P;\n    else\n       opts.profile.stubopts.SPUS := 1;\n    fi;\n\n    mbuf_its := Collect(code, multibuffer_loop);\n    if Length(mbuf_its) >=1 then\n       # Write the loop with the smallest mbuf_its range to stub.h since the backend uses this value to divide and declare arrays\n       opts.profile.stubopts.MULTIBUFFER_ITERATIONS :=  Minimum(List([1..Length(mbuf_its)], i->Length(mbuf_its[i].range)));\n       # Write info on whether last mbuf stage is a ping or a pong (will result of computation end up in X or Y)?\n       opts.profile.stubopts.MBUF_ENDS_IN_Y :=  Length(mbuf_its) mod 2;\n\n       # We're probably doing internal streaming, so let the backend know of that.\n       opts.profile.stubopts.INTERNAL_MULTIBUFFERING  := 1;\n    else\n       opts.profile.stubopts.MULTIBUFFER_ITERATIONS := 1;\n       opts.profile.stubopts.MBUF_ENDS_IN_Y := 1;\n    fi;\n\n    memloop_its := Collect(code, mem_loop);\n    if Length(memloop_its) >=1 then\n       opts.profile.stubopts.VECTOR_IN_MEM := Length(memloop_its[1].range);\n       opts.profile.stubopts.MBUF_ENDS_IN_Y :=  Length(memloop_its) mod 2;\n    else\n       if IsBound(opts.profile.stubopts.VECTOR_IN_MEM) then\n        Unbind(opts.profile.stubopts.VECTOR_IN_MEM);\n       fi;\n    fi;\n\n    parallel_its := Collect(code, @(1, func, e->ObjId(e.cmd)=dist_loop)); # Only checking for topmost level of parallelism\n    if Length(parallel_its) >=1 then\n       opts.profile.stubopts.PARALLEL_ITERATIONS := parallel_its[1].cmd.P;\n    else\n       opts.profile.stubopts.PARALLEL_ITERATIONS := 1;\n    fi;\nend;\n\n_StandardMeasure := (code, opts) -> _CallProfiler(\"time\", code, opts);\n\n_StandardBuild := (code, opts) -> _CallProfiler(\"build\", code, opts);\n\n_StandardMeasureVerify := function(code, opts, makeTarget)\n\t#PrintLine(\"_StandardMeasureVerify(), makeTarget: \\\"\", makeTarget, \"\\\"\");\n\tif (makeTarget = \"\") then\n\t\tmakeTarget := \"time\";\n\tfi;\n\treturn _CallProfiler(makeTarget, code, opts);\nend;\n\n\n\n\n", "meta": {"hexsha": "bfd701eb15f170090c235cc19851b6b2f3f92bb7", "size": 9995, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/profiler/build.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/profiler/build.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/profiler/build.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 30.3799392097, "max_line_length": 151, "alphanum_fraction": 0.6368184092, "num_tokens": 2709, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.25091278688527247, "lm_q2_score": 0.03676946436037402, "lm_q1q2_score": 0.009225928774940146}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(AsmX86Unparser, Unparser, rec(\n\n\n    asmvolatile := meth(self, o)\n        local oo,a,x;\n\n\ta := [];\n        oo := self.preprocess(o);\n\twhile(ObjId(oo)=data) do\n\t  oo.var.asmpseudoregister:=Length(a);\n\t  Append(a,[[oo.var,oo.value]]);\n\t  Print(\"static const double \",oo.var.id,\"=\",oo.value.v,\";\\n\");\n\t  oo:=oo.cmd;\n\t od;\n        Print(\n\t    \"asm volatile (\\n\",\n            Unparse(oo, self, 4, 2),\n\t    \":: \");\n\tfor x in a do\n\t   Print(\"\\\"m\\\"(\",x[1].id,\"), \");\n\tod;\n\tPrint(\"\\\"eax\\\"(X), \\\"ecx\\\"(Y));\");\n    end,\n\n    preprocess := (self, o) >> o,\n\n    # NOTE: dynamically set mul and ofs based on X.t, Y.t\n    #        note -- these are in bytes (8 bytes = 64 bits = double fp)\n    #switched to double %% for asm volatile\n    regmap := rec(\n\tS := rec(reg:=\"%%esp\",ofs:=-8, mul:=-8),\n\tX := rec(reg:=\"%%eax\",ofs:=0, mul:=8),\n\tY := rec(reg:=\"%%ecx\",ofs:=0, mul:=8),\n\n\tA := rec(reg:=\"%%eax\",ofs:=0, mul:=16),\n\tB := rec(reg:=\"%%ebx\",ofs:=0, mul:=8),\n\tC := rec(reg:=\"%%ecx\",ofs:=0, mul:=16),\n\n\tr0 := rec(reg:=\"%%xmm0\"),\n\tr1 := rec(reg:=\"%%xmm1\"),\n\tr2 := rec(reg:=\"%%xmm2\"),\n\tr3 := rec(reg:=\"%%xmm3\"),\n\tr4 := rec(reg:=\"%%xmm4\"),\n\tr5 := rec(reg:=\"%%xmm5\"),\n\tr6 := rec(reg:=\"%%xmm6\"),\n\tr7 := rec(reg:=\"%%xmm7\"),\n\tr8 := rec(reg:=\"%%xmm8\"),\n\tr9 := rec(reg:=\"%%xmm9\"),\n\tr10 := rec(reg:=\"%%xmm10\"),\n\tr11 := rec(reg:=\"%%xmm11\"),\n\tr12 := rec(reg:=\"%%xmm12\"),\n\tr13 := rec(reg:=\"%%xmm13\"),\n\tr14 := rec(reg:=\"%%xmm14\"),\n\tr15 := rec(reg:=\"%%xmm15\"),\n\n\tA0 := rec(reg:=\"%%xmm8\"),\n\tA1 := rec(reg:=\"%%xmm9\"),\n\tA2 := rec(reg:=\"%%xmm10\"),\n\tA3 := rec(reg:=\"%%xmm11\"),\n\tA4 := rec(reg:=\"%%xmm12\"),\n\tA5 := rec(reg:=\"%%xmm13\"),\n\tA6 := rec(reg:=\"%%xmm14\"),\n\tA7 := rec(reg:=\"%%xmm15\"),\n    ),\n\n    startFunc := meth(self, fname, stackofs, loadptrs)\n        local v, i;\n        PrintLine(\".globl \", fname);\n#\tPrintLine(\"    .def  _\", fname, \"; .scl 2; .type 32; .endef\");\n        PrintLine(\"    .type  \", fname, \", @function\");\n\tPrintLine(\"\", fname, \":\");\n\n\t# load arguments into registers\n\tfor i in [1..Length(loadptrs)] do\n\t    v := loadptrs[i];\n\t    PrintLine(\"    movl  \", (stackofs+i-1)*4, \"(%esp), \", self.regmap.(v.id).reg);\n\tod;\n    end,\n\t\n    header_top := meth(self, subname, o) \n        local precomputed_data;\n\tPrintLine(\"    .data\");\n\tPrintLine(\"    .align 8\");\n        precomputed_data := List(Collect(o, data), x->[x.var, x.value]);\n\tDoForAll(precomputed_data, d -> self.genData(d[1], d[2]));\n\tPrintLine(\"\");\n\tPrintLine(\"    .text\");\n\tPrintLine(\"    .align 8\");\n    end,\n\n    header_func := (self, subname, o) >> self.startFunc(subname, 1, [Y, X]),\n\n    header := meth(self, subname, o)\n        self.header_top(subname, o);\n        self.header_func(subname, o);\n    end,\n\n    footer := meth(self, subname, o)\n        local init, loopvars;\n\tPrintLine(\"    ret\");\n\tPrintLine(\"\");\n\tself.startFunc(Concat(\"init_\", subname), 0, []);\n\tPrintLine(\"    ret\");\n    end,\n    \n    genData := (self, v, val) >> Cond(\n\tval.t = TDouble, PrintLine(v, \": .double \", val.v),\n\tval.t = TInt,    PrintLine(v, \": .long \", val.v),\n\tIsArray(val.t) and val.t.t = TDouble,\n\t    val.t.t=TDouble, PrintLine(v, \": .double \", PrintCS(val.v)),\n\tIsArray(val.t) and val.t.t = TInt,\n\t    val.t.t=TDouble, PrintLine(v, \": .long \", PrintCS(val.v)),\n        Error(\"Can't handle type \", val.t)),\n\n    ###################\n    # Helpers\n    ###################\n\n\n#HERE is a HACK to print correct GCC intrincsics\n#old code is commented out \n    instr2 := (self, mnem, src, dest) >>\n#        Print(\"    \", mnem, \"  \", self(src,0,0), \", \", self(dest,0,0), \"\\n\"),\n        Print(\"\\\"    \", mnem, \"  \", self(src,0,0), \", \", self(dest,0,0), \"\\\\n\\\\t\\\"\\n\"),\n\n    isReg := (self, loc) >> IsVar(loc) and IsBound(self.regmap.(loc.id)),\n\n    ####################\n    ## General\n    ####################\n    atomic  := (self,o,i,is) >> Print(o),\n    Loc     := (self,o,i,is) >> o.cprint(),\n\n    ####################\n    ## Commands\n    ####################\n\n    # just sequence them\n    #removed the chain label\n#    chain := (self,o,i,is) >> Print(\"chain_\", BagAddr(o), \":\\n\", \n#\tDoForAll(o.cmds, c -> self(c, i, is))), \n    chain := (self,o,i,is) >> Print( DoForAll(o.cmds, c -> self(c, i, is))), \n\n\n    # all datas are handled in the header, just proceed to children\n    data := (self,o,i,is) >> self(o.cmd, i, is),\n\n    # nothing need to be declared in assembly, we just have registers and stack space\n    decl := (self,o,i,is) >> self(o.cmd, i, is),\n\n    # on Pentium M using sd seems to be more efficient\n    assign     := (self,o,i,is) >> let(\n\tsfx := When(self.isReg(o.exp) and self.isReg(o.loc), \"sd\", \"sd\"), # apd\n\tself.instr2(Concat(\"mov\", sfx), o.exp, o.loc)),\n\n    assign_add := (self,o,i,is) >> let(\t\n\tsfx := When(self.isReg(o.exp) and self.isReg(o.loc), \"sd\", \"sd\"),\n\tself.instr2(Concat(\"add\",sfx), o.exp, o.loc)),\n\n    assign_sub := (self,o,i,is) >> let(\n\tsfx := When(self.isReg(o.exp) and self.isReg(o.loc), \"sd\", \"sd\"),\n\tself.instr2(Concat(\"sub\", sfx), o.exp, o.loc)),\n\n    assign_mul := (self,o,i,is) >> let(\n\tsfx := When(self.isReg(o.exp) and self.isReg(o.loc), \"sd\", \"sd\"),\n\tself.instr2(Concat(\"mul\", sfx), o.exp, o.loc)),\n\n    ####################\n    ## Expressions\n    ####################\n\n    Exp := (self,o,i,is) >> Error(\"X86 Assembly backend expects 2-operand low-level representation, it must not have expressions, so I can't handle <o>\"),\n\n    dup := (self,o,i,is) >> \n        Print( \"shufpd(\", self.regmap.(o.args[1].id).reg, \")\"),\n\n    nth := (self,o,i,is) >> Checked(IsValue(o.idx), \n\tlet(d := self.regmap.(o.loc.id),\n\t    Print( (o.idx.v * d.mul + d.ofs), \"(\", d.reg, \")\"))),\n\n    var := (self,o,i,is) >> When(IsBound(self.regmap.(o.id)),\n\tPrint(self.regmap.(o.id).reg),\n\tWhen(IsBound(o.asmpseudoregister),Print(\"%\",o.asmpseudoregister),\n\tPrint(o.id))),\n\n    Value := CUnparser.Value\n));\n", "meta": {"hexsha": "d07971abc95f0c54775e1581d1d6f97ecedae9f2", "size": 5836, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/x86.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/x86.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/x86.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 30.2383419689, "max_line_length": 154, "alphanum_fraction": 0.5255311857, "num_tokens": 1899, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.25386101825929835, "lm_q2_score": 0.035678546776264586, "lm_q1q2_score": 0.009057392214634535}}
{"text": "DK1 schwarz,1,Projekt\t\t//creates kone\r\n  S(1,1,2)\t\t\t//rediefine edges as (r,r,h)\r\n", "meta": {"hexsha": "65622bee8e0a1f20982e850429ec87cdecb87fae", "size": 82, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "HowGAMfileswork/cone.gap", "max_stars_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_stars_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-03-14T08:02:54.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-14T08:02:54.000Z", "max_issues_repo_path": "HowGAMfileswork/cone.gap", "max_issues_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_issues_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HowGAMfileswork/cone.gap", "max_forks_repo_name": "rjs-codeworks/GAM-gen-graphical", "max_forks_repo_head_hexsha": "113535ab8741052ed81a9402b16a201466ea0091", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.3333333333, "max_line_length": 42, "alphanum_fraction": 0.6341463415, "num_tokens": 37, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.42250463481418826, "lm_q2_score": 0.02096424016821224, "lm_q1q2_score": 0.008857488636427449}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nImportAll(paradigms.smp);\nImportAll(paradigms.vector);\n\nClass(IAGlobals, rec(\n    getOpts := meth(arg)\n        local opts, self, smpopts, isa, sseopts, optrec, tid;\n        \n        #   set up defaults\n        optrec := rec(\n            cpu := LocalConfig.cpuinfo,\n            useSIMD := true,\n            useSMP := true,\n            useNewSettingsForICC := false,\n            dataType := T_Real(64),\n            globalUnrolling := 128,\n            useArea := false,\n            processIntTables := false,\n            use64bit := LocalConfig.osinfo.is64bit()\n        );\n\n        smpopts := rec(\n                numproc := LocalConfig.cpuinfo.cores,\n                api := \"OpenMP\"\n        );\n        \n        sseopts := rec(\n            svct:=true, \n            splitL:=false, \n            oddSizes := false,\n            stdTTensor := true, \n            tsplPFA := false\n        );\n\n        self := arg[1];\n        arg := Flat(Drop(arg, 1));\n        \n        if IsList(arg[1]) then arg := arg[1]; fi;\n        if Length(arg) >= 1 then optrec := CopyFields(optrec, arg[1]); fi;\n        if Length(arg) >= 2 then smpopts := CopyFields(smpopts, arg[2]); fi;\n        if Length(arg) >= 3 then sseopts := CopyFields(sseopts, arg[3]); fi;\n        \n        if optrec.useSIMD then \n            #   handle SSE\n            #   let SSE work the unrolling magic\n            sseopts.globalUnrolling := optrec.globalUnrolling;\n            sseopts.useArea := optrec.useArea;\n            sseopts.processIntTables := optrec.processIntTables;\n            if IsBound(optrec.mode) then sseopts.mode := optrec.mode; fi;\n            \n            isa := optrec.cpu.getSimdIsa(optrec.dataType);\n            opts := CopyFields(SIMDGlobals.getOpts(isa, sseopts), rec(\n                IAconf := rec(\n                    optrec := optrec,\n                    smpopts := smpopts,\n                    sseopts := sseopts\n                ),\n                \n                unparser := When(smpopts.api = \"OpenMP\", \n                    When(isa in [AVX_8x32f, AVX_4x64f], \n                        When(IsBound(smpopts.OmpMode) and smpopts.OmpMode = \"for\", \n                            spiral.libgen.OpenMP_AVXUnparser_ParFor, \n                            spiral.libgen.OpenMP_AVXUnparser),\n                        When(IsBound(smpopts.OmpMode) and smpopts.OmpMode = \"for\", \n                            spiral.libgen.OpenMP_SSEUnparser_ParFor, \n                            spiral.libgen.OpenMP_SSEUnparser)),\n                    spiral.libgen.SMP_SSEUnparser),\n                codegen := spiral.libgen.VecRecCodegen\n            ));\n            \n            if optrec.useNewSettingsForICC then\n                if IsBound(opts.language) then Unbind(opts.language); fi;\n                if LocalConfig.osinfo.isLinux() then \n                    if optrec.use64bit then\n                        opts.profile := default_profiles.linux_x64_icc;\n                    else\n                        opts.profile := default_profiles.linux_x86_icc;\n                    fi;\n                elif LocalConfig.osinfo.isDarwin() then \n                    Error(\"No Darwin SMP profiles defined yet\");\n                elif LocalConfig.osinfo.isWindows() then\n                    if optrec.use64bit then\n                        opts.profile := default_profiles.win_x64_icc;\n                    else\n                        opts.profile :=default_profiles.win_x86_icc;\n                    fi;\n                else\n                    Error(\"Unknow OS\");\n                fi;\n            fi;\n\n        else\n            if optrec.useSMP then Error(\"scalar SMP not implemented\"); fi;\n            \n            opts := Copy(SpiralDefaults);\n            \n            opts.globalUnrolling := optrec.globalUnrolling;\n            opts.useArea := optrec.useArea;\n            opts.processIntTables := optrec.processIntTables;\n            \n            if optrec.dataType = T_Real(32) then \n                opts := InitDataType(opts, \"f32re\");\n            elif optrec.dataType = T_Real(64) then \n                opts := InitDataType(opts, \"f64re\");\n            else\n                Error(\"unknown data type\");    \n            fi;\n            \n            if optrec.useNewSettingsForICC then\n                if IsBound(opts.language) then Unbind(opts.language); fi;\n                if LocalConfig.osinfo.isLinux() then \n                    if optrec.use64bit then\n                        opts.profile := default_profiles.linux_x64_icc;\n                    else\n                        opts.profile := default_profiles.linux_x86_icc;\n                    fi;\n                elif LocalConfig.osinfo.isDarwin() then \n                    Error(\"No Darwin SMP profiles defined yet\");\n                elif LocalConfig.osinfo.isWindows() then\n                    if optrec.use64bit then\n                        opts.profile := default_profiles.win_x64_icc;\n                    else\n                        opts.profile :=default_profiles.win_x86_icc;\n                    fi;\n                else\n                    Error(\"Unknow OS\");\n                fi;\n            fi;\n            \n            if optrec.useArea then\n                opts.globalUnrolling := 2 * opts.globalUnrolling; # * Log2Int(opts.globalUnrolling);\n                opts.markBlock := MarkBlocksAreaSums;\n            fi;\n            \n            return opts;            \n        fi;\n            \n        # handle the SMP pthreads/OpenMP case\n        if optrec.useSMP then\n            opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, \n                CopyFields(GT_Par, rec(parEntireLoop := false, splitLoop := true)), GT_Par_odd,\n                GT_Vec_AxI, GT_Vec_IxA, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA        \n            ];\n            opts.breakdownRules.TTensorI := Concat([ \n            CopyFields(TTensorI_toGT, rec(\n                applicable := (self, t) >> t.hasTags() and ObjId(t.getTags()[1])=AParSMP ))], \n                opts.breakdownRules.TTensorI);\n                \n            opts.breakdownRules.TTensorInd := \n                Concat([dsA_base_smp, dsA_smp, L_dsA_L_base_smp, L_dsA_L_smp], \n                    opts.breakdownRules.TTensorInd);    \n                \n            tid := When(smpopts.api = \"OpenMP\", threadId(), var(\"tid\", TInt));\n            opts.tags := Concat([ AParSMP(smpopts.numproc, tid)  ], opts.tags);\n            \n            if optrec.useNewSettingsForICC then\n                if IsBound(opts.language) then Unbind(opts.language); fi;\n                if LocalConfig.osinfo.isLinux() then \n                    if optrec.use64bit then\n                        opts.profile := When(smpopts.api = \"OpenMP\", default_profiles.linux_x64_icc_openmp, default_profiles.linux_x64_threads);\n                    else\n                        opts.profile := When(smpopts.api = \"OpenMP\", default_profiles.linux_x86_icc_openmp, default_profiles.linux_x86_threads);\n                    fi;\n                elif LocalConfig.osinfo.isDarwin() then \n                    Error(\"No Darwin SMP profiles defined yet\");\n                elif LocalConfig.osinfo.isWindows() then\n                    if optrec.use64bit then\n                        opts.profile := When(smpopts.api = \"OpenMP\", default_profiles.win_x64_icc_openmp, default_profiles.win_x64_icc_threads);\n                    else\n                        opts.profile := When(smpopts.api = \"OpenMP\", default_profiles.win_x86_icc_openmp, default_profiles.win_x86_icc_threads);\n                    fi;\n                else\n                    Error(\"Unknow OS\");\n                fi;\n            else\n                opts.language := When(smpopts.api = \"OpenMP\", optrec.cpu.OpenMP_lang, optrec.cpu.smp_lang);\n            fi;\n    \n            if smpopts.api = \"threads\" then opts.subParams := [var(\"num_threads\", TInt), var(\"tid\", TInt)]; fi;\n            opts.smp := smpopts;\n        fi;\n\n        Add(opts.includes, \"<include/mm_malloc.h>\");\n        if not IsBound(opts.globalUnrolling) then opts.globalUnrolling := optrec.globalUnrolling; fi;\n        opts.operations := rec(Print := (s) -> Print(\"<IA options>\"));\n        return opts;\n    end\n));\n", "meta": {"hexsha": "91276f519698be1f1908fb1885e36cf0b4f40ed4", "size": 8200, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/intel/ia.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/intel/ia.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/intel/ia.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 42.7083333333, "max_line_length": 144, "alphanum_fraction": 0.5112195122, "num_tokens": 1834, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.27512971193602087, "lm_q2_score": 0.032100710073633826, "lm_q1q2_score": 0.008831859115500598}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImportAll(paradigms.stream);\n\n# gets/replaces the module names, copies generated files into genpath\nsetModule := function(filename, searchString, moduleName, genpath, bb)\t\n\tlocal cmdString;\n\t# replace the module name\n\tcmdString := ConcatenationString(paradigms.stream._hardwarePath, \"dram_scripts/_getModuleName.sh \", filename,\" \",searchString,\" \", moduleName);\n\tExec(cmdString);\n\tif(bb = 1) then\n\t\tcmdString := ConcatenationString(paradigms.stream._hardwarePath, \"dram_scripts/_blackBoxifyMems.sh \", filename);\n\t\tExec(cmdString);\n\tfi;\n\t# Copy the file into genpath\n\tcmdString := ConcatenationString(\"cp \",filename,\" \",genpath);\n\tExec(cmdString);\n\treturn moduleName;\nend;\n\n# gets the latency of permMems, writes them into a tmp file\ngetLMLatency := function(filename, RD_WR, memInst, tmpFile )\n\tlocal cmdString;\n\t# Puts lm latency define statement into tmpFile\n\tcmdString := ConcatenationString(paradigms.stream._hardwarePath, \"dram_scripts/_permMemLatencies.sh \",filename,\" \",RD_WR,\" \",String(memInst),\" \",tmpFile);\n\tExec(cmdString);\nend;\n\n# prints the latencies into config file, determines the max latency etc., then deletes the tmp file\nputLMLatency := function(tmpFile, readFile)\n\tlocal cmdString;\n\tcmdString := ConcatenationString(paradigms.stream._hardwarePath, \"dram_scripts/_putPermMemLatencies.sh \",tmpFile,\" \",readFile);\n\tExec(cmdString);\n\tRead(readFile);\n\tExec(ConcatenationString(\"rm \", readFile));\n\tExec(ConcatenationString(\"rm \", tmpFile));\nend;\n\n# adds prefix to module names to avoid overwrites\nprefixModules := function(filename, prefix)\n\tlocal cmdString;\n\tcmdString := ConcatenationString(paradigms.stream._hardwarePath, \"dram_scripts/_prefixModName.sh \",filename,\" \",prefix);\n\tExec(cmdString);\nend;\n\n#genConfigFile := function(srt, prec, genpath)\ngenConfigFile3 := function(srt, opts, genpath)\n\tlocal \tstages, fft_size, i,j,diff_prms,a,b,c,d,e,stream,path,format,cmdString,module,locmodname,bb,memfences,prmObjs,prmObj,\n\t\t\tcube_width,\n\t\t\tmem_wr_prms,                    \n\t\t\tmem_rd_prms,                    \n\t\t\tloc_wr_prms,                    \n\t\t\tloc_rd_prms,\n\t\t\tsym_mem_wr,\n\t\t\tsym_mem_rd,\n\t\t\tsym_loc_wr,\n\t\t\tsym_loc_rd;\n\t\n\tstages := Length(Collect(srt, MemFence));\n\tfft_size := Collect(srt, DFT)[1].params[1];\n\tmemfences := Collect(srt, MemFence);\n\t\n\tmem_wr_prms := [];\n\tmem_rd_prms := [];\n\tloc_wr_prms := [];\n\tloc_rd_prms := [];\n\t\n\tfor i in [1..stages] do\n\t\tmem_wr_prms[i] := Collect(memfences[i], MemWrPrm);\n\t\tmem_rd_prms[i] := Collect(memfences[i], MemRdPrm);\n\t\tloc_wr_prms[i] := Collect(memfences[i], LocalWrPrm);\n\t\tloc_rd_prms[i] := Collect(memfences[i], LocalRdPrm);\n\tod;\n\t\n\tcube_width := mem_rd_prms[1][1].func._children[Length(mem_rd_prms[1][1].func._children)].params[1];\n\tstream := opts.dram_datawidth/opts.precision/2;\n\tformat := When (opts.precision = 64, 2, 1);\n\tbb := opts.bb;\n\t\n\t\n\tPrintLine(\"//=========================\");\n\tPrintLine(\"// DO NOT MODIFY THIS FILE!\");\n\tPrintLine(\"//=========================\\n\");\n\t\n\t# Print the define statements into config\n\tPrintLine(\"`define CONFIG_FILE\");\n\t\n\t# Streamig width\n\tif(stream >= 4) then\n\t\tPrintLine(\"`define SW_4\");\n\tfi;\n\tif(stream >= 8) then\n\t\tPrintLine(\"`define SW_8\");\n\tfi;\n\tif(stream = 16) then\n\t\tPrintLine(\"`define SW_16\");\n\tfi;\n\tif(stream > 16 or stream < 2) then\n\t\tError(\"\\n***ERROR: Streaming width = \",stream,\" is not supported for now!\\n\");\n\tfi;\n\n\tPrintLine(\"// Asymmetric algorithm...\");\n\tdiff_prms := stages;\n\tPrintLine(\"`define ASYMMETRIC_ALGO\");\n\n\t\n\n\tPrintLine(\"`define APPDATA_WIDTH \", opts.dram_datawidth);\n\tPrintLine(\"`define DDR_ADDR_WIDTH \", opts.dram_addrwidth);\n\tPrintLine(\"`define LOG_FFT_SIZE \", LogInt(fft_size,2));\n\tPrintLine(\"`define PACKET_SIZE \", cube_width/stream);\n\tPrintLine(\"`define PRECISION \", opts.precision);\n\tPrintLine(\"`define NUM_OF_STAGES \", stages);\n\t\n\t\n\tPrintLine(\"// ODCM parameters\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// MemWrPrm:\");\n\t\n\tfor i in [1..stages] do\n\t\tfor j in [1..Length(mem_wr_prms[i])] do\n\t\t\tif(mem_wr_prms[i][j].func.numChildren() = 3) then # IxLxI\n\t\t\t\ta := mem_wr_prms[i][j].func._children[1].params[1];\n\t\t\t\tb := mem_wr_prms[i][j].func._children[2].params[1];\n\t\t\t\tc := mem_wr_prms[i][j].func._children[2].params[2];\n\t\t\t\td := mem_wr_prms[i][j].func._children[3].params[1];\n\t\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\") --> need to transpose for write address generation --> IxLxI: I(\",a,\")xL(\",b,\",\",b/c,\")xI(\",d,\")\");\n\t\t\t\tPrintLine(\"`define MEM_WR_PERM_MODULE_NAME_\",i,\"_\",Length(mem_wr_prms[i])-j+1,\" permIL #(.loga(\",LogInt(a,2),\"), .logb(\",LogInt(b,2),\"), .logc(\",LogInt(b/c,2),\"))\");\n\t\t\tfi;\n\t\t\tif(mem_wr_prms[i][j].func.numChildren() = 2) then # LxI\n\t\t\t\tb := mem_wr_prms[i][j].func._children[1].params[1];\n\t\t\t\tc := mem_wr_prms[i][j].func._children[1].params[2];\n\t\t\t\td := mem_wr_prms[i][j].func._children[2].params[1];\n\t\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\") --> need to transpose for write address generation --> LxI: L(\",b,\",\",b/c,\")xI(\",d,\")\");\n\t\t\t\tPrintLine(\"`define MEM_WR_PERM_MODULE_NAME_\",i,\"_\",Length(mem_wr_prms[i])-j+1,\" permL #(.logb(\",LogInt(b,2),\"), .logc(\",LogInt(b/c,2),\"))\");\t\t\t\t\n\t\t\tfi;\n\t\t\tif(mem_wr_prms[i][j].func.numChildren() = 4) then # IxLxIxI\n\t\t\t\ta := mem_wr_prms[i][j].func._children[1].params[1];\n\t\t\t\tb := mem_wr_prms[i][j].func._children[2].params[1];\n\t\t\t\tc := mem_wr_prms[i][j].func._children[2].params[2];\n\t\t\t\td := mem_wr_prms[i][j].func._children[3].params[1];\n\t\t\t\te := mem_wr_prms[i][j].func._children[4].params[1];\n\t\t\t\tPrintLine(\"// IxLxIxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")xI(\",e,\") --> need to transpose for write address generation --> IxLxIxI: I(\",a,\")xL(\",b,\",\",b/c,\")xI(\",d,\")xI(\",e,\")\");\n\t\t\t\tPrintLine(\"`define MEM_WR_PERM_MODULE_NAME_\",i,\"_\",Length(mem_wr_prms[i])-j+1,\" permILI #(.loga(\",LogInt(a,2),\"), .logb(\",LogInt(b,2),\"), .logc(\",LogInt(b/c,2),\"), .logd(\",LogInt(d,2),\"))\");\n\t\t\tfi;\n\t\tod;\n\tod;\n\t\n\tPrintLine(\"//\");\n\tPrintLine(\"// MemRdPrm:\");\n\n\tfor i in [1..stages] do\n\t\tfor j in [1..Length(mem_rd_prms[i])] do\n\t\t\tif(mem_rd_prms[i][j].func.numChildren() = 3) then # IxLxI\n\t\t\t\ta := mem_rd_prms[i][j].func._children[1].params[1];\n\t\t\t\tb := mem_rd_prms[i][j].func._children[2].params[1];\n\t\t\t\tc := mem_rd_prms[i][j].func._children[2].params[2];\n\t\t\t\td := mem_rd_prms[i][j].func._children[3].params[1];\n\t\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\tPrintLine(\"`define MEM_RD_PERM_MODULE_NAME_\",i,\"_\",j,\" permIL #(.loga(\",LogInt(a,2),\"), .logb(\",LogInt(b,2),\"), .logc(\",LogInt(c,2),\"))\");\n\t\t\tfi;\n\t\t\tif(mem_rd_prms[i][j].func.numChildren() = 2) then # LxI\n\t\t\t\tb := mem_rd_prms[i][j].func._children[1].params[1];\n\t\t\t\tc := mem_rd_prms[i][j].func._children[1].params[2];\n\t\t\t\td := mem_rd_prms[i][j].func._children[2].params[1];\n\t\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\tPrintLine(\"`define MEM_RD_PERM_MODULE_NAME_\",i,\"_\",j,\" permL #(.logb(\",LogInt(b,2),\"), .logc(\",LogInt(c,2),\"))\");\n\t\t\tfi;\n\t\t\tif(mem_rd_prms[i][j].func.numChildren() = 4) then # IxLxIxI\n\t\t\t\ta := mem_rd_prms[i][j].func._children[1].params[1];\n\t\t\t\tb := mem_rd_prms[i][j].func._children[2].params[1];\n\t\t\t\tc := mem_rd_prms[i][j].func._children[2].params[2];\n\t\t\t\td := mem_rd_prms[i][j].func._children[3].params[1];\n\t\t\t\te := mem_rd_prms[i][j].func._children[4].params[1];\n\t\t\t\tPrintLine(\"// IxLxIxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")xI(\",e,\")\");\n\t\t\t\tPrintLine(\"`define MEM_RD_PERM_MODULE_NAME_\",i,\"_\",j,\" permILI #(.loga(\",LogInt(a,2),\"), .logb(\",LogInt(b,2),\"), .logc(\",LogInt(c,2),\"), .logd(\",LogInt(d,2),\"))\");\n\t\t\tfi;\n\t\tod;\n\tod;\n\n\n\tPrintLine(\"// LM parameters\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// LocalWrPrm:\");\n\tfor i in [1..stages] do\n\t\tprmObjs := [];\n\t\tlocmodname := ConcatenationString(\"LocWrPrm_\",String(i));\n\t\tPrintLine(\"/*** \");\n\t\tfor j in [1..Length(loc_wr_prms[i])] do\n\t\t\tif(loc_wr_prms[i][j].func.numChildren() = 3) then # IxLxI\n\t\t\t\ta := loc_wr_prms[i][j].func._children[1].params[1];\n\t\t\t\tb := loc_wr_prms[i][j].func._children[2].params[1];\n\t\t\t\tc := loc_wr_prms[i][j].func._children[2].params[2];\n\t\t\t\td := loc_wr_prms[i][j].func._children[3].params[1];\n\t\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\tprmObjs[j] := TL(b,c,a,d);\n\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,a,d))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\t\tif(loc_wr_prms[i][j].func.numChildren() = 2) then\n\t\t\t\tif(Length(loc_wr_prms[i][j].func._children[1].params) = 2) then # LxI\n\t\t\t\t\tb := loc_wr_prms[i][j].func._children[1].params[1];\n\t\t\t\t\tc := loc_wr_prms[i][j].func._children[1].params[2];\n\t\t\t\t\td := loc_wr_prms[i][j].func._children[2].params[1];\n\t\t\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\t\tprmObjs[j] := TL(b,c,1,d);\n\t\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,1,d))), stream*2, format, opts.precision, locmodname); \n\t\t\t\tfi;\n\t\t\t\tif(Length(loc_wr_prms[i][j].func._children[1].params) = 1) then # IxL\n\t\t\t\t\ta := loc_wr_prms[i][j].func._children[1].params[1];\n\t\t\t\t\tb := loc_wr_prms[i][j].func._children[2].params[1];\n\t\t\t\t\tc := loc_wr_prms[i][j].func._children[2].params[2];\n\t\t\t\t\tPrintLine(\"// IxL: I(\",a,\")xL(\",b,\",\",c,\")\");\n\t\t\t\t\tprmObjs[j] := TL(b,c,a,1);\n\t\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,a,1))), stream*2, format, opts.precision, locmodname); \n\t\t\t\tfi;\n\t\t\tfi;\n\t\t\tif(loc_wr_prms[i][j].func.numChildren() = 0) then # L\n\t\t\t\tb := loc_wr_prms[i][j].func.params[1];\n\t\t\t\tc := loc_wr_prms[i][j].func.params[2];\n\t\t\t\tPrintLine(\"// L: L(\",b,\",\",c,\")\");\n\t\t\t\tprmObjs[j] := TL(b,c,1,1);\n\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,1,1))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\tod;\n\t\t\n\t\tprmObj := prmObjs[1];\n\t\tfor j in [2..Length(loc_wr_prms[i])] do\n\t\t\tprmObj := prmObj * prmObjs[j];\n\t\tod;\n\t\tpath := genBRAMPermMem(TRC(TPrm(prmObj)), stream*2, format, opts.precision, locmodname); \n\t\t\n\t\tprefixModules(ConcatenationString(path, locmodname,\".v\"), ConcatenationString(\"lw\",String(i)));\n\t\tmodule := setModule(ConcatenationString(path, locmodname,\".v\"), \"module_name_is\", ConcatenationString(\"perm_mem_locwr_\",String(i)), genpath, bb);\n\t\tPrintLine(\"***/ \");\n\t\tPrintLine(\"`define LOC_WR_MODULE_NAME_\",i,\" \",module);\n\t\tgetLMLatency(ConcatenationString(path, locmodname,\".v\"), \"WR\", i, \"/tmp/_spiral.tmp\");\n\tod;\n\n\t#genBRAMPermMem(perm, w, format, bits, name)\n\t#genBRAMPermMem(TRC(TPrm(TL(32,2,1,1))), 4, 2, 16, \"LocRdPrm\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// LocalRdPrm:\");\n\tfor i in [1..stages] do\n\t\tprmObjs := [];\n\t\tlocmodname := ConcatenationString(\"LocRdPrm_\",String(i));\n\t\tPrintLine(\"/*** \");\n\t\tfor j in [1..Length(loc_rd_prms[i])] do\n\t\t\tif(loc_rd_prms[i][j].func.numChildren() = 3) then # IxLxI\n\t\t\t\ta := loc_rd_prms[i][j].func._children[1].params[1];\n\t\t\t\tb := loc_rd_prms[i][j].func._children[2].params[1];\n\t\t\t\tc := loc_rd_prms[i][j].func._children[2].params[2];\n\t\t\t\td := loc_rd_prms[i][j].func._children[3].params[1];\n\t\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\tprmObjs[j] := TL(b,c,a,d);\n\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,a,d))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\t\tif(loc_rd_prms[i][j].func.numChildren() = 2) then\n\t\t\t\tif(Length(loc_rd_prms[i][j].func._children[1].params) = 2) then # LxI\n\t\t\t\t\tb := loc_rd_prms[i][j].func._children[1].params[1];\n\t\t\t\t\tc := loc_rd_prms[i][j].func._children[1].params[2];\n\t\t\t\t\td := loc_rd_prms[i][j].func._children[2].params[1];\n\t\t\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\t\tprmObjs[j] := TL(b,c,1,d);\n\t\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,1,d))), stream*2, format, opts.precision, locmodname); \n\t\t\t\tfi;\n\t\t\t\tif(Length(loc_rd_prms[i][j].func._children[1].params) = 1) then # IxL\n\t\t\t\t\ta := loc_rd_prms[i][j].func._children[1].params[1];\n\t\t\t\t\tb := loc_rd_prms[i][j].func._children[2].params[1];\n\t\t\t\t\tc := loc_rd_prms[i][j].func._children[2].params[2];\n\t\t\t\t\tPrintLine(\"// IxL: I(\",a,\")xL(\",b,\",\",c,\")\");\n\t\t\t\t\tprmObjs[j] := TL(b,c,a,1);\n\t\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,a,1))), stream*2, format, opts.precision, locmodname); \n\t\t\t\tfi;\n\t\t\tfi;\n\t\t\tif(loc_rd_prms[i][j].func.numChildren() = 0) then # L\n\t\t\t\tb := loc_rd_prms[i][j].func.params[1];\n\t\t\t\tc := loc_rd_prms[i][j].func.params[2];\n\t\t\t\tPrintLine(\"// L: L(\",b,\",\",c,\")\");\n\t\t\t\tprmObjs[j] := TL(b,c,1,1);\n\t\t\t\t#path := genBRAMPermMem(TRC(TPrm(TL(b,c,1,1))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\tod;\n\t\t\n\t\tprmObj := prmObjs[1];\n\t\tfor j in [2..Length(loc_rd_prms[i])] do\n\t\t\tprmObj := prmObj * prmObjs[j];\n\t\tod;\n\t\tpath := genBRAMPermMem(TRC(TPrm(prmObj)), stream*2, format, opts.precision, locmodname); \n\t\t\n\t\tprefixModules(ConcatenationString(path, locmodname,\".v\"), ConcatenationString(\"lr\",String(i)));\n\t\tmodule := setModule(ConcatenationString(path, locmodname,\".v\"), \"module_name_is\", ConcatenationString(\"perm_mem_locrd_\",String(i)), genpath, bb);\n\t\tPrintLine(\"***/ \");\n\t\tPrintLine(\"`define LOC_RD_MODULE_NAME_\",i,\" \",module);\n\t\tgetLMLatency(ConcatenationString(path, locmodname,\".v\"), \"RD\", i, \"/tmp/_spiral.tmp\");\n\tod;\n\t\n\tPrintLine(\"// LM Additive latency \");\n\tputLMLatency(\"/tmp/_spiral.tmp\", \"/tmp/_spiral_readFile.tmp\");\n\t\n\tPrintLine(\"/*** \");\n\tpath := HDLGen(streamDFTUnroll(fft_size,2,stream*2), 1, format, 0, 0, 0, \"dftgen\");\n\tprefixModules(ConcatenationString(path, \"dftgen.v\"), \"f\");\n\tmodule := setModule(ConcatenationString(path, \"dftgen.v\"), \"module_name_is\", \"dftcore\", genpath, bb);\n\tPrintLine(\"***/ \");\n\t\n\tPrintLine(\"//\");\n\tPrintLine(\"// FFT Core\");\n\tPrintLine(\"`define FFT_CORE_MODULE_NAME \", module);\n\t\n\tif(opts.throttle = 1) then\n\t\tPrintLine(\"`define THROTTLE_EN\");\n\tfi;\n\t\n\tPrintLine(\"// Summary\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// Cube Width:\",cube_width/stream,\" accesses\");\n\tPrintLine(\"// Cube Width:\",cube_width,\" words\");\n\tPrintLine(\"// Stages:\",stages);\n\tPrintLine(\"// Streaming Width:\",opts.dram_datawidth/opts.precision/2);\n\tPrintLine(\"// DFT Size:\",fft_size);\t\n\tPrintLine(\"// Format: \",format,\" (2:double, 1:single)\");\t\n\nend;\n\n#genConfigFile := function(srt, prec, genpath)\ngenConfigFile2 := function(srt, opts, genpath)\n\tlocal \tstages, fft_size, i,j,diff_prms,a,b,c,d,stream,path,format,cmdString,module,locmodname,bb,twiddles,twiddle,\n\t\t\tmem_wr_prms,                    \n\t\t\tmem_rd_prms,                    \n\t\t\tloc_wr_prms,                    \n\t\t\tloc_rd_prms,\n\t\t\ttile_width,\n\t\t\tsym_mem_wr,\n\t\t\tsym_mem_rd,\n\t\t\tsym_loc_wr,\n\t\t\tsym_loc_rd;\n\t\n\tstages := Length(Collect(srt, MemFence));\n\tfft_size := Collect(srt, DFT)[1].params[1];\n\tmem_wr_prms := Collect(srt, MemWrPrm);\n\tmem_rd_prms := Collect(srt, MemRdPrm);\n\tloc_wr_prms := Collect(srt, LocalWrPrm);\n\tloc_rd_prms := Collect(srt, LocalRdPrm);\n\ttwiddles := Collect(srt, TwiddleROM);\n\ttile_width := mem_rd_prms[1].func._children[Length(mem_rd_prms[1].func._children)].params[1];\n\tstream := opts.dram_datawidth/opts.precision/2;\n\tformat := When (opts.precision = 64, 2, 1);\n\tbb := opts.bb;\n\t\n\tsym_mem_wr := true;\n\tsym_mem_rd := true;\n\tsym_loc_wr := true;\n\tsym_loc_rd := true;\n\t\n\tfor i in [1..stages] do\n\t\tfor j in [1..stages] do\n\t\t\tsym_mem_wr := sym_mem_wr and (mem_wr_prms[i] = mem_wr_prms[j]);\n\t\t\tsym_mem_rd := sym_mem_rd and (mem_rd_prms[i] = mem_rd_prms[j]);\n\t\t\tsym_loc_wr := sym_loc_wr and (loc_wr_prms[i] = loc_wr_prms[j]);\n\t\t\tsym_loc_rd := sym_loc_rd and (loc_rd_prms[i] = loc_rd_prms[j]);\n\t\tod;\n\tod;\n\t\n\tPrintLine(\"//=========================\");\n\tPrintLine(\"// DO NOT MODIFY THIS FILE!\");\n\tPrintLine(\"//=========================\\n\");\n\t\n\t# Print the define statements into config\n\tPrintLine(\"`define CONFIG_FILE\");\n\t\n\t# Streamig width\n\tif(stream >= 4) then\n\t\tPrintLine(\"`define SW_4\");\n\tfi;\n\tif(stream >= 8) then\n\t\tPrintLine(\"`define SW_8\");\n\tfi;\n\tif(stream = 16) then\n\t\tPrintLine(\"`define SW_16\");\n\tfi;\n\tif(stream > 16 or stream < 2) then\n\t\tError(\"\\n***ERROR: Streaming width = \",stream,\" is not supported for now!\\n\");\n\tfi;\n\n\n\t\n\t# determine symmetry of the algorithm\n\tif(sym_mem_wr and sym_mem_rd and sym_loc_wr and sym_loc_rd) then\n\t\tPrintLine(\"// All symmetric algorithm...\");\n\t\tdiff_prms := 1;\n\telse\n\t\tPrintLine(\"// Asymmetric algorithm...\");\n\t\tdiff_prms := stages;\n\t\tPrintLine(\"`define ASYMMETRIC_ALGO\");\n\tfi;\n\t\n\n\tPrintLine(\"`define APPDATA_WIDTH \", opts.dram_datawidth);\n\tPrintLine(\"`define DDR_ADDR_WIDTH \", opts.dram_addrwidth);\n\tPrintLine(\"`define LOG_FFT_SIZE \", LogInt(fft_size,2));\n\tPrintLine(\"`define PACKET_SIZE \", tile_width/stream);\n\tPrintLine(\"`define PRECISION \", opts.precision);\n\tPrintLine(\"`define NUM_OF_STAGES \", stages);\n\t\n\t\n\tPrintLine(\"// ODCM parameters\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// MemWrPrm:\");\n\tfor i in [1..diff_prms] do\n\t\tif(mem_wr_prms[i].func.numChildren() = 3) then # IxLxI\n\t\t\ta := mem_wr_prms[i].func._children[1].params[1];\n\t\t\tb := mem_wr_prms[i].func._children[2].params[1];\n\t\t\tc := mem_wr_prms[i].func._children[2].params[2];\n\t\t\td := mem_wr_prms[i].func._children[3].params[1];\n\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\") --> need to transpose for write address generation --> IxLxI: I(\",a,\")xL(\",b,\",\",b/c,\")xI(\",d,\")\");\n\t\t\tPrintLine(\"`define MEM_WR_PERM_MODULE_NAME_\",i,\" permIL #(.loga(\",LogInt(a,2),\"), .logb(\",LogInt(b,2),\"), .logc(\",LogInt(b/c,2),\"))\");\n\t\t\t#PrintLine(\"`define MEM_WR_PERM_MODULE_NAME permIL #(.loga(\",LogInt(a/stream,2),\"), .logb(\",LogInt(b/stream,2),\"), .logc(\",LogInt(c/stream,2),\"))\");\n\t\tfi;\n\t\tif(mem_wr_prms[i].func.numChildren() = 2) then # LxI\n\t\t\tb := mem_wr_prms[i].func._children[1].params[1];\n\t\t\tc := mem_wr_prms[i].func._children[1].params[2];\n\t\t\td := mem_wr_prms[i].func._children[2].params[1];\n\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\") --> need to transpose for write address generation --> LxI: L(\",b,\",\",b/c,\")xI(\",d,\")\");\n\t\t\tPrintLine(\"`define MEM_WR_PERM_MODULE_NAME_\",i,\" permL #(.logb(\",LogInt(b,2),\"), .logc(\",LogInt(b/c,2),\"))\");\n\t\t\t#PrintLine(\"`define MEM_WR_PERM_MODULE_NAME permL #(.logb(\",LogInt(b/stream,2),\"), .logc(\",LogInt(c/stream,2),\"))\");\n\t\tfi;\n\tod;\n\t\n\tPrintLine(\"//\");\n\tPrintLine(\"// MemRdPrm:\");\n\tfor i in [1..diff_prms] do\n\t\tif(mem_rd_prms[i].func.numChildren() = 3) then # IxLxI\n\t\t\ta := mem_rd_prms[i].func._children[1].params[1];\n\t\t\tb := mem_rd_prms[i].func._children[2].params[1];\n\t\t\tc := mem_rd_prms[i].func._children[2].params[2];\n\t\t\td := mem_rd_prms[i].func._children[3].params[1];\n\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\tPrintLine(\"`define MEM_RD_PERM_MODULE_NAME_\",i,\" permIL #(.loga(\",LogInt(a,2),\"), .logb(\",LogInt(b,2),\"), .logc(\",LogInt(c,2),\"))\");\n\t\t\t#PrintLine(\"`define MEM_RD_PERM_MODULE_NAME permIL #(.loga(\",LogInt(a/stream,2),\"), .logb(\",LogInt(b/stream,2),\"), .logc(\",LogInt(c/stream,2),\"))\");\n\t\tfi;\n\t\tif(mem_rd_prms[i].func.numChildren() = 2) then # LxI\n\t\t\tb := mem_rd_prms[i].func._children[1].params[1];\n\t\t\tc := mem_rd_prms[i].func._children[1].params[2];\n\t\t\td := mem_rd_prms[i].func._children[2].params[1];\n\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\tPrintLine(\"`define MEM_RD_PERM_MODULE_NAME_\",i,\" permL #(.logb(\",LogInt(b,2),\"), .logc(\",LogInt(c,2),\"))\");\n\t\t\t#PrintLine(\"`define MEM_RD_PERM_MODULE_NAME permL #(.logb(\",LogInt(b/stream,2),\"), .logc(\",LogInt(c/stream,2),\"))\");\n\t\tfi;\n\tod;\n\t\n\tPrintLine(\"// LM parameters\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// LocalWrPrm:\");\n\tfor i in [1..diff_prms] do\n\t\tlocmodname := ConcatenationString(\"LocWrPrm_\",String(i));\n\t\tPrintLine(\"/*** \");\n\t\tif(loc_wr_prms[i].func.numChildren() = 3) then # IxLxI\n\t\t\ta := loc_wr_prms[i].func._children[1].params[1];\n\t\t\tb := loc_wr_prms[i].func._children[2].params[1];\n\t\t\tc := loc_wr_prms[i].func._children[2].params[2];\n\t\t\td := loc_wr_prms[i].func._children[3].params[1];\n\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,a,d))), stream*2, format, opts.precision, locmodname); \n\t\t\t\n\t\tfi;\n\t\tif(loc_wr_prms[i].func.numChildren() = 2) then\n\t\t\tif(Length(loc_wr_prms[i].func._children[1].params) = 2) then # LxI\n\t\t\t\tb := loc_wr_prms[i].func._children[1].params[1];\n\t\t\t\tc := loc_wr_prms[i].func._children[1].params[2];\n\t\t\t\td := loc_wr_prms[i].func._children[2].params[1];\n\t\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,1,d))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\t\tif(Length(loc_wr_prms[i].func._children[1].params) = 1) then # IxL\n\t\t\t\ta := loc_wr_prms[i].func._children[1].params[1];\n\t\t\t\tb := loc_wr_prms[i].func._children[2].params[1];\n\t\t\t\tc := loc_wr_prms[i].func._children[2].params[2];\n\t\t\t\tPrintLine(\"// IxL: I(\",a,\")xL(\",b,\",\",c,\")\");\n\t\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,a,1))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\tfi;\n\t\tif(loc_wr_prms[i].func.numChildren() = 0) then # L\n\t\t\tb := loc_wr_prms[i].func.params[1];\n\t\t\tc := loc_wr_prms[i].func.params[2];\n\t\t\tPrintLine(\"// L: L(\",b,\",\",c,\")\");\n\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,1,1))), stream*2, format, opts.precision, locmodname); \n\t\tfi;\n\t\t\n\t\tprefixModules(ConcatenationString(path, locmodname,\".v\"), ConcatenationString(\"lw\",String(i)));\n\t\tmodule := setModule(ConcatenationString(path, locmodname,\".v\"), \"module_name_is\", ConcatenationString(\"perm_mem_locwr_\",String(i)), genpath, bb);\n\t\tPrintLine(\"***/ \");\n\t\tPrintLine(\"`define LOC_WR_MODULE_NAME_\",i,\" \",module);\n\t\tgetLMLatency(ConcatenationString(path, locmodname,\".v\"), \"WR\", i, \"/tmp/_spiral.tmp\");\n\tod;\n\n\t\t\n\t#genBRAMPermMem(perm, w, format, bits, name)\n\t#genBRAMPermMem(TRC(TPrm(TL(32,2,1,1))), 4, 2, 16, \"LocRdPrm\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// LocalRdPrm:\");\n\tfor i in [1..diff_prms] do\n\t\tlocmodname := ConcatenationString(\"LocRdPrm_\",String(i));\n\t\tPrintLine(\"/*** \");\n\t\tif(loc_rd_prms[i].func.numChildren() = 3) then # IxLxI\n\t\t\ta := loc_rd_prms[i].func._children[1].params[1];\n\t\t\tb := loc_rd_prms[i].func._children[2].params[1];\n\t\t\tc := loc_rd_prms[i].func._children[2].params[2];\n\t\t\td := loc_rd_prms[i].func._children[3].params[1];\n\t\t\tPrintLine(\"// IxLxI: I(\",a,\")xL(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,a,d))), stream*2, format, opts.precision, locmodname); \n\t\tfi;\n\t\tif(loc_rd_prms[i].func.numChildren() = 2) then\n\t\t\tif(Length(loc_rd_prms[i].func._children[1].params) = 2) then # LxI\n\t\t\t\tb := loc_rd_prms[i].func._children[1].params[1];\n\t\t\t\tc := loc_rd_prms[i].func._children[1].params[2];\n\t\t\t\td := loc_rd_prms[i].func._children[2].params[1];\n\t\t\t\tPrintLine(\"// LxI: L(\",b,\",\",c,\")xI(\",d,\")\");\n\t\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,1,d))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\t\tif(Length(loc_rd_prms[i].func._children[1].params) = 1) then # IxL\n\t\t\t\ta := loc_rd_prms[i].func._children[1].params[1];\n\t\t\t\tb := loc_rd_prms[i].func._children[2].params[1];\n\t\t\t\tc := loc_rd_prms[i].func._children[2].params[2];\n\t\t\t\tPrintLine(\"// IxL: I(\",a,\")xL(\",b,\",\",c,\")\");\n\t\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,a,1))), stream*2, format, opts.precision, locmodname); \n\t\t\tfi;\n\t\tfi;\n\t\tif(loc_rd_prms[i].func.numChildren() = 0) then # L\n\t\t\tb := loc_rd_prms[i].func.params[1];\n\t\t\tc := loc_rd_prms[i].func.params[2];\n\t\t\tPrintLine(\"// L: L(\",b,\",\",c,\")\");\n\t\t\tpath := genBRAMPermMem(TRC(TPrm(TL(b,c,1,1))), stream*2, format, opts.precision, locmodname); \n\t\tfi;\n\t\t\n\t\tprefixModules(ConcatenationString(path, locmodname,\".v\"), ConcatenationString(\"lr\",String(i)));\n\t\tmodule := setModule(ConcatenationString(path, locmodname,\".v\"), \"module_name_is\", ConcatenationString(\"perm_mem_locrd_\",String(i)), genpath, bb);\n\t\tPrintLine(\"***/ \");\n\t\tPrintLine(\"`define LOC_RD_MODULE_NAME_\",i,\" \",module);\n\t\tgetLMLatency(ConcatenationString(path, locmodname,\".v\"), \"RD\", i, \"/tmp/_spiral.tmp\");\n\tod;\n\t\n\tPrintLine(\"// LM Additive latency \");\n\tputLMLatency(\"/tmp/_spiral.tmp\", \"/tmp/_spiral_readFile.tmp\");\n\t\n\tPrintLine(\"/*** \");\n\tpath := HDLGen(streamDFTUnroll(fft_size,2,stream*2), 1, format, 0, 0, 0, \"dftgen\");\n\tprefixModules(ConcatenationString(path, \"dftgen.v\"), \"f\");\n\tmodule := setModule(ConcatenationString(path, \"dftgen.v\"), \"module_name_is\", \"dftcore\", genpath, bb);\n\tPrintLine(\"***/ \");\n\t\n\tPrintLine(\"//\");\n\tPrintLine(\"// FFT Core\");\n\tPrintLine(\"`define FFT_CORE_MODULE_NAME \", module);\n\t\n\t\n\tif(opts.throttle = 1) then\n\t\tPrintLine(\"`define THROTTLE_EN\");\n\tfi;\n\t\n\t\n\t# Twiddle ROM\n\tif(Length(twiddles) > 0) then\n\t\tif(Length(twiddles) > 1) then\n\t\t\tError(\"Unexpected number of twiddles!\");\n\t\tfi;\n\t\ttwiddle := twiddles[1];\n\t\ta := twiddle.params[1];\n\t\tb := twiddle.params[2];\n\t\tc := twiddle.params[3];\n\t\t\n\t\tPrintLine(\"/*** \");\n\t\tpath := HDLGen(streamGen(TRC(TDiag(fPrecompute(Tw1(a, b, c)))).withTags([AStream(stream*2)]), InitStreamHw()), 1, format, 0, 0, 0, \"twiddleUnit\");\n\t\tcmdString := ConcatenationString(paradigms.stream._hardwarePath, \"dram_scripts/_twidModuleName.sh \", path, \"twiddleUnit.v \", \"twiddleUnit \", \"iter_in\");\n\t\tExec(cmdString);\n\t\tcmdString := ConcatenationString(\"cp \", path, \"twiddleUnit.v \", genpath);\n\t\tExec(cmdString);\n\t\tPrintLine(\"***/ \");\n\t\tPrintLine(\"//\");\n\t\tPrintLine(\"// Twiddle Unit\");\n\t\tPrintLine(\"`define TWIDDLE_UNIT_v2\");\n\t\tPrintLine(\"`define TWIDDLE_UNIT_NAME tw_twiddleUnit\");\n\t\tPrintLine(\"`define CODEBLOCK_IT iter_in\");\n\tfi;\n\t\n\tPrintLine(\" \");\n\tPrintLine(\"// Summary\");\n\tPrintLine(\"//\");\n\tPrintLine(\"// Tile Width:\",tile_width/stream,\" accesses\");\n\tPrintLine(\"// Tile Width:\",tile_width,\" words\");\n\tPrintLine(\"// Stages:\",stages);\n\tPrintLine(\"// Streaming Width:\",opts.dram_datawidth/opts.precision/2);\n\tPrintLine(\"// DFT Size:\",fft_size);\t\n\tPrintLine(\"// Format: \",format,\" (2:double, 1:single)\");\t\n\nend;\n\ngenVerifFile := function(srt, opts, genpath)\n\tlocal mem_rd_prms, tile_width;\n\n\tmem_rd_prms := Collect(srt, MemRdPrm);\n\ttile_width := mem_rd_prms[1].func._children[Length(mem_rd_prms[1].func._children)].params[1];\n\t\n\t\n\tPrintLine(\"SIZE=\",Collect(srt, DFT)[1].params[1]);\n\tPrintLine(\"SW=\",opts.dram_datawidth/opts.precision/2);\n\tPrintLine(\"TILE=\",tile_width);\n\t\n\tPrintLine(\"matlab -nodisplay -nosplash -r \\\"genRefInputOutput($SIZE,$SW,$TILE); exit;\\\"\");\n\tPrintLine(\"./run.sh sim\");\n\tPrintLine(\"matlab -nodisplay -nosplash -r \\\"compareOutputs($SIZE); exit;\\\" > matlab.log\");\n\tPrintLine(\"echo \\\"\\\"\");\n\tPrintLine(\"grep \\\"SNR (dB)\\\" matlab.log\");\n\nend;\n\n\nDRAMSystemGen := function(srt, opts)\n\tlocal path,conf,cmd,s,verif;\n\t\n\tpath := Concat(\"/tmp/spiral/dramSys\", String(GetPid()), \"/\");\n    MakeDir(path);\n\t\n\t# generate conf file & permMem & dft & put into genpath\n\tconf := ConcatenationString(path,\"_configFile.vh\");\n\t\n\t# 8/6/2014 - put the verification scripts in the genpath too\n\tverif := ConcatenationString(path,\"verify.sh\");\n\t\n\t# 2D or 3D?\n\ts := Length(Collect(srt, MemFence));\n\tif( s = 2 ) then \n\t\tPrintTo(conf, genConfigFile2(srt, opts, path));\n\t\tPrintTo(verif, genVerifFile(srt, opts, path));\n\t\t# copy src files into genpath\n\t\tcmd := ConcatenationString(\"cp -rf \", paradigms.stream._hardwarePath,\"dram_src/* \", path);\n\tExec(cmd);\n\telse if ( s = 3) then\n\t\tPrintTo(conf, genConfigFile3(srt, opts, path));\n\t\t# copy src files into genpath\n\t\tcmd := ConcatenationString(\"cp -rf \", paradigms.stream._hardwarePath, \"dram_src_3d/* \", path);\n\tExec(cmd);\n\telse\n\t\tPrintLine(\"SPLRuleTree not recognized! s=\",s);\n\tfi;fi;\n\t\t\n\t\n\treturn path;\t\nend;\n\n", "meta": {"hexsha": "3953de8a1f42c42e8c9e5d6748fa2b551bf8ce5f", "size": 26677, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/dram/systgen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/dram/systgen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/dram/systgen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 40.8529862175, "max_line_length": 194, "alphanum_fraction": 0.6405892717, "num_tokens": 9122, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.26284183737131667, "lm_q2_score": 0.03358950419897302, "lm_q1q2_score": 0.008828727000049625}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n\nLocalConfig.bench := rec();\n\nif IsBound(platforms.sse) then         LocalConfig.bench.SSE     := platforms.sse.benchSSE; fi;\nif IsBound(platforms.intel) then       LocalConfig.bench.SMP_SSE := platforms.intel.benchCore2; fi;\nif IsBound(platforms.benchScalar) then LocalConfig.bench.scalar  := platforms.benchScalar; fi;\nif IsBound(platforms.avx) then         LocalConfig.bench.AVX     := platforms.avx.benchAVX; fi;\n\n_dumpBench := function(obj, objPath, masterList, level)\n\tlocal newObj, newObjPath, fieldNames, name, size;\n\t\n\tif IsClass(obj) then\n\t\tif obj.__name__ = \"DPBench\" then\n\t\t\tif (level > 0) and IsBound(obj.sizes) and EndsWith(objPath, \")\") then\n\t\t\t\tnewObjPath := DropLast(Copy(objPath), 1);\n\t\t\t\tfor size in obj.sizes do\n\t\t\t\t\tAppend(masterList, [newObjPath::\"[\"::String(size)::\"])\"]);\n\t\t\t\tod;\n\t\t\telse\n\t\t\t\tAppend(masterList, [Copy(objPath)]);\n\t\t\tfi;\n\t\tfi;\n\t\treturn;\n\telif IsRec(obj) then\n\t\tfieldNames := UserRecFields(obj);\n\t\tfor name in fieldNames do\n\t\t\tnewObj := obj.(name);\n\t\t\tnewObjPath := Copy(objPath)::\".\"::Copy(name);\n\t\t\t_dumpBench(newObj, newObjPath, masterList, level);\n\t\tod;\n\telif IsFunc(obj) then\n\t\tnewObj := obj();\n\t\tnewObjPath := Copy(objPath)::\"()\";\n\t\t_dumpBench(newObj, newObjPath, masterList, level);\n\tfi;\nend;\n\n#F\n#F DumpBenches(platform, level)\n#F     platform : string, name of platform, eg., \"SSE\"\n#F     level    : integer, level of detail\n#F                0 : build benches that test a list of sizes\n#F                1 : build an individual bench for each size\n#F\n#F Returns a list of all bench constructors for the specified platform\n#F\n\nDumpBenches := function(platform, level)\n\tlocal benchlist;\n\t\n\tbenchlist := [];\n\t\n\tif IsBound(LocalConfig.bench.(platform)) and IsFunc(LocalConfig.bench.(platform)) then\n\t\t_dumpBench(LocalConfig.bench.(platform), \"LocalConfig.bench.\"::platform, benchlist, level);\n\tfi;\n\n\treturn Copy(benchlist);\nend;\n\n\n#F\n#F DumpAllBenches(level = 0)\n#F     level    : integer, optional (see DumpBenches)\n#F\n#F Returns a list of bench constructors for all supported platforms.\n#F\n\nDumpAllBenches := function(arg)\n\tlocal level, platform, platforms, benchlist;\n\t\n\tlevel := Cond(IsBound(arg[1]) and IsInt(arg[1]), arg[1], 0);\n\n\t##platforms := UserRecFields(LocalConfig.bench);\n\tplatforms := [\"SSE\", \"AVX\"];\n\t\n\tbenchlist := [];\n\t\n\tfor platform in platforms do\n\t\tAppend(benchlist, DumpBenches(platform, level));\n\tod;\n\t\n\treturn Copy(benchlist);\nend;\n\n", "meta": {"hexsha": "abf49c40fe9c94641c9871f1ef4e903b5817d8c6", "size": 2484, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/bench.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/bench.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/bench.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.6, "max_line_length": 99, "alphanum_fraction": 0.6855877617, "num_tokens": 718, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.29098086621490676, "lm_q2_score": 0.03021458925053828, "lm_q1q2_score": 0.00879186735244924}}
{"text": "%options package=$PACKAGE_NAME$\n%options template=$TEMPLATE$F.gi\n$KEYWORD_FILTER$\n--\n-- This is just a sample lexer and not a real lexer for $LANG_NAME$\n--\n\n%Globals\n    /.\n\n    ./\n%End\n\n%Define\n    $additional_interfaces /., ILexer./\n    $kw_lexer_class /.$KEYWORD_LEXER$./\n%End\n\n%Include\n    $LEXER_MAP$F.gi\n%End\n\n%Export\n    --\n    -- List all the token types the lexer will directly process\n    -- and export to the parser. If a keyword lexer is used as\n    -- a filter for this lexer, it may export a set of keywords\n    -- that will also be passed along to the parser.\n    -- \n    -- For example:\n    --\n        SINGLE_LINE_COMMENT\n        IDENTIFIER \n        NUMBER\n        DoubleLiteral\n        COMMA\n        SEMICOLON\n        PLUS\n        MINUS\n        TIMES\n        DIVIDE\n        GREATER\n        LESS\n        EQUAL\n        NOTEQUAL\n        ASSIGN\n        LEFTPAREN\n        RIGHTPAREN\n        LEFTBRACE\n        RIGHTBRACE\n%End\n\n%Terminals\n    CtlCharNotWS\n\n    LF   CR   HT   FF\n\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n    _\n\n    A    B    C    D    E    F    G    H    I    J    K    L    M\n    N    O    P    Q    R    S    T    U    V    W    X    Y    Z\n\n    0    1    2    3    4    5    6    7    8    9\n\n    AfterASCII   ::= '\\u0080..\\ufffe'\n    Space        ::= ' '\n    LF           ::= NewLine\n    CR           ::= Return\n    HT           ::= HorizontalTab\n    FF           ::= FormFeed\n    DoubleQuote  ::= '\"'\n    SingleQuote  ::= \"'\"\n    Percent      ::= '%'\n    VerticalBar  ::= '|'\n    Exclamation  ::= '!'\n    AtSign       ::= '@'\n    BackQuote    ::= '`'\n    Tilde        ::= '~'\n    Sharp        ::= '#'\n    DollarSign   ::= '$'\n    Ampersand    ::= '&'\n    Caret        ::= '^'\n    Colon        ::= ':'\n    SemiColon    ::= ';'\n    BackSlash    ::= '\\'\n    LeftBrace    ::= '{'\n    RightBrace   ::= '}'\n    LeftBracket  ::= '['\n    RightBracket ::= ']'\n    QuestionMark ::= '?'\n    Comma        ::= ','\n    Dot          ::= '.'\n    LessThan     ::= '<'\n    GreaterThan  ::= '>'\n    Plus         ::= '+'\n    Minus        ::= '-'\n    Slash        ::= '/'\n    Star         ::= '*'\n    LeftParen    ::= '('\n    RightParen   ::= ')'\n    Equal        ::= '='\n%End\n\n%Start\n    Token\n%End\n\n%Rules\n    Token ::= identifier    /.    checkForKeyWord();./\n            | number        /.    makeToken($_NUMBER);./\n            | DoubleLiteral /.    makeToken($_DoubleLiteral);./\n            | white         /.    skipToken();./\n            | slc           /.    makeComment($_SINGLE_LINE_COMMENT);./\n            | ';'           /.    makeToken($_SEMICOLON);./\n            | ','           /.    makeToken($_COMMA);./\n            | '+'           /.    makeToken($_PLUS);./\n            | '-'           /.    makeToken($_MINUS);./\n            | '='           /.    makeToken($_ASSIGN);./\n            | '('           /.    makeToken($_LEFTPAREN);./\n            | ')'           /.    makeToken($_RIGHTPAREN);./\n            | '{'           /.    makeToken($_LEFTBRACE);./\n            | '}'           /.    makeToken($_RIGHTBRACE);./\n            | '*'           /.    makeToken($_TIMES);./\n            | '/'           /.    makeToken($_DIVIDE);./\n            | '>'           /.    makeToken($_GREATER);./\n            | '<'           /.    makeToken($_LESS);./\n            | '=' '='       /.    makeToken($_EQUAL);./\n            | '!' '='       /.    makeToken($_NOTEQUAL);./\n\n    identifier -> letter\n                | identifier letter\n                | identifier digit\n\n    number ::= digit\n             | number digit\n\n    DoubleLiteral ::= Decimal\n                    | Decimal Exponent\n                    | number Exponent\n                    \n    Exponent ::= LetterEe number\n               | LetterEe '-' number\n               | LetterEe '+' number\n\n    LetterEe ::= 'e'\n               | 'E'\n\n    Decimal ::= '.' number\n              | number '.'\n              | number '.' number\n    \n    white ::= whiteChar\n            | white whiteChar\n\n    slc ::= '/' '/'\n          | slc notEOL\n\n    digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n    aA ::= a | A\n    bB ::= b | B\n    cC ::= c | C\n    dD ::= d | D\n    eE ::= e | E\n    fF ::= f | F\n    gG ::= g | G\n    hH ::= h | H\n    iI ::= i | I\n    jJ ::= j | J\n    kK ::= k | K\n    lL ::= l | L\n    mM ::= m | M\n    nN ::= n | N\n    oO ::= o | O\n    pP ::= p | P\n    qQ ::= q | Q\n    rR ::= r | R\n    sS ::= s | S\n    tT ::= t | T\n    uU ::= u | U\n    vV ::= v | V\n    wW ::= w | W\n    xX ::= x | X\n    yY ::= y | Y\n    zZ ::= z | Z\n\n    letter ::= aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | nN | oO | pP | qQ | rR | sS | tT | uU | vV | wW | xX | yY | zZ\n\n    -- any ::= letter | digit | special | white\n\n    whiteChar ::= Space | LF | CR | HT | FF\n\n    special ::= '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' |\n                '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '_' |\n                '/' | '$'\n\n    notEOL ::= letter | digit | special | Space | HT | FF\n%End\n", "meta": {"hexsha": "e7cd98be56d31b70944876dd34f6727a51e9df2b", "size": 5145, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "example/java/lexer.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "example/java/lexer.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example/java/lexer.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.4702970297, "max_line_length": 142, "alphanum_fraction": 0.3657920311, "num_tokens": 1539, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2598256379609837, "lm_q2_score": 0.03358950915700405, "lm_q1q2_score": 0.008727415645514882}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImport(paradigms.vector.rewrite);\nImport(paradigms.smp);\nImport(paradigms.distributed);\nImport(paradigms.multibuffer);\n\nStandardVecRules := MergedRuleSet(RulesSplitComplex, StandardSumsRules, RulesSMP, RulesVec, RulesPropagate, RulesVDiag, RulesKickout, RulesTermGrp, TerminateSymSPL);\nHfuncVecRules    := MergedRuleSet(StandardVecRules, RulesHfunc);\n\nPartialVecTermRules := MergedRuleSet(RulesVRC, RulesRC, RulesTermGrp, RulesVRCTermDiag);\nFullVecTermRules    := MergedRuleSet(RulesVRC, RulesRC, RulesTermGrp, RulesVRCTerm, RulesTerm, TerminateSymSPL);\n\nErrorOut := function(sums, opts)\n    PrintLine(\"------------- Begin ------------------\");\n    PrintLine(sums);\n    PrintLine(\"------------- End ------------------\");\n    Error(\"BP: postprocess\");\n    return(sums);\nend;\n\nErrorOut1 := function(sums, opts)\n   Print(\".\");\n   return(sums);\nend;\n\nVecLibStrategiesCell := rec(\n#    sigmaSpl := [ StandardSumsRules, StandardVecRules ],\n   sigmaSpl := [\n               #(s, opts) -> ErrorOut(s, opts),\n               RemoveNoPull_Dist,\n               StandardSumsRules ],\n\n    postProcess := [\n    #(s, opts) -> ErrorOut(s, opts),\n    MergedRuleSet(PTensorRules, StandardSumsRules, RulesTermGrp, RemoveBuf),\n    #(s, opts) -> ErrorOut(s, opts),\n    MergedRuleSet(PTensorConvertRules, StandardSumsRules),\n    #(s, opts) -> ErrorOut(s, opts),\n    StandardSumsRules,\n    #(s, opts) -> ErrorOut(s, opts),\n    StandardVecRules,\n    #(s, opts) -> ErrorOut(s, opts),\n        MergedRuleSet(HfuncVecRules, PartialVecTermRules),\n    #(s, opts) -> ErrorOut(s, opts),\n       MergedRuleSet(HfuncVecRules, PartialVecTermRules),\n    #(s, opts) -> ErrorOut(s, opts),\n       #(s, opts) -> BlockSums(opts.globalUnrolling, s), #Doing this later (is this a problem?)\n       #(s, opts) -> Process_fPrecompute(s, opts), # Doing this in the codegen so we can verify\n       RecursStepTerm,\n    #(s, opts) -> ErrorOut(s, opts),\n       MergedRuleSet(StandardVecRules, FullVecTermRules),\n    #(s, opts) -> ErrorOut(s, opts),\n       MergedRuleSet(RulesHfunc, RulesFuncSimp, RulesStrengthReduce),\n    #(s, opts) -> ErrorOut(s, opts),\n        CellVRCTerm,\n        RemoveBuf,\n      DistMultiBuf,\n        #RulesSums, # So composes are flattened before RulesComposeDists runs\n       RulesComposeDists,\n        #RulesDistMerge, # Not required because for the DMP algorithm, we now do this at a high level\n    #(s, opts) -> ErrorOut(s, opts),\n      (s, opts) -> applyCellRules(s, opts),\n    #(s, opts) -> ErrorOut(s, opts),\n        MultiBufDist, #NOTE: Need to do this after RC/VRC has been dealt with, (but before marking BBs). Why not move this to where DistMBuf is?\n    #(s, opts) -> ErrorOut(s, opts), #Uncomment line to see state after VRC rules apply.\n#      DistMultiBuf, # Why is this here? Why not move it down?\n    #(s, opts) -> ErrorOut(s, opts),\n        FixBorder,    #Border is used by MultiBufDist, and hence cannot precede it, since FixBorder removes the border\n    #(s, opts) -> ErrorOut(s, opts),\n        (s, opts) -> BlockSums(opts.globalUnrolling, s),\n    #(s, opts) -> ErrorOut(s, opts),\n#       (s, opts) -> CellDFTBlockCyclicLayoutHackWrap(s, opts),   # This does nothing if there are no GathRecv/ScatSend that still have functions\n    #(s, opts) -> ErrorOut(s, opts),\n        (s, opts) -> applyCellInplace(s, opts),\n        RulesComposeStreams\n    ],\n\n    rc := [],\n    preRC := [],\n);\n\nVecLibStrategies := rec(\n#    sigmaSpl := [ StandardSumsRules, StandardVecRules ],\n    sigmaSpl := [ StandardSumsRules ],\n\n    postProcess := [\n    #MergedRuleSet(PTensorRules, StandardSumsRules),\n    #MergedRuleSet(PTensorConvertRules, StandardSumsRules),\n    StandardSumsRules,\n    StandardVecRules,\n        MergedRuleSet(HfuncVecRules, PartialVecTermRules),\n        MultiBufDist,\n        MergedRuleSet(HfuncVecRules, PartialVecTermRules),\n        (s, opts) -> BlockSums(opts.globalUnrolling, s),\n        (s, opts) -> Process_fPrecompute(s, opts), # Doing this in the codegen so we can verify\n        RecursStepTerm,\n        MergedRuleSet(StandardVecRules, FullVecTermRules),\n        MergedRuleSet(RulesHfunc, RulesFuncSimp, RulesStrengthReduce),\n        CellVRCTerm,\n        (s, opts) -> applyCellRules(s, opts),\n        CellDFTBlockCyclicLayoutHack,\n        (s, opts) -> applyCellInplace(s, opts),\n        RulesComposeDists\n    ],\n\n    rc := [],\n    preRC := [],\n);\n\nVecLibTerminate := [\n    MergedRuleSet(StandardVecRules, FullVecTermRules),\n    MergedRuleSet(RulesHfunc, RulesFuncSimp, RulesStrengthReduce),\n];\n\n#\n# NOTE: implement layering\n#\n#Class(VecRecCodegen, RecCodegen, VectorCodegen);\nClass(VecRecCodegen, RecCodegen, VectorCodegen, rec(\n\n#\tvRC_Compose := Rule([vRC, @(1, Compose)], e -> Compose(List(@(1).val.children(), vRC))),\n#\tvRC_SUM := Rule([vRC, @(1, SUM)], e -> SUM(List(@(1).val.children(), vRC))),\n#\tvRC_SUMAcc := Rule([vRC, @(1, SUMAcc)], e -> SUMAcc(List(@(1).val.children(), vRC))),\n\n#\tvRC_Container := Rule([vRC, @(1, [BB,Buf,Inplace,Grp,NoPull,NoPullLeft,NoPullRight, NoDiagPullin, NoDiagPullinLeft, NoDiagPullinRight ])],\n#\t\te -> ObjId(@(1).val)(vRC(@(1).val.child(1)))),\n\n#\tvRC_Data := Rule([vRC, @(1, Data)], e -> Data(@(1).val.var, @(1).val.value, vRC(@(1).val.child(1)))),\n\n#\tvRC_RStep := Rule([vRC, @(1, RecursStep)], e -> RecursStep(2*@(1).val.yofs, 2*@(1).val.xofs,vRC(@(1).val.child(1)))),\n\n#\tvRC_ISum := Rule([vRC, @(1, ISum)], e -> ISum(@(1).val.var, @(1).val.domain, vRC(@(1).val.child(1)))),\n#\tvRC_ICompose := Rule([vRC, @(1, ICompose)], e -> ICompose(@(1).val.var, @(1).val.domain, vRC(@(1).val.child(1)))),\n\n#\tvRC_Grp := Rule([vRC, @(1, Grp)], e -> Grp(vRC(@(1).val.child(1)))),\n\n\n#\tvRC_Scale := Rule([vRC, @(1, Scale)], e ->\n#\t\tvRC(Diag(fConst(Rows(@(1).val), @(1).val.scalar))) * vRC(@(1).val.child(1))),\n\n#\tvRC_CR := Rule([vRC, @(1, CR)], e -> @(1).val.child(1)),\n\n#\tVTensor_VScale := Rule([@(1, VTensor), [VScale, @(2), @(3), @(4)]], e -> VScale(VTensor(@(2).val, @(1).val.vlen), @(3).val, @(4).val*@(1).val.vlen)),\n#\tVTensor_VTensor := Rule([@(1, VTensor), @(2, VTensor)], e -> VTensor(@(2).val.child(1), @(1).val.vlen*@(2).val.vlen)),\n\n\n#\tvRC_SMP := Rule([@(1, vRC), @(2, [SMPSum, SMPBarrier])],\n#\t\te -> let(s := @(2).val, CopyFields(s, rec(_children := List(s.children(), c->ObjId(@(1).val)(c)), dimensions := @(1).val.dimensions)))),\n\n# should RC and VRC be in some other place?\n#\tvRC_TCvt := Rule( [@(0, [vRC, RC, VRC]), @(1, TCvt)],\n#\t\te -> let( t := @(1).val, TCvt( 2*t.n(), t.isa_to(), t.isa_from(), t.props()).withTags(t.getTags()).takeAobj(t) )),\n\n));\n\nClass(OpenMP_SSEUnparser, paradigms.smp.OpenMP_UnparseMixin, platforms.sse.SSEUnparser);\nClass(OpenMP_SSEUnparser_ParFor, paradigms.smp.OpenMP_UnparseMixin_ParFor, platforms.sse.SSEUnparser);\nClass(SMP_SSEUnparser,    paradigms.smp.SMP_UnparseMixin,    platforms.sse.SSEUnparser);\nClass(SMP_NEONUnparser,    paradigms.smp.SMP_UnparseMixin,    platforms.neon.NEONUnparser);\n\nClass(OpenMP_AVXUnparser, paradigms.smp.OpenMP_UnparseMixin, platforms.avx.AVXUnparser);\nClass(OpenMP_AVXUnparser_ParFor, paradigms.smp.OpenMP_UnparseMixin_ParFor, platforms.avx.AVXUnparser);\n\nSMP_NEONUnparser.preprocess := x -> FixAssign0(x);\nSMP_SSEUnparser.preprocess := x -> FixAssign0(x);\nOpenMP_SSEUnparser.preprocess := x -> FixAssign0(x);\n\nDeclare(_InitVecLibgen);\nDeclare(_InitVecParLibgenNEON);\nDeclare(_InitVecLibgenNEON);\n\nInitVecLibgenCell := (isa, use_functions, use_openmp, use_buffering, simdopts) ->\n    _InitVecLibgen(\n        InitLibgen(CopyFields(LibgenDefaults, SIMDGlobals.getOpts(isa, simdopts),\n        rec(generateComplexCode:=false))),\n        use_functions, use_openmp, use_buffering, false);\n\nInitVecLibgenNEON := (opt) ->\n    _InitVecLibgenNEON(opt);\n\nInitVecParLibgenNEON := (opt, use_functions, use_openmp, use_buffering) ->\n    _InitVecParLibgenNEON(\n\t\t\tInitLibgen(CopyFields(LibgenDefaults, _InitVecLibgenNEON(opt), rec(generateComplexCode:=false))),\n        use_functions, use_openmp, use_buffering, false);\n\nInitVecParLibgenNEONCx := (opt, use_functions, use_openmp, use_buffering) ->\n    _InitVecParLibgenNEON(\n\t\t\tInitLibgen(CopyFields(CplxLibgenDefaults, _InitVecLibgenNEON(opt), rec(generateComplexCode:=true))),\n        use_functions, use_openmp, use_buffering, false);\n\nInitVecLibgen := (isa, use_functions, use_openmp, use_buffering) ->\n    _InitVecLibgen(\n        InitLibgen(CopyFields(LibgenDefaults, SIMDGlobals.getOpts(isa,\n                     rec(svct:=true, splitL:=true, oddSizes:=false)), rec(generateComplexCode:=false))),\n        use_functions, use_openmp, use_buffering, false);\n\nInitParLibgen := (use_functions, use_openmp, use_buffering) ->\n    _InitVecLibgen(InitLibgen(LibgenDefaults), use_functions, use_openmp, use_buffering, false);\n\nInitParLibgenCplx := (use_functions, use_openmp, use_buffering, use_inplace) -> CopyFields(\n    _InitVecLibgen(InitLibgen(CplxLibgenDefaults), use_functions, use_openmp, use_buffering, use_inplace),\n    rec(unparser := CMacroUnparserProg));\n\n_InitVecLibgenNEON := function(opt)\n#\tlocal opts;\n#\topts := platforms.neon.benchNEON().half.1d.dft_ic.small.cmplx().getOpts();\n#\topts.profile := default_profiles.linux_arm;\n\topt.globalUnrolling := 64;\n\topt.breakdownRules.TL := [L_cx_real, SIMD_ISA_Bases1, SIMD_ISA_Bases2, IxLxI_kmn_n, IxLxI_kmn_km, L_mn_m_vec, IxLxI_vtensor];\n\treturn opt;\nend;\n\n_InitVecParLibgenNEON := function(opt, use_functions, use_openmp, use_buffering, use_inplace)\n    local opts, m, clet_size;\n#\t\topt := platforms.neon.benchNEON().half.1d.dft_ic.small.cmplx().getOpts();\n\t\t#\topts.profile := default_profiles.linux_arm_pthread;\n\t\topt.globalUnrolling := 64;\n\t\topt.breakdownRules.TL := [L_cx_real, SIMD_ISA_Bases1, SIMD_ISA_Bases2, IxLxI_kmn_n, IxLxI_kmn_km, L_mn_m_vec, IxLxI_vtensor];\n    m := When(not use_functions, 64, 32);\n    clet_size := m;\n\n    opts := CopyFields(opt, rec(\n#        formulaStrategies := Copy(VecLibStrategies),\n        breakdownRules := CopyFields(opt.breakdownRules, rec(\n            GT := [\n                CopyFields(GT_Base, rec(maxSize:=false)),\n                GT_NthLoop,\n                CopyFields(GT_DFT_CT, rec(\n                        minRank := 1,\n                        maxRank := When(use_buffering, 1, 0),\n                        minSize := When(use_functions, m+1, 1),\n                        forTransposition := false,   # What is the right value? beta.anl needs false.\n                        codeletSize := When(use_inplace, clet_size, false),\n                        inplace := use_inplace)),\n                CopyFields(GT_Par, rec(parEntireLoop := false, splitLoop := true)),\n                GT_Vec_AxI,\n                GT_Vec_IxA, GT_Vec_IxA_L, GT_Vec_L_IxA,\n                GT_Vec_SplitL ],\n#\t\t\t\t\t\tDFT := opts.breakdownRules.DFT :: [  \n#                CopyFields(DFT_GT_CT, rec(\n#                        codeletSize := When(use_inplace, clet_size, false),\n#                        inplace := use_inplace,\n#                        minSize := When(use_functions, m+1, 1)))\n#\t\t\t\t\t\t],\n            DFT := [\n                DFT_Rader, DFT_GoodThomas, DFT_PD, DFT_Base,\n                CopyFields(DFT_CT, rec(maxSize := m)),\n                CopyFields(DFT_GT_CT, rec(\n                        codeletSize := When(use_inplace, clet_size, false),\n                        inplace := use_inplace,\n            # YSV: Please don't uncomment without talking to YSV\n                        #requiredFirstTag := [AVecReg, AVecRegCx, AParSMP, ParCell],\n                        minSize := When(use_functions, m+1, 1)))\n            ],\n            DFT3     := [ DFT3_Base, DFT3_CT ],\n            MDDFT    := [ MDDFT_Base, MDDFT_tSPL_RowCol ],\n            # Below is used for MDDFT. MDDFT with inplaceness excludes DFT with inplaceness\n            # Thus setting use_inplace=false will disable DFT inplaceness, and enable it in MDDFT\n            # NOTE: above is ugly! the only way to fix it is to figure out storage schemes automatically..\n            TTensor  := [ CopyFields(AxI_IxB,rec(inplace:=not use_inplace)),\n                          CopyFields(IxB_AxI,rec(inplace:=not use_inplace)) ],\n            TTensorI := [ TTensorI_toGT ],\n            TCompose := [ TCompose_tag ],\n#D            TTag     := [TTag_down],\n            InfoNt   := [Info_Base]\n        )),\n\n        codegen := VecRecCodegen,\n        libgen := CopyFields(opt.libgen, rec(terminateStrategy := VecLibTerminate)),\n        compileStrategy := IndicesCS,\n        useDeref := true\n    ));\n\n    if use_buffering then Add(opts.breakdownRules.GT,\n            CopyFields(GT_BufReshape, rec(bufIters := [2,4,8,16], u := [2,4]))); fi;\n\n    if not use_functions then\n        opts.baseHashes := DropLast(opts.baseHashes, 1);\n        Append(opts.formulaStrategies.postProcess, opts.libgen.terminateStrategy);\n    fi;\n\n    if use_openmp then\n        opts.unparser := OpenMP_SSEUnparser;\n    else\n        # should not be needed in latest version\n        opts.subParams := [var(\"num_threads\", TInt), var(\"tid\", TInt)];\n        opts.unparser := SMP_NEONUnparser;\n        opts.profile := When(LocalConfig.osinfo.isWindows(), # or LocalConfig.osinfo.isCygwin(),\n            LocalConfig.cpuinfo.profile.threads(),\n            profiler.default_profiles.linux_x86_threads\n        );\n    fi;\n\n    return opts;\nend;\n\n_InitVecLibgen := function(opts, use_functions, use_openmp, use_buffering, use_inplace)\n    local opts, m, clet_size;\n    m := When(not use_functions, 64, 32);\n    clet_size := m;\n\n    opts := CopyFields(opts, rec(\n        formulaStrategies := Copy(VecLibStrategies),\n        breakdownRules := CopyFields(opts.breakdownRules, rec(\n            GT := [\n                CopyFields(GT_Base, rec(maxSize:=false)),\n                GT_NthLoop,\n                CopyFields(GT_DFT_CT, rec(\n                        minRank := 1,\n                        maxRank := When(use_buffering, 1, 0),\n                        minSize := When(use_functions, m+1, 1),\n                        forTransposition := false,   # What is the right value? beta.anl needs false.\n                        codeletSize := When(use_inplace, clet_size, false),\n                        inplace := use_inplace)),\n                CopyFields(GT_Par, rec(parEntireLoop := false, splitLoop := true)),\n                GT_Vec_AxI,\n                GT_Vec_IxA, GT_Vec_IxA_L, GT_Vec_L_IxA,\n                GT_Vec_SplitL ],\n            DFT := [\n                DFT_Rader, DFT_GoodThomas, DFT_PD, DFT_Base,\n                CopyFields(DFT_CT, rec(maxSize := m)),\n                CopyFields(DFT_GT_CT, rec(\n                        codeletSize := When(use_inplace, clet_size, false),\n                        inplace := use_inplace,\n            # YSV: Please don't uncomment without talking to YSV\n                        #requiredFirstTag := [AVecReg, AVecRegCx, AParSMP, ParCell],\n                        minSize := When(use_functions, m+1, 1)))\n            ],\n            DFT3     := [ DFT3_Base, DFT3_CT ],\n            MDDFT    := [ MDDFT_Base, MDDFT_tSPL_RowCol ],\n            # Below is used for MDDFT. MDDFT with inplaceness excludes DFT with inplaceness\n            # Thus setting use_inplace=false will disable DFT inplaceness, and enable it in MDDFT\n            # NOTE: above is ugly! the only way to fix it is to figure out storage schemes automatically..\n            TTensor  := [ CopyFields(AxI_IxB,rec(inplace:=not use_inplace)),\n                          CopyFields(IxB_AxI,rec(inplace:=not use_inplace)) ],\n            TTensorI := [ TTensorI_toGT ],\n            TCompose := [ TCompose_tag ],\n#D            TTag     := [TTag_down],\n            InfoNt   := [Info_Base]\n        )),\n\n        codegen := VecRecCodegen,\n        libgen := CopyFields(opts.libgen, rec(terminateStrategy := VecLibTerminate)),\n        compileStrategy := IndicesCS,\n        useDeref := true\n    ));\n\n    if use_buffering then Add(opts.breakdownRules.GT,\n            CopyFields(GT_BufReshape, rec(bufIters := [2,4,8,16], u := [2,4]))); fi;\n\n    if not use_functions then\n        opts.baseHashes := DropLast(opts.baseHashes, 1);\n        Append(opts.formulaStrategies.postProcess, opts.libgen.terminateStrategy);\n    fi;\n\n    if use_openmp then\n        opts.unparser := OpenMP_SSEUnparser;\n    else\n        # should not be needed in latest version\n        opts.subParams := [var(\"num_threads\", TInt), var(\"tid\", TInt)];\n        opts.unparser := SMP_SSEUnparser;\n        opts.profile := When(LocalConfig.osinfo.isWindows(), # or LocalConfig.osinfo.isCygwin(),\n            LocalConfig.cpuinfo.profile.threads(),\n            profiler.default_profiles.linux_x86_threads\n        );\n    fi;\n\n    return opts;\nend;\n\n# Example: doParSimdDft(1, 8, false, false, false); # no threads\n# Example: doParSimdDft(4, 8, false, false, false); # 4 threads, SPMD\n# Example: doParSimdDft(4, 8, false, true, false);  # 4 threads, OpenMP\n# Example: doParSimdDft(4, 8, true, true, false);   # 4 threads, OpenMP, codelet reuse\n#\ndoParSimdDft := function(arg)\n    local sizes, opts, dpbench, tags, name, isa, p, logn, use_functions, use_openmp,\n        use_buffering, interleavedComplex, argrec,simd_opts;\n\n    isa := arg[1];\n    p := arg[2];\n    logn := arg[3];\n    if Length(arg) = 4 and IsRec(arg[4]) then\n        argrec := CopyFields(rec(\n            use_functions := false,\n            use_openmp := true,\n            use_buffering := false,\n            interleavedComplex := true,\n            simd_opts := rec()\n        ), arg[4]);\n        use_functions := argrec.use_functions;\n        use_openmp := argrec.use_openmp;\n        use_buffering := argrec.use_buffering;\n        interleavedComplex := argrec.interleavedComplex;\n        simd_opts := argrec.simd_opts;\n    else\n        use_functions := arg[4];\n        use_openmp := arg[5];\n        use_buffering := arg[6];\n        interleavedComplex := arg[7];\n        simd_opts := rec();\n    fi;\n\n    opts := InitVecLibgen(isa, use_functions, use_openmp, use_buffering);\n    if use_openmp then opts.language := \"c.icl.openmp\"; fi;\n\n    if IsList(logn) then sizes := logn;\n    else sizes := List([2 * isa.v * p^2 .. logn], d -> 2^d); fi;\n\n    tags := When(p=1, [AVecReg(opts.vector.isa)], [AParSMP(p), AVecReg(opts.vector.isa)]);\n    opts.benchTransforms := List(sizes, d -> When(interleavedComplex, InterleavedComplexT, SplitComplexT)(DFT(d)).withTags(tags));\n    if p = 1 then\n        PrintLine(\"ISA: \", isa, \", sizes: \", sizes);\n        name := isa.name;\n    else\n        PrintLine(\"ISA: \", isa, \", threads: \",p,\", sizes: \", sizes);\n        name := Concat(StringInt(p), \"p_\", isa.name);\n    fi;\n    dpbench := DPBench(rec((name) := opts),\n                    rec(timeBaseCases := false, verbosity:=0));\n    return dpbench;\nend;\n\n\ndoParSimdMddft := function(isa, p, logn, use_functions, use_openmp, use_buffering)\n    local sizes, opts, dpbench, tags;\n    opts := InitVecLibgen(isa, use_functions, use_openmp, use_buffering);\n\n    if IsList(logn) then sizes := logn;\n    else sizes := List(Cartesian([4..logn], [4..logn]), d -> [2^d[1], 2^d[2]]); fi;\n\n    tags := When(p=1, [AVecReg(opts.vector.isa)], [AParSMP(p), AVecReg(opts.vector.isa)]);\n    PrintLine(\"ISA: \", isa, \", threads: \",p,\", sizes: \", sizes);\n\n    opts.benchTransforms := List(sizes, d -> TRC(MDDFT(d)).withTags(tags));\n    dpbench := DPBench(rec((Concat(StringInt(p), \"p_\", isa.name)) := opts),\n                       rec(timeBaseCases := false, verbosity:=0));\n    return dpbench;\nend;\n\ndoParSimdWht := function(isa, p, logn, use_functions, use_openmp, use_buffering)\n    local sizes, opts, dpbench, tags;\n    opts := InitVecLibgen(isa, use_functions, use_openmp, use_buffering);\n\n    if use_openmp then opts.language := \"c.icl.openmp\"; else opts.language := \"c.icl.opt.core2\"; fi;\n\n    if IsList(logn) then sizes := logn;\n    else sizes := [Log2Int(isa.v^2 * p^2) .. logn]; fi;\n\n    tags := When(p=1, [AVecReg(opts.vector.isa)], [AParSMP(p), AVecReg(opts.vector.isa)]);\n    opts.benchTransforms := List(sizes, d -> WHT(d).withTags(tags));\n    PrintLine(\"ISA: \", isa, \", threads: \",p,\", sizes: \", sizes);\n    dpbench := DPBench(rec((Concat(StringInt(p), \"p_\", isa.name)) := opts),\n                       rec(timeBaseCases := false, verbosity:=0));\n    return dpbench;\nend;\n\nClass(cellopts_tmp, rec(\n  sc := rec(tsplRader:=false, tsplBluestein:=false, tsplPFA:=false, oddSizes:=false, interleavedComplex := false),\n  ic := rec(tsplRader:=false, tsplBluestein:=false, tsplPFA:=false, oddSizes:=false, interleavedComplex := true),\n));\n\n#F doMBufIndeParSimdDftCell_old([sizes], isa, p, mbuf_its)\ndoMBufIndeParSimdDftCell_old := function(arg)\n#doMBufIndeParSimdWhtCell := function(arg)\n    local sizes, opts, tags, dpbench, mbuf_its, name, isa, logn, use_functions, use_openmp,\n        use_buffering, interleavedComplex, argrec, simd_opts, transform, p, extra_its;\n\n    sizes := arg[1];\n    isa   := arg[2];\n    p     := arg[3];\n    mbuf_its := arg[4];\n\n    use_functions := false;\n    use_openmp := true;\n    use_buffering := false;\n    interleavedComplex := true; #NOTE: change this?\n    simd_opts := rec();\n\n    opts := InitVecLibgenCell(isa, use_functions, use_openmp, use_buffering, cellopts_tmp.sc);\n    opts.compileStrategy := IndicesCS2_FMA;\n    opts.spus     := p;\n    opts.multibuffer_its := mbuf_its;\n    opts.codegen  := MBufCodegen;\n    opts.unparser := isa.unparser;\n    opts.profile  := isa.backendConfig.profile;\n\n    #opts.globalUnrolling := opts.globalUnrolling*p;\n    opts.globalUnrolling := 520;\n\n    opts.measSteadyState := true;\n\n    #opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, GT_DFT_CT, GT_CellDMP_base, GT_CellDMP_gen, GT_Cell, GT_Vec_AxI, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA, GT_MBufCell_spec ];\n    opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, GT_DFT_CT, GT_CellDMP_base, GT_CellDMP_gen, GT_Cell, GT_Vec_AxI, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA ];\n    opts.breakdownRules.TL := Concatenation(opts.breakdownRules.TL, [  TL_CellDMP ]);\n\n    # Determine best packet size here. Packet size is simply size of kernel\n\n    # Determine the correct # of extra loops here\n    # For block size of 16384 bytes, we need (16384/(opts.vector.bits/8))/\n\n    # WHT:\n    #transform := k -> GT(WHT(LogInt(k,2)), GTPar, GTPar, [mbuf_its*p*((16384/(opts.vector.isa.bits/8))/k)]).withTags(\n    #            Concatenation([ParCell(p, k*((16384/(opts.vector.isa.bits/8))/k)), MBufCell(mbuf_its)], opts.tags));\n\n    # DFT_ic:\n    transform := k -> GT( TRC(GT(DFT(k,1,false), GTPar, GTPar, [((16384/(opts.vector.isa.bits/8))/(2*k))])), GTPar, GTPar, [mbuf_its*p]).withTags(\n                        Concatenation([ParCell(p, 2*k*((16384/(opts.vector.isa.bits/8))/(2*k))), MBufCell(mbuf_its)], opts.tags) );\n\n    # DFT_sc: (untested)\n    #transform := k -> GT( SplitComplexT(DFT(k,1,false)), GTPar, GTPar, [mbuf_its*p*((16384/(opts.vector.isa.bits/8))/(2*k))]).withTags(\n    #                     Concatenation([ParCell(p, 2*k*((16384/(opts.vector.isa.bits/8))/(2*k))), MBufCell(mbuf_its)], opts.tags) );\n\n    #Error(\"BP\");\n    opts.benchTransforms := List(sizes, transform);\n\n    PrintLine(\"ISA: \", isa, \", Multibuf_its: \",mbuf_its,\", sizes: \", sizes);\n    name := Concat(StringInt(p), \"p_\", StringInt(mbuf_its), \"mbuf_\", isa.name, \"_ic\");\n\n    dpbench := DPBench(rec((name) := opts),\n                    rec(timeBaseCases := false, verbosity:=0));\n    return dpbench;\nend;\n\n#F doMBufIndeParSimdDftCell([sizes], isa, p, mbuf_its)\n#F Does a multibffered, parallel DFT, but not the IxDFT.\ndoMBufIndeParSimdDftCell_single := function(arg)\n#doMBufIndeParSimdWhtCell := function(arg)\n    local sizes, opts, tags, dpbench, mbuf_its, name, isa, logn, use_functions, use_openmp,\n        use_buffering, interleavedComplex, argrec, simd_opts, transform, p, extra_its;\n\n    sizes := arg[1];\n    isa   := arg[2];\n    p     := arg[3];\n    mbuf_its := arg[4];\n\n    use_functions := false;\n    use_openmp := true;\n    use_buffering := false;\n    interleavedComplex := true; #NOTE: change this?\n    simd_opts := rec();\n\n    opts := InitVecLibgenCell(isa, use_functions, use_openmp, use_buffering, cellopts_tmp.sc);\n    opts.compileStrategy := IndicesCS2_FMA;\n    opts.spus     := p;\n    opts.multibuffer_its := mbuf_its;\n    opts.codegen  := MBufCodegen;\n    opts.unparser := isa.unparser;\n    opts.profile  := isa.backendConfig.profile;\n\n    #opts.globalUnrolling := opts.globalUnrolling*p;\n    opts.globalUnrolling := 520;\n\n    opts.measSteadyState := true;\n\n    #opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, GT_DFT_CT, GT_CellDMP_base, GT_CellDMP_gen, GT_Cell, GT_Vec_AxI, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA, GT_MBufCell_spec ];\n    opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, GT_DFT_CT, GT_CellDMP_base, GT_CellDMP_gen, GT_Cell, GT_Vec_AxI, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA];\n    opts.breakdownRules.TL := Concatenation(opts.breakdownRules.TL, [  TL_CellDMP ]);\n\n    # Determine best packet size here. Packet size is simply size of kernel\n\n    # Determine the correct # of extra loops here\n    # For block size of 16384 bytes, we need (16384/(opts.vector.bits/8))/\n\n    # WHT:\n    #transform := k -> GT(WHT(LogInt(k,2)), GTPar, GTPar, [mbuf_its*p*((16384/(opts.vector.isa.bits/8))/k)]).withTags(\n    #            Concatenation([ParCell(p, k*((16384/(opts.vector.isa.bits/8))/k)), MBufCell(mbuf_its)], opts.tags));\n\n    # DFT_ic:\n    #transform := k -> GT( TRC(DFT(k,1,false)), GTPar, GTPar, [mbuf_its*p]).withTags( Concatenation([ParCell(p, (2*k)), MBufCell(mbuf_its)], opts.tags) );\n\n    # DFT_sc:\n    transform := k -> GT( SplitComplexT(DFT(k,1,false)), GTPar, GTPar, [mbuf_its*p]).withTags( Concatenation([ParCell(p, (2*k)), MBufCell(mbuf_its)], opts.tags) );\n\n    opts.benchTransforms := List(sizes, transform);\n\n    PrintLine(\"ISA: \", isa, \", Multibuf_its: \",mbuf_its,\", sizes: \", sizes);\n    name := Concat(StringInt(mbuf_its), \"mbuf_\", StringInt(p), \"p_\", isa.name, \"_sc\");\n\n    dpbench := DPBench(rec((name) := opts),\n                    rec(timeBaseCases := false, verbosity:=0));\n    return dpbench;\nend;\n\n#F doMBufIndeParSimdDftCell([sizes], isa, p, mbuf_its)\n#F Does just the IxBase (no parallelization, no multibuffering)\ndoMBufIndeParSimdDftCell_IxDFTbase := function(arg)\n#doMBufIndeParSimdWhtCell := function(arg)\n    local sizes, opts, tags, dpbench, mbuf_its, name, isa, logn, use_functions, use_openmp,\n        use_buffering, interleavedComplex, argrec, simd_opts, transform, p, extra_its;\n\n    sizes := arg[1];\n    isa   := arg[2];\n    p     := arg[3];\n    mbuf_its := arg[4];\n\n    use_functions := false;\n    use_openmp := true;\n    use_buffering := false;\n    interleavedComplex := true; #NOTE: change this?\n    simd_opts := rec();\n\n    opts := InitVecLibgenCell(isa, use_functions, use_openmp, use_buffering, cellopts_tmp.sc);\n    opts.compileStrategy := IndicesCS2_FMA;\n    opts.spus     := p;\n    opts.multibuffer_its := mbuf_its;\n    opts.codegen  := MBufCodegen;\n    opts.unparser := isa.unparser;\n    opts.profile  := isa.backendConfig.profile;\n\n    #opts.globalUnrolling := opts.globalUnrolling*p;\n    opts.globalUnrolling := 520;\n\n    opts.measSteadyState := true;\n\n    #opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, GT_DFT_CT, GT_CellDMP_base, GT_CellDMP_gen, GT_Cell, GT_Vec_AxI, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA, GT_MBufCell_spec ];\n    opts.breakdownRules.GT := [ GT_Base, GT_NthLoop, GT_DFT_CT, GT_CellDMP_base, GT_CellDMP_gen, GT_Cell, GT_Vec_AxI, GT_Vec_IxA_Push, GT_Vec_IxA_L, GT_Vec_L_IxA ];\n    opts.breakdownRules.TL := Concatenation(opts.breakdownRules.TL, [  TL_CellDMP ]);\n\n    # Determine best packet size here. Packet size is simply size of kernel\n\n    # Determine the correct # of extra loops here\n    # For block size of 16384 bytes, we need (16384/(opts.vector.bits/8))/\n\n    # WHT:\n    #transform := k -> GT(WHT(LogInt(k,2)), GTPar, GTPar, [mbuf_its*p*((16384/(opts.vector.isa.bits/8))/k)]).withTags(\n    #            Concatenation([ParCell(p, k*((16384/(opts.vector.isa.bits/8))/k)), MBufCell(mbuf_its)], opts.tags));\n\n    # DFT_ic:\n    #transform := k -> TRC(GT(DFT(k,1,false), GTPar, GTPar, [((16384/(opts.vector.isa.bits/8))/(2*k))])).withTags(opts.tags);\n\n    # DFT_sc:\n    transform := k -> GT( SplitComplexT(DFT(k,1,false)), GTPar, GTPar, [((16384/(opts.vector.isa.bits/8))/(2*k))] ).withTags(opts.tags);\n\n    opts.benchTransforms := List(sizes, transform);\n\n    PrintLine(\"ISA: \", isa, \", Multibuf_its: \",mbuf_its,\", sizes: \", sizes);\n    name := Concat(\"Ix_\", isa.name, \"_sc\");\n\n    dpbench := DPBench(rec((name) := opts),\n                    rec(timeBaseCases := false, verbosity:=0));\n    return dpbench;\nend;\n\n\nRecursStep.needInterleavedLeft := self >> self.child(1).needInterleavedLeft();\nRecursStep.needInterleavedRight := self >> self.child(1).needInterleavedRight();\n\nRTWrap.needInterleavedRight := self >> false;\nRTWrap.needInterleavedLeft := self >> false;\n\nVGath.mkCodelet    := self >> ObjId(self)(self.func.mkCodelet(), self.v);\nVGath_sv.mkCodelet := self >> ObjId(self)(self.func.mkCodelet(), self.v, self.sv);\nVScat.mkCodelet    := self >> ObjId(self)(self.func.mkCodelet(), self.v);\nVScat_sv.mkCodelet := self >> ObjId(self)(self.func.mkCodelet(), self.v, self.sv);\nVTensor.mkCodelet  := self >> ObjId(self)(self.child(1).mkCodelet(), self.vlen);\n\nVRC.mkCodelet   := self >> ObjId(self)(self.child(1).mkCodelet(), self.v);\nVRCL.mkCodelet  := self >> ObjId(self)(self.child(1).mkCodelet(), self.v);\nVRCR.mkCodelet  := self >> ObjId(self)(self.child(1).mkCodelet(), self.v);\nVRCLR.mkCodelet := self >> ObjId(self)(self.child(1).mkCodelet(), self.v);\n\nBlockVPerm.mkCodelet := self >> self;\nVPerm.mkCodelet      := self >> self;\nVPrm_x_I.mkCodelet   := self >> self;\n\nVDiag.mkCodelet     := self >> ObjId(self)(self.element.mkCodelet(), self.v);\nVDiag_x_I.mkCodelet := self >> ObjId(self)(self.element.mkCodelet(), self.v);\nVRCDiag.mkCodelet   := self >> ObjId(self)(self.element.mkCodelet(), self.v);\n\nVData.signature     := self >> CodeletSignature(self.func);\nVData.codeletParams := self >> CodeletParams(self.func);\nVData.mkCodelet     := self >> ObjId(self)(MkCodelet(self.func), self.v);\nVData.codeletShape  := self >> [ObjId(self), CodeletShape(self.func), self.v];\n\nVDup.signature     := self >> CodeletSignature(self.func);\nVDup.codeletParams := self >> CodeletParams(self.func);\nVDup.mkCodelet     := self >> ObjId(self)(MkCodelet(self.func), self.v);\nVDup.codeletShape  := self >> [ObjId(self), CodeletShape(self.func), self.v];\n\n# NOTE:\n\n# Also children/rChildren is invalid throughout\n# children/rChildren inconsistent with constructor\n\n# cutoff_size is eg. 8, then vector length 4 results in VTensor(DFT(2), 4),\n# which is size 16, and will be terminated to a Blk(...). How do we prevent this?\n\n# niterate := function(clet_set)\n#    s := vrec4(7, 8)[2]; s := prep(s);\n#    UniteSet(clet_set, List(clets(s), CodeletName));\n#    return clet_set;\n# end;\n#\n# iterate := function(clet_set)\n#    s := vrec4(7, 8)[2]; s := prep(s);\n#    UniteSet(clet_set, clets(s));\n#    return clet_set;\n# end;\n", "meta": {"hexsha": "e0069821ae06b94bcf76aa5572f0701c4cfcac28", "size": 30897, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/libgen/recvector.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/libgen/recvector.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/libgen/recvector.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 43.8877840909, "max_line_length": 183, "alphanum_fraction": 0.6409360132, "num_tokens": 9228, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.35220178204788966, "lm_q2_score": 0.024423090941717344, "lm_q1q2_score": 0.00860185615279052}}
{"text": "#\n# usage: (!!!Achtung: This will overwrite all manual modifications)\n#\n# Read(\"~/Workspace/Chevalley.gap/init.gi\"); Read(Filename(home_dir,\"load.gi\"));\n# Read(Filename(e8_dir_char3,\"init_char3.gi\")); Read(Filename(e8_dir_char3,\"gen_files.gi\"));\n#\n\nfor l in labels do\n    f:=Filename(e8_dir_char3,Concatenation(l,\".gi\"));\n    #PrintTo(f,l);\n    PrintTo(f,\"#\\n\");\n    AppendTo(f,\"# usage:\\n\");\n    AppendTo(f,\"# Read(\\\"~/Workspace/Chevalley.gap/init.gi\\\"); Read(Filename(home_dir,\\\"load.gi\\\")); \");\n    AppendTo(f,\"Read(Filename(e8_dir_char3,\\\"init_char3.gi\\\")); Read(Filename(e8_dir_char3,\\\"\");\n    AppendTo(f,Concatenation(l,\".gi\"));\n    AppendTo(f,\"\\\"));\\n\");\n    AppendTo(f,\"#\\n\");\n    AppendTo(f,\"# Read(Filename(e8_dir_char3,\\\"init_char3.gi\\\")); Read(Filename(e8_dir_char3,\\\"\");\n    AppendTo(f,Concatenation(l,\".gi\"));\n    AppendTo(f,\"\\\"));\\n\\n\");\n\n    AppendTo(f,\"label:=\\\"\");\n    AppendTo(f,l);\n    AppendTo(f,\"\\\";\\n\");\n\n    AppendTo(f,\"orb_nr:=Position(labels,label);\\n\\n\");\n    AppendTo(f,\"orb:=AllClasses(orbs)[orb_nr];\\n\");\n    AppendTo(f,\"info:=handleClassShort(orb);\\n\\n\");\n\n    AppendTo(f,\"Print(\\\"Consider the class \\\",Label(orb),\\\" in characteristic \\\",Characteristic(ring(sys)),\\\":\\\\n\\\");\\n\");\n    AppendTo(f,\"Print(\\\"\\\\tBorel representative \\\\n\\\\t\\\",coefficients(BorelRep(orb)),\\\"\\\\n\\\");\\n\");\n    AppendTo(f,\"Print(\\\"\\\\tconnected C_U(u) \\\\n\\\\t\\\",coefficients(info[1]),\\\"\\\\n\\\");\\n\");\n    AppendTo(f,\"Print(\\\"\\\\tconnected C_U(u) in Levi \\\\n\\\\t\\\",coefficients(info[2]),\\\"\\\\n\\\");\\n\");\n    AppendTo(f,\"Print(\\\"\\\\tconnected double C_U(u) \\\\n\\\\t\\\",coefficients(info[3]),\\\"\\\\n\\\");\\n\");\nod;", "meta": {"hexsha": "036ae30e311aafda360e7de9abc52aa13dbe91c4", "size": 1599, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/cases/e8/char3/gen_files.gi", "max_stars_repo_name": "iuliansimion/Chevalley.gap", "max_stars_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/cases/e8/char3/gen_files.gi", "max_issues_repo_name": "iuliansimion/Chevalley.gap", "max_issues_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/cases/e8/char3/gen_files.gi", "max_forks_repo_name": "iuliansimion/Chevalley.gap", "max_forks_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.6857142857, "max_line_length": 122, "alphanum_fraction": 0.6153846154, "num_tokens": 519, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3380771374883919, "lm_q2_score": 0.025178840466205665, "lm_q1q2_score": 0.008512390310091699}}
{"text": "Concatenation(ListWithIdenticalEntries(10, \"BOB \"));\n\"BOB BOB BOB BOB BOB BOB BOB BOB BOB BOB \"\n", "meta": {"hexsha": "e0dc2a1ada20f3541ee0e1e0c77467bccb8ea9de", "size": 96, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Repeat-a-string/GAP/repeat-a-string.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Repeat-a-string/GAP/repeat-a-string.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Repeat-a-string/GAP/repeat-a-string.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 32.0, "max_line_length": 52, "alphanum_fraction": 0.75, "num_tokens": 37, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3073580295544412, "lm_q2_score": 0.02758528212686156, "lm_q1q2_score": 0.008478557959215514}}
{"text": "#############################################################################\n####\n##\n#W  anupqios.gi            ANUPQ package                          Greg Gamble\n##\n##  This file installs core functions used with iostreams.\n##    \n#Y  Copyright (C) 2001  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany\n##\n\n#############################################################################\n##\n#F  PQ_START( <workspace>, <setupfile> ) . . . open a stream for a pq process\n##\n##  ensures the images file written by the `pq' binary when in  the  Standard\n##  Presentation menu is empty, opens an io stream  to  a  `pq'  process  (if\n##  <setupfile> is `fail') or a file stream for a setup file (if  <setupfile>\n##  is a filename i.e. a string) and returns  a  record  with  fields  `menu'\n##  (current menu for the `pq' binary), `opts' (the runtime switches used  by\n##  the `pq' process), `workspace' (the value of <workspace> which should  be\n##  a positive integer), and `stream' (the io or file stream opened).\n##\nInstallGlobalFunction(PQ_START, function( workspace, setupfile )\nlocal opts, iorec, topqlogfile;\n  PrintTo(ANUPQData.SPimages, \"\"); #to ensure it's empty\n  if setupfile = fail then\n    opts := [ \"-G\" ];\n  else\n    opts := [ \"-i\", \"-k\", \"-g\" ];\n  fi;\n  if workspace <> 10000000 then\n    Append( opts, [ \"-s\", String(workspace) ] );\n  fi;\n  iorec := rec( menu := \"SP\", \n                opts := opts,\n                workspace := workspace );\n  if setupfile = fail then\n    iorec.stream := InputOutputLocalProcess( ANUPQData.tmpdir, \n                                             ANUPQData.binary, \n                                             opts );\n    if iorec.stream = fail then\n      Error( \"failed to launch child process\" );\n    fi;\n    # menus are flushed at InfoANUPQ level 6, prompts at level 5\n    FLUSH_PQ_STREAM_UNTIL(iorec.stream, 6, 5, PQ_READ_NEXT_LINE, IS_PQ_PROMPT);\n  else\n    iorec.stream := OutputTextFile(setupfile, false);\n    iorec.setupfile := setupfile;\n    ToPQk(iorec, [], [ \"#call pq with flags: '\",\n                       JoinStringsWithSeparator(opts, \" \"),\n                       \"'\" ]);\n  fi;\n  return iorec;\nend );\n\n#############################################################################\n##\n#F  PqStart(<G>,<workspace> : <options>) . Initiate interactive ANUPQ session\n#F  PqStart(<G> : <options>)\n#F  PqStart(<workspace> : <options>)\n#F  PqStart( : <options>)\n##\n##  activate an iostream for an interactive {\\ANUPQ} process (i.e.  `PqStart'\n##  starts up a `pq' binary process and opens a {\\GAP} iostream  to  ``talk''\n##  to that process) and returns an integer <i> that can be used to  identify\n##  that process. The argument <G>, if given, should be an *fp group* or  *pc\n##  group* that the user  intends  to  manipute  using  interactive  {\\ANUPQ}\n##  functions. If `PqStart' is given an integer argument <workspace> then the\n##  `pq' binary is started up with a workspace (an  integer  array)  of  size\n##  <workspace> (i.e. $4 \\times <workspace>$ bytes in a 32-bit  environment);\n##  otherwise, the `pq' binary sets a default workspace of $10000000$.\n##\n##  The only <options> currently recognised  by  `PqStart'  are  `Prime'  and\n##  `Exponent' (see~\"Pq\" for details) and if provided  they  are  essentially\n##  global for the interactive {\\ANUPQ} process, except that any  interactive\n##  function interacting with the process and passing new  values  for  these\n##  options will over-ride the global values.\n##\nInstallGlobalFunction(PqStart, function(arg)\nlocal opts, iorec, procId, G, workspace, optname;\n\n  if 2 < Length(arg) then\n    Error(\"at most two arguments expected.\\n\");\n  fi;\n\n  if not IsEmpty(arg) and IsGroup( arg[1] ) then\n    G := arg[1];\n    if not( IsFpGroup(G) or IsPcGroup(G) ) then\n      Error( \"argument <G> should be an fp group or a pc group\\n\" );\n    fi;\n    arg := arg{[2 .. Length(arg)]};\n  fi;\n\n  if not IsEmpty(arg) then\n    workspace := arg[1];\n    if not IsPosInt(workspace) then\n      Error(\"argument <workspace> should be a positive integer.\\n\");\n    fi;\n  else\n    workspace := 10000000;\n  fi;\n\n  iorec := PQ_START( workspace, fail );\n  if IsBound( G ) then\n    iorec.group := G;\n  fi;\n  iorec.calltype := \"interactive\";\n  for optname in ANUPQGlobalOptions do\n    VALUE_PQ_OPTION(optname, iorec);\n  od;\n\n  procId := Length(ANUPQData.io) + 1;\n  iorec.procId := procId;\n  ANUPQData.io[ procId ] := iorec;\n  return procId;\nend);\n\n#############################################################################\n##\n#F  PqQuit( <i> )  . . . . . . . . . . . . Close an interactive ANUPQ session\n#F  PqQuit()\n##\n##  closes the stream of the <i>th or default  interactive  {\\ANUPQ}  process\n##  and unbinds its `ANUPQData.io' record.\n##\nInstallGlobalFunction(PqQuit, function(arg)\nlocal ioIndex;\n\n  ioIndex := ANUPQ_IOINDEX(arg);\n  # No need to bother about descending through the menus.\n  CloseStream(ANUPQData.io[ioIndex].stream);\n  Unbind(ANUPQData.io[ioIndex]);\nend);\n\n#############################################################################\n##\n#F  PqQuitAll() . . . . . . . . . . . .  Close all interactive ANUPQ sessions\n##\n##  closes the streams of all active interactive {\\ANUPQ} process and unbinds\n##  their `ANUPQData.io' records.\n##\nInstallGlobalFunction(PqQuitAll, function()\nlocal ioIndex;\n\n  for ioIndex in [1 .. Length(ANUPQData.io)] do\n    if IsBound(ANUPQData.io[ioIndex]) then\n      CloseStream(ANUPQData.io[ioIndex].stream);\n      Unbind(ANUPQData.io[ioIndex]);\n    fi;\n  od;\nend);\n\n#############################################################################\n##\n#F  ANUPQ_IOINDEX . . . . the number identifying an interactive ANUPQ session\n##\n##  returns the index of the record in the `ANUPQData.io' list  corresponding\n##  to an interactive {\\ANUPQ} session. With  no  argument  the  first  bound\n##  index in `ANUPQData.io' is returned. With integer (first)  argument  <i>,\n##  <i> is returned if `ANUPQData.io[<i>]' is bound.\n##\nInstallGlobalFunction(ANUPQ_IOINDEX, function(arglist)\nlocal ioIndex;\n\n  if IsEmpty(arglist) then\n    # Find the first bound ioIndex\n    ioIndex := 1;\n    while not(IsBound(ANUPQData.io[ioIndex])) and \n          ioIndex < Length(ANUPQData.io) do\n      ioIndex := ioIndex + 1;\n    od;\n    if IsBound(ANUPQData.io[ioIndex]) then\n      return ioIndex;\n    else\n      Info(InfoANUPQ + InfoWarning, 1, \n           \"No interactive ANUPQ sessions are currently active\");\n      return fail;\n    fi;\n  elif IsBound(ANUPQData.io[ arglist[1] ]) then\n    return arglist[1];\n  else\n    Error(\"no such interactive ANUPQ session\\n\");\n  fi;\nend);\n\n#############################################################################\n##\n#F  ANUPQ_IOINDEX_ARG_CHK .  Checks ANUPQ_IOINDEX has the right no. of arg'ts\n##\nInstallGlobalFunction(ANUPQ_IOINDEX_ARG_CHK, function(arglist)\n  if Length(arglist) > 1 then\n    Info(InfoANUPQ + InfoWarning, 1,\n         \"Expected 0 or 1 arguments, all but first argument ignored\");\n  fi;\nend);\n\n#############################################################################\n##\n#F  ANUPQDataRecord([<i>]) . . . . . . . returns the data record of a process\n##\nInstallGlobalFunction(ANUPQDataRecord, function( arg )\n  if not IsEmpty(arg) and arg[1] = 0 and IsBound( ANUPQData.ni ) then\n    return ANUPQData.ni;\n  else\n    return ANUPQData.io[ CallFuncList(PqProcessIndex, arg) ];\n  fi;\nend);\n\n#############################################################################\n##\n#F  PqProcessIndex( <i> ) . . . . . . . . . . . User version of ANUPQ_IOINDEX\n#F  PqProcessIndex()\n##\n##  If given (at least) one integer  argument  `PqProcessIndex'  returns  its\n##  first argument if it corresponds to  an  active  interactive  process  or\n##  raises an error; otherwise, with no arguments,  it  returns  the  default\n##  active interactive process. If the user provides more than  one  argument\n##  then all arguments other than the  first  argument  are  ignored  (and  a\n##  warning is issued to `Info' at `InfoANUPQ' or `InfoWarning' level 1).\n##\nInstallGlobalFunction(PqProcessIndex, function(arg)\n  ANUPQ_IOINDEX_ARG_CHK(arg);\n  return ANUPQ_IOINDEX(arg);\nend);\n\n#############################################################################\n##\n#F  PqProcessIndices() . . . . the list of active interactive ANUPQ processes\n##\n##  returns the list of (integer) indices of all active interactive  {\\ANUPQ}\n##  processes.\n##\nInstallGlobalFunction(PqProcessIndices, function()\n  return Filtered( [1..Length(ANUPQData.io)], i -> IsBound( ANUPQData.io[i] ) );\nend);\n\n#############################################################################\n##\n#F  IsPqProcessAlive( <i> ) . .  checks an interactive ANUPQ process iostream\n#F  IsPqProcessAlive()\n##\n##  return  `true'  if  the  {\\GAP}  iostream  of  the  <i>th  (or   default)\n##  interactive {\\ANUPQ} process is alive (i.e. can still be written to),  or\n##  `false', otherwise.\n##\nInstallGlobalFunction(IsPqProcessAlive, function(arg)\n  return not IsEndOfStream( ANUPQData.io[ PqProcessIndex(arg) ].stream );\nend);\n\n#############################################################################\n##\n#V  PQ_MENUS . . . . . . . . . . . data describing the menus of the pq binary\n##\n##  a record whose fields are abbreviated names of  the  menus  of  the  `pq'\n##  binary and whose values are themselves records with fields:\n##\n##    name\n##        long name of menu;\n##    depth\n##        the number of times 0 must be passed to the `pq' binary for  it  to\n##        exit;\n##    prev\n##        the menu one gets to from the current menu via option 0 (or `\"\"' in\n##        the case of the menu `SP';\n##    nextopt\n##        a record whose fields are the new menus of greater depth  that  can\n##        be reached by an option of the current menu, and whose  values  are \n##        the corresponding numbers of the options of the current menu needed\n##        to get to the new menus.\n##\nInstallValue(PQ_MENUS, rec(\n  SP  := rec( name  := \"Standard Presentation Menu\",\n              depth := 1, prev  := \"\",   nextopt := rec( pQ := 7 ) ),\n  pQ  := rec( name  := \"(Main) p-Quotient Menu\",\n              depth := 2, prev  := \"SP\", nextopt := rec( pG  := 9, ApQ := 8 ) ),\n  pG  := rec( name  := \"(Main) p-Group Generation Menu\",\n              depth := 3, prev  := \"pQ\", nextopt := rec( ApG := 6 ) ),\n  ApQ := rec( name  := \"Advanced p-Quotient Menu\",\n              depth := 3, prev  := \"pQ\", nextopt := rec() ),\n  ApG := rec( name  := \"Advanced p-Group Gen'n Menu\",\n              depth := 4, prev  := \"pG\", nextopt := rec() )\n  ) );\n\n#############################################################################\n##\n#F  PQ_MENU( <datarec>, <newmenu> ) . . . . . . change/get menu of pq process\n#F  PQ_MENU( <datarec> )\n##\nInstallGlobalFunction(PQ_MENU, function(arg)\nlocal datarec, newmenu, nextmenu, tomenu, infolev;\n  datarec := arg[1];\n  if 2 = Length(arg) then\n    newmenu := arg[2];\n    if datarec.menu in [\"SP\", \"pQ\"] and newmenu in [\"ApQ\", \"pG\", \"ApG\"] then\n      PQ_GRP_EXISTS_CHK( datarec ); #We try to avoid seg-faults!\n    fi;\n    while datarec.menu <> newmenu do\n      if PQ_MENUS.(datarec.menu).depth >= PQ_MENUS.(newmenu).depth then\n        datarec.menu := PQ_MENUS.(datarec.menu).prev;\n        tomenu := PQ_MENUS.(datarec.menu).name;\n        ToPQk(datarec, [ 0 ], [ \"  #to \", tomenu]);\n        infolev := 5;\n      elif datarec.menu = \"pQ\" and newmenu = \"ApQ\" then\n        datarec.menu := \"ApQ\";\n        tomenu := PQ_MENUS.(datarec.menu).name;\n        ToPQk(datarec, [ PQ_MENUS.pQ.nextopt.ApQ ], [ \"  #to \", tomenu ]);\n        infolev := 6;\n      else\n        nextmenu := RecNames( PQ_MENUS.(datarec.menu).nextopt )[1];\n        tomenu := PQ_MENUS.(nextmenu).name;\n        ToPQk(datarec, [ PQ_MENUS.(datarec.menu).nextopt.(nextmenu) ],\n                       [ \"  #to \", tomenu ]);\n        datarec.menu := nextmenu;\n        infolev := 6;\n      fi;\n      # menus are flushed at InfoANUPQ level 6, prompts at level 5\n      if not IsBound(datarec.setupfile) then\n        FLUSH_PQ_STREAM_UNTIL(datarec.stream, infolev, 5, PQ_READ_NEXT_LINE,\n                              IS_PQ_PROMPT);\n      fi;\n    od;\n  fi;\n  return datarec.menu;\nend);\n\n#############################################################################\n##\n#F  IS_PQ_PROMPT( <line> ) . . . .  checks whether the line is a prompt of pq\n##\n##  returns `true' if the string  <line>  is  a  `pq'  prompt,  or  otherwise\n##  returns `false'.\n##\nInstallGlobalFunction(IS_PQ_PROMPT,\n  line -> IS_ALL_PQ_LINE(line) and ANUPQData.linetype = \"prompt\"\n);\n\n#############################################################################\n##\n#F  IS_ALL_PQ_LINE( <line> ) . checks whether line is a complete line from pq\n##\n##  returns `true' if the string <line> is a `pq' prompt or  a  request  from\n##  `pq' to {\\GAP} to compute stabilisers or simply ends  in  a  newline  and\n##  sets `ANUPQData.linetype' to `\"prompt\"', `\"request\"'  or  `\"hasnewline\"',\n##  accordingly; otherwise `ANUPQData.linetype' is  set  to  `\"unknown\"'  and\n##  `false' is returned.\n##\nInstallGlobalFunction(IS_ALL_PQ_LINE, function( line )\nlocal len;\n  ANUPQData.linetype := \"unknown\";\n  len := Length(line);\n  if 0 < len then\n    if line[len] = '\\n' then\n      if 4 < len  and line{[1 .. 3]} = \"GAP\" and line[len - 1] = '!' then\n        ANUPQData.linetype := \"request\";\n      elif 6 < len and line{[1 .. 6]} in [\"Enter \", \"Input \"] then\n        ANUPQData.linetype := \"prompt\";\n      else\n        ANUPQData.linetype := \"hasnewline\";\n      fi;\n    elif line = \"Select option: \" or\n         1 < len and line{[len - 1 .. len]} = \"? \"  or\n         8 < len and line{[len - 1 .. len]} = \": \" and\n                     line{[1 .. 6]} in [\"Enter \", \"Input \", \"Add ne\"] then\n      ANUPQData.linetype := \"prompt\";\n    fi;\n  fi;\n  return ANUPQData.linetype <> \"unknown\";\nend);\n\n#############################################################################\n##\n#F  PQ_READ_ALL_LINE( <iostream> ) .  read line from pq but poss. return fail\n##\n##  reads a complete line from <iostream> or return `fail'.\n##\nInstallGlobalFunction(PQ_READ_ALL_LINE, \n  iostream -> ReadAllLine(iostream, false, IS_ALL_PQ_LINE)\n);\n\n#############################################################################\n##\n#F  PQ_READ_NEXT_LINE( <iostream> ) . read line from pq but never return fail\n##\n##  Essentially, like `PQ_READ_ALL_LINE' but we know there is a complete line\n##  to be got, so we wait for it, before returning.\n##\nInstallGlobalFunction(PQ_READ_NEXT_LINE, \n  iostream -> ReadAllLine(iostream, true, IS_ALL_PQ_LINE)\n);\n\n#############################################################################\n##\n#F  FLUSH_PQ_STREAM_UNTIL(<stream>,<infoLev>,<infoLevMy>,<readln>,<IsMyLine>)\n##  . . .  . . . . . . . . . . . read lines from a stream until a wanted line\n##\n##  calls <readln> (which should be one of `ReadLine', `PQ_READ_NEXT_LINE' or\n##  `PQ_READ_ALL_LINE') to read lines from a stream <stream> and `Info's each\n##  line read at `InfoANUPQ' level <infoLev> until a line <line> is read  for\n##  which `<IsMyLine>(<line>)' is `true'; <line> is `Info'-ed at  `InfoANUPQ'\n##  level <infoLevMy> and returned. <IsMyLine>  should  be  a  boolean-valued\n##  function that expects a string as its only argument,  and  <infoLev>  and\n##  <infoLevMy> should be positive integers. An <infoLevMy> of 10 means  that\n##  the  line  <line>  matched  by  `<IsMyLine>(<line>)'  should   never   be\n##  `Info'-ed.\n##\nInstallGlobalFunction(FLUSH_PQ_STREAM_UNTIL, \nfunction(stream, infoLev, infoLevMy, readln, IsMyLine)\nlocal line;\n  line := readln(stream);\n  while not IsMyLine(line) do\n    Info(InfoANUPQ, infoLev, Chomp(line));\n    line := readln(stream);\n  od;\n  if line <> fail and infoLevMy < 10 then\n    Info(InfoANUPQ, infoLevMy, Chomp(line));\n  fi;\n  return line;\nend);\n\n#############################################################################\n##\n#V  PQ_ERROR_EXIT_MESSAGES . . . error messages emitted by the pq before exit\n##\n##  A list of the error messages the `pq' emits just before exiting.\n##\nInstallValue(PQ_ERROR_EXIT_MESSAGES,\n  [ \"Evaluation in compute_degree may cause integer overflow\",\n    \"A relation is too long -- increase the value of MAXWORD\",\n    \"Ran out of space during computation\" ]);\n\n#############################################################################\n##\n#F  FILTER_PQ_STREAM_UNTIL_PROMPT( <datarec> )\n##\n##  reads `pq' output from `<datarec>.stream' until a `pq' prompt and `Info's\n##  any lines that are prompts, blank lines, menu exits  or  start  with  the\n##  strings in the list `<datarec>.filter' (if bound) at `InfoANUPQ' level 5;\n##  all  other  lines  are  either  `Info'-ed  at  `InfoANUPQ'  level  3   if\n##  `datarec.nonuser' is set, or, more usually, are `Info'-ed at  `InfoANUPQ'\n##  level 2 if  they  are  computation  times  or  at  `InfoANUPQ'  level  1,\n##  otherwise.\n##\nInstallGlobalFunction(FILTER_PQ_STREAM_UNTIL_PROMPT, function( datarec )\nlocal match, filter, lowlev, ctimelev;\n  filter := [\"Exiting\", \"pq,\", \"Now enter\", \n             \"Presentation listing images\", \"(use generators x1,x2\"];\n  if IsBound(datarec.match) then\n    if datarec.match = true then\n      match := [\"Group:\", \"Group completed\"];\n    else\n      match := [datarec.match];\n    fi;\n  fi;\n  if IsBound(datarec.filter) then\n    Append(filter, datarec.filter);\n  fi;\n  if ValueOption(\"nonuser\") = true then\n    lowlev := 3;\n    ctimelev := 3;\n  else\n    ctimelev := 2;\n    if not IsBound(datarec.OutputLevel) or datarec.OutputLevel = 0 then\n      lowlev := 3;\n    else\n      lowlev := 1;\n    fi;\n  fi;\n  repeat\n    datarec.line := PQ_READ_NEXT_LINE(datarec.stream);\n    if ANUPQData.linetype in [\"prompt\", \"request\"] then\n      Info( InfoANUPQ, 5,        Chomp(datarec.line) );\n      break;\n    elif ForAny([\"seconds\", \"Lused\", \"*** Final \"], \n                s -> PositionSublist(datarec.line, s) <> fail) then\n      Info( InfoANUPQ, ctimelev, Chomp(datarec.line) );\n    elif datarec.line = \"\\n\" or\n         ForAny( filter, s -> IsMatchingSublist(datarec.line, s) ) then\n      Info( InfoANUPQ, 5,        Chomp(datarec.line) );\n    elif PositionSublist(datarec.line, \" saved on file\") <> fail then\n      Info( InfoANUPQ, ctimelev, Chomp(datarec.line) );\n    elif ForAny( PQ_ERROR_EXIT_MESSAGES,\n                 s -> IsMatchingSublist(datarec.line, s) ) then\n      Info( InfoANUPQ + InfoWarning, 1, Chomp(datarec.line) );\n      Error( \"pq program terminated, with error condition:\\n  \", datarec.line );\n    else\n      Info( InfoANUPQ, lowlev,   Chomp(datarec.line) );\n    fi;\n    if IsBound(match) then\n      if ForAny( match, s -> IsMatchingSublist(datarec.line, s) ) then\n        datarec.matchedline := datarec.line;\n        datarec.complete := IsBound(datarec.complete) and datarec.complete or\n                            IsMatchingSublist(datarec.line, \"Group completed\");\n      fi;\n    elif IsBound(datarec.matchlist) and \n         ForAny( datarec.matchlist, \n                 s -> PositionSublist(datarec.line, s) <> fail ) then\n      Add(datarec.matchedlines, datarec.line);\n    fi;\n  until false;\nend);\n\n#############################################################################\n##\n#F  ToPQk( <datarec>, <cmd>, <comment> ) . . . . . . .  writes to a pq stream\n##\n##  writes  <cmd>  (and  <comment>,   in   setup   file   case)   to   stream\n##  `<datarec>.stream' and `Info's <cmd> and <comment> at `InfoANUPQ' level 3\n##  after a ```ToPQ> ''' prompt, and returns `true' if successful and  `fail'\n##  otherwise. The ``k'' at the end of the  function  name  is  mnemonic  for\n##  ``keyword'' (for ``keyword'' inputs to the `pq' binary one never wants to\n##  flush output).\n##\nInstallGlobalFunction(ToPQk, function(datarec, cmd, comment)\nlocal ok, line, i, j, closed, fragment, sepchars, words, filterones;\n\n  if not IsOutputTextStream(datarec.stream) and \n     IsEndOfStream(datarec.stream) then\n    Error(\"sorry! Process stream has died!\\n\");\n  fi;\n  if cmd in [\"gens\", \"rels\"] then\n    # these are done specially because of their potential to be enormously long\n    if cmd = \"gens\" then\n      line := \"generators { \";\n      sepchars := \", \";\n    else\n      line := \"relators   { \";\n      sepchars := \"*^, \";\n    fi;\n    words := datarec.(cmd);\n    filterones := cmd = \"rels\" and not IsBound(datarec.Relators) and\n                  (IsFpGroup(datarec.group) or not IsPGroup(datarec.group));\n    i := 1;\n    while filterones and i <= Length(words) and IsOne(words[i]) do\n      i := i + 1;\n    od;\n    if i <= Length(words) then\n      Append(line, String(words[i]));\n      i := i + 1;\n    fi;\n    ok := true;\n    closed := false;\n    repeat\n      while filterones and i <= Length(words) and IsOne(words[i]) do\n        i := i + 1;\n      od;\n      # i is the index of the next word to be added to line or > #words \n      if i <= Length(words) then\n        # if number of non-trivial words is 0 or 1 no comma is ever added\n        Append(line, \", \");\n        Append(line, String(words[i]));\n        i := i + 1;\n      else\n        Append(line, \" }\");\n        if cmd = \"rels\" then\n          Append(line, \";\");\n        fi;\n        closed := true; # not quite equivalent to: i > Length(words)\n      fi;\n      while ok and (Length(line) >= 69 or (closed and Length(line) > 0)) do\n        if Length(line) >= 69 then\n          # find a nice break if we can\n          j := 68;\n          while j > 4 and not line[j] in sepchars do j := j - 1; od;\n          # no nice break\n          if j = 4 then\n            j := 69;\n            while j < Length(line) and not line[j] in sepchars do \n              j := j + 1;\n            od;\n          fi;\n          fragment := line{[1 .. j]};\n        else\n          fragment := line;\n          j := Length(line);\n        fi;\n        if j = Length(line) and closed then\n          line := \"\";\n        else\n          line := Concatenation(\"  \", line{[j + 1 .. Length(line)]});\n        fi;\n        Info(InfoANUPQ, 4, \"ToPQ> \", fragment);\n        if IsBound( datarec.setupfile) then\n          ok := WriteLine(datarec.stream, fragment);\n        else\n          ok := WriteLine(datarec.stream, fragment);\n          if IsBound( ANUPQData.topqlogfile ) then\n            WriteLine(ANUPQData.logstream, fragment);\n          fi;\n        fi;\n      od;\n    until closed or not ok;\n  else\n    # We add a null string in case <cmd> or <comment> is []\n    # ... so that `Concatenation( List(., String) );' statements return strings\n    Add(cmd, \"\");\n    Add(comment, \"\");\n    cmd     := Concatenation( List(cmd, String) );\n    comment := Concatenation( List(comment, String) );\n    Info(InfoANUPQ, 4, \"ToPQ> \", cmd, comment);\n    if IsBound( datarec.setupfile) then\n      ok := WriteLine(datarec.stream, Concatenation(cmd, comment));\n    else\n      ok := WriteLine(datarec.stream, cmd);\n      if IsBound( ANUPQData.topqlogfile ) then\n        WriteLine(ANUPQData.logstream, Concatenation(cmd, comment));\n      fi;\n    fi;\n  fi;\n  if ok = fail then\n    Error(\"write to stream failed\\n\");\n  fi;\n  return ok;\nend);\n\n#############################################################################\n##\n#F  ToPQ(<datarec>, <cmd>, <comment>) . .  write to pq (& for iostream flush)\n##\n##  calls `ToPQk' to write <cmd> (and  <comment>,  in  setup  file  case)  to\n##  stream `<datarec>.stream' and `Info' <cmd> and <comment>  at  `InfoANUPQ'\n##  level 3 after a ```ToPQ> ''' prompt, and then, if we are not just writing\n##  a setup file (determined by  checking  whether  `<datarec>.setupfile'  is\n##  bound), calls `FILTER_PQ_STREAM_UNTIL_PROMPT' to filter lines  to  `Info'\n##  at the various `InfoANUPQ' levels. If we are not writing a setup file the\n##  last line flushed is saved in `<datarec>.line'.\n##\nInstallGlobalFunction(ToPQ, function(datarec, cmd, comment)\n  ToPQk(datarec, cmd, comment);\n  if not IsBound( datarec.setupfile ) then\n    FILTER_PQ_STREAM_UNTIL_PROMPT(datarec);\n  \n    while ANUPQData.linetype = \"request\" do\n      HideGlobalVariables( \"ANUPQglb\", \"F\", \"gens\", \"relativeOrders\",\n                           \"ANUPQsize\", \"ANUPQagsize\" );\n      Read( Filename( ANUPQData.tmpdir, \"GAP_input\" ) );\n      Read( Filename( ANUPQData.tmpdir, \"GAP_rep\" ) );\n      UnhideGlobalVariables( \"ANUPQglb\", \"F\", \"gens\", \"relativeOrders\",\n                             \"ANUPQsize\", \"ANUPQagsize\" );\n      ToPQk( datarec, [ \"pq, stabiliser is ready!\" ], [] );\n      FILTER_PQ_STREAM_UNTIL_PROMPT(datarec);\n    od;\n  fi;\nend);\n\n#############################################################################\n##\n#F  ToPQ_BOOL( <datarec>, <optval>, <comment> ) . . . .  pass a boolean to pq\n##    \n##  converts a {\\GAP} boolean  <optval>  to  a  C  boolean  and  appends  the\n##  appropriate adjustment to the string <comment> before calling `ToPQ'  (we\n##  assume that <optval> is boolean ... `VALUE_PQ_OPTION' should already have\n##  checked that).\n##\nInstallGlobalFunction( ToPQ_BOOL, function( datarec, optval, comment )\n  if optval = true then\n    ToPQ( datarec, [ 1 ], [ \"  #do \", comment ] );\n  else\n    ToPQ( datarec, [ 0 ], [ \"  #do not \", comment ] );\n  fi;\nend);\n\n#############################################################################\n##\n#F  PqRead( <i> )  . . .  primitive read of a single line from ANUPQ iostream\n#F  PqRead()\n##\n##  read a complete line of  {\\ANUPQ}  output,  from  the  <i>th  or  default\n##  interactive {\\ANUPQ} process, if there is output to be read  and  returns\n##  `fail' otherwise. When successful, the  line  is  returned  as  a  string\n##  complete with trailing newline, colon, or question-mark character. Please\n##  note that it is possible to be ``too  quick''  (i.e.~the  return  can  be\n##  `fail' purely because the output from {\\ANUPQ} is not there yet), but  if\n##  `PqRead' finds any output at all, it waits for a complete line.  `PqRead'\n##  also writes the line read via `Info' at `InfoANUPQ' level 2.  It  doesn't\n##  try to distinguish banner and menu output from other output of  the  `pq'\n##  binary.\n##\nInstallGlobalFunction(PqRead, function(arg)\nlocal line;\n\n  line := PQ_READ_ALL_LINE( ANUPQData.io[ PqProcessIndex(arg) ].stream );\n  Info(InfoANUPQ, 2, Chomp(line));\n  return line;\nend);\n\n#############################################################################\n##\n#F  PqReadAll( <i> ) . . . . . read all current output from an ANUPQ iostream\n#F  PqReadAll()\n##\n##  read and return as many *complete* lines of  {\\ANUPQ}  output,  from  the\n##  <i>th or default interactive {\\ANUPQ} process, as there are to  be  read,\n##  *at the time of the call*,  as  a  list  of  strings  with  any  trailing\n##  newlines removed and returns the empty list otherwise.  `PqReadAll'  also\n##  writes each line read via `Info' at `InfoANUPQ' level 2. It  doesn't  try\n##  to distinguish banner and menu output  from  other  output  of  the  `pq'\n##  binary. Whenever `PqReadAll' finds only a partial line, it waits for  the\n##  complete line, thus increasing the probability that it has  captured  all\n##  the output to be had from {\\ANUPQ}.\n##\nInstallGlobalFunction(PqReadAll, function(arg)\nlocal lines, stream, line;\n\n  stream := ANUPQData.io[ PqProcessIndex(arg) ].stream;\n  lines := [];\n  line := PQ_READ_ALL_LINE(stream);\n  while line <> fail do\n    line := Chomp(line);\n    Info(InfoANUPQ, 2, line);\n    Add(lines, line);\n    line := PQ_READ_ALL_LINE(stream);\n  od;\n  return lines;\nend);\n\n#############################################################################\n##\n#F  PqReadUntil( <i>, <IsMyLine> ) .  read from ANUPQ iostream until a cond'n\n#F  PqReadUntil( <IsMyLine> )\n#F  PqReadUntil( <i>, <IsMyLine>, <Modify> )\n#F  PqReadUntil( <IsMyLine>, <Modify> )\n##\n##  read complete lines  of  {\\ANUPQ}  output,  from  the  <i>th  or  default\n##  interactive {\\ANUPQ} process, ``chomps'' them (i.e.~removes any  trailing\n##  newline character), emits them to `Info' at `InfoANUPQ' level 2  (without\n##  trying to distinguish banner and menu output from  other  output  of  the\n##  `pq' binary), and applies the function <Modify> (where <Modify>  is  just\n##  the identity map/function for the first two forms)  until  a  ``chomped''\n##  line  <line>  for  which  `<IsMyLine>(  <Modify>(<line>)  )'   is   true.\n##  `PqReadUntil' returns the list of <Modify>-ed ``chomped'' lines read.\n##\nInstallGlobalFunction(PqReadUntil, function(arg)\nlocal idx1stfn, stream, IsMyLine, Modify, lines, line;\n\n  idx1stfn := First([1..Length(arg)], i -> IsFunction(arg[i]));\n  if idx1stfn = fail then\n    Error(\"expected at least one function argument\\n\");\n  elif Length(arg) > idx1stfn + 1 then\n    Error(\"expected 1 or 2 function arguments, not \", \n          Length(arg) - idx1stfn + 1, \"\\n\");\n  elif idx1stfn > 2  then\n    Error(\"expected 0 or 1 integer arguments, not \", idx1stfn - 1, \"\\n\");\n  else\n    stream := ANUPQData.io[ ANUPQ_IOINDEX(arg{[1..idx1stfn - 1]}) ].stream;\n    IsMyLine := arg[idx1stfn];\n    if idx1stfn = Length(arg) then\n      Modify := line -> line; # The identity function\n    else\n      Modify := arg[Length(arg)];\n    fi;\n    lines := [];\n    repeat\n      line := Chomp( PQ_READ_NEXT_LINE(stream) );\n      Info(InfoANUPQ, 2, line);\n      line := Modify(line);\n      Add(lines, line);\n    until IsMyLine(line);\n    return lines;\n  fi;\nend);\n\n#############################################################################\n##\n#F  PqWrite( <i>, <string> ) . . . . . . .  primitive write to ANUPQ iostream\n#F  PqWrite( <string> )\n##\n##  write <string> to the <i>th  or  default  interactive  {\\ANUPQ}  process;\n##  <string> must be in exactly the form the {\\ANUPQ} standalone expects. The\n##  command is echoed via `Info' at `InfoANUPQ' level 3 (with a  ```ToPQ> '''\n##  prompt); i.e.~do `SetInfoLevel(InfoANUPQ, 3);' to see what is transmitted\n##  to the `pq' binary. `PqWrite' returns `true' if successful in writing  to\n##  the stream of the interactive {\\ANUPQ} process, and `fail' otherwise.\n##\nInstallGlobalFunction(PqWrite, function(arg)\nlocal ioIndex, line;\n\n  if Length(arg) in [1, 2] then\n    ioIndex := ANUPQ_IOINDEX(arg{[1..Length(arg) - 1]});\n    return ToPQk( ANUPQData.io[ioIndex], arg{[Length(arg)..Length(arg)]}, [] );\n  else\n    Error(\"expected 1 or 2 arguments ... not \", Length(arg), \" arguments\\n\");\n  fi;\nend);\n\n#############################################################################\n##\n#F  ANUPQ_ARG_CHK( <funcname>, <args> ) . . . . check args of int/non-int fns\n##\n##  checks the argument list <args> for a function that has both  interactive\n##  and non-interactive versions, where <funcname> is the generic name of the\n##  function. If <args> has length more than 1 then it contains  options  for\n##  the function that have been passed in one of the {\\GAP} 3-compatible ways\n##  only available non-interactively. `ANUPQ_ARG_CHK' returns <datarec> which\n##  is   either   `ANUPQData.ni'   in    the    non-interactive    case    or\n##  `ANUPQData.io[<i>]' for some <i> in the interactive case,  after  setting\n##  <datarec>.calltype' to one  of  `\"interactive\"',  `\"non-interactive\"'  or\n##  `\"GAP3compatible\"'.\n##\nInstallGlobalFunction(ANUPQ_ARG_CHK, function(funcname, args)\nlocal ioIndex, datarec, optrec, optnames;\n  PQ_OTHER_OPTS_CHK( funcname, IsEmpty(args) or IsPosInt( args[1] ) );\n  if IsEmpty(args) or IsPosInt( args[1] ) then\n    datarec := ANUPQData.io[ CallFuncList( PqProcessIndex, args ) ];\n    datarec.outfname := ANUPQData.outfile; # not always needed\n    #datarec.calltype := \"interactive\";    # PqStart sets this\n    if not IsBound(datarec.group) then\n      Error( \"huh! Interactive process has no group\\n\" );\n    elif IsMatchingSublist(funcname, \"PqDescendants\") then\n      if not IsPcGroup( datarec.group ) then\n        Error( \"group of process must be a pc group\\n\" );\n      fi;\n    else # Check for Prime, ClassBound if nec.\n      PQ_OPTION_CHECK( funcname, datarec );\n    fi;\n  elif 1 = Length(args) then\n    if not IsPcGroup( args[1] ) then\n      if IsMatchingSublist(funcname, \"PqDescendants\") then\n        Error( \"first argument <args[1]> must be a pc group\\n\" );\n      elif not IsFpGroup( args[1] ) then\n        Error( \"first argument <args[1]> must be a pc group or an fp group\\n\" );\n      fi;\n    fi;\n    ANUPQData.ni := PQ_START( VALUE_PQ_OPTION( \"PqWorkspace\", 10000000 ),\n                              VALUE_PQ_OPTION( \"SetupFile\" ) );\n    datarec := ANUPQData.ni;\n    datarec.group := args[1];\n    datarec.calltype := \"non-interactive\";\n    datarec.procId := 0;\n    PQ_OPTION_CHECK( funcname, datarec ); # Check for Prime, ClassBound if nec.\n    if IsBound( datarec.setupfile ) then\n      datarec.outfname := \"PQ_OUTPUT\";\n    else\n      datarec.outfname := ANUPQData.outfile; # not always needed\n    fi;\n  else\n    # GAP 3 way of passing options is supported in non-interactive use\n    if funcname = \"PqDescendantsTreeCoclassOne\" then\n      Error(\"GAP 3-compatible ways of passing options not supported\");\n    elif IsRecord(args[2]) then\n      optrec := ShallowCopy(args[2]);\n      optnames := Set( REC_NAMES(optrec) );\n      SubtractSet( optnames, Set( ANUPQoptions.(funcname) ) );\n      if not IsEmpty(optnames) then\n        Error(ANUPQoptError( funcname, optnames ), \"\\n\");\n      fi;\n    else\n      optrec := ANUPQextractOptions(funcname, args{[2 .. Length(args)]});\n    fi;\n    PushOptions(optrec);\n    PQ_FUNCTION.(funcname)( args{[1]} );\n    PopOptions();\n    datarec := ANUPQData.ni;\n    datarec.calltype := \"GAP3compatible\";\n    datarec.procId := 0;\n  fi;\n  return datarec;\nend );\n\n#############################################################################\n##\n#F  PQ_COMPLETE_NONINTERACTIVE_FUNC_CALL( <datarec> )\n##\n##  writes the final commands to the `pq' setup file so that the `pq'  binary\n##  makes a clean exit, or just closes the stream to kill the `pq' process.\n##\nInstallGlobalFunction(PQ_COMPLETE_NONINTERACTIVE_FUNC_CALL, function(datarec)\n  if IsBound( datarec.setupfile ) then\n    PQ_MENU(datarec, \"SP\");\n    ToPQk(datarec, [ 0 ], [ \"  #exit program\" ]);\n  fi;\n  CloseStream(datarec.stream);\n\n  if IsBound( datarec.setupfile ) then\n    Info(InfoANUPQ, 1, \"Input file: '\", datarec.setupfile, \"' written.\");\n    Info(InfoANUPQ, 1, \"Run `pq' with '\", datarec.opts, \"' flags.\");\n    Info(InfoANUPQ, 1, \"The result will be saved in: '\", \n                       datarec.outfname, \"'.\");\n  fi;\nend );\n\n#############################################################################\n##\n#F  ToPQLog([<filename>]) . . . . . . log or stop logging pq commands to file\n##\n##  With string argument <filename>,  `ToPQLog'  opens  the  file  with  name\n##  <filename> for logging; all commands written to the `pq' binary (that are\n##  `Info'-ed behind a ```ToPQ> ''' prompt at `InfoANUPQ' level 4)  are  then\n##  also written to that  file  (but  without  prompts).  With  no  argument,\n##  `ToPQLog' stops logging to whatever file was being logged to. If  a  file\n##  was already being logged to, that file is closed and the file  with  name\n##  <filename> is opened for logging.\n##\nInstallGlobalFunction(ToPQLog, function(arg)\n  if not( IsEmpty(arg) or IsString( arg[1] ) ) then\n    Error( \"expected no arguments or one string argument\\n\" );\n  fi;\n  if IsBound(ANUPQData.topqlogfile) then\n    CloseStream(ANUPQData.logstream);\n    PQ_UNBIND(ANUPQData, [\"topqlogfile\", \"logstream\"]);\n  elif IsEmpty(arg) then\n    Info(InfoANUPQ + InfoWarning, 1, \"No file currently being logged to.\");\n    return;\n  fi;\n  if not( IsEmpty(arg) ) and IsString(arg[1]) then\n    ANUPQData.topqlogfile := arg[1];\n    ANUPQData.logstream := OutputTextFile(ANUPQData.topqlogfile, false);\n  fi;\nend);\n\n#E  anupqios.gi . . . . . . . . . . . . . . . . . . . . . . . . . . ends here \n", "meta": {"hexsha": "32f626beb6076d8cd259404b44f523296a6bfce3", "size": 35525, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lib/anupqios.gi", "max_stars_repo_name": "gap-system/anupq", "max_stars_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_stars_repo_licenses": ["Artistic-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/anupqios.gi", "max_issues_repo_name": "gap-system/anupq", "max_issues_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_issues_repo_licenses": ["Artistic-2.0"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2015-03-04T12:41:28.000Z", "max_issues_repo_issues_event_max_datetime": "2015-09-27T22:17:27.000Z", "max_forks_repo_path": "lib/anupqios.gi", "max_forks_repo_name": "gap-system/anupq", "max_forks_repo_head_hexsha": "075d27ffe985d561f377a253563605ffea726448", "max_forks_repo_licenses": ["Artistic-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.9956092206, "max_line_length": 80, "alphanum_fraction": 0.59026038, "num_tokens": 10252, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2598256379609837, "lm_q2_score": 0.03258974582307231, "lm_q1q2_score": 0.008467651499466065}}
{"text": "package main\n\nimport (\n\t\"fmt\"\n)\n\ntype Baggins interface {\n\tWearRing() bool\n}\ntype Gollum interface {\n\tScowl() int\n}\ntype hobbit struct {\n\thasRing bool\n}\n\nfunc (h *hobbit) WearRing() bool {\n\th.hasRing = !h.hasRing\n\treturn h.hasRing\n}\n\ntype Wolf struct {\n\tClaw    int\n\tHasRing bool\n}\n\nfunc (w *Wolf) Scowl() int {\n\tw.Claw++\n\treturn w.Claw\n}\nfunc battle(g Gollum, b Baggins) (int, bool) {\n\treturn g.Scowl(), b.WearRing()\n}\nfunc tryTheTypeSwitch(i interface{}) int {\n\tswitch x := i.(type) {\n\tcase Gollum:\n\t\treturn x.Scowl()\n\tcase Baggins:\n\t\tif x.WearRing() {\n\t\t\treturn 1\n\t\t}\n\t}\n\treturn 0\n}\n//func main() {\n\tw := &Wolf{}\n\tbilbo := &hobbit{}\n\ti0, b0 := battle(w, bilbo)\n\ti1, b1 := battle(w, bilbo)\n\tfmt.Printf(\"i0=%v, b0=%v\\n\", i0, b0)\n\tfmt.Printf(\"i1=%v, b1=%v\\n\", i1, b1)\n\tfmt.Printf(\"tried wolf=%v\\n\", tryTheTypeSwitch(w))\n\tfmt.Printf(\"tried bilbo=%v\\n\", tryTheTypeSwitch(bilbo))\n//}\n\n/*\ni0=1, b0=true\ni1=2, b1=false\ntried wolf=3\ntried bilbo=1\n*/\n", "meta": {"hexsha": "7267ea15b3cc23cfda2c83f4d8b65167d308cd91", "size": 944, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "pkg/compiler/attic/bilbo.gi", "max_stars_repo_name": "gijit/gi-minimal", "max_stars_repo_head_hexsha": "1aa4cc82ef6d45ce43cbf1744d50740fe8aff803", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 313, "max_stars_repo_stars_event_min_datetime": "2018-01-13T22:09:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-01T21:50:51.000Z", "max_issues_repo_path": "pkg/compiler/attic/bilbo.gi", "max_issues_repo_name": "gijit/gi-minimal", "max_issues_repo_head_hexsha": "1aa4cc82ef6d45ce43cbf1744d50740fe8aff803", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 57, "max_issues_repo_issues_event_min_datetime": "2018-01-13T19:50:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-09T19:00:05.000Z", "max_forks_repo_path": "pkg/compiler/attic/bilbo.gi", "max_forks_repo_name": "gijit/gi-minimal", "max_forks_repo_head_hexsha": "1aa4cc82ef6d45ce43cbf1744d50740fe8aff803", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-02-09T15:34:45.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-03T19:57:49.000Z", "avg_line_length": 15.2258064516, "max_line_length": 56, "alphanum_fraction": 0.6302966102, "num_tokens": 348, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.22000708951749934, "lm_q2_score": 0.03846619036489695, "lm_q1q2_score": 0.008462834587007053}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# tag to force GT_NthLoop expansions to be smaller, results in less\n# ruletrees being generated, which is sometimes desirable.\n#\n# NOTE: it is used in the GT_NthLoop rule at currently needs no\n#       parameters\n\nClass(ALimitNthLoop, AGenericTag);\n\n# Input/Output tag which describes the input/outputs of the given block. \n# Designed with OL in mind, although written for transforms.\n#\n# You initialize the tag with a list of pairs which specify which input\n# and outputs are connected. \n#\n# In the case of transforms, this means AIO([1,1]) is the only acceptable \n# input. And it means the block is done inplace. Normal operation is \n# out-of-place.\n#\n# for OL, this can be AIO([1,3],[2,1]), which means input1 -> output3 and\n# input2 -> output1\n#\nClass(AIO, AGenericTag);\n\n\n", "meta": {"hexsha": "5372b2442b6636097b702282cebf3e31f0c34dd8", "size": 859, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/common/tags.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/common/tags.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/common/tags.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.6333333333, "max_line_length": 74, "alphanum_fraction": 0.736903376, "num_tokens": 224, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.23370635691404026, "lm_q2_score": 0.03461883859017464, "lm_q1q2_score": 0.008090642647504904}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Parameter container\nClass(vparam, Value, rec(\n    __call__ := arg >> let(self := arg[1], WithBases(self,\n    rec(p := arg[2], operations := PrintOps))),\n\n    t := TSym(\"vparam\"),\n    isVparam := true,\n    print := self >> Print(self.__name__, \"(\", self.p, \")\")\n));\n\n# Container for hex numbers\nClass(vhex, Value, rec(\n    __call__ := arg >> let(self := arg[1], WithBases(self,\n    rec(p := arg[2], t:=TVectDouble(Length(arg[2])), operations := PrintOps))),\n\n    isVhex := true,\n    print := self >> Print(self.name, \"(\", self.p, \")\"),\n    can_fold := False,\n));\n\n# Generic instructions\n#\n_vparam := vp -> When(ObjId(vp)=vparam, vp, vparam(vp));\n\n#F VecExp\n#F\n#F This class serves as base class for vector instructions. It has\n#F some extra fields to describe semantics, so that the magic in\n#F paradigms/vector/bases can automatically build some simple base\n#F cases like stride permutations.\n#F\nClass(VecExp, Exp, rec(\n    __call__ := arg >> let(self:=arg[1], WithBases(self, rec(\n        args  := Concat(List(Sublist(arg, [2..self.numargs+1]), toExpArg),\n            When(Length(arg) >= self.numargs+2 and arg[self.numargs+2] <> [],\n            [_vparam(arg[self.numargs+2])], [])),\n        operations := ExpOps\n    )).setType()),\n\n    # Needs to be defined in subclasses:\n    # v := ...    # vector length\n    # numargs := ... # number of arguments, not counting vparam, which could come last\n\n    # NOTE: this is ugly, because it derives type from 1st argument only\n    computeType := self >> let(\n        t       := self.args[1].t,\n        deref_t := When(IsPtrT(t), t.t, t),\n        el_t    := Cond(IsVecT(deref_t), deref_t.t, deref_t),\n        TVect(el_t, self.v)),\n\n    # _vval returns unwrapped (e.g. list) value by index\n    _vval := (self, i) >> _unwrap( When( IsValue(self.args[i]) and not IsVecT(self.args[i].t),\n                                       self.t.value(self.args[i]),\n                                       self.args[i] )),\n\n    params := self >> [],\n    permparams := self >> Cartesian(self.params()),\n    countAsVectOp := True,\n\n    isBinop := self >> self.numargs = 2,\n    isUnop := self >> self.numargs = 1,\n\n    _unaryFromBinopFields := rec(\n        numargs  := 1,\n        params   := self >> self.binop.params(),\n        semantic := (self, in1, p) >> self.binop.semantic(in1, in1, p),\n        ev       := self >> self.toBinop().ev()\n    ),\n\n    # Example: Class(ushuffle, VecExp.unaryFromBinop(shuffle));\n    unaryFromBinop := (self, binop) >> CopyFields(self, self._unaryFromBinopFields,\n        rec(binop := binop, v := binop.v, vcost := binop.vcost)),\n    toBinop := self >> ApplyFunc(self.binop, [self.args[1]] :: self.args),\n\n    unary   := self >> CopyFields(self, rec(numargs := 1)),\n    binary  := self >> CopyFields(self, rec(numargs := 2)),\n    ternary := self >> CopyFields(self, rec(numargs := 3)),\n    quad    := self >> CopyFields(self, rec(numargs := 4)),\n\n    # instruction cost, used to estimate TL cost when building TL bases \n    vcost   := 1,\n));\n\nClass(VecExp_2, VecExp, rec(v := 2));\nClass(VecExp_4, VecExp, rec(v := 4));\nClass(VecExp_8, VecExp, rec(v := 8));\nClass(VecExp_16, VecExp, rec(v := 16));\nClass(VecExp_32, VecExp, rec(v := 32));\nClass(VecExp_64, VecExp, rec(v := 64));\nClass(VecExp_128, VecExp, rec(v := 128));\n\n\n#F VecExpCommand\n#F\n#F Base classes for vector statements (commands) such as stores, which do not return\n#F a value.\n#F\nClass(VecExpCommand, ExpCommand, rec(\n    # Needs to be defined in subclasses:\n    #   nothing\n    unary   := self >> CopyFields(self, rec(numargs := 1)),\n    binary  := self >> CopyFields(self, rec(numargs := 2)),\n    ternary := self >> CopyFields(self, rec(numargs := 3)),\n    quad    := self >> CopyFields(self, rec(numargs := 4)),\n));\n\n#F VecStoreCommand\n#F\n#F  Base class for store operations\n#F\nClass(VecStoreCommand, VecExpCommand, rec(\n    op_in    := self >> ConcatList(self.args{[1..self.numargs]} , ArgsExp),\n    op_out   := self >> [deref(self.args[1])], # ok, here is a problem\n    op_inout := self >> [],\n\n));\n\n# evaluating binary operation using 'semantic' method\n_ev_binop_semantic_mixin := rec(\n    ev := self >> self.t.value(self.semantic(self._vval(1),self. _vval(2), [])),\n);\n\n", "meta": {"hexsha": "ccb1b481756f42ccdf15bf6067f588086badafd7", "size": 4279, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/vec_ir.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/vec_ir.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/vec_ir.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.4296875, "max_line_length": 94, "alphanum_fraction": 0.6041131105, "num_tokens": 1245, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.31742626558767584, "lm_q2_score": 0.025178839231809528, "lm_q1q2_score": 0.007992424909185763}}
{"text": "#\n# GreenMachine: The GreenMachine: Hyperbolic Groups in GAP\n#\n# Implementations\n#\nInstallGlobalFunction( GreenMachine_Example,\nfunction()\n\tPrint( \"This is a placeholder function, replace it with your own code.\\n\" );\nend );\n\n", "meta": {"hexsha": "5ab696c2e1e3342437aef45fb68f702612fe24c8", "size": 225, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/GreenMachine.gi", "max_stars_repo_name": "db213/GreenMachine", "max_stars_repo_head_hexsha": "fbed716dbd4332ba0deb5110eb7f5a00335b12c8", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/GreenMachine.gi", "max_issues_repo_name": "db213/GreenMachine", "max_issues_repo_head_hexsha": "fbed716dbd4332ba0deb5110eb7f5a00335b12c8", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2018-01-14T00:50:08.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-14T00:50:08.000Z", "max_forks_repo_path": "gap/GreenMachine.gi", "max_forks_repo_name": "db213/GreenMachine", "max_forks_repo_head_hexsha": "fbed716dbd4332ba0deb5110eb7f5a00335b12c8", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.4545454545, "max_line_length": 77, "alphanum_fraction": 0.76, "num_tokens": 54, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.22815649166448126, "lm_q2_score": 0.03461884232519275, "lm_q1q2_score": 0.007898513610401831}}
{"text": "#############################################################################\n##\n#W  interact.gi                ACE Package                        Greg Gamble\n##\n##  This file  installs  commands for using ACE interactively via IO Streams.\n##    \n#Y  Copyright (C) 2000  Centre for Discrete Mathematics and Computing\n#Y                      Department of Information Technology & Electrical Eng.\n#Y                      University of Queensland, Australia.\n##\n\n#############################################################################\n####\n##\n#F  ACE_IOINDEX . . . . . . . . . . . .  Get the index of the ACEData.io list\n##  . . . . . . . . . . . . . . . . . . . . . for an interactive ACE session.\n##\nInstallGlobalFunction(ACE_IOINDEX, function(arglist)\nlocal ioIndex;\n\n  if IsEmpty(arglist) then\n    # Find the first bound ioIndex\n    ioIndex := 1;\n    while not(IsBound(ACEData.io[ioIndex])) and ioIndex < Length(ACEData.io) do\n      ioIndex := ioIndex + 1;\n    od;\n    if IsBound(ACEData.io[ioIndex]) then\n      return ioIndex;\n    else\n      Info(InfoACE + InfoWarning, 1, \n           \"No interactive ACE sessions are currently active\");\n      return fail;\n    fi;\n  elif IsBound(ACEData.io[ arglist[1] ]) then\n    return arglist[1];\n  else\n    Error(\"no such interactive ACE session\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_IOINDEX_ARG_CHK . . . . . . . . Checks for the right no. of arguments\n##  . . . . . . . . . . . . . . . . . . warns user of any  ignored  arguments \n##\nInstallGlobalFunction(ACE_IOINDEX_ARG_CHK, function(arglist)\n  if Length(arglist) > 1 then\n    Info(InfoACE + InfoWarning, 1,\n         \"Expected 0 or 1 arguments, all but first argument ignored\");\n  fi;\nend);\n\n#############################################################################\n##\n#F  ACEDataRecord([<i>]) . . . . . . . . returns the data record of a process\n##\nInstallGlobalFunction(ACEDataRecord, function( arg )\n  if not IsEmpty(arg) and arg[1] = 0 and IsBound( ACEData.ni ) then\n    return ACEData.ni;\n  else\n    return ACEData.io[ CallFuncList(ACEProcessIndex, arg) ];\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEProcessIndex . . . . . . . . . . . . . . . User version of ACE_IOINDEX\n##\n##  If given (at least) one integer argument returns the first argument if it\n##  corresponds  to  an  active  interactive  process  or  raises  an  error,\n##  otherwise it returns the default active interactive process. If the  user\n##  provides more than one argument then all arguments other than  the  first\n##  argument are ignored (and a warning is issued).\n##\nInstallGlobalFunction(ACEProcessIndex, function(arg)\nlocal ioIndex;\n  ACE_IOINDEX_ARG_CHK(arg);\n  ioIndex := ACE_IOINDEX(arg);\n  if ioIndex = fail then\n    Error( \"no currently active interactive ACE sessions\" );\n  fi;\n  return ioIndex;\nend);\n\n#############################################################################\n####\n##\n#F  ACEProcessIndices . . . . . . . . . .  Returns the list of indices of all\n##  . . . . . . . . . . . . . . . . . . .  active interactive  ACE  processes\n##\n##\nInstallGlobalFunction(ACEProcessIndices, function()\n  return Filtered( [1..Length(ACEData.io)], i -> IsBound( ACEData.io[i] ) );\nend);\n\n#############################################################################\n####\n##\n#F  IsACEProcessAlive . . . . . . . . . . Returns true if the stream  of  the\n##  . . . . . . . . . . . . . . . . . . . interactive ACE process  determined\n##  . . . . . . . . . . . . . . . . . . . by arg can be written to  (i.e.  is\n##  . . . . . . . . . . . . . . . . . . . .  still alive) and false otherwise\n##\nInstallGlobalFunction(IsACEProcessAlive, function(arg)\n  return not IsEndOfStream( CallFuncList(ACEDataRecord, arg).stream );\nend);\n\n#############################################################################\n####\n##\n#F  ACEResurrectProcess . . . . . . . . . Re-generates the stream of the i-th\n##  . . . . . . . . . . . . . . . . . . . interactive ACE process, where i is\n##  . . . . . . . . . . . . . . . . . . . determined by  arg,  and  tries  to\n##  . . . . . . . . . . . . . . . . . . . recover as much as possible of  the\n##  . . . . . . . . . . . . . . . . . . . previous state from saved values of\n##  . . . . . . . . . . . . . . . . . . . . .  the args and parameter options\n##\n##  The  args  of  the  i-th  interactive   ACE   process   are   stored   in\n##  ACEData.io[i].args (a record with fields fgens, rels and sgens, which are\n##  the   GAP   group   generators,   relators   and   subgroup   generators,\n##  respectively). Option information is saved in ACEData.io[i].options  when\n##  a user uses an interactive ACE interface function with  options  or  uses\n##  SetACEOptions. Option information is saved in ACEData.io[i].parameters if\n##  ACEParameters is used to extract from ACE the current values of  the  ACE\n##  parameter options (this is generally less reliable unless one of the  ACE\n##  modes has been run previously).\n##\n##  By default, ACEResurrectProcess  recovers  parameter  option  information\n##  from    ACEData.io[i].options    if    it    is    bound,     or     from\n##  ACEData.io[i].parameters if is bound, otherwise. To alter this behaviour,\n##  the user is provided two options:\n##\n##   use := list  . list  may  contain  one  or   both   of   \"options\"   and\n##                  \"parameters\". By default: use = [\"options\", \"parameters\"]\n##\n##   useboth  . . . (boolean) By default: useboth = false\n##\n##  If useboth is true, ACEResurrectProcess applies SetACEOptions  with  each\n##  ACEData.io[i].(field) for each field (\"options\" or \"parameters\") that  is\n##  bound and in use's list, in the order implied  by  list.  If  useboth  is\n##  false,      ACEResurrectProcess      applies      SetACEOptions      with\n##  ACEData.io[i].(field) for only the first field that  is  bound  in  use's\n##  list.\n##\nInstallGlobalFunction(ACEResurrectProcess, function(arg)\nlocal ioIndex, datarec, gens, ToACE, uselist, useone, saved, optname, field;\n\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  datarec := ACEData.io[ ioIndex ];\n  if not IsEndOfStream( datarec.stream ) then\n    Info(InfoACE + InfoWarning, 1, \n         \"Huh? Stream of interactive ACE process \", ioIndex, \" not dead?\");\n    return fail;\n  fi;\n\n  # Restart the stream\n  datarec.stream := InputOutputLocalProcess(ACEData.tmpdir, ACEData.binary, []);\n\n  if IsBound(datarec.args) and IsBound(datarec.args.fgens) then\n    gens := TO_ACE_GENS(datarec.args.fgens);\n    ToACE := function(list) WRITE_LIST_TO_ACE_STREAM(datarec.stream, list); end;\n    ToACE([ \"Group Generators: \", gens.toace, \";\" ]);\n    Info(InfoACE, 1, \"Group generators:\", datarec.args.fgens);\n    if IsBound(datarec.args.rels) then\n      ToACE([ \"Group Relators: \", \n              ACE_WORDS(datarec.args.rels, datarec.args.fgens, gens.acegens), \n              \";\" ]);\n      Info(InfoACE, 1, \"Relators:\", datarec.args.rels);\n    else\n      Info(InfoACE + InfoWarning, 1, \"No relators.\");\n    fi;\n    if IsBound(datarec.args.sgens) then\n      ToACE([ \"Subgroup Generators: \", \n              ACE_WORDS(datarec.args.sgens, datarec.args.fgens, gens.acegens), \n              \";\" ]);\n      Info(InfoACE, 1, \"Subgroup generators:\", datarec.args.sgens);\n    else\n      Info(InfoACE + InfoWarning, 1, \"No subgroup generators.\");\n    fi;\n  else\n    Info(InfoACE + InfoWarning, 1, \"No group generators.\");\n  fi;\n    \n  uselist := Filtered(ACE_VALUE_OPTION(\"use\", [\"options\", \"parameters\"]),\n                      field -> IsBound(datarec.(field)) );\n  useone := not ACE_VALUE_OPTION(\"useboth\", false);\n  if IsEmpty(uselist) then\n    Info(InfoACE + InfoWarning, 1, \"Sorry. No parameter options recovered.\");\n  else\n    if useone then\n      uselist := uselist{[1]};\n    fi;\n    if \"options\" in uselist then\n      # Scrub any non{-parameter,-strategy,-echo} options\n      for optname in Filtered(\n                         RecNames(datarec.options),\n                         function(optname)\n                           local prefname;\n                           prefname := ACEPreferredOptionName(optname);\n                           return prefname <> \"echo\" and\n                                  not (prefname in ACEStrategyOptions) and\n                                  not (prefname in RecNames(\n                                                       ACEParameterOptions\n                                                       ));\n                         end\n                         )\n      do\n        Unbind( datarec.options.(optname) );\n      od;\n      saved := rec(options := datarec.options);\n      if IsBound(datarec.parameters) then\n        saved.parameters := datarec.parameters;\n      fi;\n    else\n      saved := rec( parameters := ShallowCopy(datarec.parameters) );\n      if IsBound(datarec.options) then\n        for optname in Filtered( \n                           RecNames(datarec.options),\n                           optname -> ACEPreferredOptionName(optname) = \"echo\" \n                           )\n        do\n          saved.parameters.(optname) := datarec.options.(optname);\n        od;\n      fi;\n    fi;\n    Unbind( datarec.options );\n    for field in uselist do\n      PushOptions( saved.(field) );\n      INTERACT_SET_ACE_OPTIONS(\"ACEResurrectProcess\", datarec);\n      PopOptions();\n    od;\n    Info(InfoACE, 1, \"Options set to: \", GetACEOptions(ioIndex));\n  fi;\n  if not IsBound(datarec.options) then\n    datarec.options := rec();\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  READ_ACE_ERRORS . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . . . . reads interactive ACE output from\n##  . . . . . . . . . . . . . . . . . . . . stream  when  none  is  expected.\n##\n##  Writes any output read to Info at InfoACE + InfoWarning level 1.\n##\n##  This function may miss data output by ACE purely because it wasn't  ready\n##  at the time of the call. If it turns out that READ_ACE_ERRORS is used  in\n##  a place where it's important that all data be collected  from  ACE,  then\n##  the  call  to  READ_ACE_ERRORS  should  be  replaced   by   a   call   to\n##  ENSURE_NO_ACE_ERRORS.\n##\nInstallGlobalFunction(READ_ACE_ERRORS, function(datarec)\nlocal line;\n\n  line := ReadAllLine(datarec.stream);\n  while line <> fail do\n    if not IsMatchingSublist(line, \"** ERROR\") and\n       Length(line) > 1 and line[ Length(line) - 1 ] = ')' then\n      #a `start', `aep' or `rep' option was slipped in\n      datarec.enumResult := Chomp(line);\n      datarec.stats := ACE_STATS(datarec.enumResult);\n    fi;\n    Info(InfoACE + InfoWarning, 1, Chomp(line));\n    line := ReadAllLine(datarec.stream);\n  od;\nend);\n\n#############################################################################\n####\n##\n#F  ENSURE_NO_ACE_ERRORS  . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . . . . . . .  purges all interactive ACE\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . .  output from stream\n##\n##  Writes any output read to Info at InfoACE + InfoWarning level 1.\n##\n##  This function is like READ_ACE_ERRORS but makes ACE write \"***\" which  we\n##  use as a sentinel to ensure we get all output due to  be  collected  from\n##  ACE.\n##\nInstallGlobalFunction(ENSURE_NO_ACE_ERRORS, function(datarec)\n\n  PROCESS_ACE_OPTION(datarec.stream, \"text\", \"***\"); # Causes ACE to print \"***\"\n  FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                         line -> IsMatchingSublist(line, \"***\"));\nend);\n\n#############################################################################\n####\n##\n#F  INTERACT_TO_ACE_WITH_ERRCHK . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . .  interactive ToACE procedure with error check\n##\n##  Writes list to the interactive ACE iostream stream and reads from  stream\n##  to check for errors. Any output read is written  to  Info  at  InfoACE  +\n##  InfoWarning level 1. Used where no output is expected.\n##\nInstallGlobalFunction(INTERACT_TO_ACE_WITH_ERRCHK, function(datarec, list)\n\n  WRITE_LIST_TO_ACE_STREAM(datarec.stream, list);\n  READ_ACE_ERRORS(datarec);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_ENUMERATION_RESULT  . . . .  Get and return an ACE enumeration result\n##\n##\nInstallGlobalFunction(ACE_ENUMERATION_RESULT, function(stream, readline)\n  # Call LAST_ACE_ENUM_RESULT with first (3rd argument) set to true,\n  # so that it returns on the first enumeration result (or error) found\n  return  LAST_ACE_ENUM_RESULT(stream, readline, true);\nend);\n\n#############################################################################\n####\n##\n#F  LAST_ACE_ENUM_RESULT  . . . .  Get and return the last enumeration result\n##\n##  Enumeration result lines are recognised by being ones that end  in  \")\\n\"\n##  but not starting with \"** \" or \" \" (as ACE error diagnostics do) ... this\n##  is potentially flaky.\n##\n##  Reads and Infos lines from stream via function readline until a  sentinel\n##  \"***\" and returns the last enumeration result (or  error)  found,  unless\n##  first = true, in which case, it simply returns on the  first  enumeration\n##  result (or error) found (without looking for a sentinel \"***\").\n##\nInstallGlobalFunction(LAST_ACE_ENUM_RESULT, function(stream, readline, first)\nlocal errmsg, onbreakmsg, IsLastLine, IsEnumLine, line, enumResult;\n\n  if first = true then\n    IsLastLine := line -> true;\n    IsEnumLine := line -> Length(line) > 1 and line[ Length(line) - 1 ] = ')';\n  else\n    IsLastLine := line -> IsMatchingSublist(line, \"***\");\n    IsEnumLine := line -> line = fail or IsMatchingSublist(line, \"***\") or \n                          Length(line) > 1 and line[ Length(line) - 1 ] = ')';\n  fi;\n  repeat\n    line := Chomp(FLUSH_ACE_STREAM_UNTIL(stream, 3, 10, readline, IsEnumLine));\n    if line = fail then\n      errmsg := [\"expected to find output ...\",\n                 \"possibly, you have reached the limit of what can be\",\n                 \"written to ACEData.tmpdir (temporary directory).\"];\n      onbreakmsg :=\n                [\"You can only 'quit;' from here.\",\n                 \"You will have to redo the calculation, but before that\",\n                 \"try running 'ACEDirectoryTemporary(<dir>);' for some\",\n                 \"directory <dir> where you know you will not be so limited.\"];\n      Error(ACE_ERROR(errmsg, onbreakmsg), \"\\n\");\n    elif IsMatchingSublist(line, \"** ERROR\") then\n      Info(InfoACE + InfoWarning, 1, line);\n      line := Chomp( readline(stream) );\n      Info(InfoACE + InfoWarning, 1, line);\n      enumResult := Concatenation(\"ACE Enumeration failed: \", line);\n    elif (first = true) or not IsLastLine(line) then\n      Info(InfoACE, 2, line);\n      enumResult := line;\n    else\n      Info(InfoACE, 3, line);\n    fi;\n  until IsLastLine(line);\n  if IsMatchingSublist(enumResult, \"ACE Enum\") and first <> fail then\n    Error(enumResult, \"\\n\");\n  fi;\n  return enumResult;\nend);\n\n#############################################################################\n####\n##\n#F  ACEWrite  . . . . . . . . . . . . . . . . . . . .  Primitive write to ACE\n##\n##  Writes the last argument to the i-th interactive ACE process, where i  is\n##  the first argument if there are 2 arguments or  the  default  process  if\n##  there is only 1 argument. The action is echoed via Info at InfoACE  level\n##  4 (with a `ToACE> ' prompt). Returns true if successful in writing to the\n##  stream and fail otherwise.\n##\nInstallGlobalFunction(ACEWrite, function(arg)\n\n  if Length(arg) in [1, 2] then\n    return WRITE_LIST_TO_ACE_STREAM( \n               CallFuncList(ACEDataRecord, arg{[1..Length(arg) - 1]}).stream,\n               arg{[Length(arg)..Length(arg)]} );\n  else\n    Error(\"expected 1 or 2 arguments ... not \", Length(arg), \" arguments\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACERead . . . . . . . . . . . . . . . . . . . . . Primitive read from ACE\n##\n##  Reads a complete line of  ACE  output,  from  the  i-th  interactive  ACE\n##  process, if there is output to be read and returns fail otherwise,  where\n##  i is the first argument if there is 1 argument or the default process  if\n##  there are no arguments.\n##\nInstallGlobalFunction(ACERead, function(arg)\n\n  return ReadAllLine( CallFuncList(ACEDataRecord, arg).stream );\nend);\n\n#############################################################################\n####\n##\n#F  ACEReadAll  . . . . . . . . . . . . . . . . . . . Primitive read from ACE\n##\n##  Reads and returns as many complete lines of ACE  output,  from  the  i-th\n##  interactive ACE process, as there are to be read, as a  list  of  strings\n##  with the trailing newlines removed and returns the empty list  otherwise,\n##  where i is the first argument if there  is  1  argument  or  the  default\n##  process if there are no arguments. Also writes via Info at InfoACE  level\n##  3 each line read.\n##\nInstallGlobalFunction(ACEReadAll, function(arg)\nlocal stream, lines, line;\n\n  stream := CallFuncList(ACEDataRecord, arg).stream;\n  lines := [];\n  line := ReadAllLine(stream);\n  while line <> fail do\n    line := Chomp(line);\n    Info(InfoACE, 3, line);\n    Add(lines, line);\n    line := ReadAllLine(stream);\n  od;\n  return lines;\nend);\n\n#############################################################################\n####\n##\n#F  ACEReadUntil  . . . . . . . . . . . . . . . . . . Primitive read from ACE\n##\n##  Reads complete lines  of  ACE  output,  from  the  i-th  interactive  ACE\n##  process, until a line for which IsMyLine(line) is true, where  i  is  the\n##  first argument if the first argument is an integer or the default process\n##  otherwise, and IsMyLine is the first function argument.  The  lines  read\n##  are returned as a list of strings with the trailing newlines removed.  If\n##  IsMyLine(line) is never true ACEReadUntil will  wait  indefinitely.  Also\n##  writes via Info at InfoACE level 3 each line read. If there is  a  second\n##  function argument it is used to modify each returned line; in this  case,\n##  each line is emitted to  Info  before  modification,  but  each  line  is\n##  modified before the IsMyLine test.\n##\nInstallGlobalFunction(ACEReadUntil, function(arg)\nlocal idx1stfn, stream, IsMyLine, Modify, lines, line;\n\n  idx1stfn := First([1..Length(arg)], i -> IsFunction(arg[i]));\n  if idx1stfn = fail then\n    Error(\"expected at least one function argument\\n\");\n  elif Length(arg) > idx1stfn + 1 then\n    Error(\"expected 1 or 2 function arguments, not \", \n          Length(arg) - idx1stfn + 1, \"\\n\");\n  elif idx1stfn > 2  then\n    Error(\"expected 0 or 1 integer arguments, not \", idx1stfn - 1, \"\\n\");\n  else\n    stream := CallFuncList(ACEDataRecord, arg{[1..idx1stfn - 1]}).stream;\n    IsMyLine := arg[idx1stfn];\n    if idx1stfn = Length(arg) then\n      Modify := line -> line; # The identity function\n    else\n      Modify := arg[Length(arg)];\n    fi;\n    lines := [];\n    repeat\n      line := Chomp( ACE_READ_NEXT_LINE(stream) );\n      Info(InfoACE, 3, line);\n      line := Modify(line);\n      Add(lines, line);\n    until IsMyLine(line);\n    return lines;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_STATS . . . . . . . . . . . . . . . . Called by ACEStart and ACEStats\n##  \n##\nInstallGlobalFunction(ACE_STATS, function(line)\nlocal stats;\n\n  # Parse line for statistics and return\n  stats := Filtered(line, char -> char in \". \" or char in CHARS_DIGITS);\n  if not IsMatchingSublist(line, \"INDEX\") then\n    # Enumeration failed so the index is missing \n    # ... shove a 0 index on the front of stats\n    stats := Concatenation(\"0 \", stats);\n  fi;\n  stats := SplitString(stats, \"\", \" .\");\n\n  return rec(index     := Int(stats[1]),\n             cputime   := Int(stats[7])*10^Length(stats[8])+Int(stats[8]),\n             cputimeUnits := Concatenation(\"10^-\", String(Length(stats[8])),\n                                           \" seconds\"),\n             activecosets := Int(stats[2]),\n             maxcosets := Int(stats[9]),\n             totcosets := Int(stats[10]));\nend);\n\n#############################################################################\n####\n##\n#F  ACE_COSET_TABLE\n##\n##\nInstallGlobalFunction(ACE_COSET_TABLE, \n                      function(activecosets, acegens, iostream, readline)\nlocal n, line, genColIndex, invColIndex, table, i, rowi, j, colj, invcolj;\n\n  n := Length(acegens);\n\n  # Skip some header until the ` coset ' line\n  line := FLUSH_ACE_STREAM_UNTIL(iostream, 3, 3, readline, \n                                 line -> Length(line)>5 and\n                                         line{[1..6]} in [\" coset\", \"** ERR\"]);\n  if IsMatchingSublist(line, \"** ERROR\") then\n    line := Chomp(readline(iostream));\n    Info(InfoACE, 1, line);\n    Error(line{[3..Length(line)]}, \". Try running ACEStart first.\\n\");\n  fi;\n  # Extract the coset table column headers\n  rowi := SplitString(line, \"\", \" |\\n\");\n\n  # Look at the coset table column headers and determine the column\n  # corresponding to each generator:\n  #   colIndex[j] = Index of column(acegens[j])\n  genColIndex := List(acegens, gen -> Position(rowi, gen));\n  invColIndex := List(genColIndex, \n                      i -> ACE_IF_EXPR(\n                               i + 1 in genColIndex or i + 1 > Length(rowi),\n                               i,\n                               i + 1,\n                               0 # doesn't occur\n                               ));\n  # Discard the `---' line\n  line := Chomp( readline(iostream) );\n  Info(InfoACE, 3, line);\n\n  # Now read the body of the coset table into table as a GAP List\n  table := List([1 .. 2*n], j -> []);\n  i := 0;\n  repeat\n    line := Chomp( readline(iostream) );\n    Info(InfoACE, 3, line);\n    i := i + 1;\n    rowi := SplitString(line, \"\", \" :|\");\n    for j in [1..n] do\n      Add(table[2*j - 1], Int(rowi[ genColIndex[j] ]));\n      Add(table[2*j],     Int(rowi[ invColIndex[j] ]));\n    od;\n  until i = activecosets;\n\n  return table;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_MODE  . . . . . . . . . . . .  Start, continue or redo an enumeration\n##  . . . . . . . . . . . .  also sets enumResult and stats fields of datarec\n##\nInstallGlobalFunction(ACE_MODE, function(mode, datarec)\n  ENSURE_NO_ACE_ERRORS(datarec); # purge any output not yet collected\n                                 # e.g. error messages due to unknown \n                                 # or inappropriate options\n  WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ mode, \";\" ]);\n  datarec.enumResult := ACE_ENUMERATION_RESULT(datarec.stream, \n                                               ACE_READ_NEXT_LINE);\n  datarec.stats := ACE_STATS(datarec.enumResult);\nend);\n  \n#############################################################################\n####\n##\n#F  ACE_MODE_AFTER_SET_OPTS . . . . . . . Gets ACE stream index, sets options \n##  . . . . . . . . . . . . . . . . . . . and then calls ACE_MODE  to  start,\n##  . . . . . . . . . . . . . . . . . . . . . continue or redo an enumeration\n##\nInstallGlobalFunction(ACE_MODE_AFTER_SET_OPTS, function(mode, arglist)\nlocal ioIndex;\n  ioIndex := CallFuncList(ACEProcessIndex, arglist);\n  INTERACT_SET_ACE_OPTIONS(Flat( [\"ACE\", mode] ), ACEData.io[ioIndex]);\n  if IsEmpty( ACEGroupGenerators(ioIndex) ) then\n    Info(InfoACE + InfoWarning, 1, \"ACE\", mode, \" : No group generators?!\");\n  else\n    ACE_MODE(mode, ACEData.io[ioIndex]);\n  fi;\n  return ioIndex;\nend);\n  \n#############################################################################\n####\n##\n#F  CHEAPEST_ACE_MODE . . . . . . . . . . . . .  Does ACE_MODE(mode, datarec)\n##  . . . . . . . . . . . . . . . . . . . . . for the cheapest mode available\n##\nInstallGlobalFunction(CHEAPEST_ACE_MODE, function(datarec)\nlocal modes, mode;\n  modes := ACE_MODES( datarec );\n  mode := First( RecNames(modes), ACEmode -> modes.(ACEmode) );\n  if mode = fail then\n    Error(\"none of ACEContinue, ACERedo or ACEStart is possible. Huh???\\n\");\n  else\n    ACE_MODE(mode{[4..Length(mode)]}, datarec);\n  fi;\nend);\n  \n#############################################################################\n####\n##\n#F  ACE_LENLEX_CHK  . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . for the interactive ACE process indexed by ioIndex,\n##  . . . . . . . . . . . determine the coset  table  standardisation  scheme\n##  . . . . . . . . . . . desired by the user: if \"lenlex\" ensure  `asis'  is\n##  . . . . . . . . . . . enforced and re-emit the  relators  using  ACE_RELS\n##  . . . . . . . . . . . with 4th arg `true' to avoid ACE swapping the first\n##  . . . . . . . . . . . two generators, if  necessary;  when  found  to  be\n##  . . . . . . . . . . . necessary `start' is invoked and if  dostandard  is\n##  . . . . . . . . . . . true, `standard' is invoked. Finally the determined\n##  . . . . . . . . . . . . . coset table standardisation scheme is returned.\n##\nInstallGlobalFunction(ACE_LENLEX_CHK, function(ioIndex, dostandard)\nlocal datarec, standard;\n  datarec := ACEData.io[ ioIndex ];  \n  standard := ACE_COSET_TABLE_STANDARD( datarec.options );\n  if (standard = \"lenlex\") and IsBound(datarec.enumResult) then\n    if (not IsBound(datarec.enforceAsis) or not datarec.enforceAsis) and \n       not IsACEGeneratorsInPreferredOrder(ioIndex) then\n      datarec.enforceAsis := true;\n      PROCESS_ACE_OPTION(datarec.stream, \"relators\", \n                         ACE_RELS(ACERelators(ioIndex),\n                                  ACEGroupGenerators(ioIndex),\n                                  datarec.acegens,\n                                  true));\n      PROCESS_ACE_OPTION(datarec.stream, \"asis\", 1);\n      ACE_MODE(\"Start\", datarec);\n    fi;\n    if dostandard then\n      PROCESS_ACE_OPTION(datarec.stream, \"standard\", \"\");\n    fi;\n  fi;\n  return standard;\nend);\n\n#############################################################################\n####\n##\n#F  SET_ACE_ARGS . . . . . . . . . . . . . . . . . . . . .  Set ACEStart args\n##\n##\nInstallGlobalFunction(SET_ACE_ARGS, function(ioIndex, fgens, rels, sgens)\nlocal datarec, gens;\n  ioIndex := ACEProcessIndex(ioIndex); # Ensure ioIndex is valid\n  fgens := ACE_FGENS_ARG_CHK(fgens);\n  rels  := ACE_WORDS_ARG_CHK(fgens, rels, \"relators\");\n  sgens := ACE_WORDS_ARG_CHK(fgens, sgens, \"subgp gen'rs\");\n  \n  gens := TO_ACE_GENS(fgens);\n  datarec := ACEData.io[ ioIndex ];\n  datarec.enforceAsis \n      := ( DATAREC_VALUE_ACE_OPTION(datarec, false, \"lenlex\") or\n           VALUE_ACE_OPTION( ACE_OPT_NAMES(), false, \"lenlex\") ) and\n         not IsACEGeneratorsInPreferredOrder(fgens, rels, \"noargchk\");\n  datarec.echoargs := true; # If echo option is set INTERACT_SET_ACE_OPTIONS\n                            # will echo args\n  PROCESS_ACE_OPTION(datarec.stream, \"group\", gens.toace);\n  PROCESS_ACE_OPTION(datarec.stream, \"relators\", \n                     ACE_RELS(rels, fgens, gens.acegens, datarec.enforceAsis));\n  PROCESS_ACE_OPTION(datarec.stream, \"generators\", \n                     ACE_WORDS(sgens, fgens, gens.acegens));\n  if datarec.enforceAsis then\n    PROCESS_ACE_OPTION(datarec.stream, \"asis\", 1);\n  fi;\n  datarec.args := rec(fgens := fgens, rels := rels, sgens := sgens);\n  datarec.acegens := gens.acegens;\n  return ioIndex;\nend);\n  \n#############################################################################\n####\n##\n#F  NO_START_DO_ACE_OPTIONS . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . If set is true, set options for the  ACEStart\n##  . . . . . . . . . . . . . . process indexed by ioIndex. If one of the new\n##  . . . . . . . . . . . . . . options evokes an enumeration the  enumResult\n##  . . . . . . . . . . . . . . and stats fields are re-set. All  ACE  output\n##  . . . . . . . . . . . . . . is flushed. Called when no `start'  directive\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  is needed.\n##\n##\nInstallGlobalFunction(NO_START_DO_ACE_OPTIONS, function(ioIndex, set)\nlocal datarec, setEnumResult;\n  datarec := ACEDataRecord(ioIndex);\n  if not IsEmpty(OptionsStack) then\n    setEnumResult := VALUE_ACE_OPTION( ACE_OPT_NAMES(), \n                                       fail, \n                                       [\"start\", \"aep\", \"rep\"] ) <> fail;\n    if set then\n      INTERACT_SET_ACE_OPTIONS(\"ACEStart\", datarec);\n    fi;\n    PROCESS_ACE_OPTION(datarec.stream, \"text\", \"***\");\n    if setEnumResult then\n      datarec.enumResult \n          := LAST_ACE_ENUM_RESULT(datarec.stream, ACE_READ_NEXT_LINE, fail);\n      if IsEmpty( ACEGroupGenerators(ioIndex) ) then\n        Info(InfoACE + InfoWarning, 1, \"ACEStart : No group generators?!\");\n        Unbind(datarec.enumResult);\n        Unbind(datarec.stats);\n      else\n        datarec.stats := ACE_STATS(datarec.enumResult);\n      fi;\n    else\n      FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                             line -> IsMatchingSublist(line, \"***\"));\n    fi;\n  fi;\nend);\n  \n#############################################################################\n####\n##\n#F  ACEStart . . . . . . . . . . . . . .  Initiate an interactive ACE session\n##\n##\nInstallGlobalFunction(ACEStart, function(arg)\nlocal start, ioIndex, stream, datarec, gens;\n\n  if Length(arg) > 5 then\n    Error(\"expected at most 5 arguments ... not \", Length(arg), \n          \" arguments.\\n\");\n  elif Length(arg) = 2 and arg[1] <> 0 then\n    Error(\"when called with 2 arguments, first argument should be 0.\\n\");\n  elif not IsEmpty(arg) and arg[1] = 0 then\n    start := false;\n    arg := arg{[2..Length(arg)]};\n  else\n    start := true;\n  fi;\n\n  if Length(arg) in [3, 4] then\n    if Length(arg) = 3 then #args are: fgens,  rels,  sgens\n      ioIndex := CALL_ACE( \"ACEStart\", arg[1], arg[2], arg[3] );\n    else             #arg{[2..4]} are: fgens,  rels,  sgens\n      ioIndex := SET_ACE_ARGS( arg[1], arg[2], arg[3], arg[4] );\n      NO_START_DO_ACE_OPTIONS(ioIndex, true);\n    fi;\n    if start then\n      if IsEmpty( ACEGroupGenerators(ioIndex) ) then\n        Info(InfoACE + InfoWarning, 1, \"ACEStart : No group generators?!\");\n      else\n        ACE_MODE( \"Start\", ACEData.io[ ioIndex ] );\n      fi;\n    elif Length(arg) = 3 then\n      NO_START_DO_ACE_OPTIONS(ioIndex, false);\n    fi;\n  elif Length(arg) <= 1 and start then\n    ioIndex := ACE_MODE_AFTER_SET_OPTS(\"Start\", arg);\n  else # start = false\n    if Length(arg) = 1 then\n      ioIndex := CallFuncList(ACEProcessIndex, arg);\n    else\n      stream := InputOutputLocalProcess(ACEData.tmpdir, ACEData.binary, []);\n      if stream = fail then\n        Error(\"sorry! Run out of pseudo-ttys. Can't initiate stream.\\n\");\n      else\n        Add( ACEData.io, rec(stream := stream, options := rec()) );\n        ioIndex := Length(ACEData.io);\n        ACEData.io[ioIndex].procId := ioIndex;\n      fi;\n    fi;\n    NO_START_DO_ACE_OPTIONS(ioIndex, true);\n  fi;\n  ACE_LENLEX_CHK(ioIndex, false);\n  return ioIndex;\nend);\n\n#############################################################################\n##\n#F  ACEQuit . . . . . . . . . . . . . . . .  Close an interactive ACE session\n##\nInstallGlobalFunction(ACEQuit, function(arg)\nlocal ioIndex;\n\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  CloseStream(ACEData.io[ioIndex].stream);\n  Unbind(ACEData.io[ioIndex]);\nend);\n\n#############################################################################\n##\n#F  ACEQuitAll . . . . . . . . . . . . . . Close all interactive ACE sessions\n##\nInstallGlobalFunction(ACEQuitAll, function()\nlocal ioIndex;\n\n  for ioIndex in [1 .. Length(ACEData.io)] do\n    if IsBound(ACEData.io[ioIndex]) then\n      CloseStream(ACEData.io[ioIndex].stream);\n      Unbind(ACEData.io[ioIndex]);\n    fi;\n  od;\nend);\n\n#############################################################################\n##\n#F  ACE_MODES . . . . . . . . . .  Returns a record of which of the ACE modes\n##  . . . . . . . . . . . . . . . . . . Continue, Redo and Start are possible\n##\nInstallGlobalFunction(ACE_MODES, function(datarec)\nlocal modes;\n\n  READ_ACE_ERRORS(datarec);\n  WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"mode;\" ]);\n  modes := SplitString(FLUSH_ACE_STREAM_UNTIL(\n                           datarec.stream, 3, 2, ACE_READ_NEXT_LINE,\n                           line -> IsMatchingSublist(line, \"start = \")\n                           ),\n                       \"\",\n                       \" =,\\n\");\n  return rec(ACEContinue := modes[4] = \"yes\", # Modes in order of `cheapness'\n             ACERedo     := modes[6] = \"yes\",\n             ACEStart    := modes[2] = \"yes\");\nend);\n\n#############################################################################\n##\n#F  ACEModes  . . . . . . . . . . . .  Returns a record of which of the modes\n##  . . . . . . . . . . . . .  ACEContinue, ACERedo and ACEStart are possible\n##\nInstallGlobalFunction(ACEModes, function(arg)\n  return ACE_MODES( CallFuncList(ACEDataRecord, arg) );\nend);\n\n#############################################################################\n####\n##\n#F  ACEContinue  . . . . . . . . . . . .  Continue an interactive ACE session\n##\n##\nInstallGlobalFunction(ACEContinue, function(arg)\n  return ACE_MODE_AFTER_SET_OPTS(\"Continue\", arg);\nend);\n\n#############################################################################\n####\n##\n#F  ACERedo . . . . . . . . . . . . . . . . . Redo an interactive ACE session\n##\n##\nInstallGlobalFunction(ACERedo, function(arg)\n  return ACE_MODE_AFTER_SET_OPTS(\"Redo\", arg);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_EQUIV_PRESENTATIONS . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . . called  by   ACEAllEquivPresentations\n##  . . . . . . . . . . . . . . . . . . and ACERandomEquivPresentations where\n##  . . . . . . . . . . . . . . . . . . . . string matches the last line read\n##\nInstallGlobalFunction(ACE_EQUIV_PRESENTATIONS, function(ioIndex, string)\nlocal datarec, out, run;\n  datarec := ACEData.io[ ioIndex ];\n  out := rec(line := FLUSH_ACE_STREAM_UNTIL(\n                         datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                         line -> Length(line) > 5 and\n                                 line{[1..6]} in [ \"Group \", \"** ERR\" ] \n                         ),\n             runs := []);\n  if IsMatchingSublist(out.line, \"** ERROR\") then\n    # Can only happen for ACERandomEquivPresentations\n    out.line := ACEReadUntil(ioIndex, \n                             line -> IsMatchingSublist(line, string))[1];\n    Error(\"ACERandomEquivPresentations:\", out.line{[3..Length(out.line)]});\n  fi;\n  while not IsMatchingSublist(out.line, string) do\n    run := rec(rels := ACE_GAP_WORDS(datarec,\n                                     ACE_PARAMETER_WITH_LINE(ioIndex, \n                                                             \"Group Relators\",\n                                                             out.line)),\n               enumResult := ACE_ENUMERATION_RESULT(datarec.stream,\n                                                    ACE_READ_NEXT_LINE));\n    run.stats := ACE_STATS(run.enumResult);\n    Add(out.runs, run);\n    out.line := ACE_READ_NEXT_LINE(datarec.stream);\n    Info(InfoACE, 3, Chomp(out.line));\n  od;\n  return out;\nend);\n#############################################################################\n####\n##\n#F  ACEAllEquivPresentations . . . . . . . Tests all equivalent presentations\n##\n##  For the i-th interactive ACE process, generates and tests an  enumeration\n##  for combinations of relator  ordering,  relator  rotations,  and  relator\n##  inversions, according to the value of optval,  where  i  and  optval  are\n##  determined by arg. The argument optval is considered as a binary  number;\n##  its three bits are treated as flags, and control relator  rotations  (the\n##  2^0 bit), relator inversions (the 2^1 bit) and relator orderings (the 2^2\n##  bit), respectively; 1 means `active' and 0 means `inactive'.\n##\n##  Outputs a record with fields:\n##\n##    primingResult \n##        the ACE enumeration result message of the priming run;\n##\n##    primingStats\n##        the enumeration result of the priming run as  a  GAP  ACEStats-like\n##        record;\n##\n##    equivRuns\n##        a list of data records, one for each run,  where  each  record  has\n##        fields:\n##\n##      rels\n##        the relators in the order used for the run,\n##\n##      enumResult\n##        the ACE enumeration result message of the run, and\n##\n##      stats\n##        the enumeration result as a GAP ACEStats-like record;\n##\n##    summary\n##        a record with fields:\n##\n##      successes\n##        the total number of  successful  (i.e.  having  finite  enumeration\n##        index) runs,\n##\n##      runs\n##        the total number of equivalent presentation runs executed,\n##\n##      maxcosetsRange\n##        the  range  of  values  as   a   GAP   list   inside   which   each\n##        `equivRuns[i].maxcosets' lies, and\n##\n##      totcosetsRange\n##        the  range  of  values  as  a  {\\GAP}  list   inside   which   each\n##        `equivRuns[i].totcosets' lies.\n##\nInstallGlobalFunction(ACEAllEquivPresentations, function(arg)\nlocal ioIndexAndOptval, ioIndex, datarec, aep, epRec, line;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  ioIndex := ioIndexAndOptval[1];\n  datarec := ACEData.io[ ioIndex ];\n\n  line := EXEC_ACE_DIRECTIVE_OPTION(ioIndexAndOptval, \"aep\", 3, \n                                    line -> IsMatchingSublist(line, \"* P\"), \n                                    \"\", false);\n  if not IsMatchingSublist(line, \"* P\") then\n    Error(\"ACEAllEquivPresentations:\", line{[3..Length(line)]});\n  fi;\n\n  aep := rec(primingResult := ACE_ENUMERATION_RESULT(datarec.stream,\n                                                     ACE_READ_NEXT_LINE));\n  aep.primingStats := ACE_STATS(aep.primingResult);\n\n  epRec := ACE_EQUIV_PRESENTATIONS(ioIndex, \"* There were\");\n  aep.equivRuns := epRec.runs;\n\n  line := SplitString(epRec.line, \"\", \"* Therwsucinu:\\n\");\n  aep.summary := rec(successes := Int(line[1]), runs := Int(line[2]));\n  line := Chomp( ACE_READ_NEXT_LINE(datarec.stream) );\n  Info(InfoACE, 3, line);\n  line := SplitString(line, \"\", \"* maxcost=,\");\n  aep.summary.maxcosetsRange\n       := EvalString( Concatenation( \"[\", line[1], \"]\" ) );\n  aep.summary.totcosetsRange\n       := EvalString( Concatenation( \"[\", line[2], \"]\" ) );\n  return aep;\nend);\n\n#############################################################################\n####\n##\n#F  ACERandomEquivPresentations . . . . . Tests a number of random equivalent \n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . presentations\n##\n##  For the i-th interactive  ACE  process,  generates  and  tests  n  random\n##  enumeration for combinations of relator ordering, relator rotations,  and\n##  relator inversions,  according  to  the  value  of  optval,  where  n  is\n##  determined by optval, and  i  and  optval  are  determined  by  arg.  The\n##  argument optval is considered as a binary  number;  its  three  bits  are\n##  treated as flags, and control relator rotations (the  2^0  bit),  relator\n##  inversions  (the  2^1  bit)  and  relator  orderings   (the   2^2   bit),\n##  respectively; 1 means `active' and 0 means `inactive'.\n##\n##  Outputs a list of records, each record of which has fields:\n##\n##    rels\n##        the relators in the order used for a presentation run,\n##\n##    enumResult\n##        the ACE enumeration result message of the run, and\n##\n##    stats\n##        the enumeration result of the run as a GAP ACEStats-like record.\n##\nInstallGlobalFunction(ACERandomEquivPresentations, function(arg)\nlocal ioIndexAndOptval, ioIndex, datarec, stream;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  ioIndex := ioIndexAndOptval[1];\n  datarec := ACEData.io[ ioIndex ];\n  stream := datarec.stream;\n\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n  PROCESS_ACE_OPTION(stream, \"rep\", ioIndexAndOptval[2]);\n  PROCESS_ACE_OPTION(stream, \"text\", \"------------------------------------\");\n\n  return ACE_EQUIV_PRESENTATIONS(ioIndex, \"------------\").runs;\nend);\n\n#############################################################################\n####\n##\n#F  ACEGroupGenerators  . . . . . . . . . . . Return the GAP group generators\n##  . . . . . . . . . . . . . . . . . . . . . . of an interactive ACE session\n##\n##\nInstallGlobalFunction(ACEGroupGenerators, function(arg)\nlocal datarec, ioIndex;\n\n  datarec := CallFuncList(ACEDataRecord, arg);\n  ioIndex := datarec.procId;\n  if not( IsBound( datarec.args ) and IsBound( datarec.args.fgens ) ) then\n    Info(InfoACE + InfoWarning, 1, \n         \"No group generators saved. Setting value(s) from ACE ...\");\n    return ACE_ARGS(ioIndex, \"fgens\");\n  else\n    return datarec.args.fgens;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACERelators . . . . . . . . . . . . . . . . . . . Return the GAP relators\n##  . . . . . . . . . . . . . . . . . . . . . . of an interactive ACE session\n##\n##\nInstallGlobalFunction(ACERelators, function(arg)\nlocal datarec, ioIndex;\n\n  datarec := CallFuncList(ACEDataRecord, arg);\n  ioIndex := datarec.procId;\n  if not( IsBound( datarec.args ) and IsBound( datarec.args.rels ) ) then\n    Info(InfoACE + InfoWarning, 1, \n         \"No relators saved. Setting value(s) from ACE ...\");\n    return ACE_ARGS(ioIndex, \"rels\");\n  else\n    return datarec.args.rels;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACESubgroupGenerators . . . . . . . .  Return the GAP subgroup generators\n##  . . . . . . . . . . . . . . . . . . . . . . of an interactive ACE session\n##\n##\nInstallGlobalFunction(ACESubgroupGenerators, function(arg)\nlocal datarec, ioIndex;\n\n  datarec := CallFuncList(ACEDataRecord, arg);\n  ioIndex := datarec.procId;\n  if not( IsBound( datarec.args ) and IsBound( datarec.args.sgens ) ) then\n    Info(InfoACE + InfoWarning, 1, \n         \"No subgroup generators saved. Setting value(s) from ACE ...\");\n    return ACE_ARGS(ioIndex, \"sgens\");\n  else\n    return datarec.args.sgens;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  DISPLAY_ACE_REC_FIELD . . . . . . . . . . . . . Displays  a  record  that\n##  . . . . . . . . . . . . . . . . . . . . . . . . is itself a record  field\n##\n##\nInstallGlobalFunction(DISPLAY_ACE_REC_FIELD, function(datarec, field)\n\n  if not IsBound(datarec.(field)) or datarec.(field) = rec() then\n    Print(\"No \", field, \".\\n\");\n  else\n    Display(datarec.(field));\n    Print(\"\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  DisplayACEOptions . . . . . . . . . . .  Displays the current ACE options\n##\n##\nInstallGlobalFunction(DisplayACEOptions, function(arg)\n  DISPLAY_ACE_REC_FIELD( CallFuncList(ACEDataRecord, arg), \"options\" );\nend);\n\n#############################################################################\n####\n##\n#F  DisplayACEArgs  . . . . . . . . . . . . . . Displays the current ACE args\n##\n##\nInstallGlobalFunction(DisplayACEArgs, function(arg)\n  DISPLAY_ACE_REC_FIELD( CallFuncList(ACEDataRecord, arg), \"args\" );\nend);\n\n#############################################################################\n####\n##\n#F  GET_ACE_REC_FIELD . . . . . . . . . . . . . . .  Returns a record that is\n##  . . . . . . . . . . . . . . . . . . . . . . . .  itself  a  record  field\n##  . . . . . . . . . . . . . . . . . . . . . . . .  associated   with     an\n##  . . . . . . . . . . . . . . . . . . . . . . . . . interactive ACE process\n##\n##\nInstallGlobalFunction(GET_ACE_REC_FIELD, function(arglist, field)\nlocal datarec;\n\n  datarec := CallFuncList(ACEDataRecord, arglist);\n  if not IsBound(datarec.(field)) or datarec.(field) = rec() then\n    Info(InfoACE + InfoWarning, 1, \"No \", field, \" saved.\");\n    return rec();\n  else\n    return datarec.(field);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  GetACEOptions . . . . . . . . . . . . . . Returns the current ACE options\n##\n##\nInstallGlobalFunction(GetACEOptions, function(arg)\n  return GET_ACE_REC_FIELD(arg, \"options\");\nend);\n\n#############################################################################\n####\n##\n#F  GetACEArgs . . . . . . . . . . . . . . . . . Returns the current ACE args\n##\n##\nInstallGlobalFunction(GetACEArgs, function(arg)\n  return GET_ACE_REC_FIELD(arg, \"args\");\nend);\n\n#############################################################################\n####\n##\n#F  SET_ACE_OPTIONS . . . . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . . . . . . . . . . . . . Called by SetACEOptions\n##\n##  SetACEOptions has two forms: the  interactive  version  (below)  and  the\n##  non-interactive version defined locally  within  ACECosetTable.  For  the\n##  interactive version the data record datarec  is  ACEData.io[ioIndex]  for\n##  some integer ioIndex. For the non-interactive version, which will only be\n##  invoked from within a break-loop, datarec is ACEData.\n##\nInstallGlobalFunction(SET_ACE_OPTIONS, function(datarec)\nlocal newoptnames;\n\n  datarec.newoptions := NEW_ACE_OPTIONS();\n  # First we need to scrub any option names in datarec.options that\n  # match those in datarec.newoptions ... to ensure that *all* new\n  # options are at the end of the stack\n  SANITISE_ACE_OPTIONS(datarec.options, datarec.newoptions);\n  PopOptions();\n  Add(OptionsStack, datarec.options);\n  PushOptions(datarec.newoptions);\n  # The following is needed when SetACEOptions is invoked via ACEExample\n  Unbind(OptionsStack[ Length(OptionsStack) ].aceexampleoptions);\n  datarec.options := ShallowCopy( OptionsStack[ Length(OptionsStack) ] );\n  # We ensure OptionsStack is the same length as before the call to \n  # SET_ACE_OPTIONS, and ensure the updated options are on top\n  PopOptions();\n  PopOptions();\n  Add(OptionsStack, datarec.options);\n  newoptnames := RecNames(datarec.newoptions);\n  Unbind(datarec.newoptions);\n  return newoptnames;\nend);\n\n#############################################################################\n####\n##\n#F  ECHO_ACE_ARGS . . . . . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . . . . . . . . . . Echoes  the  values  of   the\n##  . . . . . . . . . . . . . . . . . . . . . . fields: fgens, rels, sgens of\n##  . . . . . . . . . . . . . . . . . . . . . . args  submitted  to  function\n##  . . . . . . . . . . . . . . . . . . . . . . ACEfname if echo is positive.\n##\nInstallGlobalFunction(ECHO_ACE_ARGS, function(echo, ACEfname, args)\n  if echo > 0 then\n    Print(ACEfname, \" called with the following arguments:\\n\");\n    Print(\" Group generators : \", args.fgens, \"\\n\");\n    Print(\" Group relators : \", args.rels, \"\\n\");\n    Print(\" Subgroup generators : \", args.sgens, \"\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  INTERACT_SET_ACE_OPTIONS  . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . . . . . . . . . . .  Passes new options to  ACE\n##  . . . . . . . . . . . . . . . . . . . . . . .  and updates stored options\n##\n##  Called by the ACE function with name ACEfname and with datarec  equal  to\n##  ACEData.io[ioIndex] for some integer ioIndex,  the  updated  options  are\n##  stored in datarec.options.\n##\nInstallGlobalFunction(INTERACT_SET_ACE_OPTIONS, function(ACEfname, datarec)\nlocal newoptnames, s, optnames, echo, ignored;\n  datarec.modereqd := false;\n  if not(IsEmpty(OptionsStack) or\n         ForAll(RecNames(OptionsStack[ Length(OptionsStack) ]),\n                optname -> optname in ACE_INTERACT_FUNC_OPTIONS)) then\n    if IsBound(datarec.options) then\n      newoptnames := SET_ACE_OPTIONS(datarec);\n    else\n      datarec.options := NEW_ACE_OPTIONS();\n      newoptnames := RecNames(datarec.options);\n    fi;\n    optnames := RecNames(datarec.options);\n    newoptnames := Filtered(\n                       newoptnames,\n                       optname -> not(optname in ACE_INTERACT_FUNC_OPTIONS));\n    ignored := List(VALUE_ACE_OPTION(newoptnames, [], \"aceignore\"),\n                    optname -> ACEPreferredOptionName(optname));\n    datarec.modereqd := ForAny(newoptnames, \n                               function(optname)\n                                 local prefname;\n                                 \n                                 prefname := ACEPreferredOptionName(optname);\n                                 return not(prefname in NonACEbinOptions or\n                                            prefname in ignored);\n                               end);\n    if ForAny(newoptnames, \n              optname -> ACEPreferredOptionName(optname)\n                         in [\"group\", \"relators\", \"generators\"]) then\n      for s in [ \"Detected usage of a synonym of one (or more) of the options:\",\n                 \"    `group', `relators', `generators'.\",\n                 \"Discarding current values of args.\",\n                 \"(The new args will be extracted from ACE, later).\" ]\n      do\n        Info(InfoACE + InfoWarning, 1, s);\n      od;\n      Unbind(datarec.args);\n      Unbind(datarec.acegens);\n    fi;\n    echo := ACE_VALUE_ECHO(optnames);\n    if IsBound(datarec.echoargs) then\n      if IsBound(datarec.args) then\n        ECHO_ACE_ARGS( echo, ACEfname, datarec.args );\n      fi;\n      Unbind(datarec.echoargs);\n    fi;\n    PROCESS_ACE_OPTIONS(ACEfname, optnames, newoptnames, echo, datarec,\n                        # disallowed (options) ... none\n                        rec(),\n                        # ignored\n                        Concatenation( [ \"aceinfile\", \"aceoutfile\" ],\n                                       ignored,\n                                       ACE_IF_EXPR(\n                                           IsBound(datarec.enforceAsis)\n                                           and datarec.enforceAsis,\n                                                   [ \"asis\" ], [], []) ));\n  fi;\nend);\n  \n#############################################################################\n####\n##\n#F  SetACEOptions . . . . . . . . . . . .  Interactively, passes  new options \n##  . . . . . . . . . . . . . . . . . . .  to ACE and updates stored  options\n##\nInstallGlobalFunction(SetACEOptions, function(arg)\nlocal datarec;\n\n  if Length(arg) > 2 then\n    Error(\"expected 0, 1 or 2 arguments ... not \", Length(arg), \" arguments\\n\");\n  elif Length(arg) in [1, 2] and IsRecord( arg[Length(arg)] ) then\n    if not IsEmpty(OptionsStack) then\n      Info(InfoACE + InfoWarning, 1,\n           \"Non-empty OptionsStack: SetACEOptions may have been called with\");\n      Info(InfoACE + InfoWarning, 1,\n           \"both a record argument and options. The order options are listed\");\n      Info(InfoACE + InfoWarning, 1,\n           \"may be incorrect. Please use separate calls to SetACEOptions,\");\n      Info(InfoACE + InfoWarning, 1,\n           \"e.g. 'SetACEOptions(<optionsRec>); SetACEOptions(: <options>);' \");\n    fi;\n    PushOptions( arg[Length(arg)] );\n    datarec := CallFuncList(ACEDataRecord, arg{[1..Length(arg) - 1]});\n    INTERACT_SET_ACE_OPTIONS(\"SetACEOptions\", datarec);\n    PopOptions();\n  elif Length(arg) <= 1 then\n    datarec := CallFuncList(ACEDataRecord, arg);\n    INTERACT_SET_ACE_OPTIONS(\"SetACEOptions\", datarec);\n  else\n    Error(\"2nd argument should have been a record\\n\");\n  fi;\n  if datarec.modereqd then\n    CHEAPEST_ACE_MODE(datarec); \n  fi;\n  ACE_LENLEX_CHK(datarec.procId, false);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_PARAMETER_WITH_LINE . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . for the ACE process  of  index  ioIndex\n##  . . . . . . . . . . . . . . . . . returns ACE's value  of  the  parameter\n##  . . . . . . . . . . . . . . . . . identified by string starting with line\n##\nInstallGlobalFunction(ACE_PARAMETER_WITH_LINE, function(ioIndex, string, line)\n  # Remove \"<string>: \" and trailing newline\n  line := line{[Length(string) + 3 .. Length(line) - 1]};\n  if line = \"\" or line[ Length(line) ] <> ';' then\n    line := Flat([line,\n                  List(ACEReadUntil(ioIndex, line -> line[Length(line)] = ';'),\n                       line -> line{[3..Length(line)]}) # Scrub two blanks at\n                                                        # beginning of lines\n                  ]);\n  fi;\n  # Remove any blanks after commas and trailing ';'\n  return ReplacedString(line{[1..Length(line) - 1]}, \", \", \",\");\nend);\n\n#############################################################################\n####\n##\n#F  ACE_PARAMETER . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . .  for the ACE process of index ioIndex\n##  . . . . . . . . . . . . . . . . . .  returns ACE's value of the parameter\n##  . . . . . . . . . . . . . . . . . . . . . . . . . .  identified by string\n##\nInstallGlobalFunction(ACE_PARAMETER, function(ioIndex, string)\nlocal line;\n  line := FLUSH_ACE_STREAM_UNTIL(ACEData.io[ ioIndex ].stream, 3, 3, \n                                 ACE_READ_NEXT_LINE, \n                                 line -> Length(line) >= Length(string) and\n                                         line{[1..Length(string)]} = string);\n  return ACE_PARAMETER_WITH_LINE(ioIndex, string, line);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_GAP_WORDS . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . .  returns the translation into GAP of an ACE list of words\n##\n##  ACE stores words according to the BNF:\n##      <word>      = <element> <word> | \"(\" <word> \")^\" <power>\n##      <power>     = <integer>\n##      <element>   = <generator> | <inverse>\n##      <generator> = <integer> <space> | <lowercase letter>\n##      <inverse>   = \"-\" <generator> | <uppercase letter> \n##\nInstallGlobalFunction(ACE_GAP_WORDS, function(datarec, words)\nlocal GAPWord;\n  \n  GAPWord := function(word)\n  local power, parts, elements;\n    if word[1] = '(' then\n      parts := SplitString(word, \"\", \"()^\");\n      word := parts[1];\n      power := Int(parts[2]);\n    else\n      power := 1;\n    fi;\n    if IsDigitChar(word[1]) or word[1] = '-' then\n      elements := List(SplitString(word, \" \"), Int);\n      # Convert to GAP elements\n      elements := List(elements, \n                       function(element)\n                         if element < 0 then\n                           return datarec.args.fgens[ AbsInt(element) ]^-1;\n                         else\n                           return datarec.args.fgens[element];\n                         fi;\n                       end);\n    else\n      elements := List([1..Length(word)], i -> WordAlp(word, i));\n      # Convert to GAP elements\n      elements := List(elements, \n                       function(element)\n                         if IsUpperAlphaChar(element[1]) then\n                           return datarec.args.fgens[ \n                                      Position(\n                                          datarec.acegens,\n                                          LowercaseString(element)\n                                          )\n                                      ]^-1;\n                         else\n                           return datarec.args.fgens[ Position(datarec.acegens, \n                                                              element) ];\n                         fi;\n                       end);\n    fi;\n    return Product( elements, One(datarec.args.fgens[1]) )^power;\n  end;\n\n  return List(SplitString(words, ','), GAPWord);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_GENS  . . . . . . . . . . . . . . . . . . . . . .  Internal procedure\n##  . . . . . . . . . . . . . . . sets datarec.args.fgens and datarec.acegens\n##  . . . . . . . . . . . . . . . from the value of ACE's \"Group  Generators\"\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . parameter\n##\nInstallGlobalFunction(ACE_GENS, function(datarec, string)\nlocal line;\n  if IsAlphaChar(string[1]) then\n    datarec.acegens := List([1..Length(string)], i -> WordAlp(string, i));\n    datarec.args.fgens := GeneratorsOfGroup( FreeGroup(datarec.acegens) );\n  else\n    datarec.acegens := List([1..Int(string)], i -> String(i));\n    datarec.args.fgens := GeneratorsOfGroup(FreeGroup(\n                                                List(datarec.acegens, \n                                                     s -> Flat([\"x\", s]))\n                                                ));\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_ARGS  . . . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . for the ACE process indexed by  ioIndex  sets\n##  . . . . . . . . . . . . . and returns ACEDataRecord(ioIndex).args.(field)\n##  . . . . . . . . . . . . . . . . . . .  according to ACE's parameter value\n##\n##  If      ACEDataRecord(ioIndex).args      is      unset,      it       and\n##  ACEDataRecord(ioIndex).acegens are set according to the  values  held  by\n##  the ACE process indexed by ioIndex.\n##\nInstallGlobalFunction(ACE_ARGS, function(ioIndex, field)\nlocal datarec, line;\n  datarec := ACEDataRecord(ioIndex);\n  if not IsBound(datarec.args) then\n    datarec.args := rec();\n  fi;\n  if not IsBound(datarec.args.fgens) or field = \"fgens\" then\n    WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"sr:1;\" ]);\n    line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                                   line -> Length(line) > 8 and\n                                           line{[1..9]} in [ \"Group Gen\",\n                                                             \"Group Rel\" ]);\n    if IsMatchingSublist(line, \"Group Gen\") then\n      ACE_GENS(datarec, ACE_PARAMETER_WITH_LINE(ioIndex, \n                                                \"Group Generators\", \n                                                line));\n    else\n      datarec.acegens := [];\n      datarec.args.fgens := [];\n    fi;\n  else\n    WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"sr;\" ]);\n  fi;\n  if not IsBound(datarec.args.rels) or field = \"rels\" then\n    if not IsBound(line) or not IsMatchingSublist(line, \"Group Rel\") then\n      line := FLUSH_ACE_STREAM_UNTIL(\n                  datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                  line -> IsMatchingSublist(line, \"Group Rel\") );\n    fi;\n    datarec.args.rels := ACE_GAP_WORDS(datarec,\n                                       ACE_PARAMETER_WITH_LINE(\n                                           ioIndex, \"Group Relators\", line\n                                           ));\n  fi;\n  if not IsBound(datarec.args.sgens) or field = \"sgens\" then\n    datarec.args.sgens := ACE_GAP_WORDS(datarec,\n                                        ACE_PARAMETER(ioIndex, \n                                                      \"Subgroup Generators\"));\n  fi;\n  FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                         line -> IsMatchingSublist(line, \"  #--\"));\n  return datarec.args.(field);\nend);\n\n#############################################################################\n####\n##\n#F  ACEParameters . . . . . .  Returns the ACE value of ACE parameter options\n##\n##  Also ensures for the interactive ACE process indexed by i that  the  args\n##  and acegens fields of  ACEData.io[i]  are  set.  If  not,  it  sets  them\n##  according to the values held by ACE process i (the assumption being  that\n##  the user started the process via 'ACEStart(0);').\n##\nInstallGlobalFunction(ACEParameters, function(arg)\nlocal ioIndex, datarec, line, fieldsAndValues, parameters, sgens, i, opt, val;\n\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  datarec := ACEData.io[ ioIndex ];\n  READ_ACE_ERRORS(datarec);\n  WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"sr:1;\" ]);\n  datarec.parameters \n      := rec(enumeration := ACE_PARAMETER(ioIndex, \"Group Name\"));\n  parameters := datarec.parameters;\n  if not IsBound(datarec.args) then\n    datarec.args := rec();\n  fi;\n  if not IsBound(datarec.acegens) or not IsBound(datarec.args.fgens) then\n    line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                                   line -> Length(line) > 8 and\n                                           line{[1..9]} in [ \"Group Gen\",\n                                                             \"Group Rel\" ]);\n    if IsMatchingSublist(line, \"Group Gen\") then\n      ACE_GENS(datarec, ACE_PARAMETER_WITH_LINE(ioIndex, \n                                                \"Group Generators\", \n                                                line));\n    else\n      datarec.args.fgens := [];\n      datarec.acegens := [];\n    fi;\n  fi;\n  if not IsBound(datarec.args.rels) then\n    if not IsBound(line) or not IsMatchingSublist(line, \"Group Rel\") then\n      line := FLUSH_ACE_STREAM_UNTIL(\n                  datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                  line -> IsMatchingSublist(line, \"Group Rel\"));\n    fi;\n    datarec.args.rels := ACE_GAP_WORDS(datarec,\n                                       ACE_PARAMETER_WITH_LINE(\n                                           ioIndex, \"Group Relators\", line\n                                           ));\n  fi;\n  parameters.subgroup := ACE_PARAMETER(ioIndex, \"Subgroup Name\");\n  sgens := ACE_PARAMETER(ioIndex, \"Subgroup Generators\");\n  if not IsBound(datarec.args.sgens) then\n    datarec.args.sgens := ACE_GAP_WORDS(datarec, sgens);\n  fi;\n  fieldsAndValues :=\n      SplitString( \n          ReplacedString(\n              Flat( ACEReadUntil(ioIndex, \n                                 line -> IsMatchingSublist(line, \"C:\")) ),\n              \"Fi:\", \"Fil:\"\n              ),\n          \"\", \" :;\" \n          );\n  FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                         line -> IsMatchingSublist(line, \"  #---\"));\n  i := 1;\n  while i < Length(fieldsAndValues) do\n    val := Int(fieldsAndValues[i + 1]);\n    if val = fail then\n      # workspace can be an integer or a string\n      val := fieldsAndValues[i + 1];\n    fi;\n    parameters.(ACEOptionData( fieldsAndValues[i] ).synonyms[1]) := val;\n    i := i + 2;\n  od;\n  return parameters;\nend);\n\n#############################################################################\n####\n##\n#F  ACEBinaryVersion \n##\n##  Infos the version and component compilation details of  the  ACE  binary,\n##  and returns the version of the ACE binary.\n##\nInstallGlobalFunction(ACEBinaryVersion, function(arg)\nlocal ioIndex, datarec;\n\n  ACE_IOINDEX_ARG_CHK(arg);\n  ioIndex := ACE_IOINDEX(arg);\n  if ioIndex = fail then \n    # Fire up a new stream ... which we'll close when we're finished\n    datarec := ACEData.ni;\n    datarec.stream \n        := InputOutputLocalProcess( ACEData.tmpdir, ACEData.binary, [] );\n  else\n    # Use interactive ACE process: ioIndex\n    datarec := ACEData.io[ ioIndex ];\n  fi;\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n                            # e.g. error messages due to unknown options\n  Info(InfoACE, 1, \"ACE Binary Version: \", ACEData.version);\n  WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"options;\" ]);\n  FLUSH_ACE_STREAM_UNTIL(datarec.stream, 1, 1, ACE_READ_NEXT_LINE,\n                         line -> IsMatchingSublist(line, \"  host info =\"));\n  if ioIndex = fail then \n    CloseStream(datarec.stream);\n  fi;\n  return ACEData.version;\nend);\n\n#############################################################################\n####\n##\n#F  EXEC_ACE_DIRECTIVE_OPTION . . . . . . . . . . . . . . . Internal Function\n##  . . . . . . . . . . . . . . . . . . .  executes an ACE `directive' option\n##\n##  An ACE `directive' option is an ACE option with name optname that returns\n##  output; most are implemented by a function of form: ACEOptname.\n##\n##  For the stream and option value defined by arglist pass optname (the name\n##  of an ACE option that expects a value) to ACE and flush the output  until\n##  a line for which IsMyLine(line) is true or an error  is  encountered  and\n##  then return the final line. If IsMyLine is the the null string  then  ACE\n##  is also directed to print closeline via option  `text'  and  IsMyLine  is\n##  defined to be true if a line matches closeline; in this way closeline  is\n##  a sentinel. If both IsMyLine and  closeline  are  null  strings  then  we\n##  expect no ACE output and  just  check  for  error  output  from  ACE.  If\n##  IsMyLine is the null string, closeline is a non-null string and readUntil\n##  is true then all lines read are returned rather than just the last line.\n##\nInstallGlobalFunction(EXEC_ACE_DIRECTIVE_OPTION, \nfunction(arglist, optname, infoLevel, IsMyLine, closeline, readUntil)\nlocal datarec, optval, line;\n  datarec := ACEData.io[ arglist[1] ];\n  optval := arglist[2];\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n                            # e.g. error messages due to unknown options\n  PROCESS_ACE_OPTION(datarec.stream, optname, optval);\n\n  if IsMyLine = \"\" then\n    if closeline = \"\" then \n      # We don't expect any ACE output ... just check for errors\n      READ_ACE_ERRORS(datarec);\n      return;\n    else\n      PROCESS_ACE_OPTION(datarec.stream, \"text\", closeline);\n      IsMyLine := line -> Chomp(line) = closeline;\n      if readUntil then\n        return ACEReadUntil(arglist[1], IsMyLine);\n      fi;\n    fi;\n  else\n    line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, infoLevel, infoLevel, \n                                   ACE_READ_NEXT_LINE, \n                                   line -> IsMyLine(line) or\n                                           IsMatchingSublist(line, \"** ERROR\"));\n    if IsMatchingSublist(line, \"** ERROR\") then\n      IsMyLine := line -> IsMatchingSublist(line, \"   \"); # 1 more line to flush\n    else \n      return line;\n    fi;\n  fi;\n\n  return FLUSH_ACE_STREAM_UNTIL(datarec.stream, infoLevel, infoLevel, \n                                ACE_READ_NEXT_LINE, IsMyLine);\nend);\n\n#############################################################################\n####\n##\n#F  ACE_IOINDEX_AND_NO_VALUE  . . . . . . . . . . . . . . . Internal Function\n##  . . . . . . . . . . . . . . . . . . . .  returns a list [ioIndex, optval]\n##  . . . . . . . . . . . . . . . . . . . .  for a no-value  ACE  `directive'\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  option\n##\nInstallGlobalFunction(ACE_IOINDEX_AND_NO_VALUE, function(arglist)\n  return [ CallFuncList(ACEProcessIndex, arglist), \"\" ];\nend);\n\n#############################################################################\n####\n##\n#F  ACE_IOINDEX_AND_ONE_VALUE . . . . . . . . . . . . . . . Internal Function\n##  . . . . . . . . . . . . . . . . . . . .  returns a list [ioIndex, optval]\n##  . . . . . . . . . . . . . . . . . . . .  for a one-value ACE  `directive'\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  option\n##\nInstallGlobalFunction(ACE_IOINDEX_AND_ONE_VALUE, function(arglist)\n  if Length(arglist) in [1,2] then\n    return [ CallFuncList(ACEProcessIndex, arglist{[1..Length(arglist) - 1]}),\n             arglist[Length(arglist)] ];\n  else\n    Error(\"expected 1 or 2 arguments ... not \", \n          Length(arglist), \" arguments\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_IOINDEX_AND_ONE_LIST  . . . . . . . . . . . . . . . Internal Function\n##  . . . . . . . . . . . . . . . . . . . .  returns a list [ioIndex, optval]\n##  . . . . . . . . . . . . . . . . . . . .  for a one-value ACE  `directive'\n##  . . . . . . . . . . . . . . . . . . . .  option,  where  that   one-value\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  must be a list\n##\nInstallGlobalFunction(ACE_IOINDEX_AND_ONE_LIST, function(arglist)\n  if not(Length(arglist) in [1,2]) then\n    Error(\"expected 1 or 2 arguments ... not \", \n          Length(arglist), \" arguments\\n\");\n  elif IsString(arglist[ Length(arglist) ]) or \n       not IsList(arglist[ Length(arglist) ]) then\n    Error(\"last argument should be a list\\n\");\n  else\n    return [ CallFuncList(ACEProcessIndex, arglist{[1..Length(arglist) - 1]}),\n             arglist[Length(arglist)] ];\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_IOINDEX_AND_LIST  . . . . . . . . . . . . . . . . . Internal Function\n##  . . . . . . . . . . . . . . . . . . . .  returns a list [ioIndex, optval]\n##  . . . . . . . . . . . . . . . . . . . .  for a no-value or list-value ACE\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . .  `directive' option\n##\nInstallGlobalFunction(ACE_IOINDEX_AND_LIST, function(arglist)\n  if Length(arglist) > 2 then\n    Error(\"expected 0, 1 or 2 arguments ... not \", \n          Length(arglist), \" arguments\\n\");\n  elif Length(arglist) in [1, 2] and IsList( arglist[Length(arglist)] ) then\n    return [ CallFuncList(ACEProcessIndex, arglist{[1..Length(arglist) - 1]}),\n             arglist[Length(arglist)] ];\n  elif Length(arglist) <= 1 then\n    return [ CallFuncList(ACEProcessIndex, arglist), \"\" ];\n  else\n    Error(\"2nd argument should have been a list\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEDumpVariables . . . . . . . . . . . . . Dumps ACE's internal variables\n##\n##\nInstallGlobalFunction(ACEDumpVariables, function(arg)\n  EXEC_ACE_DIRECTIVE_OPTION(\n      ACE_IOINDEX_AND_LIST(arg), \"dump\", 1, \n      line -> IsMatchingSublist(line, \"  #----\"), \"\", false);\nend);\n\n#############################################################################\n####\n##\n#F  ACEDumpStatistics . . . . . . . . . . . . Dumps ACE's internal statistics \n##\n##\nInstallGlobalFunction(ACEDumpStatistics, function(arg)\n  EXEC_ACE_DIRECTIVE_OPTION(\n      ACE_IOINDEX_AND_NO_VALUE(arg), \"statistics\", 1, \n      line -> IsMatchingSublist(line, \"  #----\"), \"\", false);\nend);\n\n#############################################################################\n####\n##\n#F  ACEStyle . . . . . . . . . . . . .  Returns the current enumeration style\n##\n##\nInstallGlobalFunction(ACEStyle, function(arg)\nlocal splitstyle;\n  splitstyle := SplitString(\n                    EXEC_ACE_DIRECTIVE_OPTION(\n                        ACE_IOINDEX_AND_NO_VALUE(arg), \"style\", 3, \n                        line -> IsMatchingSublist(line, \"style\"), \"\", false\n                        ),\n                    \"\", \" =\\n\"\n                    );\n  if Length(splitstyle) = 2 then\n    return splitstyle[2];\n  else\n    return Flat([ splitstyle[2], \" (defaulted)\" ]);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEDisplayCosetTable  . . . . . . . .  Prints the current ACE coset table\n##  . . . . . . . . . . . . . . . . . .  at its current level of completeness\n##\n##\nInstallGlobalFunction(ACEDisplayCosetTable, function(arg)\nlocal ioIndexAndValue, stream, closeline;\n  ioIndexAndValue := ACE_IOINDEX_AND_LIST(arg);\n  stream := ACEData.io[ ioIndexAndValue[1] ].stream;\n  PROCESS_ACE_OPTION(stream, \"print\", ioIndexAndValue[2]);\n  closeline := \"------------------------------------------------------------\";\n  PROCESS_ACE_OPTION(stream, \"text\", closeline);\n  FLUSH_ACE_STREAM_UNTIL(stream, 3, 3, ACE_READ_NEXT_LINE, \n                         line -> IsMatchingSublist(line, \"CO:\") or\n                                 IsMatchingSublist(line, \"co:\") or\n                                 IsMatchingSublist(line, \"** ERROR\"));\n  FLUSH_ACE_STREAM_UNTIL(stream, 1, 3, ACE_READ_NEXT_LINE, \n                         line -> IsMatchingSublist(line, closeline));\nend);\n\n#############################################################################\n####\n##\n#F  IsCompleteACECosetTable . . . . . Returns true if the current coset table \n##  . . . . . . . . . . . . . . . . . is  complete,  as  determined  by   the\n##  . . . . . . . . . . . . . . . . . current value of the enumeration index,\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . and false otherwise\n##\nInstallGlobalFunction(IsCompleteACECosetTable, function(arg)\nlocal datarec;\n  datarec := CallFuncList(ACEDataRecord, arg);\n  if not IsBound(datarec.stats) then\n    CHEAPEST_ACE_MODE(datarec);\n  fi;\n  return datarec.stats.index <> 0;\nend);\n\n#############################################################################\n####\n##\n#F  ACECosetRepresentative  . . . . . . . . Returns the coset  representative\n##  . . . . . . . . . . . . . . . . . . . . of coset n, for the current coset\n##  . . . . . . . . . . . . . . . . . . . . table held by interactive process\n##  . . . . . . . . . . . . . . . . . . . . . . i, for i, n determined by arg\n##\nInstallGlobalFunction(ACECosetRepresentative, function(arg)\nlocal ioIndexAndValue, datarec, coset, line, list;\n  ioIndexAndValue := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  datarec := ACEData.io[ ioIndexAndValue[1] ];\n  coset := ioIndexAndValue[2];\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n  if coset = 1 then\n    return One(ACEGroupGenerators( ioIndexAndValue[1] )[1]);\n  elif coset > datarec.stats.activecosets then\n    Error(\"ACECosetRepresentative: coset table has only \",\n          datarec.stats.activecosets, \" (<\", coset, \") active coset nos.\\n\");\n  fi;\n  PROCESS_ACE_OPTION(datarec.stream, \"print\", [-coset, coset]);\n  line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                                 line -> Length(line) > 1 and\n                                         line{[1..2]} in [\"--\", \"  \"]);\n  if IsMatchingSublist(line, \"  \") then\n    Error(\"ACECosetRepresentative: \", line{[4..Length(line)]});\n  fi;\n  list := ACEReadUntil(ioIndexAndValue[1], list -> true, \n                       line -> SplitString(line, \"\", \"| \"))[1];\n  return ACE_GAP_WORDS(datarec, list[ Length(list) ])[1];\nend);\n\n#############################################################################\n####\n##\n#F  ACECosetRepresentatives . . . . . . . . Returns the coset representatives\n##  . . . . . . . . . . . . . . . . . . . . . .  of ACE's current coset table\n##\n##\nInstallGlobalFunction(ACECosetRepresentatives, function(arg)\nlocal ioIndex, datarec, line, activecosets, cosetreps;\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  datarec := ACEData.io[ ioIndex ];\n  if not IsBound(datarec.stats) then\n    Error(\"ACECosetRepresentatives: no current table?\\n\");\n  fi;\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n  PROCESS_ACE_OPTION(datarec.stream, \"print\", -datarec.stats.activecosets);\n  line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                                 line -> Length(line) > 1 and\n                                         line{[1..2]} in [\"co\", \"CO\", \"  \"]);\n  if IsMatchingSublist(line, \"  \") then\n    Error(\"ACECosetRepresentatives: \", line{[4..Length(line)]});\n  fi;\n  activecosets := Int( SplitString(line, \"\", \"coCO: a=\")[1] );\n  FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                         line -> IsMatchingSublist(line, \"     1 \"));\n  cosetreps := List(ACEReadUntil(\n                        ioIndex, \n                        list -> Int(list[1]) = Minimum(\n                                                   activecosets,\n                                                   datarec.stats.activecosets),\n                        line -> SplitString(line, \"\", \"| \")\n                        ),\n                    list -> ACE_GAP_WORDS(datarec, list[ Length(list) ])[1]\n                    );\n  if datarec.stats.activecosets < activecosets then\n    # We missed some\n    PROCESS_ACE_OPTION(datarec.stream, \"print\", \n                       [-(datarec.stats.activecosets + 1), activecosets]);\n    line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                                   line -> IsMatchingSublist(line, \"---\"));\n    return Concatenation([One(ACEGroupGenerators(ioIndex)[1])],\n                         cosetreps,\n                         List(ACEReadUntil(ioIndex, \n                                           list -> Int(list[1]) = activecosets,\n                                           line -> SplitString(line, \"\", \"| \")),\n                              list -> ACE_GAP_WORDS(\n                                          datarec, list[ Length(list) ])[1]\n                              )\n                         );\n  else\n    return Concatenation([One(ACEGroupGenerators(ioIndex)[1])], cosetreps);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACETransversal  . . . . . . . . . Returns ACECosetRepresentatives(arg) if\n##  . . . . . . . . . . . . . . . . . the current coset  table  is  complete,\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . .  and fail otherwise\n##\nInstallGlobalFunction(ACETransversal, function(arg)\nlocal ioIndex;\n  ioIndex := CallFuncList(ACEProcessIndex, arg);  \n  if IsCompleteACECosetTable(ioIndex) then\n    return ACECosetRepresentatives(ioIndex);\n  else\n    Info(InfoACE + InfoWarning, 1,\n         \"ACETransversal: coset table is not complete\");\n    return fail;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACECycles . . . . . . . . . . . . .  Display the cycles (permutations) of\n##  . . . . . . . . . . . . . . . . . . . . .  the permutation representation\n##\nInstallGlobalFunction(ACECycles, function(arg)\nlocal datarec, error, cycles;\n  datarec := CallFuncList(ACEDataRecord, arg);\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n                            # e.g. error messages due to unknown options\n  PROCESS_ACE_OPTION(datarec.stream, \"cycles\", \"\");\n  PROCESS_ACE_OPTION(datarec.stream, \"text\", \"\"); # Make ACE print a blank line\n                                                  # ... that we use as sentinel\n  error := IsMatchingSublist(\n               FLUSH_ACE_STREAM_UNTIL( \n                   datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                   line -> Length(line) > 1 and\n                           line{[1..2]} in [\"**\", \"CO\", \"co\"]\n                   ),\n               \"**\", 1);\n  cycles := ACEReadUntil(datarec.procId, line -> line = \"\");\n  if error then\n    Info(InfoACE + InfoWarning, 1,\n         ReplacedString(cycles[1], \"   \", \"ACECycles: \"));\n    return fail;\n  else\n    cycles := List(cycles, \n                   function(line)\n                     local posEq;\n                     posEq := Position(line, '=');\n                     if posEq = fail then\n                       return line;\n                     elif IsMatchingSublist(line, \"= identity\", posEq) then\n                       return \", ()\";\n                     else\n                       return ReplacedString(line, line{[1..posEq]}, \",\");\n                     fi;\n                   end);\n    cycles[1][1] := '[';\n    Add(cycles, \"]\");\n    return EvalString( Concatenation(cycles) );\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACETraceWord  . . . . . . . . . . . . Traces word through the coset table\n##  . . . . . . . . . . . . . . . . . . . of the i-th interactive ACE process\n##  . . . . . . . . . . . . . . . . . . . starting at coset n, for i, n, word\n##  . . . . . . . . . . . . . . . . . . . determined by arg, and  return  the\n##  . . . . . . . . . . . . . . . . . . . final coset  number  if  the  trace\n##  . . . . . . . . . . . . . . . . . . . . . . completes, and fail otherwise\n##\nInstallGlobalFunction(ACETraceWord, function(arg)\nlocal ioIndex, datarec, twArgs, acegen, expected, line;\n  if Length(arg) in [2,3] then\n    datarec := CallFuncList(ACEDataRecord, arg{[1..Length(arg) - 2]});\n    ioIndex := datarec.procId;\n    twArgs := arg{[Length(arg) - 1..Length(arg)]};\n    if not IsPosInt(twArgs[1]) then\n      Error(\"ACETraceWord: coset number must be a positive integer\\n\"); \n    fi;\n  else\n    Error(\"expected 2 or 3 arguments ... not \", \n          Length(arg), \" arguments\\n\");\n  fi;\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n  if IsOne(twArgs[2]) and twArgs[2] = One( ACEGroupGenerators(ioIndex)[1] ) then\n    acegen := datarec.acegens[1];\n    # The ACE binary does not recognise the empty string as the identity\n    WRITE_LIST_TO_ACE_STREAM(\n        datarec.stream, [ \"tw:\", twArgs[1], \",\", acegen, \"*\", acegen, \"^-1;\" ]);\n  else\n    PROCESS_ACE_OPTION(datarec.stream, \"tw\", twArgs);\n  fi;\n  expected := Flat([String(twArgs[1]), \" * word = \"]){[1..8]};\n  line := FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE, \n                                 line -> Length(line) > 7 and\n                                         line{[1..8]} in [expected,\n                                                          \"* Trace \",\n                                                          \"** ERROR\"]);\n  if IsMatchingSublist(line, expected) then\n    return Int(SplitString(line, \"\", \" *word=\\n\")[2]);\n  elif IsMatchingSublist(line, \"* Trace \") then\n    Info(InfoACE + InfoWarning, 1,\n         \"ACETraceWord:\", line{[2..Length(line) - 1]});\n    return fail;\n  else\n    line := Chomp( ACE_READ_NEXT_LINE(datarec.stream) );\n    Info(InfoACE, 3, line);\n    Error(\"ACETraceWord:\", line{[3..Length(line)]});\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_ORDER . . . . . . . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . . . . . . .  called by ACEOrder and ACEOrders\n##\n##\nInstallGlobalFunction(ACE_ORDER, function(ACEfname, ioIndexAndValue)\nlocal lines, line, datarec;\n  lines := EXEC_ACE_DIRECTIVE_OPTION(\n               ioIndexAndValue, \"order\", 3, \"\", \"---------------------\", true);\n  if lines[Length(lines) - 1][1] = '*' then\n    line := lines[Length(lines) - 1];\n    Info(InfoACE + InfoWarning, 1, ACEfname, \":\", line{[2..Length(line)]});\n    if ioIndexAndValue[2] > 0 then\n      return fail;\n    else\n      return [];\n    fi;\n  elif IsMatchingSublist(lines[Length(lines) - 2], \"** ERROR\", 1) then\n    line := lines[Length(lines) - 1];\n    Error(ACEfname, \":\", line{[3..Length(line)]}, \"\\n\",\n          \"(most probably the value passed to \", ACEfname, \n          \"\\nwas inappropriate)\\n\");\n  else\n    datarec := ACEData.io[ ioIndexAndValue[1] ];\n    return List(lines{[First([1..Length(lines)], \n                             i -> IsMatchingSublist(lines[i], \"--------\")) + 1\n                       .. Length(lines) - 1]},\n                function(line)\n                  line := SplitString(line, \"\", \"| \");\n                  return rec(coset := Int(line[1]),\n                             order := Int(line[2]),\n                             rep := ACE_GAP_WORDS(datarec, line[3])[1]);\n                end);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEOrders . . . . . . . . . . . . . . . . . . . Returns a list of records\n##  . . . . . . . . . . . . . . . . . . rec(coset := n, order := o, rep := r)\n##  . . . . . . . . . . . . . . . . . . of   all    coset    numbers    whose\n##  . . . . . . . . . . . . . . . . . . representatives' orders  (modulo  the\n##  . . . . . . . . . . . . . . . . . . subgroup) are either finite,  or,  if\n##  . . . . . . . . . . . . . . . . . . invoked with the  `suborder'  option,\n##  . . . . . . . . . . . . . . . . . . are multiples of the  value  assigned\n##  . . . . . . . . . . . . . . . . . . to ` suborder', for  the  interactive\n##  . . . . . . . . . . . . . . . . . . . . . . ACE process determined by arg\n##\nInstallGlobalFunction(ACEOrders, function(arg)\nlocal ioIndex, suborder;\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  suborder := ValueOption(\"suborder\");\n  if IsPosInt(suborder) then\n    return ACE_ORDER(\"ACEOrders\", [ioIndex, -suborder]);\n  else\n    if suborder <> fail then\n      Info(InfoACE + InfoWarning, 1, \n           \"ACEOrders: Expected positive integer value of suborder option\");\n      Info(InfoACE + InfoWarning, 1,\n           \"but received: \", suborder, \". Ignoring ... giving all orders.\");\n    fi;\n    return ACE_ORDER(\"ACEOrders\", [ioIndex, 0]);\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACEOrder  . . . . . . . . . . . . . . . . . . . . . . .  Returns a record\n##  . . . . . . . . . . . . . . . . . . rec(coset := n, order := o, rep := r)\n##  . . . . . . . . . . . . . . . . . . whose representative's order  (modulo\n##  . . . . . . . . . . . . . . . . . . the  subgroup)  is  a   multiple   of\n##  . . . . . . . . . . . . . . . . . . suborder,  a  positive  integer,   or\n##  . . . . . . . . . . . . . . . . . . `fail' if  there  is  no  such  coset\n##  . . . . . . . . . . . . . . . . . . number, for the i-th interactive  ACE\n##  . . . . . . . . . . . . . . . . . . process, for i,  suborder  determined\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  by arg\n##\n##  Actually, suborder is also allowed to be a negative integer -n, in  which\n##  case, `ACEOrder(i, -n)' is equivalent to `ACEOrders(i : suborder :=  n)';\n##  or suborder may be zero, in which case, `ACEOrder(i, 0)' is equivalent to\n##  `ACEOrders(i)'.\n##\nInstallGlobalFunction(ACEOrder, function(arg)\nlocal ioIndexAndValue, orderlist;\n  ioIndexAndValue := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  orderlist := ACE_ORDER(\"ACEOrder\", ioIndexAndValue);\n  if IsList(orderlist) and ioIndexAndValue[2] > 0 then\n    return orderlist[1];\n  else\n    return orderlist;\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACECosetOrderFromRepresentative( <i>, <cosetrep> )\n#F  ACECosetOrderFromRepresentative( <cosetrep> )\n##\n##  for the <i>-th (or default) interactive {\\ACE} process return  the  order\n##  (modulo the subgroup) of the coset with representative <cosetrep> a  word\n##  in the free group generators.\n##\n##  *Note:*   \n##  `ACECosetOrderFromRepresentative' calls `ACETraceWord' to  determine  the\n##  coset (number) to which <cosetrep> belongs, and then scans the output  of\n##  `ACEOrders' to determine the order of the coset (number).\n##\nInstallGlobalFunction(ACECosetOrderFromRepresentative, function(arg)\nlocal ioIndexAndValue, ioIndex, cosetrep, coset, entry;\n  ioIndexAndValue := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  ioIndex := ioIndexAndValue[1];\n  cosetrep := ioIndexAndValue[2];\n  if IsOne(cosetrep) and cosetrep = One( ACEGroupGenerators(ioIndex)[1] ) then\n    return 1;\n  fi;\n  ACERecover(ioIndex);\n  coset := ACETraceWord(ioIndex, 1, ioIndexAndValue[2]);\n  if coset = fail or coset = 1 then\n    return coset;\n  fi;\n  entry := First(ACE_ORDER(\"ACEOrder\", [ioIndex, 0]),\n                 entry -> entry.coset = coset);\n  if entry = fail then\n    return fail;\n  fi;\n  return entry.order;\nend);\n\n#############################################################################\n####\n##\n#F  ACECosetsThatNormaliseSubgroup  . . . . . . .  Determine  coset   numbers\n##  . . . . . . . . . . . . . . . . . . . . . . .  whose      representatives\n##  . . . . . . . . . . . . . . . . . . . . . . .  normalise   the   subgroup\n##\n##  For the i-th interactive ACE process and n, where i and n are  determined\n##  by arg:\n##\n##  * If n > 0, the list of the first n non-trivial (i.e.  excluding coset 1)\n##    coset numbers whose representatives normalise the subgroup is returned.\n##  * If n < 0, a list  of  records  with  fields  `coset'  and  `rep'  which\n##    represent the coset number and a representative, respectively,  of  the\n##    first n non-trivial coset numbers whose representatives  normalise  the  \n##    subgroup is returned.\n##  * If n = 0, a list  of  records  with  fields  `coset'  and  `rep'  which\n##    represent the coset number and a representative, respectively,  of  all\n##    non-trivial coset numbers whose representatives normalise the  subgroup\n##    is returned.\n##\nInstallGlobalFunction(ACECosetsThatNormaliseSubgroup, function(arg)\nlocal ACEfname, ioIndexAndValue, lines, line, datarec;\n  ACEfname := \"ACECosetsThatNormaliseSubgroup\";\n  ioIndexAndValue := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  lines := EXEC_ACE_DIRECTIVE_OPTION(\n               ioIndexAndValue, \"sc\", 3, \"\", \"---------------------\", true);\n  if Length(lines) > 2 and \n     IsMatchingSublist(lines[Length(lines) - 2], \"** ERROR\", 1) then\n    line := lines[Length(lines) - 1];\n    Error(ACEfname, \":\", line{[3..Length(line)]}, \"\\n\",\n          \"(most probably the value passed to \", ACEfname, \n          \"\\nwas inappropriate)\\n\");\n  else\n    if IsMatchingSublist(lines[Length(lines) - 1], \"* Nothing found\", 1) then\n      lines := [];\n      Info(InfoACE + InfoWarning, 1, \"no nontrivial normalising cosets found\");\n    else\n      lines := lines{[First([1..Length(lines)], \n                            i -> IsMatchingSublist(lines[i], \"Stabil\")) + 1 ..\n                      Length(lines) - 1]};\n    fi;\n    if ioIndexAndValue[2] > 0 then\n      return List(lines, line -> Int( SplitString(line, \"\", \" \")[1] ));\n    else\n      datarec := ACEData.io[ ioIndexAndValue[1] ];\n      return List(lines,\n                  function(line)\n                    line := SplitString(line, \"\", \" \");\n                    return rec(coset := Int(line[1]),\n                               rep := ACE_GAP_WORDS(datarec, line[2])[1]);\n                  end);\n    fi;\n  fi;\nend);\n\n#############################################################################\n##\n#F  ACECosetTable  . . . . . . . . . . . .  Extracts the coset table from ACE\n##\nInstallGlobalFunction(ACECosetTable, function(arg)\nlocal ioIndex, iostream, datarec, fgens, standard, incomplete,\n      cosettable, errmsg, onbreakmsg, SetACEOptions, DisplayACEOptions;\n\n  if Length(arg) = 2 or Length(arg) > 3 then\n    Error(\"expected 0, 1 or 3 arguments ... not \", Length(arg), \" arguments\\n\");\n  elif Length(arg) <= 1 then\n    # Called as an interactive ACE command\n    ioIndex := CallFuncList(ACEProcessIndex, arg);\n    datarec := ACEData.io[ ioIndex ];\n    INTERACT_SET_ACE_OPTIONS(\"ACECosetTable\", datarec);\n    if not IsEmpty(OptionsStack) or not IsBound(datarec.stats) then\n      CHEAPEST_ACE_MODE(datarec); \n    fi;\n    standard := ACE_LENLEX_CHK(ioIndex, true);\n    incomplete := datarec.stats.index = 0 and\n                  DATAREC_VALUE_ACE_OPTION(datarec, false, \"incomplete\");\n    if not incomplete and datarec.stats.index = 0 then\n      Info(InfoACE + InfoWarning, 1, \n           \"The `ACE' coset enumeration failed with the result:\");\n      Info(InfoACE + InfoWarning, 1, datarec.enumResult);\n      Info(InfoACE + InfoWarning, 1, \"Try relaxing any restrictive options.\");\n      Info(InfoACE + InfoWarning, 1, \"For interactive ACE process <i>,\");\n      Info(InfoACE + InfoWarning, 1, \n           \"type: 'DisplayACEOptions(<i>);' to see current ACE options.\");\n      return fail;\n    else\n      WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"Print Table;\" ]);\n      cosettable := ACE_COSET_TABLE(datarec.stats.activecosets, \n                                    datarec.acegens, \n                                    datarec.stream, \n                                    ACE_READ_NEXT_LINE);\n    fi;\n  else\n    # Called non-interactively\n    ACEData.ni := rec();\n\n    onbreakmsg := [\"Try relaxing any restrictive options\",\n                   \"e.g. try the `hard' strategy or increasing `workspace'\",\n                   \"type: '?strategy options' for info on strategies\",\n                   \"type: '?options for ACE' for info on options\",\n                   \"type: 'DisplayACEOptions();' to see current ACE options;\",\n                   \"type: 'SetACEOptions(:<option1> := <value1>, ...);'\",\n                   \"to set <option1> to <value1> etc.\",\n                   \"(i.e. pass options after the ':' in the usual way)\",\n                   \"... and then, type: 'return;' to continue.\",\n                   \"Otherwise, type: 'quit;' to quit to outer loop.\"];\n\n    SetACEOptions := function()\n      if not IsEmpty(OptionsStack) and \n         datarec.optionsStackDepth in [0, Length(OptionsStack)] then\n        SET_ACE_OPTIONS(datarec);\n      fi;\n    end;\n\n    DisplayACEOptions := function()\n      DISPLAY_ACE_REC_FIELD( datarec, \"options\" );\n    end;\n\n    repeat\n      datarec :=\n          CALL_ACE( \"ACECosetTableFromGensAndRels\", arg[1], arg[2], arg[3] );\n      standard := ACE_COSET_TABLE_STANDARD( ACE_OPTIONS() );\n      if IsBound(datarec.infile) then\n        # User only wanted an ACE input file to use directly with standalone\n        Info(InfoACE, 1, \"ACE standalone input file: \", datarec.infile);\n        return;\n      fi;\n      incomplete := datarec.stats.index = 0 and\n                    VALUE_ACE_OPTION(ACE_OPT_NAMES(), false, \"incomplete\");\n      if not incomplete and datarec.stats.index = 0 then\n        CloseStream(datarec.stream);\n        if datarec.silent then\n          return fail;\n        else\n          datarec.options := ACE_OPTIONS();\n          datarec.optionsStackDepth := Length(OptionsStack);\n          if not IsBound(datarec.origOptionsStackDepth) then\n            datarec.origOptionsStackDepth := datarec.optionsStackDepth;\n          fi;\n          if datarec.optionsStackDepth > 0 then\n            # We pop options here, in case the user decides to quit\n            PopOptions();\n          fi;\n          errmsg := [\"no coset table ...\",\n                     \"the `ACE' coset enumeration failed with the result:\",\n                      datarec.enumResult];\n          Error(ACE_ERROR(errmsg, onbreakmsg), \"\\n\");\n          if datarec.options <> rec() then\n            Add(OptionsStack, datarec.options);\n            Unbind(datarec.options);\n          fi;\n        fi;\n      else\n        if IsBound(datarec.cosettable) then\n          cosettable := datarec.cosettable;\n          Unbind(datarec.cosettable);\n        else\n          WRITE_LIST_TO_ACE_STREAM(datarec.stream, [ \"Print Table;\" ]);\n          cosettable := ACE_COSET_TABLE(datarec.stats.activecosets,\n                                        datarec.acegens, \n                                        datarec.stream, \n                                        ACE_READ_NEXT_LINE);\n        fi;\n        CloseStream(datarec.stream);\n        if IsBound(datarec.origOptionsStackDepth) and\n           (datarec.origOptionsStackDepth = 0) and \n           not IsEmpty(OptionsStack) \n        then\n          PopOptions();\n        fi;\n        Unbind(datarec.optionsStackDepth);\n        Unbind(datarec.origOptionsStackDepth);\n        break;\n      fi;\n    until false;\n  fi;\n  if incomplete then\n    StandardizeTable(cosettable, \"lenlex\");\n    Info(InfoACE + InfoWarning, 1, \n         \"ACECosetTable: Coset table is incomplete, reduced \",\n         \"& lenlex standardised.\");\n  elif standard = \"semilenlex\" then\n    StandardizeTable(cosettable, \"semilenlex\");\n  elif IsMatchingSublist(standard, \"GAP\") or standard = \"semilenlex\" then\n    StandardizeTable(cosettable);\n  fi;\n  return cosettable;\nend);\n\n#############################################################################\n####\n##\n#F  ACEStats  . . . Get the subgroup index, time and number of cosets defined\n##  . . . . . . . . . .  during an interactive or non-interactive ACE session\n##\nInstallGlobalFunction(ACEStats, function(arg)\nlocal datarec, iostream, line, stats;\n\n  if Length(arg) <= 1 then \n    # Called as an interactive ACE command\n    datarec := CallFuncList(ACEDataRecord, arg);\n    INTERACT_SET_ACE_OPTIONS(\"ACEStats\", datarec);\n    if not IsEmpty(OptionsStack) then\n      CHEAPEST_ACE_MODE(datarec);\n    fi;\n    return datarec.stats;\n  elif Length(arg) = 3 then              # args are: fgens,   rels,  sgens\n    # Called non-interactively\n    datarec := CALL_ACE(\"ACEStats\", arg[1], arg[2], arg[3]);\n    CloseStream( datarec.stream );\n    return datarec.stats;\n  else\n    Error(\"expected 0, 1 or 3 arguments ... not \", Length(arg), \" arguments\\n\");\n  fi;\nend);\n\n#############################################################################\n####\n##\n#F  ACERecover  . . . . . . . . . . . . Recover space from dead coset numbers\n##  . . . . . . . . . . . . . . for interactive ACE process determined by arg\n##\nInstallGlobalFunction(ACERecover, function(arg)\n  EXEC_ACE_DIRECTIVE_OPTION(\n      ACE_IOINDEX_AND_NO_VALUE(arg), \"recover\", 3, \n      line -> Length(line) > 1 and line{[1..2]} in [\"CO\", \"co\"], \"\", false);\nend);\n\n#############################################################################\n####\n##\n#F  ACEStandardCosetNumbering . . Reassigns coset numbers in lenlex  standard\n##  . . . . . . . . . . . . . . . order   for   interactive    ACE    process\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . determined by arg\n##\nInstallGlobalFunction(ACEStandardCosetNumbering, function(arg)\n  EXEC_ACE_DIRECTIVE_OPTION(\n      ACE_IOINDEX_AND_NO_VALUE(arg), \"standard\", 3, \n      line -> Length(line) > 1 and line{[1..2]} in [\"CO\", \"co\"], \"\", false);\nend);\n\n#############################################################################\n####\n##\n#F  ACEAddRelators  . . . . . . . . . . . . . . . Add relatorlist to relators \n##  . . . . . . . . . . . . . . . for interactive ACE process and relatorlist\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . determined by arg\n##\n##  Also sets and returns ACEData.io[i].args.rels, where i is  the  index  of\n##  the interactive ACE process.\n##\nInstallGlobalFunction(ACEAddRelators, function(arg)\nlocal ioIndexAndOptval, ioIndex, datarec;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_LIST(arg);\n  ioIndex := ioIndexAndOptval[1];\n  datarec := ACEData.io[ ioIndex ];\n  if not IsBound(datarec.enforceAsis) then\n    datarec.enforceAsis := false;\n  fi;\n  EXEC_ACE_DIRECTIVE_OPTION(\n      [ ioIndex, ACE_RELS(ioIndexAndOptval[2], # relatorlist\n                          ACEGroupGenerators(ioIndex),\n                          datarec.acegens,\n                          datarec.enforceAsis) ],\n      \"rl\", 3, \"\", \"\", false\n      );\n  CHEAPEST_ACE_MODE(datarec);\n  return ACE_ARGS(ioIndex, \"rels\");\nend);\n\n#############################################################################\n####\n##\n#F  ACEAddSubgroupGenerators  . . . . . . . . . Add generatorlist to relators \n##  . . . . . . . . . . . . . . for interactive ACE process and generatorlist\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . determined by arg\n##\n##  Also sets and returns ACEData.io[i].args.sgens, where i is the  index  of\n##  the interactive ACE process.\n##\nInstallGlobalFunction(ACEAddSubgroupGenerators, function(arg)\nlocal ioIndexAndOptval, ioIndex, datarec;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_LIST(arg);\n  ioIndex := ioIndexAndOptval[1];\n  datarec := ACEData.io[ ioIndex ];\n  EXEC_ACE_DIRECTIVE_OPTION(\n      [ ioIndex, ACE_WORDS(ioIndexAndOptval[2], # generatorlist\n                           ACEGroupGenerators(ioIndex),\n                           datarec.acegens) ],\n      \"sg\", 3, \"\", \"\", false\n      );\n  CHEAPEST_ACE_MODE(datarec);\n  return ACE_ARGS(ioIndex, \"sgens\");\nend);\n\n#############################################################################\n####\n##\n#F  ACE_WORDS_OR_UNSORTED . . . . . . . . . . . . . . . . . Internal function\n##  . . . . . . . . . . . . . . check val is a word list of goodwords, if  so\n##  . . . . . . . . . . . . . . return the sorted list  of  indices  of  word\n##  . . . . . . . . . . . . . . list in goodwords or report that  some  words\n##  . . . . . . . . . . . . . . are not of wordtype. If  val  is  an  integer\n##  . . . . . . . . . . . . . . list  a  sorted  integer  list  is  returned.\n##  . . . . . . . . . . . . . . Otherwise, if  val  is  not  a  list  or  not\n##  . . . . . . . . . . . . . . . . . . . . . . homogeneous, val is returned.\n##\nInstallGlobalFunction(ACE_WORDS_OR_UNSORTED, function(val, goodwords, wordtype)\nlocal badwords;\n  if IsList(val) then\n    if ForAll(val, IsWord) then\n      badwords := Filtered(val, w -> not(w in goodwords));\n      if IsEmpty(badwords) then\n        return SortedList(List(val, w -> Position(goodwords, w)));\n      else\n        Error(badwords, \" are not \", wordtype, \"\\n\");\n      fi;\n    elif ForAll(val, IsInt) then\n      return SortedList(val);\n    fi;\n  fi;\n  # Let the default error message sort it out\n  return val;\nend);\n\n#############################################################################\n####\n##\n#F  ACEDeleteRelators . . . . . . . . . . .  Delete relatorlist from relators \n##  . . . . . . . . . . . . . . . for interactive ACE process and relatorlist\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . determined by arg\n##\n##  Also sets and returns ACEData.io[i].args.rels, where i is  the  index  of\n##  the interactive ACE process.\n##\nInstallGlobalFunction(ACEDeleteRelators, function(arg)\nlocal ioIndexAndOptval;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_LIST(arg);\n  ioIndexAndOptval[2] := ACE_WORDS_OR_UNSORTED(ioIndexAndOptval[2],\n                                               ACERelators(ioIndexAndOptval[1]),\n                                               \"relators\");\n  EXEC_ACE_DIRECTIVE_OPTION(ioIndexAndOptval, \"dr\", 3, \"\", \"\", false);\n  CHEAPEST_ACE_MODE(ACEData.io[ ioIndexAndOptval[1] ]);\n  return ACE_ARGS(ioIndexAndOptval[1], \"rels\");\nend);\n\n#############################################################################\n####\n##\n#F  ACEDeleteSubgroupGenerators . . . . .  Delete generatorlist from relators \n##  . . . . . . . . . . . . . . for interactive ACE process and generatorlist\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . determined by arg\n##\n##  Also sets and returns ACEData.io[i].args.sgens, where i is the  index  of\n##  the interactive ACE process.\n##\nInstallGlobalFunction(ACEDeleteSubgroupGenerators, function(arg)\nlocal ioIndexAndOptval;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_LIST(arg);\n  ioIndexAndOptval[2] := ACE_WORDS_OR_UNSORTED(ioIndexAndOptval[2],\n                                               ACESubgroupGenerators(\n                                                   ioIndexAndOptval[1]\n                                                   ),\n                                               \"subgroup generators\");\n  EXEC_ACE_DIRECTIVE_OPTION(ioIndexAndOptval, \"ds\", 3, \"\", \"\", false);\n  CHEAPEST_ACE_MODE(ACEData.io[ ioIndexAndOptval[1] ]);\n  return ACE_ARGS(ioIndexAndOptval[1], \"sgens\");\nend);\n\n#############################################################################\n####\n##\n#F  ACECosetCoincidence . . . . . . . . . . Force the coincidence of coset  n \n##  . . . . . . . . . . . . . . . . . . . . with coset 1, for the interactive\n##  . . . . . . . . . . . . . . . . . . . . ACE  process  i  and  integer   n\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . determined by arg\n##\n##  Essentially, the coset representative of coset n is added to the subgroup\n##  generators, ACERedo and ACESubgroupGenerators are invoked, and the  coset\n##  representative of coset n is returned.\n##\nInstallGlobalFunction(ACECosetCoincidence, function(arg)\nlocal ioIndexAndOptval, cosetrep, datarec;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  cosetrep := EXEC_ACE_DIRECTIVE_OPTION(\n                  ioIndexAndOptval, \"cc\", 3, \n                  line -> IsMatchingSublist(line, \"Coset\"), \"\", false);\n  if IsMatchingSublist(cosetrep, \"  \") then\n    return fail; # Error in input\n  fi;\n  datarec := ACEData.io[ ioIndexAndOptval[1] ];\n  FLUSH_ACE_STREAM_UNTIL(datarec.stream, 3, 3, ACE_READ_NEXT_LINE,\n                         line -> IsMatchingSublist(line, \"*\"));\n  CHEAPEST_ACE_MODE(datarec);\n  ACE_ARGS(ioIndexAndOptval[1], \"sgens\");\n  return ACE_GAP_WORDS(\n             datarec,\n             cosetrep{[Position(cosetrep, ':') + 2..Length(cosetrep) - 1]}\n             )[1];\nend);\n\n#############################################################################\n####\n##\n#F  ACERandomCoincidences( <i>, <subindex> )\n#F  ACERandomCoincidences( <subindex>)\n#F  ACERandomCoincidences( <i>, [<subindex>] )\n#F  ACERandomCoincidences( [<subindex>] )\n#F  ACERandomCoincidences( <i>, [<subindex>, <attempts>] )\n#F  ACERandomCoincidences( [<subindex>, <attempts>] )\n##\n##  for  the  <i>th  (or  default)  interactive  {\\ACE}  process  started  by\n##  `ACEStart', attempt up to <attempts> (or, in the  first  four  forms,  8)\n##  times to find nontrivial subgroups with index a multiple of <subindex> by\n##  repeatedly making random coset numbers coincident with coset 1 and seeing\n##  what happens. The starting coset table must be non-empty, but must  *not*\n##  be        complete        (use         `ACERandomlyApplyCosetCoincidence'\n##  (see~\"ACERandomlyApplyCosetCoincidence\")  if  your   table   is   already\n##  complete).  For  each   attempt,   we   repeatedly   add   random   coset\n##  representatives to the subgroup and `redo' the enumeration. If the  table\n##  becomes  too  small,  the  attempt  is  aborted,  the  original  subgroup\n##  generators restored, and another attempt made. If  an  attempt  succeeds,\n##  then   the   new   set    of    subgroup    generators    is    retained.\n##  `ACERandomCoincidences' returns  the  list  of  new  subgroup  generators\n##  added.  Use  `ACESubgroupGenerators'   (see~\"ACESubgroupGenerators\")   to\n##  determine the current subgroup generator list.\n##\nInstallGlobalFunction(ACERandomCoincidences, function(arg)\nlocal ioIndexAndOptval, datarec, index, sgens, lines, newsgens;\n  ioIndexAndOptval := ACE_IOINDEX_AND_ONE_VALUE(arg);\n  datarec := ACEData.io[ ioIndexAndOptval[1] ];\n  sgens := ACE_ARGS(ioIndexAndOptval[1], \"sgens\");\n  READ_ACE_ERRORS(datarec); # purge any output not yet collected\n  if not IsBound(datarec.stats) then\n    CHEAPEST_ACE_MODE(datarec);\n  fi;\n  index := datarec.stats.index;\n  if index <> 0 then\n    Error(\"ACERandomCoincidences: enumeration index is already finite!\\n\");\n  fi;\n  PROCESS_ACE_OPTION(datarec.stream, \"rc\", ioIndexAndOptval[2]);\n  # Perhaps it's wasteful to use ACEReadUntil here ...\n  lines := ACEReadUntil(ioIndexAndOptval[1],\n                        line -> Length(line)>12 and\n                                line{[1..13]} in [\"* No success;\",\n                                                  \"* An appropri\",\n                                                  \"   finite ind\",\n                                                  \"   * Unable t\"]);\n  if IsMatchingSublist(lines[Length(lines)], \"* An appropri\", 1) then\n    datarec.enumResult := lines[Length(lines) - 1];\n    datarec.stats := ACE_STATS(datarec.enumResult);\n  else\n    Info(InfoACE + InfoWarning, 1, \"ACERandomCoincidences: Unsuccessful!\");\n    newsgens := Difference(ACE_ARGS(ioIndexAndOptval[1], \"sgens\"), sgens);\n    if not IsEmpty(newsgens) then\n      ACEDeleteSubgroupGenerators(ioIndexAndOptval[1], newsgens);\n      Info(InfoACE + InfoWarning, 1, \"Subgroup generators restored.\");\n    fi;\n  fi;\n  return Difference(ACE_ARGS(ioIndexAndOptval[1], \"sgens\"), sgens);\nend);\n\n#############################################################################\n####\n##\n#F  ACERandomlyApplyCosetCoincidence( <i> [: subindex := <subindex>, \n##                                           hibound := <hibound>,\n##                                           lobound := <lobound>,\n##                                           attempts := <attempts>] )\n#F  ACERandomlyApplyCosetCoincidence( [: subindex := <subindex>, \n##                                       hibound := <hibound>,\n##                                       lobound := <lobound>,\n##                                       attempts := <attempts>] )\n##\n##  for  the  <i>th  (or  default)  interactive  {\\ACE}  process  started  by\n##  `ACEStart', attempt up to <attempts> (or, by default, 8) times to find  a\n##  larger proper  subgroup,  by  repeatedly  applying  `ACECosetCoincidence'\n##  (see~\"ACECosetCoincidence\") and seeing what happens. The  starting  coset\n##  table   must   already   be   complete    (use    `ACERandomCoincidences'\n##  (see~\"ACERandomCoincidences\") if your table is not already complete).  By\n##  default, `<subindex> = 1', <hibound> is the existing subgroup  index  and\n##  `<lobound> = 1'. If after an attempt the  new  index  is  a  multiple  of\n##  <subindex>, less than <hibound> and greater than <lobound> then  the  the\n##  process terminates and  the  list  of  new  subgroup  representatives  is\n##  returned. Otherwise, if an attempt reaches a  stage  where  the  criteria\n##  cannot be satisfied,  the  attempt  is  aborted,  the  original  subgroup\n##  generators    restored,     and     another     attempt     made.     Use\n##  `ACESubgroupGenerators' (see~\"ACESubgroupGenerators\")  to  determine  the\n##  current subgroup generator list.\n##\nInstallGlobalFunction(ACERandomlyApplyCosetCoincidence, function(arg)\nlocal ioIndex, datarec, index, opt, sgens, try, trycosetrep, tries, newsgens;\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  datarec := ACEData.io[ ioIndex ];\n  index := ACEStats(ioIndex).index;\n  if index = 0 then\n    Error(\"ACERandomlyApplyCosetCoincidence: coset table must be complete.\\n\");\n  fi;\n  opt := rec();\n  if ACE_VALUE_OPTION_ERROR(\n         opt, \"subindex\", 1, d -> IsPosInt(d) and (index mod d = 0),\n         \"option `subindex' must be a positive divisor of current index\"\n         ) or\n     ACE_VALUE_OPTION_ERROR(\n         opt, \"hibound\", index, h -> 1 < h and h <= index,\n         \"option `hibound' must be > 1 and at most the current index\"\n         ) or\n     ACE_VALUE_OPTION_ERROR(\n         opt, \"lobound\", 1, lo -> 1 <= lo and lo < index,\n         \"option `lobound' must be at least 1 and less than the current index\"\n         ) or\n     ACE_VALUE_OPTION_ERROR(\n         opt, \"attempts\", 8, IsPosInt,\n         \"option `attempts' must be a positive integer\"\n         )\n  then\n     opt.onbreakmsg := [\"You can only 'quit;' from here.\"];\n     PopOptions();\n     Error(ACE_ERROR(opt.errmsg, opt.onbreakmsg), \"\\n\");\n  fi;\n  if opt.attempts > index - 1 then\n    opt.attempts := index - 1;\n  fi;\n\n  sgens := ACESubgroupGenerators(ioIndex);\n  tries := [];\n  newsgens := [];\n  ACERecover(ioIndex);\n  while Length(tries) < opt.attempts and (datarec.stats.index >= opt.hibound) do\n    repeat\n      try := Random([2 .. datarec.stats.index]);\n      trycosetrep := ACECosetRepresentative(ioIndex, try);\n    until not(trycosetrep in tries);\n    Add(tries, try);\n    Add(newsgens, ACECosetCoincidence(ioIndex, try));\n    Info(InfoACE, 1, \"Added new subgroup gen'r:\");\n    Info(InfoACE, 1, \"  \", newsgens[ Length(newsgens) ]);\n    if datarec.stats.index <= opt.lobound or \n       (datarec.stats.index mod opt.subindex <> 0) then\n      # abort\n      Info(InfoACE, 1, \"Subgroup index (\", datarec.stats.index, \") \",\n                       \"has become too small ...\");\n      Info(InfoACE, 1, \"restoring original subgroup gen'rs.\");\n      ACEDeleteSubgroupGenerators(ioIndex, newsgens);\n      newsgens := [];\n    else\n      Info(InfoACE, 1, \"New subgroup index = \", datarec.stats.index);\n    fi;\n    ACERecover(ioIndex);\n  od;\n  if ACEStats(ioIndex).index >= opt.hibound then\n    Info(InfoACE, 1, \"ACERandomlyApplyCosetCoincidence: Unsuccessful!\");\n  fi;\n  return Difference(ACESubgroupGenerators(ioIndex), sgens);\nend);\n\n#############################################################################\n####\n##\n#F  ACEConjugatesForSubgroupNormalClosure . .  Returns conjugates of subgroup  \n##  . . . . . . . . . . . . . . . . . . . . .  generators by generators (that\n##  . . . . . . . . . . . . . . . . . . . . .  can  be  determined   to   be)\n##  . . . . . . . . . . . . . . . . . . . . .  needed for normal  closure  of\n##  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  the subgroup\n##\n##  Tests that each conjugate of a subgroup generator by  a  group  generator\n##  can be traced from coset 1 to a coset number other than coset 1, for  the\n##  i-th interactive ACE process, where i is determined by arg. The  list  of\n##  conjugates that were determined to belong to cosets other  than  coset  1\n##  (the subgroup) is returned; and, if called with the `add'  option,  these\n##  conjugates are also added to the existing list of subgroup generators.\n##\nInstallGlobalFunction(ACEConjugatesForSubgroupNormalClosure, function(arg)\nlocal ACEfname, ioIndex, add, lines, line, datarec;\n  ACEfname := \"ACEConjugatesForSubgroupNormalClosure\";\n  ioIndex := CallFuncList(ACEProcessIndex, arg);\n  add := ValueOption(\"add\");\n  if not IsBool(add) then\n    Info(InfoACE + InfoWarning, 1,\n         ACEfname, \": Expected boolean value of add option\");\n    Info(InfoACE + InfoWarning, 1,\n         \"but received: \", add, \". Ignoring ... no new generators will be.\");\n    Info(InfoACE + InfoWarning, 1,\n         \"added to the subgroup\");\n    add := \"\";\n  elif add <> true then\n    add := \"\";\n  else\n    add := 1;\n  fi;\n  lines := EXEC_ACE_DIRECTIVE_OPTION(\n               [ioIndex, add], \"nc\", 3, \"\", \"---------------------\", true);\n  if lines[Length(lines) - 1] = \"* All (traceable) conjugates in subgroup\" then\n    Info(InfoACE + InfoWarning, 1, \n         ACEfname, \": All (traceable) conjugates in subgp\");\n    return [];\n  elif IsMatchingSublist(lines[Length(lines) - 2], \"** ERROR\", 1) then\n    line := lines[Length(lines) - 1];\n    Error(ACEfname, \":\", line{[3..Length(line)]}, \"\\n\",\n          \"(most probably the value passed to \", ACEfname, \n          \"\\nwas inappropriate)\\n\");\n  else\n    datarec := ACEData.io[ ioIndex ];\n    if add = 1 then\n      CHEAPEST_ACE_MODE(datarec);\n      ACE_ARGS(ioIndex, \"sgens\"); # Update saved subgroup generators\n    fi;\n    return List(Filtered(lines, \n                         line -> IsMatchingSublist(line, \"Conjugate by grp\") or\n                                 # in case we have an old src for ACE\n                                 IsMatchingSublist(line, \"Grp\")),\n                function(line)\n                  line := SplitString(line, '\"');\n                  return ACE_GAP_WORDS(datarec, line[4])[1]\n                         ^ ACE_GAP_WORDS(datarec, line[2])[1];\n                end);\n  fi;\nend);\n\n#E  interact.gi . . . . . . . . . . . . . . . . . . . . . . . . .  ends here \n", "meta": {"hexsha": "c01311df5ed0c8bc050cb5d5b49ef8be7a3e65f5", "size": 113994, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/interact.gi", "max_stars_repo_name": "wilfwilson/ace", "max_stars_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-10-11T23:08:47.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-01T16:47:18.000Z", "max_issues_repo_path": "gap/interact.gi", "max_issues_repo_name": "wilfwilson/ace", "max_issues_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 25, "max_issues_repo_issues_event_min_datetime": "2016-02-26T09:00:39.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-23T12:28:10.000Z", "max_forks_repo_path": "gap/interact.gi", "max_forks_repo_name": "wilfwilson/ace", "max_forks_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2017-04-17T21:40:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-11T21:10:37.000Z", "avg_line_length": 40.8580645161, "max_line_length": 80, "alphanum_fraction": 0.5395722582, "num_tokens": 30212, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2043418902459481, "lm_q2_score": 0.037892427172852926, "lm_q1q2_score": 0.007743010194507694}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F Rules\n#F =====\n#F\n#F A rule is a record with the following mandatory fields:\n#F\n#F   isRule           = \"true\"         # identifies rules\n#F   operations       = RuleOps        # operations record\n#F   name             = <string>       # the name of the rule\n#F   info             = <string>       # a string with info about the rule\n#F   nonTerminal      = <symbol>       # the non-terminal the rule is meant\n#F                                       for, given by its symbol (e.g. \"WHT\")\n#F   forTransposition = true/false     # identifies whether the should also\n#F                                       be used in its transposed form\n#F   switch           = true/false     # allows to switch rules on (true) or off\n#F   isApplicable     = func( params ) # rule applicable for params?\n#F   allChildren      = func( params ) # returns a list of ordered lists of\n#F                                       all possible children for the rule \n#F   randomChildren   = func( params ) # returns an ordered list of children\n#F                                       for the rule, chosen at random\n#F   rule             =                # the actual rule, given as a formula\n#F     func( params, children )          combining children\n#F\n#F The following are optional fields:\n#F\n#F The function .isDerivable checks whether a given set of children can\n#F be derived from a given spl. This can also be decided by using doing\n#F   children in .allChildren(spl.params)\n#F In some cases, namely when there are to many children configurations, \n#F this field should be present. It is only used in the function RuleTree\n#F and nowhere during code generation.\n#F\n#F   isDerivable = func( spl, children )\n#F\n#F Note that the field \"nonTerminal\" must contain a symbol known\n#F from the NonTerminalTable in spl.g\n#F All rules have to be in the global variable RuleTable in order\n#F to be used.\n#F\n#F\n#F new rule:\n#F    .children := nt -> list of ordered lists of all possible children \n#F    .applicable := nt -> true/false\n#F    .apply := (nt, children) -> apply the rule\n#F    or .apply := (nt, children, child_nonterms) -> apply the rule\n#F Functions for Rules\n#F -------------------\n#F\n\nRuleOps := OperationsRecord(\"RuleOps\");\n\n#F IsRule( <rule> ) - true for breakdown rules (base class = BreakdownRule)\n#F\nIsRule := R -> IsRec(R) and IsBound(R.isRule) and R.isRule = true;\n\n#F IsNewRule(<rule>) - true for new style rules (base class = NewBreakdownRule)\n#F\nIsNewRule := R -> IsRec(R) and IsBound(R.isRule) and R.isRule and IsBound(R.isNewRule) and R.isNewRule;\n\n#F IsAlternativeRewriteRule(<rule>) - true for new style rules (base class = AlternativeRewriteRule)\n#F\nIsAlternativeRewriteRule := R -> IsRec(R) and IsBound(R.isRule) and R.isRule and IsBound(R.isAlternativeRewriteRule) and R.isAlternativeRewriteRule;\n\n#F RuleOps.Print( <rule> ) -  prints the name of <rule>.\n#F\nRuleOps.Print:= R -> Print(R.name, Cond(IsBound(R.a), R.printA(), \"\"));\n\n#F RuleOps.\\=( <rule1>, <rule2> ) - equality of rules based on names\n#F\nRuleOps.\\= := (R1, R2) -> IsRule(R1) and IsRule(R2) and R1.name = R2.name and \n    When(IsBound(R1.a), R1.a = R2.a, true);\n\n#F RuleOps.\\<( <rule1>, <rule2> ) - ordering of rules based on their names. \n#F\nRuleOps.\\< := (R1, R2) -> Cond(\n    IsRule(R1) and IsRule(R2), \n        R1.name < R2.name or (R1.name = R2.name and When(IsBound(R1.a), R1.a < R2.a, true)),\n    ObjId(R1) < ObjId(R2));\n\n\n# Default rule for SPLs which not non-terminals\nDeclare(@_Base);\n\n_applicable := (R, nt, ruleset) -> \n    (not Same(ruleset, ApplicableTable) or R.switch) and \n    (R.nonTerminal=@ or R.nonTerminal = ObjId(nt)) and\n    ((nt.transposed = R.transposed) or (nt.transpose()=nt)) and \n    # R.requiredFirstTag is obsolete\n    When(not IsNewRule(R) or not IsBound(R.requiredFirstTag), true,\n\tWhen(IsBound(nt.firstTag), \n            When(IsList(R.requiredFirstTag), \n                 nt.firstTag().kind() in R.requiredFirstTag,\n                 nt.firstTag().kind()  = R.requiredFirstTag), false)) and\n    # R.a.requiredFirstTag is the better way of setting mandatory tags\n    When(not IsNewRule(R) or not IsBound(R.a.requiredFirstTag), true,\n\tWhen(IsBound(nt.firstTag), \n            When(IsList(R.a.requiredFirstTag), \n                 nt.firstTag().kind() in R.a.requiredFirstTag,\n                 nt.firstTag().kind()  = R.a.requiredFirstTag), false)) and\n    When(IsNewRule(R), \n            SReduceSimple(R.applicable(nt)) <> false, \n            R.isApplicable(nt.params));\n    \n#F _allChildren( <rule>, <non-terminal>[, <opts>])\n#F   returns all possible children obtained by applying <rule> to <non-terminal>\n#F   Use of opts.restrictSplit and opts.restrictSplitSize\n#F      Set opts.restrictSplit:=true and opts.restrictSplitSize to the desired\n#F      size.\n#F      Can be used to obtain ruletrees with no leaves <= the specified size\n#F      If this is used there will be a problem with generating ruletrees\n#F      unless opts.baseHashes is set so that small sizes are fetched from the \n#F      hash table. Otherwise generating rule trees will return false\n\n #_allChildren := (R, nt) -> When(IsNewRule(R), R.children(nt), R.allChildren(nt.params));\n_allChildren := function( arg )\n    local flag, i, R, nt, opts, ch, ch_copy, children;\n    R := arg[1];\n    nt := arg[2];\n    children :=  When(IsNewRule(R), R.children(nt), R.allChildren(nt.params));\n    if IsBound(arg[3]) then \n        opts := arg[3]; \n        ch_copy := Copy(children);\n        flag := false;\n        i := 1;\n        if IsBound(opts.restrictSplit) and opts.restrictSplit = true and\n                                         IsBound(opts.restrictSplitSize) then\n            for ch in ch_copy do\n                while flag=false and i<=Length(ch) do\n                    if ch[i].params[1] <= opts.restrictSplitSize then\n                        flag := true;\n                    fi;\n                    i := i+1;\n                od;\n                if flag then\n                    RemoveSet(children, ch);\n                    flag := false;\n                fi;\n                i := 1;\n                    \n            od;\n        fi;\n    fi;\n    return children;\nend;\n# children[i] could be a complicated SPL expansion of the nonterms[i]\n# or children could be same as nonterms, depending on the workflow you are using\n#_apply := (R, nt, children, nonterms) -> Checked(IsRule(R), IsSPL(nt),\n#    When(IsNewRule(R), \n#\t R.apply(nt, children, nonterms),\n#\t When(NumGenArgs(R.rule)=2, \n#\t      R.rule(nt.params, children),\n#\t      R.rule(nt.params, children, nonterms)))\n#);\n\n# Current rule wrap for fftx needs attributes from nt object. \n# The wrapper has var. arg. This fact is used here\n# to recognize the wrapper and pass nt instead of its params.\n_apply := (R, nt, children, nonterms) -> Checked(IsRule(R), IsSPL(nt),\n    When(IsNewRule(R), \n     R.apply(nt, children, nonterms),\n     Cond(NumGenArgs(R.rule)=-1,\n            R.rule(nt, children, nonterms),\n            NumGenArgs(R.rule)=2, \n            R.rule(nt.params, children),\n            R.rule(nt.params, children, nonterms)))\n);\n\n#F IsApplicableRule( <rule>, <non-terminal>, <ruleset> )\n#F   returns true if <rule> can be applied to <non-terminal>\n#F   and false else.\n#F\nIsApplicableRule := (R, nt, ruleset) -> When(IsAlternativeRewriteRule(R),\n    Length(Collect(nt, R.pattern))<>0\n    ,\n    Checked(IsRule(R), IsSPL(nt),\n    (not Same(ruleset, ApplicableTable) or R.switch) and \n    (\n\t_applicable(R, nt, ruleset) or \n\t(R.forTransposition and _applicable(R, nt.transpose(), ruleset)))));\n\n#F ApplyRuleSPL( <rule>, <non-terminal> )\n#F   returns result of application of <rule> to <non-terminal>, if\n#F   it is non-applicable an error is reported\n#F\nApplyRuleSPL := (R, nt) -> \n\tChecked(IsRule(R), IsSPL(nt), \n\t\tlet(c := _allChildren(R,nt)[1],\t_apply(R, nt, c, c))\n\t);\n\nAllApplicableRulesDirect := (spl, ruleset) -> \n    Concatenation(\n\t\tWhen(not IsBound(ruleset.(spl.__name__)), [ ],\n\t\t\tFiltered(ruleset.(spl.__name__), r -> not r.forTranspositionOnly and _applicable(r, spl, ruleset))),\n\t\tFiltered([@_Base], r ->not r.forTranspositionOnly and _applicable(r, spl, ruleset))\n\t);\n\n#F AllApplicableRules( <non-terminal>, <ruleset> )\n#F   returns list of all rules applicable to a non-terminal\n#F\nAllApplicableRules := (nt, ruleset) -> \n\tChecked(IsSPL(nt), Set(AllApplicableRulesDirect(nt, ruleset)));\n\n#F RandomChildrenRule( <rule>, <non-terminal>, <ruleset> )\n#F   returns a random set of children for <rule> applied to <spl>.\n#F   Calls the rule's randomChildren function if available.\n#F   Otherwise, calls RandomList on the rule's allChildren function.\n#F\nRandomChildrenRule := (R, nt, ruleset) -> Checked(IsApplicableRule(R, nt, ruleset),\n    When(IsBound(R.randomChildren), \n\t R.randomChildren(nt.params),\n\t RandomList(_allChildren(R, nt))));\n\n#F Verification of Rules\n#F ---------------------\n#F\n\n#F VerifyRules(<non-terminal>, <verify-func>)\n#F\n#F  Expands <non-terminal> using all applicable rules and all\n#F  possible children sets (just one expansion step) and runs\n#F  <verify-func> on the obtained partial ruletrees and the non\n#F  terminal to check correctness.\n#F\n#F  verify_func = (rt, nt) -> boolean \n#F      <rt> is partial ruletree, \n#F      <nt> is original non-terminal\n#F \n#F  Example:\n#F   VerifyRulesForSPL := nt -> \n#F       VerifyRules(nt, (rt, nt) -> \n#F           InfinityNormMat(MatSPL(SPLRuleTree(rt)) - MatSPL(nt)) < 1e-11);\n#F \nVerifyRules := function ( nt, verify_func, opts )\n  local rule, Csets, C, ruletree, res, direct, transp, transp_nt;\n  Constraint(IsSPL(nt));\n  res := true;\n\n  for ruletree in ExpandSPL(nt, opts) do \n      Print(\"-- \", ruletree, \" --\\n\");\n      Print(\"checking rule \", ruletree.rule, \": \");\t\n      if verify_func(ruletree, nt) then\n\t  Print(Green(\"correct\\n\"));\n      else\n\t  Print(Red(\"incorrect!\\n\"));\n\t  res := false;\n      fi;\n  od;\n  return res;\nend;\n\n\n_checkMatRuleTree := function(rt, nt)\n    local me, them, diff;\n    me := MatSPL(SPLRuleTree(rt));\n    them := MatSPL(nt);\n    diff := InfinityNormMat(me-them);\n    return diff < 1e-11;\nend;\n\n#F VerifyRulesForSPL( <non-terminal>, <opts> )\n#F   expands <non-terminal> using all applicable rules and all\n#F   possible children sets (just one expansion step) and checks \n#F   whether the resulting matrix matches the non-terminal matrix.\n#F\n#F   Matrices are obtained with MatSPL, and infinity-norm of the\n#F   difference is thresholded, with threshold of 1e-11. \n#F\n#F   See also VerifyRules, it is a more general function.\n#F\nVerifyRulesForSPL := (S, opts) -> VerifyRules(S, _checkMatRuleTree, opts); \n\n\n#F Rule switching\n#F ----------------\n#F\n\n\n#F AllRules(<non-terminal> | <non-terminal-name>) \n#F    Returns a list of all rules for <non-terminal>.\n#F  \nAllRules := nt -> let(\n    name := Cond(IsSPL(nt), nt.__name__, IsString(nt), nt, \n\tError(\"<nt> must be a nonterminal or its name (string)\")),\n    When(IsBound(ApplicableTable.(name)), ApplicableTable.(name), \n\tError(\"No rules exist for '\", name, \"'\")));\n\n#F Adding your own rules\n#F ---------------------\n#F\n\n#F BreakdownRule - base class for breakdown rules created with RulesFor(...)\n#F\nClass(BreakdownRule, rec(\n    isRule := true,\n    operations := RuleOps,\n    info             := \"-not specified-\",\n    forTransposition := false,\n    forTranspositionOnly := false,\n    switch           := true,\n    transposed       := false,\n    allChildren      := P -> [[ ]],\n    isApplicable     := P -> true,\n    __call__         := arg >> ApplyFunc(RuleTree, arg)\n));\n\n#F NewBreakdownRule - base class for breakdown rules created with NewRulesFor(...)\n#F\nClass(NewBreakdownRule, AttrMixin, rec(\n    isRule := true,\n    isNewRule := true,\n    operations := RuleOps,\n    info             := \"-not specified-\",\n    forTransposition := false,\n    forTranspositionOnly := false,\n    switch           := true,\n    transposed       := false,\n\n    freedoms := (self, nt) >> [],\n    child := (self, nt, fr) >> [],\n\n    children := (self, nt) >> let(\n\tff := List(_unwrap(self.freedoms(nt)), _unwrap),\n\tcart := Cartesian(ff),   # Cartesian([])==[[ ]]\n\tList(cart, f -> self.child(nt, f))\n    ),\n    \n    applicable       := nt -> true,\n    __call__         := arg >> ApplyFunc(RuleTree, arg),\n\n# NOTE: YSV finish this (--parametrization of rules)\n#     print := self >> let(rch := self.rChildren(),\n#         Print(self.name, Cond(rch<>[], Print(\".from_rChildren(\", PrintCS(rch), \")\"), \"\"))),\n\n#     operations := RewritableObjectOps,\n#     lessThan := RewritableObject.lessThan,\n#     equals := RewritableObject.equals,\n#     rChildren := self >> [],\n#     from_rChildren := (self, rch) >> Error(\"not supported\"),    \n));\n     \nMakeRule := function ( R, name, nt )\n    local doc;\n    Constraint(IsRec(R) and IsString(name));\n    doc := R.__doc__;\n    # R.__doc__ is overwritten upon assignment\n    R := WithBases(BreakdownRule, R);\n    R.__doc__ := doc;\n    R.name    := name;\n    R.nonTerminal := nt;\n    return R;\nend;\n\nNewMakeRule := function ( R, name, nt )\n    local doc;\n    Constraint(IsRec(R) and IsString(name));\n    doc := R.__doc__;\n    # R.__doc__ is overwritten upon assignment\n    R := WithBases(NewBreakdownRule, R);\n    R.__doc__ := doc;\n    R.name    := name;\n    R.nonTerminal := nt;\n    return R;\nend;\n\n@_Base := NewMakeRule(\n    rec(applicable       := nt -> not IsNonTerminal(nt) and not IsBound(ApplicableTable.(nt.__name__)),\n\tforTransposition := false,\n        forTranspositionOnly := false,\n\tchildren             := nt -> [nt.children()],\n\tapply := (nt,ch,nonterms) -> Inherit(nt, rec(_children := ch))),\n        \"@_Base\", @); \n\n#F ApplicableTable - mapping from non-terminal names to applicable rules\n#F\nApplicableTable := rec(\n    @ := [ @_Base ]\n);\n\n_RulesFor := function(nt, rulesRec, makeRuleFunc)\n    local rules, r, ntname, fields, nam;\n    Constraint(IsSPL(nt));\n    if not IsBound(nt.index) then AddNonTerminal(nt); fi;\n\n    if not IsRec(rulesRec)\n        then Error(\"<rulesRec> must be a record containing rule records as elements\"); fi;\n\n    fields := Filtered(RecFields(rulesRec), f -> not IsSystemRecField(f));\n    if not ForAll(fields, x -> IsRec(rulesRec.(x))) \n        then Error(\"<rulesRec> must be a record containing rule records as elements\");\n    fi;\n\n    rules := [];\n    for nam in fields do\n        rulesRec.(nam) := makeRuleFunc(rulesRec.(nam), nam, nt);\n\tAdd(rules, rulesRec.(nam));\n    od;\n\n    if IsBound(ApplicableTable.(nt.__name__)) then Append(ApplicableTable.(nt.__name__), rules);\n    else ApplicableTable.(nt.__name__) := rules; fi;\n\n    # NOTE: Assign() was here for backwards compatibility\n    for r in rules do Assign(r.name, r); od;\nend;\n\n#F RulesFor( <nonterm>, <rulesRec> )\n#F\nRulesFor := (nt, rulesRec) -> _RulesFor(nt, rulesRec, MakeRule);\n\nNewRulesFor := (nt, rulesRec) -> _RulesFor(nt, rulesRec, NewMakeRule);\n    \nSimpleRule := (pat, rule) -> rec(\n    isApplicable := Subst(P -> PatternMatch(P, $pat, empty_cx())),\n    rule := rule\n);\n\nBaseRule := (transform, pat) -> let(lpat := When(IsList(pat), pat, [pat]),\n    rec(\n\tisApplicable := DetachFunc(Subst(P -> PatternMatch(P, $(Concatenation([ListClass],lpat)), empty_cx()))),\n\trule := DetachFunc(Subst((P,C) -> ApplyFunc($transform, P).terminate()))\n    ));\n\nClass(InfoNt, NonTerminal, rec(\n    abbrevs := [ arg -> arg ], \n    dims := self >> [1,1],\n    doNotExpand := true,\n    doNotMeasure := true,\n    doNotSaveInHashtable := true,\n    isReal := True,\n    transpose := self >> self\n));\n\nNewRulesFor(InfoNt, rec(Info_Base := rec(applicable := True, apply := arg -> I(1))));\n\n############\n\nClass(AlternativeRewriteRule, AttrMixin, rec(\n    isRule := true,\n    isAlternativeRewriteRule := true,\n    operations := RuleOps,\n));\n\n\nMakeAlternativeRewriteRule := function ( R, name)\n    local doc;\n    Constraint(IsRec(R) and IsString(name));\n    doc := R.__doc__;\n    # R.__doc__ is overwritten upon assignment\n    R := WithBases(AlternativeRewriteRule, R);\n    R.__doc__ := doc;\n    R.name    := name;\n    return R;\nend;\n\nAlternativeRewriteRules := function(rulesRec)\n    local fields, nam;\n\n    if not IsRec(rulesRec)\n        then Error(\"<rulesRec> must be a record containing rule records as elements\"); fi;\n\n    fields := Filtered(RecFields(rulesRec), f -> not IsSystemRecField(f));\n    if not ForAll(fields, x -> IsRec(rulesRec.(x))) \n        then Error(\"<rulesRec> must be a record containing rule records as elements\");\n    fi;\n\n    for nam in fields do\n        rulesRec.(nam) := MakeAlternativeRewriteRule(rulesRec.(nam), nam);\n        Assign(nam, rulesRec.(nam));\n    od;\nend;\n", "meta": {"hexsha": "ada889d61008fc8cf631e9b1949fc234f8d662c5", "size": 16573, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/rule.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/rule.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/rule.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 34.9641350211, "max_line_length": 148, "alphanum_fraction": 0.626380257, "num_tokens": 4559, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.30074557894124154, "lm_q2_score": 0.025565215500921792, "lm_q1q2_score": 0.0076886255365823265}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# LocalConfig is configured in the user's local _spiral.g (Linux/Unix)\n# or _spiral_win.g (Windows) in the Spiral root directory\n#\n# At a minimum, cpuinfo and osinfo need to be set, see one of those\n# above mentioned config files for reference\n\nDeclare(LocalConfig, SpiralDefaults);\nClass(LocalConfig, rec(\n    info := meth(self)\n                Print(\"\\nPID: \", GetPid(), \"\\n\");\n            end,\n\t\t\t\n    appendSym := self >> When(IsBound(self.osinfo.isWindows) and self.osinfo.isWindows(), \"%*\", \"$*\"),\n\n    compilerinfo := rec(\n        compiler:= \"\",\n        defaultMode := \"none\",\n        modes := rec(none := \"\"),\n        alignmentSpecifier := ()->\"\",\n        info := ()->Print(\"compiler info not set\"),\n    ),\n\n    cpuinfo := rec(\n        cpuname:=\"\",\n        vendor:=\"\",\n        freq:=0,\n        default_lang:=\"\",\n        isWindows := False,\n        isLinux := False,\n        is32bit := False,\n        is64bit := False,\n        nproc := 1,\n        SIMDname := False,\n        info := ()->Print(\"CPU info not set\"),\n        SIMD := () -> spiral.platforms.SIMDArchitectures\n    ),\n\n    osinfo := rec(info := ()->Print(\"OS info not set\"),\n        isWindows := False,\n        isLinux := False,\n        isDarwin := False,\n        isCygwin := False),\n\n    svninfo := rec(version := \"unknown\",\n        modified := \"unknown\",\n        mixed := \"unknown\",\n        isInit := false,\n        info := self >> When(self.isInit, Print(\"SVN: \", self.version, When(self.modified, \" (modified)\", \"\")), Print(\"SVN info not set\"))\n    ),\n\n    getOpts := arg >> arg[1].cpuinfo.getOpts(Drop(arg, 1)),\n\n    setTitle := meth(arg)\n                    local self, title;\n                    self := arg[1];\n                    if not IsBound(self.osinfo.setTitle) then return false; fi;\n                    if Length(arg)=1 then title := \"\"; else title := Concat(\" - \", arg[2]); fi;\n                    self.osinfo.setTitle(Concat(\"Spiral 5.0\", title));\n                    return true;\n                end\n));\n\nHighPerfMixin := rec(\n    useDeref := true,\n    compileStrategy := compiler.IndicesCS2,\n    propagateNth := false\n);\n\nSpiralDefaults := CopyFields(SpiralDefaults, rec(\n    includes := [\"<include/omega64.h>\"],\n    precision       := \"double\",\n    generateInitFunc := true,\n    XType := code.TPtr(code.TReal),\n    YType := code.TPtr(code.TReal),\n    unifyStoredDataType := false, # false | \"input\" | \"output\" \n                                  # if non-false, then unifies the datatype of \n                                  # precomputed data with the datatype of input (X) \n                                  # or output (Y)\n    # we implement complex transforms using real vector of 2x size\n    dataType        := \"real\",\n    globalUnrolling := 32,\n    faultTolerant   := false,\n    printWebMeasure := false,\n\n    # compiler options\n    finalBinSplit := false,\n    declareConstants := false,\n    doScalarReplacement := false,\n    propagateNth := true,\n    inplace := false,\n\n    doSumsUnification := false,\n    arrayDataModifier := \"static\",\n    scalarDataModifier := \"\",\n    arrayBufModifier := \"static\",\n    funcModifier := \"\", # for example \"__decl\" or \"__fastcall\"\n    valuePostfix := \"\",\n\n    # How much information Spiral is printing on the terminal.\n    # Currently rather few functions are using this.\n    verbosity := 1,\n\n    # list of include files in generated C code, eg. [\"<math.h>\"]\n    includes := [],\n\n    formulaStrategies := rec(\n        sigmaSpl := [ sigma.StandardSumsRules ],\n        preRC    := [],\n        rc       := [ sigma.StandardSumsRules ],\n        postProcess := [\n        (s, opts) -> compiler.BlockSums(opts.globalUnrolling, s),\n        (s, opts) -> sigma.Process_fPrecompute(s, opts)\n        ]\n    ),\n\n    baseHashes := [],\n    subParams := [],\n\n    sumsgen := sigma.DefaultSumsGen,\n    # breakdownRules limits the used breakdown rules.\n    # It must be a record of the form\n    # rec(\n    #   nonTerm := [ breakdown_rule1, breakdown_rule2, ...],\n    #   DFT := [ DFT_Base, DFT_CT ]  <-- example\n    # ).\n    #\n    # By default we set it to ApplicableTable for backwards compatibility with\n    # older svn revisions.\n    #\n    # Functions SwitchRulesOn/Off will work only with breakdownRules==ApplicableTable.\n    breakdownRules := formgen.ApplicableTable,\n\n    compileStrategy := compiler.IndicesCS,\n    simpIndicesInside := [code.nth, code.tcast, code.deref],\n    useDeref := true,\n    generateComplexCode := false,\n\n    unparser := compiler.CUnparserProg,\n    codegen := compiler.DefaultCodegen,\n    TCharCtype :=  \"char\",\n    TUCharCtype := \"unsigned char\",\n    TUIntCtype := \"unsigned int\",\n    TULongLongCtype := \"unsigned long long\",\n    TRealCtype := \"double\",\n\n    operations := rec(Print := s -> Print(\"<Spiral options record>\")),\n\n    highPerf := self >> CopyFields(self, HighPerfMixin),\n\n    coldcache := false,\n));\n\nCplxSpiralDefaults := CopyFields(SpiralDefaults, rec(\n    includes := [\"<include/complex_gcc_sse2.h>\"],\n    unparser := compiler.CMacroUnparserProg,\n    XType := code.TPtr(code.TComplex),\n    YType := code.TPtr(code.TComplex),\n    dataType := \"complex\",\n    generateComplexCode := true,\n    c99 := rec(\n        I := \"__I__\",\n        re := \"creal\",\n        im := \"cimag\"\n        )\n));\n\nIntelC99Mixin := rec(\n    includes := [\"<include/omega64c.h>\"],\n    unparser := compiler.CUnparserProg,\n    XType := code.TPtr(code.TComplex),\n    YType := code.TPtr(code.TComplex),\n    dataType := \"complex\",\n    generateComplexCode := true,\n    c99 := rec(\n        I := \"__I__\",\n        re := \"creal\",\n        im := \"cimag\"\n        ),\n    TComplexCtype := \"_Complex double\",\n    TRealCtype := \"double\",\n);\n\nIBMC99Mixin := rec(\n    includes := [\"<include/omega64c.h>\"],\n    unparser := compiler.CUnparserProg,\n    XType := code.TPtr(code.TComplex),\n    YType := code.TPtr(code.TComplex),\n    dataType := \"complex\",\n    generateComplexCode := true,\n    c99 := rec(\n        I := \"__I\",\n        re := \"_creal\",\n        im := \"_cimag\"\n        ),\n    TComplexCtype := \"_Complex double\",\n    TRealCtype := \"double\",\n    postalign := n -> Print(\"    __alignx(16,\", n, \");\\n\")\n);\n\n\n# How do we determine if we're running on Windows or Linux?\n#Try(Load(iswindows));\n#Try(Load(islinux));\n\n#  NOTE: I'd like to pull that out into a function call, but failed to use load/include/read inside a function... => ask YSV\n#if LocalConfig.osinfo.isWindows() then\n#    Exec(let(sdir:=Conf(\"spiral_dir\"), Concat(\"SubWCRev.exe \", sdir, \" \", Concat(sdir, \"\\\\spiral\\\\svn_win.src \", sdir, \"\\\\spiral\\\\svn_info.g > NUL\"))));\n#    Load(svn_info);\n#fi;\n#if LocalConfig.osinfo.isLinux() then\n# NOTE: For now, assume that any non-windows system is a linux system.\n#else\n #   Exec(let(sdir:=Conf(\"spiral_dir\"), Concat(\". \", sdir, \"/spiral/svn_linux.src \", sdir, \" > \", sdir, \"/spiral/svn_info.g\")));\n#    Load(svn_info);\n#fi;\n\ncompiler.Unparser.fileinfo := meth(self, opts)\n    local info;\n\n#    if IsBound(opts.fileinfo) then\n#        info := opts.fileinfo;\n#        Print(\"/*\\tCPU: \");\n#        LocalConfig.cpuinfo.info();\n#        Print(\"\\n\\tOS: \");\n#        LocalConfig.osinfo.info();\n#        Print(\"\\n\\t\");\n#        LocalConfig.svninfo.info();\n#        if IsBound(opts.profile) then\n#            Print(\"\\n\\tprofile: \", opts.profile.name, \", \", opts.profile.makeopts.CFLAGS);\n#        else\n#            Print(\"\\n\\tlanguage: \", opts.language);\n#        fi;\n#        PrintLine(\"\\n\\ttimestamp: \", let(t:=Date(), Concat(t[2],\" \",StringInt(t[3]),\", \",StringInt(t[1]), \"; \",StringInt(t[4]),\":\",StringInt(t[5]),\":\",StringInt(t[6]))),\n#            \"\\n\\ttransform: \", info.algorithm.node , \"\\n\\t\",\n#            \"source file: \\\"\", info.file, \"(.c)\\\"\\n\\t\",\n#            \"performance: \", info.cycles, \" cycles, \", spiral._compute_mflops(info.flops, info.cycles), \" Mflop/s\\n\",\n#            \"\\nalgorithm: \", info.algorithm, \"\\n\",\n#        \"*/\\n\");\n#    fi;\n\t\n    if IsBound(opts.fileinfo) then\n        info := opts.fileinfo;\n        if IsBound(opts.profile) then\n            Print(\"/*\\tprofile: \", opts.profile.name, \", \", opts.profile.makeopts.CFLAGS);\n        else\n            Print(\"/*\\tlanguage: \", opts.language);\n        fi;\n        PrintLine(\"\\n\\ttimestamp: \", let(t:=Date(), Concat(t[2],\" \",StringInt(t[3]),\", \",StringInt(t[1]), \"; \",StringInt(t[4]),\":\",StringInt(t[5]),\":\",StringInt(t[6]))),\n            \"\\n\",\n            \"\\nalgorithm: \", info.algorithm, \"\\n\",\n        \"*/\\n\");\n    fi;\t\nend;\n", "meta": {"hexsha": "59f5220256e6a533d0f9f7686a58bcdfeca52685", "size": 8480, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/defaults.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/defaults.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/defaults.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 32.7413127413, "max_line_length": 170, "alphanum_fraction": 0.5689858491, "num_tokens": 2228, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.21733753118592736, "lm_q2_score": 0.03514484892726186, "lm_q1q2_score": 0.0076382946997534795}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nClass(TraceBase, rec());\n\nClass(TraceRewrite, TraceBase, rec(\n        __call__ := (self, name,input,output,env) >> WithBases(self, rec(name:=name, input:=input,output:=output,env:=env,operations := PrintOps)),\n       print := self >> Print(\"Rewrite(\", self.name,\",\",self.input,\",\",self.output,\")\")\n));\n\nClass(TraceExpansion, TraceBase, rec(\n        __call__ := (self, name,input,output,env) >> WithBases(self, rec(name:=name, input:=input,output:=output,env:=env,operations := PrintOps)),\n       print := self >> Print(\"Expansion(\", self.name,\",\",self.input,\",\",self.output,\")\")\n));\n\nClass(TraceTreeExpansion, TraceBase, rec(\n        __call__ := (self, name,input,output,children,subtrees,env) >> WithBases(self, rec(name:=name, input:=input,output:=output,children:=children,subtrees:=subtrees, env:=env,operations := PrintOps)),\n       print := self >> Print(\"TreeExpansion(\", self.name,\",\",self.input,\",\",self.output,\",\",self.children,\")\")\n));\n\nClass(TraceConversion, TraceBase, rec(\n        __call__ := (self, name,input,output,env) >> WithBases(self, rec(name:=name, input:=input,output:=output, env:=env, operations := PrintOps)),\n       print := self >> Print(\"Conversion(\", self.name,\",\",self.input,\",\",self.output,\")\")\n));\n\nClass(TraceLogPrinter, rec(\n        __call__ := (self) >> WithBases(self, rec()),\n                           \n        addRewrite := (self, name,input,output,env) >> \n                           Print(\"\\n------------------------------------------------------------------\\n\", \n                                 \"RULE: \", name,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"old expression\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 input,\n                                 \"\\n------------------------------------------------------------------\\n\",\n                                 \"new expression\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 output,\n                                 \"\\n------------------------------------------------------------------\\n\"),\n                           \n        addExpansion := (self, name,input,output,env) >>\n                           Print(\"\\n==================================================================\\n\",\n                                 \"EXPANSION RULE: \", name, \n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"SPL expression:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 input,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"Sigma-SPL expression:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 output,\n                                 \"\\n\\n\"),\n                           \n        addTreeExpansion := meth(self, name,input,output,children,subtrees,env)\n                           local d;\n                           Print(\"\\n==================================================================\\n\",\n                                 \"TREE EXPANSION RULE: \", name, \n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"original expression:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 input, \"\\n\");\n\n                           if Length(children) <> 0 then\n                               Print(\"\\n------------------------------------------------------------------\\n\", \n                                     \"subtree substitutions: \", \n                                     \"\\n------------------------------------------------------------------\\n\");\n                               DoForAll(children, i->Print(i, \"\\n\\n\"));\n                               Print(\"\\n------------------------------------------------------------------\\n\", \n                                     \"subtrees substituted: \", \n                                     \"\\n------------------------------------------------------------------\\n\");\n                               Print(subtrees, \"\\n\");      \n                           fi;\n                           # NOTE: pass and save var\n                           # d := Collect(output, @(1, var, e->IsBound(e.value)));\n                           #if (d <>[]) then\n                           #   Print(\"\\n------------------------------------------------------------------\\n\", \n                           #          \"data tables: \", \n                            #         \"\\n------------------------------------------------------------------\\n\");\n                            #   DoForAll(d, i->Print(i.id, \" := \", i.value, \"\\n\\n\"));\n                           #fi;\n\n                           Print(\"------------------------------------------------------------------\\n\", \n                                 \"substituted expression:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 output, \"\\n\\n\");\n                       end,\n                           \n        addConversion := (self, name,input,output,env) >> \n                           Print(\"\\n==================================================================\\n\",\n                                 \"CONVERSION RULE: \", name, \n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"icode:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 input,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"icode:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 output,\n                                 \"\\n\\n\"),\n                           \n        beginRuleset := (self, ruleset, input) >> \n                           Print(\"\\n******************************************************************\\n\",\n                                 \"BEGIN RULESET: \", ruleset.inType, \" -> \", ruleset.outType,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"Ruleset:\", ruleset,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"Initial \", ruleset.inType,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 input,\n                                 \"\\n******************************************************************\\n\"),\n\n        endRuleset := (self, ruleset,output) >> \n                           Print(\"\\n******************************************************************\\n\",\n                                 \"END RULESET: \", ruleset.inType, \" -> \", ruleset.outType,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 \"Final \", ruleset.outType,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 output,\n                                 \"\\n******************************************************************\\n\\n\"),\n                           \n        beginStage := (self, from, to, input) >> \n                           Print(\"******************************************************************\\n\",\n                                 \"BEGIN TRACE: \",from,\" -> \", to,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 from, \" expression:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 input,\n                                 \"\\n******************************************************************\\n\"),\n                           \n        endStage := (self, from, to, output) >>\n                           Print(\"\\n******************************************************************\\n\",\n                                 \"END TRACE: \",from,\" -> \", to,\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 to,\" expression:\",\n                                 \"\\n------------------------------------------------------------------\\n\", \n                                 output,\n                                 \"\\n******************************************************************\\n\\n\"),\n\n\t\taddNote := (self, note) >>\n                           Print(\"\\n------------------------------------------------------------------\\n\",\n                                 \"NOTE:\\n\", note, \"\\n\",\n                                  \"------------------------------------------------------------------\\n\")\n\t\t\t\t\t\t\t\t \n                         #NOTE:\n                         #d := Collect(spl, @(1, var, e->IsBound(e.value)));\n                         #if (d <>[]) then\n                         #    Print(\"\\n------------------------------------------------------------------\\n\", \n                         #          \"data tables: \", \n                         #          \"\\n------------------------------------------------------------------\\n\");\n                         #    DoForAll(d, i->Print(i.id, \" := \", i.value, \"\\n\\n\"));\n                        #fi;\n));\n\nClass(TraceLogToFile, TraceLogPrinter, rec(\n        __call__ := (self, filename) >> WithBases(self, rec(filename:=filename)),\n                            \n        addRewrite    := (self, name,input,output,env) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].addRewrite           (name,input,output,env)),\n        addExpansion  := (self, name,input,output,env) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].addExpansion   (name,input,output,env)),\n        addTreeExpansion  := (self, name,input,output,children,subtrees,env) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].addTreeExpansion(name,input,output,children,subtrees,env)),\n        addConversion := (self, name,input,output,env) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].addConversion (name,input,output,env)),\n                            \n        beginRuleset  := (self, ruleset, input   ) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].beginRuleset  (ruleset, input   )),\n        endRuleset    := (self, ruleset, output  ) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].endRuleset    (ruleset, output  )),\n        beginStage    := (self, from, to, input  ) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].beginStage    (from, to, input  )),\n        endStage      := (self, from, to, output ) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].endStage      (from, to, output )),\n\t\taddNote       := (self, note             ) >> AppendTo(self.filename, self.__bases__[1].__bases__[1].addNote       (note ))\n));\n\n\nClass(TraceLogCollector, rec(\n        __call__ := (self) >> WithBases(self, rec(log:=[])),\n                       \n        addRewrite := meth(self, name,input,output,env)\n                    local e;\n                    e := TraceRewrite(name, input,output,env);\n                    Add(self.log, e);\n                    return e;\n                end,\n                  \n        addExpansion := meth(self, name,input,output,env)\n                    local e;\n                    e := TraceExpansion(name, input,output, env);\n                    Add(self.log, e);\n                    return e;\n                end,\n                  \n        addTreeExpansion := meth(self, name,input,output,children,subtrees,env)\n                    local e;\n                    e := TraceTreeExpansion(name, input,output,children,subtrees,env);\n                    Add(self.log, e);\n                    return e;\n                end,\n                  \n        addConversion := meth(self, name,input,output,env)\n                    local e;\n                    e := TraceConversion(name, input,output, env);\n                    Add(self.log, e);\n                    return e;\n                end,\n                  \n        beginRuleset := (self, ruleset, input) >> 0,\n        endRuleset := (self, ruleset, output) >> 0,\n        beginStage := (self, from, to, input) >> 0,\n        endStage := (self, from, to, output) >> 0,\n\t\taddNote := (self, note) >> 0\n                  \n));\n\nClass(TraceLog, rec(\n                        \n        __call__ := (self) >> WithBases(self, rec(plugins := [])),\n                    \n        addPlugin := (self, plugin) >>  Add(self.plugins, plugin),\n                    \n        addRewrite := meth(self, name,input,output,env)\n                    local p;\n                    for p in self.plugins do\n                          p.addRewrite(name,input,output,env);\n                     od;\n                end,\n                        \n        addExpansion := meth(self, name,input,output,env)\n                    local p;\n                    for p in self.plugins do\n                        p.addExpansion(name,input,output,env);\n                    od;\n                end,\n                  \n        addTreeExpansion := meth(self, name,input,output,children,subtrees,env)\n                    local p;\n                    for p in self.plugins do\n                        p.addTreeExpansion(name,input,output,children,subtrees,env);\n                    od;\n                end,\n                  \n        addConversion := meth(self, name,input,output,env)\n                    local p;\n                    for p in self.plugins do\n                        p.addConversion(name,input,output,env);\n                    od;\n                end,\n                  \n        beginRuleset := meth(self, ruleset, input)\n                    local p;\n                    for p in self.plugins do\n                        p.beginRuleset(ruleset, input);\n                    od;\n                end,\n                  \n        endRuleset := meth(self, ruleset,output)\n                    local p;\n                    for p in self.plugins do\n                        p.endRuleset(ruleset,output);\n                    od;\n                end,\n                  \n        beginStage := meth(self, from, to, input)\n                    local p;\n                    for p in self.plugins do\n                        p.beginStage(from, to, input);\n                    od;\n                end,\n                  \n        endStage := meth(self, from, to, output)\n                    local p;\n                    for p in self.plugins do\n                        p.endStage(from, to, output);\n                    od;\n                end,\n\t\t\t\t\n\t\taddNote := meth(self, note)\n                    local p;\n                    for p in self.plugins do\n                        p.addNote(note);\n                    od;\n                end\t\t\n));\n                \n# Global variable. Will be moved to 'opts' eventually.\ntrace_log := TraceLog();\n\n# Convenience functions\n\nTraceToConsole := function() \n    trace_log.addPlugin(TraceLogPrinter()); \nend;\n\nTraceToFile := function(filename) \n    trace_log.addPlugin(TraceLogToFile(filename));\nend;\n\ntrace_collector := TraceLogCollector();\nTraceToMemory := function() \n    trace_log.addPlugin(trace_collector);\n    return(trace_collector);\nend;\n\nTraceNote := function(note)\n\ttrace_log.addNote(note);\nend;\n\n  \n# --- Example of trace system initialization:---\n#trace_log.addPlugin(TraceLogPrinter());\n#trace_log.addPlugin(TraceLogToFile(\"trace.g\"));\n# Save reference to collector for later use\n#trace_collector := TraceLogCollector();\n#trace_log.addPlugin(trace_collector);\n", "meta": {"hexsha": "c95d90a51b310c8415a23606b967f1dc9d06bef0", "size": 16518, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/trace.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/trace.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/trace.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 53.1125401929, "max_line_length": 204, "alphanum_fraction": 0.3131735077, "num_tokens": 2718, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3073580295544412, "lm_q2_score": 0.0247981594748698, "lm_q1q2_score": 0.007621913432772778}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nIsTag := x -> IsRec(x) and IsBound(x.isTag) and x.isTag;\n\nDeclare(ANoTag);\n\n####################################################################\n#F AGenericTag - base class for tags, uses RewritableObject features\n#F    which provides\n#F      __call__\n#F      print\n#F      rSetChild\n#F      rChildren\n#F      lessThan\n#F      equal\n#F\n#F Constructor saves all parameters into .params.\n#F  Please read Doc(RewritableObject).\n#F\nClass(AGenericTag, RewritableObject, rec(\n    isTag := true,\n    kind := self >> ObjId(self),\n\n    # YSV: this should be called when we transpose the parent structure\n    transpose := self >> self,   \n\n    isSticky  := false,\n    right     := self >> When(IsBound(self.isRight), self.isRight, false),\n    left      := self >> When(IsBound(self.isRight), not self.isRight, false),\n    bisided   := self >> not IsBound(self.isRight),\n\n    leftChild  := self >> When(IsBound(self.isLeftChild),  self.isLeftChild,  false),\n    rightChild := self >> When(IsBound(self.isRightChild), self.isRightChild, false),\n\n    edge       := self >> When(IsBound(self.isEdge),  self.isEdge,  false),\n\n    leftEdge   := self >> self.edge() and self.leftChild(),\n    rightEdge  := self >> self.edge() and self.rightChild(),\n\n    # distCompose(<chlist>, <opts>)\n    #   Distributes tag over Compose(<chlist>).\n    #   Returns list of tags to assign to each composition member.\n    #   ANoTag is thrown out later during normalization.\n    distCompose := (self, chlist, opts) >>\n        Cond( self.left(),  \n                  [self] :: Replicate(Length(chlist)-1, ANoTag),\n              self.right(), \n                  Replicate(Length(chlist)-1, ANoTag) :: [self],\n              # else bisided\n                  Replicate(Length(chlist), self) ),\n\n));\n\nClass(ASingletonTag, AGenericTag, rec(\n    params := [],\n    from_rChildren := (self, rch) >> self,\n    kind := self >> self\n));\n\n#F ANoRecurse() -- tag that prevents further recursion. \n#F\n#F Currently only used in autolib.\n#F\nClass(ANoRecurse, AGenericTag);\n\n#F ANoTag - denotes absence of tags\n#F\nClass(ANoTag, ASingletonTag, rec());\n\n#F ATopLevel - used to denote that special top level processing should be used,\n#F             generally param[1] denotes at which 'level' the tag should be\n#F             dropped.\n#F\n#F             Marek uses it in his WHT/bit-perms expansions. This tag will\n#F             be moved elsewhere soon.\nClass(ATopLevel, AGenericTag, rec());\n\n\n####################################################################\n#F Mixin class for taggable objects\n#F\n#F This object/class will add tagging functionality to whatever object inherits it.\n#F Like all mixin style classes, it is not meant to be the sole parent class.\n#F\nClass(TaggedObjectMixin, rec(\n    # this is the actual list of tags. This array should not be accessed directy, rather\n    # the methods should be used to parse it.\n    tags := [],\n\n    # returns the first tag or ANoTag\n    firstTag := self >> When(Length(self.tags) >= 1, self.tags[1], ANoTag),\n\n    # returns true if first tag is has 'tag' object id\n    firstTagIs := (self, tag) >> self.firstTag().kind()=tag,\n\n    # returns the tags\n    getTags := self >> self.tags,\n\n    # returns true if the object has tags\n    hasTags := self >> self.tags <> [],\n\n    # returns a copy of the object with 'tags' added on to any existing tags.\n    withTags := (self, tags) >> Checked(IsList(tags), self.setTags(self.tags :: tags)),\n\n    # returns a copy of the object with tags given by 'tags'\n    setTags := (self, tags) >> Checked(IsList(tags), CopyFields(self, rec(tags := tags))),\n\n    # return a copy of the whole object without the first tag\n    withoutFirstTag := self >> self.setTags(Drop(self.tags, 1)),\n\n    # return a copy of the whole object without the tags given by object id 'tag'\n    withoutTag := (self, tag) >> Checked(IsTag(tag), self.setTags(Filtered(self.tags, e -> e.kind() <> tag))),\n\n    # returns true when the object id of at least one of the tags is 'tag'\n    hasTag := (self, tag) >> Checked(IsTag(tag), ForAny(self.tags, e -> e.kind() = tag)),\n\n    hasAnyTag := (self, tags) >> Checked(IsList(tags), ForAny(self.tags, e -> e.kind() in tags)),\n\n    # returns true when tag number 'n' has the object id given by 't'\n    isTag := (self, n, t) >> When(Length(self.tags) >= n, self.tags[n].kind() = t, false),\n\n    numTags := (self) >> Length(self.tags),\n\n    dropTags := (self) >> CopyFields(self, rec(tags := [])),\n\n    # \n    #F getTag\n    #\n    # get the tag by name or number, function has 3 forms:\n    #   getTag(2)           returns 2nd tag\n    #   getTag(ASomeTag)    if there is only 1 ASomeTag, returns it, if >1, returns array\n    #   getTag(ASomeTag, 2) returns 2nd ASomeTag\n    # \n    # in case of error, getTag returns false\n    #\n    getTag := meth(arg)\n        local s, t, n;\n\n        Constraint(Length(arg) = 2 or Length(arg) = 3);\n\n        s := arg[1];\n\n        # arg[2] is a number.\n        if IsInt(arg[2]) then\n            return When(Length(s.tags) >= arg[2],\n                s.tags[arg[2]],\n                false);\n\n        # arg[2] must be a tag id.\n        else\n            t := Filtered(arg[1].tags, e -> e.kind() = arg[2]); \n\n            # if tag and number are specified\n            if Length(arg) = 3 then\n                return When(Length(t) >= arg[3],\n                    t[arg[3]],\n                    false\n                );\n            \n            else\n                return When(t = [], \n                    false,\n                    When(Length(t) = 1,\n                        t[1],\n                        t\n                    )\n                );\n            fi;\n        fi;\n    end,\n\n    getAnyTag := (self, tags) >> First(self.tags, x->x.kind() in tags)\n        \n));\n\n####################################################################\n#F Tagged non-terminal. This should be used for all new taggable\n#F nonterminals.\n#F\n#F This supercedes the old system which puts tags into .params field\n#F\n#F Tags on nonterminals contain information that is beyond the mathematical\n#F details of the object. Often tags contain information about hardware\n#F which is used to direct the breakdown.\n#F\nClass(TaggedNonTerminal, TaggedObjectMixin, NonTerminal, rec(\n    _short_print := true,\n    #--------- Transformation rules support --------------------------------\n    from_rChildren := (self, rch) >> let(\n        len := Length(rch),\n        transposed := rch[len-1],\n        tags := rch[len],\n        t := ApplyFunc(ObjId(self), rch{[1..len-2]}),\n        tt := When(transposed, t.transpose(), t),\n        attrTakeA(tt.withTags(tags), self)\n    ),\n\n    rChildren := self >>\n        Concatenation(self.params, [self.transposed, self.tags]),\n\n    rSetChild := meth(self, n, newChild)\n        local l;\n        l := Length(self.params);\n        if n <= l then\n            self.params[n] := newChild;\n        elif n = l+1 then\n            self.transposed := newChild;\n        elif n = l+2 then\n            self.tags := newChild;\n        else Error(\"<n> must be in [1..\", l+2, \"]\");\n        fi;\n        # self.canonizeParams(); ??\n        self.dimensions := self.dims();\n    end,\n\n    # this print method OVERRIDES the print method in NonTerminal.\n    # here, we print the TAG INFO.\n    print := (self, i, is) >> Print(\n\tInherited(i, is),\n        When(IsBound(self.tags) and IsList(self.tags) and self.tags<>[], \n             Print(\".withTags(\", self.tags, \")\"))), \n    \n    takeTA := (self, o) >> self.setTags(o.getTags()).takeAobj(o),\n));\n", "meta": {"hexsha": "e0ebb63df3a1f6e6ca4d0c7dc705d0ec3f76f872", "size": 7576, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/spl/tags.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/spl/tags.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/spl/tags.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.2280701754, "max_line_length": 110, "alphanum_fraction": 0.568373812, "num_tokens": 1981, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3208213008246071, "lm_q2_score": 0.023689473711842175, "lm_q1q2_score": 0.00760008777208354}}
{"text": "InputTextFile(\"input.txt\");\ns := ReadAll(f);;  # two semicolons to hide the result, which may be long\nCloseStream(f);\n", "meta": {"hexsha": "d64ce522f844fa8b2f7d77053eba3c8a604d4213", "size": 118, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Read-entire-file/GAP/read-entire-file.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Read-entire-file/GAP/read-entire-file.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Read-entire-file/GAP/read-entire-file.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 29.5, "max_line_length": 73, "alphanum_fraction": 0.7118644068, "num_tokens": 34, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.16238003666671086, "lm_q2_score": 0.046724961446917804, "lm_q1q2_score": 0.007587200953001165}}
{"text": "\n# Copyright 2018-2019, Carnegie Mellon University\n# See LICENSE for details\n\nCoSynthesize := function(t, opts) \n    local tmp, f;\n    tmp := Copy(t);\n    for f in opts.csStrategy do\n        tmp := f(tmp, opts);\n    od;\n    return tmp;\nend;\n\nExportCode := function(c)\n    local vars;\n    vars := FoldL(Collect(c, var), (a,b)->When(not b.id in List(a, i->i.id), Concat([b],a), a), []);\n    Print(\"let(\", DoForAll(vars, i->Print(i.id, \" := var(\\\"\", i.id, \"\\\", \", i.t, \"),\\n\")), c, \")\");\nend;\n\nExportCProg := function(c, opts)\n    Print(opts.doc::\n        \"\\n\");\n    PrintCode(opts.subName, c, opts);\nend;\n\n\nExportInclude := function(c, opts)\n    local parameters, id, unparser, oopts, macro;\n    \n    unparser := Copy(opts.unparser);\n    opts.unparser.opts:=opts;\n    macro := \"__\"::StringToUpper(opts.filename)::\"_H__\";\n    \n    Print(opts.doc::\n        \"\\n\"::\n        \"#ifndef \"::macro::\"\\n\"::\n        \"#define \"::macro::\"\\n\\n\"::\n        \"#ifdef __cplusplus\\n\"::\n        \"extern \\\"C\\\" {\\n\"::\n        \"#endif\\n\");\n        \n    parameters:=Flat(c.params);\n    id := opts.subName;\n    Print(\"\\n\", \n        When(IsBound(c.inline) and c.inline, \"inline \",\"\"),\n        opts.funcModifier, opts.unparser.declare(c.ret, var(id, c.ret), 0, 1), \"(\",\n            DoForAllButLast(parameters, p->Print(unparser.declare(p.t, p,0,1), \", \")),\n            When(Length(parameters)>0, unparser.declare(Last(parameters).t, Last(parameters),0,1), \"\"), \");\\n\");\n        \n    Print(\"\\n#ifdef __cplusplus\\n\"::\n        \"}\\n\"::\n        \"#endif\\n\\n\"::    \n        \"#endif\\n\");\n    opts.unparser := unparser;\nend;\n\n", "meta": {"hexsha": "7183358b08384a5cab8de479e83fab42d7a9af55", "size": 1586, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "formal_compile.gi", "max_stars_repo_name": "spiral-software/spiral-package-hcol", "max_stars_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "formal_compile.gi", "max_issues_repo_name": "spiral-software/spiral-package-hcol", "max_issues_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "formal_compile.gi", "max_forks_repo_name": "spiral-software/spiral-package-hcol", "max_forks_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-26T05:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T05:21:02.000Z", "avg_line_length": 27.8245614035, "max_line_length": 112, "alphanum_fraction": 0.5359394704, "num_tokens": 453, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2877678157610531, "lm_q2_score": 0.026355353993244613, "lm_q1q2_score": 0.0075842226522453505}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# ----------------------------------------------------------------------------------\n# Visitor - base class for objects implementing the visitor pattern from Gamma book\n# ----------------------------------------------------------------------------------\n# This class basically implements a somewhat modified variant of the original\n# Visitor pattern from the book by Gamma, et al. \"Design Patterns\".\n#\n# Usage example:\n#\n# define the following class\n#\n# Class(LispGen, Visitor, rec(\n#     add := (self, o) >> Print(\"(+ \", self(o.args[1]), \" \", self(o.args[2]), \")\"),\n#     mul := (self, o) >> Print(\"(* \", self(o.args[1]), \" \", self(o.args[2]), \")\"),\n#     sub := (self, o) >> Print(\"(- \", self(o.args[1]), \" \", self(o.args[2]), \")\"),\n#     var := (self, o) >> Print(\"(var \", o.id, \")\"),\n#     Value := (self, o) >> Print(\"(value \", o.v, \")\")\n# ));\n#\n# spiral> LispGen(4*X+2);\n# (+ (* (value 4) (var X)) (value 2))spiral> \n#\n# Note that instead of using 'self' as a function (which invokes __call__),\n# we can use self.visit, and make __call__ a constructor for LispGen.\n#\n# Ie., the methods would look like\n#     add := (self, o) >> Print(\"(+ \", self.visit(o.args[1]), \" \", self.visit(o.args[2]), \")\"),\n#\nClass(Visitor, rec(\n   __call__ := arg >> ApplyFunc(arg[1].visit, arg{[2..Length(arg)]}),\n\n    # this is a rewrite of the lambda expression. The lambda was getting\n    # way too long. This implements the double dispach for the visitor\n    # class. \n    visit := meth(arg)\n        local self, o, len;\n\n        Constraint(Length(arg) >= 2);\n\n        self := arg[1];\n        o := arg[2];\n        len := Length(arg);\n\n        if IsRec(o) or IsList(o) then\n            o := ObjId(o);\n            if IsBound(self.(o.name)) then\n                ApplyFunc(self.(o.name), arg{[2..len]});\n\n            # this is just here to trap the hacks, rather than silently fail\n            elif IsBound(o.visitAs) then\n                Error(\"visitAs has been removed. Don't use it.\");\n\n            else\n\t\t        Error(\"Cannot visit <arg[2]>. Visitor \", self, \n                \" does not have field '\", o.name, \"'\", \n                    When(IsBound(o.visitAs), \n\t\t\t            Concat(\" or \",o.visitAs, \" (from .visitAs)\"), \n                        \"\"\n                    )\n                );\n            fi;\n        else\n            ApplyFunc(self.atomic, arg{[2..len]});\n        fi;\n    end\n));\n\n#F\n#F# getVisitAs\n#F\n#F get the .visitAs if it exists.\n#F\n\ngetVisitAs := function(v, o)\n\n\n    o := ObjId(o);\n\n    # if this object has a visitor, or if visitAs is unbound\n    if IsBound(v.(o.__name__)) or not IsBound(o.visitAs) then\n        return false;\n    fi;\n\n    return o.visitAs;\nend;\n\n#F HierarchicalVisitor -- same as Visitor, but does not use .visitAs, \n#F   instead traverses the super class chain \n#F\nClass(HierarchicalVisitor, rec(\n   __call__ := arg >> ApplyFunc(arg[1].visit, arg{[2..Length(arg)]}),\n\n#F the hierarchical visitor function. \n#F \n#F we consider the objects by level, in order of the objects in __bases__\n#F\n#F here's an example:\n#F objA\n#F  |---parA\n#F  | |---parA1\n#F  | \\---parA2\n#F  \\---parB\n#F\n#F traverse order is: objA parA parB parA1 parA2\n#F\n    warnings := Set([]),\n    paranoiaMode := false, # <-- if this is true, then .visit() aborts when there is a mismatch of \n                          # the method it finds with what .visitAs prescribes, otherwise,\n                          # it silently adds the mismatch to .warnings and continues\n\n    visit := meth(arg)\n        local self, o, orig, len, parents, newparents, v;\n      \n        Constraint(Length(arg) >= 2);\n\n        self := arg[1];\n        o   := arg[2];\n        len := Length(arg);\n\n        # lists are handled with .ListClass, records with .<objid>, \n        # other objects with .atomic\n        if not (IsRec(o) or IsList(o)) or IsString(o) then\n            return ApplyFunc(self.atomic, arg{[2..len]});\n\n        # objects are handled here\n        else\n            # this will be eventually removed, but for the time being,\n            # we try to figure out the object which would be selected\n            # by .visitAs and compare it to the object which is chosen\n            # hierarchically. If there is a difference, we throw an\n            # error.\n\n            v := getVisitAs(self, o);\n\n            # paranoia check to make sure we have an object\n            Constraint(IsList(o) or (IsRec(o) and IsBound(o.__name__)));\n\n            parents := Cond(IsList(o), [ObjId(o)], ShallowCopy(o.__bases__));\n\n            # traverse the parent tree as given in the function comments\n            for o in parents do\n                if IsBound(self.(o.__name__)) then\n\n                    # here is our paranoia check which will eventually\n                    # be removed after the transition is complete.\n                    if (v <> false and v <> o.__name__) then\n                        if self.paranoiaMode then\n                            Error(\"visitAs object is different from object picked by hierarchy traversal. Call Marek.\");\n                        else\n                            AddSet(self.warnings, [self,v,o]); \n                        fi;\n                    fi;\n\n                    return ApplyFunc(self.(o.__name__), arg{[2..len]});\n                elif IsBound(o.__bases__) then\n                    Append(parents, o.__bases__);\n                fi;\n            od;\n\n            return Error(\"Cannot visit <arg[2]>. visitAs was \", v);\n        fi;\n    end,\n\n    #F\n    #F getBases()\n    #F\n    #F build a list of all the bases according to the order\n    #F given in the .visitAs method\n    #F\n    getBases := meth(self)\n        local b, i;\n\n        b := [self];\n        i := 1;\n\n        while i <= Length(b) do\n            Append(b, ShallowCopy(b[i].__bases__));\n            i := i + 1;\n        od;\n\n        return b;\n    end,\n\n    #F\n    #F showMatches(obj)\n    #F\n    #F returns the ordered list of visitors triggered by this object.\n    showMatches := meth(self, o)\n        local b, bb, res, i, m;\n\n        Constraint(IsRec(o));\n        \n        b := self.getBases();\n\n        bb := ShallowCopy(o.__bases__);\n        res := [];\n        i := 1;\n\n        while i <= Length(bb) do\n            m := Filtered(b, e -> bb[i].name in UserRecFields(e));\n\n            if m <> [] then\n                Append(res, [bb[i]] :: m);\n            fi;\n\n            Append(bb, ShallowCopy(bb[i].__bases__));\n            i := i + 1;\n        od;\n\n        return res;\n    end,\n));\n\n\n#F HierarchicalVisitorCx -- HierarchicalVisitor with context accessible through\n#F   self.cx field. Drawback - start visitor using <walk> method instead of \n#F   __call__.\n#F\n#F   Ex: MyVisitor.walk(tree, arg1, arg2);\n#F\n\nClass(HierarchicalVisitorCx, HierarchicalVisitor, rec(\n\n    walk := (arg) >> ApplyFunc(CopyFields(arg[1], rec( \n        cx := empty_cx(), _current := false )), Drop(arg, 1)),\n\n    visit := meth(arg)\n        local self, parent, res;\n\n        self          := arg[1];\n        parent        := self._current;\n        self._current := arg[2];\n\n        if parent=false then\n            res := ApplyFunc(Inherited, Drop(arg, 1));\n        else\n            cx_enter(self.cx, parent);\n            res := ApplyFunc(Inherited, Drop(arg, 1));\n            cx_leave(self.cx, parent);\n        fi;\n        \n        self._current := parent;\n\n        return res;\n    end,\n));\n", "meta": {"hexsha": "0e0a4a4b229785c8dc03839a6a9adc0ca1dc7cf2", "size": 7428, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/rewrite/visitor.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/rewrite/visitor.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/rewrite/visitor.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 29.593625498, "max_line_length": 120, "alphanum_fraction": 0.5220786214, "num_tokens": 1894, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1895210821742346, "lm_q2_score": 0.0390482896509341, "lm_q1q2_score": 0.007400474111697996}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nFixUpHIP_Code := function (c, opts)\n    local kernels, kernel_inits, globals, var_decls, var_dels, cx, v, dptr; \n\n    if IsBound(opts.fixUpTeslaV_Code) and opts.fixUpTeslaV_Code then\n        kernels := List(Collect(c, specifiers_func), k->k.id);\n\n        dptr := var.fresh_t(\"hp\", TPtr(TReal));\n\n        kernel_inits := List(kernels, k-> call(rec(id := \"hipFuncSetCacheConfig\"), fcall(\"reinterpret_cast<const void*>\", k), \"hipFuncCachePreferL1\"));\n\n        globals := Flat(List(Collect(c, @@(1, decl, (e, cx) -> (not IsBound(cx.specifiers_func) or cx.specifiers_func = []) and\n                               (not IsBound(cx.func) or cx.func = []))), x->x.vars));\n\n        var_decls := chain(Flat(List(globals, v -> [ \n                call(rec(id := \"hipMalloc\"), tcast(TPtr(TPtr(TVoid)), addrof(dptr)), sizeof(v.t.t) * v.t.size), \n                call(rec(id := \"hipMemcpyToSymbol\"), fcall(\"HIP_SYMBOL\", v), addrof(dptr), sizeof(dptr.t)) \n            ])));\n        \n        var_dels := decl(dptr, chain(Flat(List(globals, v -> [ \n                call(rec(id := \"hipMemcpyFromSymbol\"), addrof(dptr), fcall(\"HIP_SYMBOL\", v), sizeof(dptr.t)), \n                call(rec(id := \"hipFree\"), dptr)\n            ]))));\n\n        cx := chain(kernel_inits :: [var_decls]);\n        for v in globals do\n            v.t := TPtr(v.t.t, [\"__device__\"]);\n        od;\n\n        c := SubstBottomUp(c, @(1, func, f -> f.id = \"init\"),\n            e -> CopyFields(@(1).val, rec(cmd := decl(dptr, chain(cx, @(1).val.cmd))))\n        );\n        c := SubstBottomUp(c, @(1, func, f -> f.id = \"destroy\"),\n            e -> CopyFields(@(1).val, rec(cmd := chain(var_dels, @(1).val.cmd)))\n        );\n        c := SubstBottomUp(c, @(1, chain, e -> ForAny(e.cmds, e -> ObjId(e) = func and e.id = \"init\")),\n            e -> chain(Filtered(@(1).val.cmds, e-> ObjId(e) <> func or e.id <> \"init\") :: Filtered(@(1).val.cmds, e -> ObjId(e) = func and e.id = \"init\"))\n        );\n\n        \n    fi;\n\n    return c;\nend;\n", "meta": {"hexsha": "654fcf0fc926348c24d29737b3e416472620370b", "size": 2060, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/hip/code.gi", "max_stars_repo_name": "mikefranusich/spiral-package-fftx", "max_stars_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "platforms/hip/code.gi", "max_issues_repo_name": "mikefranusich/spiral-package-fftx", "max_issues_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "platforms/hip/code.gi", "max_forks_repo_name": "mikefranusich/spiral-package-fftx", "max_forks_repo_head_hexsha": "a1a355f3764aade9665145aa63c2318201421543", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.9166666667, "max_line_length": 154, "alphanum_fraction": 0.536407767, "num_tokens": 606, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.23370635691404026, "lm_q2_score": 0.0316187678389692, "lm_q1q2_score": 0.007389507041756313}}
{"text": "#############################################################################\n##\n##\n#W  json.gi                  json Package                Chris Jefferson\n##\n##  Installation file for functions of the json package.\n##\n#Y  Copyright (C) 2013-2014 University of St. Andrews, North Haugh,\n#Y                          St. Andrews, Fife KY16 9SS, Scotland\n##\n\n####\n# Functions and variables beginning '_JSON_' are only called\n# from C++ by the json package.\n####\n\n\n_JSON_Globals := [];\n\n_JSON_addRef := function(obj)\n  Add(_JSON_Globals, obj);\nend;\n\n_JSON_clearRefs := function()\n  _JSON_Globals := [];\nend;\n\nInstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsInt],\nfunction(o, d)\n  PrintTo(o, String(d));\nend );\n\nInstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsFloat],\nfunction(o, d)\n  PrintTo(o, String(d));\nend );\n\nInstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsBool],\nfunction(o, b)\n  if b = true then\n    PrintTo(o, \"true\");\n  elif b = false then\n    PrintTo(o, \"false\");\n  else\n    Error(\"Invalid Boolean\");\n  fi;\nend );\n\nInstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsString],\nfunction(o, s)\n  if IsEmpty(s) then\n    if IsStringRep(s) then\n      PrintTo(o, \"\\\"\\\"\");\n    else\n      PrintTo(o, \"[]\");\n    fi;\n  else\n    PrintTo(o, \"\\\"\", JSON_ESCAPE_STRING(s), \"\\\"\");\n  fi;\nend );\n\nInstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsList],\nfunction(o, l)\n  local i, first;\n  first := true;\n  PrintTo(o, \"[\");\n  for i in l do\n    if first then\n      first := false;\n    else\n      PrintTo(o, \",\");\n    fi;\n    _GapToJsonStreamInternal(o, i);\n  od;\n  PrintTo(o, \"]\");\nend );\n\nInstallMethod(_GapToJsonStreamInternal, [IsOutputStream, IsRecord],\nfunction(o, r)\n  local i, first;\n  first := true;\n  PrintTo(o, \"{\");\n  for i in Set(RecNames(r)) do # sort for output stability across GAP sessions\n    if first then\n      first := false;\n    else\n      PrintTo(o, \",\");\n    fi;\n    _GapToJsonStreamInternal(o, i); # a string or small integer\n    PrintTo(o, \" : \");\n    _GapToJsonStreamInternal(o, r.(i)); # an arbitrary GAP object\n  od;\n  PrintTo(o, \"}\");\nend );\n\nInstallGlobalFunction(GapToJsonStream,\nfunction(stream, obj)\n  local streamformat;\n  streamformat := PrintFormattingStatus(stream);\n  SetPrintFormattingStatus(stream, false);\n  _GapToJsonStreamInternal(stream, obj);\n  SetPrintFormattingStatus(stream, streamformat);\nend );\n\n\nInstallGlobalFunction(GapToJsonString,\nfunction(obj)\n  local str, s;\n  str := \"\";\n  s := OutputTextString(str, true);\n  SetPrintFormattingStatus(s, false);\n  GapToJsonStream(s, obj);\n  return str;\nend );\n\nInstallGlobalFunction(JsonStringToGap,\nfunction(str)\n  return JSON_STRING_TO_GAP(str);\nend );\n\nInstallGlobalFunction(JsonStreamToGap,\nfunction(str)\n  return JSON_STREAM_TO_GAP(str);\nend );\n", "meta": {"hexsha": "5ec687cdcb91d23d5c7f8b2409dd63045134d2d9", "size": 2777, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/json.gi", "max_stars_repo_name": "gap-system/json", "max_stars_repo_head_hexsha": "2a75d76dca475d078b918833d77e11cebad1085b", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-11-20T18:29:08.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-01T16:49:59.000Z", "max_issues_repo_path": "gap/json.gi", "max_issues_repo_name": "gap-system/json", "max_issues_repo_head_hexsha": "2a75d76dca475d078b918833d77e11cebad1085b", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 22, "max_issues_repo_issues_event_min_datetime": "2015-11-10T23:34:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-27T00:01:59.000Z", "max_forks_repo_path": "gap/json.gi", "max_forks_repo_name": "gap-system/json", "max_forks_repo_head_hexsha": "2a75d76dca475d078b918833d77e11cebad1085b", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2015-11-10T23:23:49.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-03T07:57:45.000Z", "avg_line_length": 22.216, "max_line_length": 78, "alphanum_fraction": 0.6481814908, "num_tokens": 714, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.20689402925496744, "lm_q2_score": 0.03567854959602237, "lm_q1q2_score": 0.007381678883894258}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Class(DistMixin1, rec(\n# #   includes := [\"<include/threads.h>\", \"<include/smp2.h>\"],\n#     dist_loop := meth(self, o, i, is)\n#         local v, lo, hi;\n#         v := o.var;\n#         lo := o.range[1];\n#         hi := Last(o.range);\n#         Print(Blanks(i), \"for(int \", v, \" = tid + \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"+= \", o.p, \") {\\n\");\n#         Print(Blanks(i+is), \"int \", o.tidvar, \" = \", self(o.tidexp, i+is+is, is), \";\\n\");\n#         self(o.cmd,i+is,is);\n#         Print(Blanks(i), \"}\\n\");\n#         Print(Blanks(i), When(IsBound(self.opts.smp), \n#                               self.opts.smp.barrier, \n#                               \"//barrier(num_threads, tid, &GLOBAL_BARRIER);\\n\"));\n#     end,\n# \n#     threadId := (self, o, i, is) >> Print(\"tid\")\n# \n# ));\n\nClass(DistMixin, rec(\n#  includes := [\"<spumacros.h>\"],\n\n   dist_loop := meth(self, o, i, is)\n       Print(Blanks(i),    \"{\\n\");\n       #Print(Blanks(i+is), \"unsigned int \", o.var, \" = spe_info.spuid;\\n\");\n       self(o.cmd,i+is,is);\n       Print(Blanks(i),    \"}\\n\");\n       #Print(Blanks(i),    \"//ALL_TO_ALL_BARRIER;\\n\");\n       #Print(Blanks(i),    \"BLOCK_ON_READ();\\n\");\n    end,\n\n    dist_barrier := (self,o,i,is) >> Print(Blanks(i), \"BLOCK_ON_CPUDMA; ALL_TO_ALL_BARRIER;\\n\"),\n\n    call := (self, o, i, is) >> Print(Blanks(i), o.args[1].id, self.pinfix(Drop(o.args, 1), \", \"), \";\\n\"),\n\n    fcall := (self, o, i, is) >> Print(self(o.args[1],0,0), \"(\", self.infix(Drop(o.args, 1), \", \"), \")\"),\n\n\n));\n\nClass(DistUnparser, DistMixin, CUnparserProg);\n#Class(DistCellUnparser, DistMixin, CellUnparser);\n", "meta": {"hexsha": "b431c8c1dcc916e5c62d9e7348688ab260ef45f5", "size": 1664, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/distributed/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/distributed/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/distributed/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.9591836735, "max_line_length": 110, "alphanum_fraction": 0.5012019231, "num_tokens": 554, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.20181322226037882, "lm_q2_score": 0.03622005625510387, "lm_q1q2_score": 0.007309686263294701}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# NOTE: the code below checks if BF_NO_COPY flag is set. This is a bad way to check \n#        whether something is a class, also hardcoding 128 will break sooner or later\n_isclass := x->BinAnd(BagFlags(x),32768)=32768 or not IsRec(x);\n\n_oid := x -> Cond(_isclass(x), x, ObjId(x));\n\nClass(RewritableObjectOps, PrintOps, rec(\n    \\= := (s1,s2) -> Cond(\n        _isclass(s1) and _isclass(s2), BagAddr(s1)=BagAddr(s2), \n\t_oid(s1) = _oid(s2) and s1.rChildren() = s2.rChildren()),\n\n    \\< := (s1,s2) -> Cond(\n\t_isclass(s1) and _isclass(s2), BagAddr(s1) < BagAddr(s2), \n        _oid(s1) <> _oid(s2),        _oid(s1) < _oid(s2),\n        s1.rChildren() < s2.rChildren())\n));\n\n#F RewritableObject - convenient base class for objects to be used\n#F                    with rewriting.\n#F\n#F It provides\n#F      __call__\n#F      print\n#F      rSetChild\n#F      rChildren\n#F      lessThan\n#F      equal\n#F\n#F Constructor __call__ takes variable number of arguments and saves all\n#F of them into .params field of the constructed instance.\n#F \n#F To do error checking and validation on .params, redefine .updateParams\n#F in subclasses. It is also called after updates in .rSetChild\n#F\n\nClass(RewritableObject, rec(\n    __call__ := meth(arg)\n        local self, params, res;\n        self := arg[1];\n        params := Drop(arg, 1);\n        res := WithBases(self, \n            rec(params := params, operations := RewritableObjectOps));\n        res.updateParams();\n        return res;\n    end,\n    \n    updateParams := self >> self,\n\n    equals := (self, o) >>\n        ObjId(self) = ObjId(o) and self.rChildren() = o.rChildren(),\n\n    lessThan := (self, o) >> Cond(\n        ObjId(self) <> ObjId(o), ObjId(self) < ObjId(o), \n        [ ObjId(self), self.rChildren() ] < [ ObjId(o), o.rChildren() ]\n    ),\n\n    from_rChildren := (self, rch) >> ApplyFunc(ObjId(self), rch),\n    rChildren := self >> self.params,\n    rSetChild := meth(self, n, newC)\n        self.params[n] := newC;\n        self.updateParams();\n    end,\n\n    # Compatibility interface for Print, supports standard print() and\n    # print(s, i, is).\n    # NOTE: doesn't propagate it to children\n    print := meth(arg)\n        local self;\n        self := arg[1];\n        Print(self.__name__, \"(\", PrintCS(self.rChildren()), \")\");\n    end,\n));\n\n#F ConstClass - base class for constants.\n#F\n \nClass(ConstClass);\n\n", "meta": {"hexsha": "e19f533de7eec3d387826e9e7cabee8a162c5866", "size": 2432, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/rewrite/object.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/rewrite/object.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/rewrite/object.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 28.9523809524, "max_line_length": 85, "alphanum_fraction": 0.6077302632, "num_tokens": 703, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.3702253925955866, "lm_q2_score": 0.0197191264510955, "lm_q1q2_score": 0.0073005213319988485}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImport(profiler, rewrite, code);\n\nClass(CompilerDefaults, rec(\n    alignmentSpecifier := \"\",\n    modes := [\"\"],\n    version := \"\",\n    major := 0,\n    minor := 0,\n    compiler := \"\",\n    package := \"\",\n    build := \"\",\n    info := self >> Print(self.compiler, \" \", self.version),\n    default := self >> self.(self.modes[1])(),\n    SIMD := () -> spiral.platforms.SIMDArchitectures\n));\n\nClass(IntelC, CompilerDefaults, rec(\n    alignmentSpecifier := meth(arg)\n\t\tlocal bytes;\n\t\t\n\t\tif Length(arg) > 1 then\n\t\t\tbytes := arg[2];\n\t\telse\n\t\t\tbytes := 16;\n\t\tfi;\n\t\n\t\treturn \"__declspec(align(\"::String(bytes)::\"))\";\n\tend,\n\t\t\n    postalign := (self, a,i,is) >> Print(Blanks(i), \"__assume_aligned(\", a, \", 16);\\n\"),\n    restrict := self >> \"restrict\",\n\n    looppragma := (self, o,i,is) >> When(Collect(o.cmd, loop)=[],\n        Print(Blanks(i), \"#pragma vector always\\n\", Blanks(i), \"#pragma ivdep\\n\"),\n        Print(Blanks(i), \"#pragma novector\\n\")),\n\n    compiler := \"Intel C++ Compiler\",\n\n    SIMD := self >> CopyFields(platforms.SIMDArchitectures, rec(\n        hasMMX    := True,\n\t\thasSSE    := True,\n\t\thasSSE2   := True,\n\t\thasSSE3   := True,\n        hasSSSE3  := () -> self.major >= 10,\n\t\thasSSE4_1 := () -> self.major >= 10,\n\t\thasSSE4_2 := () -> self.major >= 10)),\n\n    modes := [\"ia32\", \"em64t\"],\n\n    # WinGetValue is only defined under windows. If the call works, it takes\n    # the returned path, adds \"bin\" onto it, and then appends\n    # the iclvars batch file redirected to nul.\n    ia32 := self >> CopyFields(default_profiles.win_x86_icc, rec(\n        premake := Concat(\n            \"\\\"\",\n            let(a := Try(WinGetValue(\"SYSTEM/CurrentControlSet/Control/Session Manager/Environment/ICPP_COMPILER15\")),\n                b := Try(WinGetValue(\"SYSTEM/CurrentControlSet/Control/Session Manager/Environment/ICPP_COMPILER14\")),\n                When(a[1],\n                    Concat(a[2], \"bin\\\\\"),\n                    When(b[1],\n                        Concat(b[2], \"bin\\\\\"),\n                        \"\"\n                    )\n                )\n            ),\n            \"iclvars.bat\\\" > nul\"\n        )\n    )),\n\n    em64t := self >> CopyFields(default_profiles.win_x64_icc, rec(\n        premake := Concat(\n            \"\\\"\",\n            let(a := Try(WinGetValue(\"SYSTEM/CurrentControlSet/Control/Session Manager/Environment/ICPP_COMPILER15\")),\n                b := Try(WinGetValue(\"SYSTEM/CurrentControlSet/Control/Session Manager/Environment/ICPP_COMPILER14\")),\n                When(a[1],\n                    Concat(a[2], \"bin\\\\\"),\n                    When(b[1],\n                        Concat(b[2], \"bin\\\\\"),\n                        \"\"\n                    )\n                )\n            ),\n            \"iclvars.bat\\\" intel64 > nul\"\n        )\n    ))\n));\n\n\nClass(GnuC, IntelC, rec(\n    compiler := \"gcc (GNU Compiler Collection)\",\n\t\n\tSIMD := self >> CopyFields(platforms.SIMDArchitectures, rec(\n        hasMMX    := True,\n\t\thasSSE    := True,\n\t\thasSSE2   := True,\n\t\thasSSE3   := True,\n        hasSSSE3  := True,\n\t\thasSSE4_1 := True,\n\t\thasSSE4_2 := True)),\n\t\t\n\talignmentSpecifier := meth(arg)\n\t\tlocal bytes;\n\t\t\n\t\tif Length(arg) > 1 then\n\t\t\tbytes := arg[2];\n\t\telse\n\t\t\tbytes := 16;\n\t\tfi;\n\t\n\t\treturn \"__attribute__((aligned(\"::String(bytes)::\")))\";\n\tend,\n));\n\n \n Class(Llvm_Clang, IntelC, rec(\n    compiler := \"clang (LLVM Compiler Collection)\",\n\t\n\tSIMD := self >> CopyFields(platforms.SIMDArchitectures, rec(\n        hasMMX    := True,\n\t\thasSSE    := True,\n\t\thasSSE2   := True,\n\t\thasSSE3   := True,\n        hasSSSE3  := True,\n\t\thasSSE4_1 := True,\n\t\thasSSE4_2 := True)),\n\t\t\n\talignmentSpecifier := meth(arg)\n\t\tlocal bytes;\n\t\t\n\t\tif Length(arg) > 1 then\n\t\t\tbytes := arg[2];\n\t\telse\n\t\t\tbytes := 16;\n\t\tfi;\n\t\n\t\treturn \"__attribute__((aligned(\"::String(bytes)::\")))\";\n\tend,\n));\n\n\nClass(GnuC_ARM, IntelC, rec(\n    compiler := \"gcc (GNU Compiler Collection)\",\n\t\n\tSIMD := self >> CopyFields(platforms.SIMDArchitectures, rec(\n        hasMMX    := False,\n\t\thasSSE    := False,\n\t\thasSSE2   := False,\n\t\thasSSE3   := False,\n        hasSSSE3  := False,\n\t\thasSSE4_1 := False,\n\t\thasSSE4_2 := False)),\n\t\t\n\talignmentSpecifier := meth(arg)\n\t\tlocal bytes;\n\t\t\n\t\tif Length(arg) > 1 then\n\t\t\tbytes := arg[2];\n\t\telse\n\t\t\tbytes := 16;\n\t\tfi;\n\t\n\t\treturn \"__attribute__((aligned(\"::String(bytes)::\")))\";\n\tend,\n));\n\nClass(VisualC, CompilerDefaults, rec(\n    compiler := \"MS VisualStudio.NET C++ compiler\",\n    modes := [\"ia32\"],\n    SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True)),\n\n\talignmentSpecifier := meth(arg)\n\t\tlocal bytes;\n\t\t\n\t\tif Length(arg) > 1 then\n\t\t\tbytes := arg[2];\n\t\telse\n\t\t\tbytes := 16;\n\t\tfi;\n\t\n\t\treturn \"__declspec(align(\"::String(bytes)::\"))\";\n\tend,\n\t\n    ia32 := self >> CopyFields(default_profiles.win_x86_vcc),\n));\n\nClass(VisualC_12, VisualC, rec(\n    compiler := \"MS VisualStudio.NET C++ 12.0 compiler\",\n    modes    := [\"x86\", \"x64\"],\n    SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSE4_1 := True)),\n    x86 := self >> CopyFields(default_profiles.win_x86_vcc, rec(\n        premake := () -> \"call \\\"%VS120COMNTOOLS%..\\\\..\\\\VC\\\\vcvarsall.bat\\\" x86 > nul\"\n    )),\n    x64 := self >> CopyFields(default_profiles.win_x64_vcc, rec(\n        premake := () -> \"call \\\"%VS120COMNTOOLS%..\\\\..\\\\VC\\\\vcvarsall.bat\\\" x64 > nul\"\n    ))\n));\n\n\nClass(NvidiaCuda, IntelC, rec(\n    compiler := \"NVIDIA Cuda compiler\",\n\t\n\tSIMD := self >> CopyFields(platforms.SIMDArchitectures, rec(\n        hasMMX    := True,\n\t\thasSSE    := True,\n\t\thasSSE2   := True,\n\t\thasSSE3   := True,\n        hasSSSE3  := True,\n\t\thasSSE4_1 := True,\n\t\thasSSE4_2 := True)),\n\t\t\n\talignmentSpecifier := meth(arg)\n\t\tlocal bytes;\n\t\t\n\t\tif Length(arg) > 1 then\n\t\t\tbytes := arg[2];\n\t\telse\n\t\t\tbytes := 16;\n\t\tfi;\n\t\n\t\treturn \"__attribute__((aligned(\"::String(bytes)::\")))\";\n\tend,\n));\n\n\nSupportedCompilers := rec(\n    IntelC := IntelC,\n    VisualC := VisualC,\n    VisualC_12 := VisualC_12,\n    GnuC := GnuC,\n    GnuC_ARM := GnuC_ARM,\n    Llvm_Clang := Llvm_Clang,\n    NvidiaCuda := NvidiaCuda\n);\n", "meta": {"hexsha": "3538b3109c963a58d2840c954d864e8dd143c0f2", "size": 6148, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compilers.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compilers.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compilers.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 25.7238493724, "max_line_length": 142, "alphanum_fraction": 0.5621340273, "num_tokens": 1803, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.18010666408646392, "lm_q2_score": 0.04023794449387964, "lm_q1q2_score": 0.007247121952488961}}
{"text": "\n_BUFFER := \"\";\nOutputStreamZmqType := NewType(\n    StreamsFamily,\n    IsOutputTextStream and IsOutputStreamZmqRep );\n\nInstallMethod( OutputStreamZmq,\n    \"output stream to Jupyter ZeroMQ\",\n    [ IsObject, IsZmqSocket, IsString ],\nfunction(kernel, socket, streamname)\n    # TODO: more specific, check kernel, connected socket, etc\n    if not IsZmqSocket(socket)  then\n        Error( \"<socket> must be a IsZmqSocket\" );\n    fi;\n    return Objectify( OutputStreamZmqType\n                    , rec( kernel := kernel, socket := socket\n                         , format := false, streamname := streamname ) );\nend);\n\n\nInstallMethod( OutputStreamZmq,\n    \"output stream to Jupyter ZeroMQ\",\n    [ IsObject, IsZmqSocket ],\n    { kernel, socket } -> OutputStreamZmq(kernel, socket, \"stdout\" ) );\n\nInstallMethod( ViewString,\n    \"output stream to Jupyter ZeroMQ\",\n    [ IsOutputStreamZmqRep ],\nfunction( obj )\n    # TODO: print some useful info about kernel/socket?\n    return \"OutputStreamZmq()\";\nend );\n\nInstallMethod( WriteAll,\n    \"output text string\",\n    [ IsOutputTextStream and IsOutputStreamZmqRep,\n      IsString ],\nfunction( stream, string )\n    local curmsg, msg;\n    if IsBound(stream!.kernel!.CurrentMsg) then\n        curmsg := stream!.kernel!.CurrentMsg;\n    else\n        curmsg := rec();\n    fi;\n    Append( _BUFFER, string );\n    JupyterMsgSend( stream!.kernel\n                  , stream!.kernel!.IOPub\n                  , JupyterMsg( stream!.kernel\n                              , \"stream\"\n                              , curmsg\n                              , rec( name := stream!.streamname\n                                   , text := string )\n                              , rec () ) );\n    return true;\nend );\n\nInstallMethod( WriteByte,\n    \"output text string\",\n    [ IsOutputTextStream and IsOutputStreamZmqRep,\n      IsInt ],\nfunction(stream, byte)\n    local curmsg, msg;\n    if byte < 0 or 255 < byte  then\n        Error( \"<byte> must an integer between 0 and 255\" );\n    fi;\n    # TODO\n    if IsBound(stream!.kernel!.CurrentMsg) then\n        curmsg := stream!.kernel!.CurrentMsg;\n    else\n        curmsg := rec();\n    fi;\n    Add( _BUFFER, CharInt(byte) );\n    JupyterMsgSend( stream!.kernel\n                  , stream!.kernel!.IOPub\n                  , JupyterMsg( stream!.kernel\n                              , \"stream\"\n                              , curmsg\n                              , rec( name := stream!.streamname\n                                   , text := CharInt(byte) )\n                              , rec () ) );\n\n    return true;\nend );\n\nInstallMethod( PrintFormattingStatus, \"output text string\"\n             , [ IsOutputTextStream and IsOutputStreamZmqRep ]\n             , str -> str!.format);\n\nInstallMethod( SetPrintFormattingStatus, \"output text string\"\n             , [ IsOutputTextStream and IsOutputStreamZmqRep,\n                 IsBool ],\nfunction(str, stat)\n    if stat = fail then\n        Error(\"Print formatting status must be true or false\");\n    else\n        str!.format := stat;\n    fi;\nend);\n\n\n", "meta": {"hexsha": "a9832dfe5d34331035bebfa9d0b9d7c5d11d4407", "size": 3046, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterStream.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterStream.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterStream.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 30.1584158416, "max_line_length": 73, "alphanum_fraction": 0.5607353907, "num_tokens": 701, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.22000709974589316, "lm_q2_score": 0.03258974805461602, "lm_q1q2_score": 0.007169975950945435}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n_printattr := x->When((x=[] and TYPE(x)=\"string\") or (x<>[] and IsString(x)), Print(\"\\\"\", x, \"\\\"\"), Print(x));\n\nattrTakeA  := (to, from) -> When(IsRec(to) and IsBound(to.takeAobj), to.takeAobj(from), to);\n\nClass(AttrMixin, rec(\n    a := rec(),\n\n    setA := meth(arg) \n        local self, i, a, f, val;\n        a := rec();\n        self := arg[1];\n        for i in [2..Length(arg)] do\n            if IsVarMap(arg[i]) then\n                f := NameOf(arg[i][1]);\n                val := Eval(arg[i][2]);\n                a.(f) := val;\n            elif IsList(arg[i]) and Length(arg[i]) in [0,2] then\n                if Length(arg[i])>0 then\n                    [f, val] := arg[i];\n                    a.(f) := val;\n                fi;\n            else return Error(\"arg[i] must be a list or varmap\");\n            fi;\n        od;\n        return CopyFields(self, rec(a:=a)); \n    end,\n\n    withA := meth(arg) \n        local self, res, set; \n        self := arg[1];\n        set := self.setA;\n        res := ApplyFunc(set, arg);\n        res.a := CopyFields(self.a, res.a);\n        return res;\n    end,\n\n    hasA := (self, attr) >> Cond(IsBound(self.a.(attr)), true, false),\n    \n    # getA(<attr>, <def> = false) - returns attribute value.\n    #   Optional <def> parameter is value to return when attribute is not found.\n\n    getA := (arg) >> let( self := arg[1], attr := arg[2],\n                        def := When(Length(arg)>2, arg[3], false),\n                        Cond(IsBound(self.a.(attr)), self.a.(attr), def)),\n\n    printA := self >> let(flds := UserRecFields(self.a),\n        Cond(flds=[], Print(\"\"),\n             Print(\".setA(\",\n                 DoForAllButLast(flds, x->Print(x, \" => \", _printattr(self.a.(x)), \", \")),\n                 Last(flds), \" => \", _printattr(self.a.(Last(flds))), \")\"))),\n\n    takeA   := meth(self, a) self.a := CopyFields(a); return self; end,\n\n    appendA := meth(self, a) self.a := CopyFields(self.a, a); return self; end,\n\n    takeAobj   := meth(self, obj) self.a := CopyFields(obj.a); return self; end,\n\n    appendAobj   := meth(self, obj) self.a := CopyFields(self.a, obj.a); return self; end,\n\n    attrs := ~.takeAobj,\n\n    # testA( attr, v = true ) returns true if object has attribute <attr> with value equal to <v>\n\t\n    testA := (arg) >> let( self := arg[1], attr := arg[2],\n        v := When(IsBound(arg[3]), arg[3], true),\n        self.hasA(attr) and self.getA(attr) = v),\n\n    dropA := meth(arg)\n        local obj, d, s;\n        obj := ShallowCopy(arg[1]);\n        d   := Drop(arg, 1);\n        if Length(arg)=1 then\n            Unbind(obj.a);\n        elif ForAll(d, IsString) then\n            obj.a := ShallowCopy(obj.a);\n            for s in d do Unbind(obj.a.(s)); od;\n        else\n            Error(\"Usage: dropA([ <attr_name_string>[, <attr_name_string>[, ...]] ])\");\n        fi;\n        return obj;\n    end,\n    \n    # listA() returns list of attribute names and values in [[name, value],...] form.\n\t\n    listA := (self) >> List(Sort(UserRecFields(self.a)), e -> [e, self.a.(e)]),\n));\n\n\n", "meta": {"hexsha": "340d5d9a20ada8693035f2334b804cc2ae16477b", "size": 3119, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/rewrite/attr.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/rewrite/attr.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/rewrite/attr.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.1808510638, "max_line_length": 110, "alphanum_fraction": 0.4982366143, "num_tokens": 885, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.25386099567919973, "lm_q2_score": 0.02800751908477895, "lm_q1q2_score": 0.007110016681366173}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n#F ==========================================================================\n#F ParCell(<num_spus>, <pkSize>) - Cell parallelization tag\n#F    .params[1] is num_spus\n#F    .params[2] is packetSize\n#F   \nClass(ParCell, AGenericTag, rec(isCell := true));\n\n\n\n#F ==========================================================================\n#F ParCell_auto (<num_spus>) - Cell parallelization tag\n#F    .params[1] is num_spus\n#F Highest possible packet size is automatically chosen\nClass(ParCell_auto, AGenericTag, rec(isCell := true));\n\n\n#F ==========================================================================\n#F ParDMPCell_old(<num_spus>) - Cell DMP parallelization tag\n#F    .params[1] is num_spus\nClass(ParCellDMP_old, AGenericTag, rec(isCell := true));\n\n#F ==========================================================================\n#F ParDMPCell(<num_spus>) - Cell DMP parallelization tag\n#F    .params[1] is num_spus\n#F    .params[2] is v\nClass(ParCellDMP, AGenericTag, rec(isCell := true));\n\nClass(StickyL, AGenericTag);\n\n", "meta": {"hexsha": "21a1932f3a30287600d3c72954cb3af2530496a9", "size": 1112, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/distributed/tags.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/distributed/tags.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/distributed/tags.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.7714285714, "max_line_length": 77, "alphanum_fraction": 0.5197841727, "num_tokens": 278, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2689414330889797, "lm_q2_score": 0.025957357009419556, "lm_q1q2_score": 0.006981008793315568}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    Percent ::= '%'\n    _\n    \n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n%End\n\n%Headers\n    /.\n        final static int tokenKind[] = new int[128];\n        static\n        {\n            tokenKind['$'] = $sym_type.$prefix$DollarSign$suffix$;\n            tokenKind['%'] = $sym_type.$prefix$Percent$suffix$;\n            tokenKind['_'] = $sym_type.$prefix$_$suffix$;\n            \n            tokenKind['a'] = $sym_type.$prefix$a$suffix$;\n            tokenKind['b'] = $sym_type.$prefix$b$suffix$;\n            tokenKind['c'] = $sym_type.$prefix$c$suffix$;\n            tokenKind['d'] = $sym_type.$prefix$d$suffix$;\n            tokenKind['e'] = $sym_type.$prefix$e$suffix$;\n            tokenKind['f'] = $sym_type.$prefix$f$suffix$;\n            tokenKind['g'] = $sym_type.$prefix$g$suffix$;\n            tokenKind['h'] = $sym_type.$prefix$h$suffix$;\n            tokenKind['i'] = $sym_type.$prefix$i$suffix$;\n            tokenKind['j'] = $sym_type.$prefix$j$suffix$;\n            tokenKind['k'] = $sym_type.$prefix$k$suffix$;\n            tokenKind['l'] = $sym_type.$prefix$l$suffix$;\n            tokenKind['m'] = $sym_type.$prefix$m$suffix$;\n            tokenKind['n'] = $sym_type.$prefix$n$suffix$;\n            tokenKind['o'] = $sym_type.$prefix$o$suffix$;\n            tokenKind['p'] = $sym_type.$prefix$p$suffix$;\n            tokenKind['q'] = $sym_type.$prefix$q$suffix$;\n            tokenKind['r'] = $sym_type.$prefix$r$suffix$;\n            tokenKind['s'] = $sym_type.$prefix$s$suffix$;\n            tokenKind['t'] = $sym_type.$prefix$t$suffix$;\n            tokenKind['u'] = $sym_type.$prefix$u$suffix$;\n            tokenKind['v'] = $sym_type.$prefix$v$suffix$;\n            tokenKind['w'] = $sym_type.$prefix$w$suffix$;\n            tokenKind['x'] = $sym_type.$prefix$x$suffix$;\n            tokenKind['y'] = $sym_type.$prefix$y$suffix$;\n            tokenKind['z'] = $sym_type.$prefix$z$suffix$;\n        };\n    \n        final int getKind(int c)\n        {\n            return ((c & 0xFFFFFF80) == 0 /* 0 <= c < 128? */ ? tokenKind[c] : 0);\n        }\n    ./\n%End\n\n", "meta": {"hexsha": "6bd1e56c3b18d868600625f4573846cd733cf3cc", "size": 2172, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/include/java/KWLexerLowerCaseMapF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/include/java/KWLexerLowerCaseMapF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/include/java/KWLexerLowerCaseMapF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.2222222222, "max_line_length": 82, "alphanum_fraction": 0.4921731123, "num_tokens": 655, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.25386100696924885, "lm_q2_score": 0.027169233701875663, "lm_q1q2_score": 0.006897209026141008}}
{"text": "#\n# francy: Interactive Discrete Mathematics in GAP\n#\n\n#############################################################################\n##\n#M  Graph( <graph type> ) . \n##\nInstallMethod(Graph,\n  \"a graph type\",\n  true,\n  [IsFrancyGraphType,\n   IsFrancyGraphDefaults],\n  0,\nfunction(graphType, options)\n  return MergeObjects(Objectify(FrancyGraphObjectType, rec(\n    id    := GenerateID(),\n    nodes := rec(),\n    links := rec(),\n    type  := graphType!.value,\n  )), options);\nend);\n\nInstallOtherMethod(Graph,\n  \"a graph type\",\n  true,\n  [IsFrancyGraphType],\n  0,\nfunction(graphType)\n  return Graph(graphType, GraphDefaults);\nend);\n\n#############################################################################\n##\n#M  UnsetNodes( <graph> ) . . . . . removes all nodes from graph\n##\nInstallMethod(UnsetNodes,\n  \"a graph\",\n  true,\n  [IsFrancyGraph],\n  0,\nfunction(graph)\n  graph!.nodes := rec();\n  return graph;\nend);\n\n#############################################################################\n##\n#M  UnsetNodes( <graph> ) . . . . . removes all nodes from graph\n##\nInstallMethod(UnsetLinks,\n  \"a graph\",\n  true,\n  [IsFrancyGraph],\n  0,\nfunction(graph)\n  graph!.links := rec();\n  return graph;\nend);\n\n#############################################################################\n##\n#M  GetShape( <graph>, <string> ) . . . . . gets a node from graph\n##\nInstallMethod(GetShape,\n  \"a graph, an id\",\n  true,\n  [IsFrancyGraph,\n   IsString],\n  0, \nfunction(g, s) \n  local shapes;\n  shapes := GetShapes(g);\n  if IsBound(shapes.(s)) then\n    return shapes.(s);\n  fi;\n  return;\nend);\n\n#############################################################################\n##\n#M  GetShapes( <graph> ) . . . . . gets all nodes from graph\n##\nInstallMethod(GetShapes,\n  \"a graph\",\n  true,\n  [IsFrancyGraph],\n  0, g -> g!.nodes);\n\n#############################################################################\n##\n#M  GetLink( <graph>, <string> ) . . . . . gets a link from graph\n##\nInstallMethod(GetLink,\n  \"a graph, an id\",\n  true,\n  [IsFrancyGraph,\n   IsString],\n  0, \nfunction(g, s) \n  local links;\n  links := GetLinks(g);\n  if IsBound(links.(s)) then\n    return links.(s);\n  fi;\n  return;\nend);\n\n\n#############################################################################\n##\n#M  GetLinks( <graph> ) . . . . . gets all links from graph\n##\nInstallMethod(GetLinks,\n  \"a graph\",\n  true,\n  [IsFrancyGraph],\n  0, g -> g!.links);\n\n#############################################################################\n##\n#M  Add( <graph>, <francy object> ) . . . . . add objects to graph\n##\nInstallOtherMethod(Add,\n  \"a graph, a link\",\n  true,\n  [IsFrancyGraph,\n   IsLink],\n  0,\nfunction(graph, link)\n  graph!.links!.(link!.id) := link;\n  return graph;\nend);\n\nInstallOtherMethod(Add,\n  \"a graph, a shape\",\n  true,\n  [IsFrancyGraph,\n   IsShape],\n  0,\nfunction(graph, shape)\n  graph!.nodes!.(shape!.id) := shape;\n  return graph;\nend);\n\n\nInstallOtherMethod(Add,\n  \"a graph, a list of francy objects\",\n  true,\n  [IsFrancyGraph,\n   IsList],\n  0,\nfunction(graph, objects)\n  local object;\n  for object in objects do\n    Add(graph, object);\n  od;\n  return graph;\nend);\n\n#############################################################################\n##\n#M  Remove( <graph>, <francy object> ) . . . . . remove object from graph\n##\nInstallOtherMethod(Remove,\n  \"a graph, a shape\",\n  true,\n  [IsFrancyGraph,\n   IsShape],\n  0,\nfunction(graph, shape)\n  local link;\n  Unbind(graph!.nodes!.(shape!.id));\n  # remove also links to this object\n  for link in graph!.links do\n    if link!.source!.id = shape!.id or link!.target!.id = shape!.id then\n      Unbind(graph!.links!.(link!.id));\n    fi;\n  od;\n  return graph;\nend);\n\nInstallOtherMethod(Remove,\n  \"a graph, a link\",\n  true,\n  [IsFrancyGraph,\n   IsLink],\n  0,\nfunction(graph, link)\n  Unbind(graph!.links!.(link!.id));\n  return graph;\nend);\n\nInstallOtherMethod(Remove,\n  \"a graph, a list of francy objects\",\n  true,\n  [IsFrancyGraph,\n   IsList],\n  0,\nfunction(graph, objects)\n  local object;\n  for object in objects do\n    Remove(graph, object);\n  od;\n  return graph;\nend);\n\n#############################################################################\n##\n#M  Shape( <shapeType>, <title>, <options> )  . .  create a Shape for a type\n##\nInstallMethod(Shape,\n  \"a shape type, a title string, a default configurations record\",\n  true,\n  [IsShapeType,\n   IsString,\n   IsShapeDefaults],\n  0,\nfunction(shapeType, title, options)\n  return MergeObjects(Objectify(ShapeObjectType, rec(\n    id        := GenerateID(),\n    type      := shapeType!.value,\n    title     := title,\n    callbacks := rec(),\n    menus     := rec(),\n    messages  := rec(),\n    layer     := 0,\n    parent    := \"\"\n  )), options);\nend);\n\nInstallOtherMethod(Shape,\n  \"a shape type, a title string\",\n  true,\n  [IsShapeType,\n   IsString],\n  0,\nfunction(shapeType, title)\n  return Shape(shapeType, title, ShapeDefaults);\nend);\n\nInstallOtherMethod(Shape,\n  \"a shape type\",\n  true,\n  [IsShapeType],\n  0,\nfunction(shapeType)\n  return Shape(shapeType, \"\", ShapeDefaults);\nend);\n\n\n#############################################################################\n##\n#M  Add( <graph>, <francy object> ) . . . . . add objects to graph\n##\nInstallOtherMethod(Add,\n  \"a shape, a menu\",\n  true,\n  [IsShape,\n   IsMenu],\n  0,\nfunction(shape, menu)\n    shape!.menus!.(menu!.id) := menu;\n  return shape;\nend);\n\nInstallOtherMethod(Add,\n  \"a shape, a callback\",\n  true,\n  [IsShape,\n   IsCallback],\n  0,\nfunction(shape, callback)\n  shape!.callbacks!.(callback!.id) := callback;\n  return shape;\nend);\n\nInstallOtherMethod(Add,\n  \"a shape, a message\",\n  true,\n  [IsShape,\n   IsFrancyMessage],\n  0,\nfunction(shape, message)\n  shape!.messages!.(message!.id) := message;\n  return shape;\nend);\n\nInstallOtherMethod(Add,\n  \"a shape, a list of objects\",\n  true,\n  [IsShape,\n   IsList],\n  0,\nfunction(shape, objects)\n  local object;\n  for object in objects do\n    Add(shape, object);\n  od;\n  return shape;\nend);\n\n#############################################################################\n##\n#M  Remove( <graph>, <francy object> ) . . . . . remove object from graph\n##\nInstallOtherMethod(Remove,\n  \"a shape, a menu\",\n  true,\n  [IsShape,\n   IsMenu],\n  0,\nfunction(shape, menu)\n  Unbind(shape!.menus!.(menu!.id));\n  return shape;\nend);\n\nInstallOtherMethod(Remove,\n  \"a shape, a callback\",\n  true,\n  [IsShape,\n   IsCallback],\n  0,\nfunction(shape, callback)\n  Unbind(shape!.callbacks!.(callback!.id));\n  return shape;\nend);\n\nInstallOtherMethod(Remove,\n  \"a shape, a message\",\n  true,\n  [IsShape,\n   IsFrancyMessage],\n  0,\nfunction(shape, message)\n  Unbind(shape!.messages!.(message!.id));\n  return shape;\nend);\n\nInstallOtherMethod(Remove,\n  \"a shape, a list of objects\",\n  true,\n  [IsShape,\n   IsList],\n  0,\nfunction(shape, objects)\n  local object;\n  for object in objects do\n    Remove(shape, object);\n  od;\n  return shape;\nend);\n\n\n#############################################################################\n##\n#M  Link( <obj1>, <obj2> )\n##\nInstallMethod(Link,\n  \"a shape, another shape, link defaults\",\n  true,\n  [IsShape,\n   IsShape,\n   IsLinkDefaults],\n  0,\nfunction(source, target, options)\n  return MergeObjects(Objectify(LinkObjectType, rec(\n    id     := GenerateID(),\n    source := source!.id,\n    target := target!.id\n  )), options);\nend);\n\nInstallOtherMethod(Link,\n  \"a shape, another shape\",\n  true,\n  [IsShape,\n   IsShape],\n  0,\nfunction(source, target)\n  return Link(source, target, LinkDefaults);\nend);\n\nInstallMethod(Links,\n  \"a list of shape, a list of shape\",\n  true,\n  [IsList,\n   IsList,\n   IsLinkDefaults],\n  0,\nfunction(source, target, options)\n  local list, src, tgt;\n  list := [];\n  for src in source do\n    for tgt in target do\n      AddSet(list, Link(src, tgt, options));\n    od;\n  od;\n  return list;\nend);\n\nInstallOtherMethod(Links,\n  \"a list of shape, a list of shape\",\n  true,\n  [IsList,\n   IsList],\n  0,\nfunction(source, target)\n  return Links(source, target, LinkDefaults);\nend);\n", "meta": {"hexsha": "5251edd9ebb1c35995ecd1cf47bcba6956edcab8", "size": 7934, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/graph.gi", "max_stars_repo_name": "LaGuer/francy", "max_stars_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2016-12-15T12:04:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-14T19:19:24.000Z", "max_issues_repo_path": "gap/graph.gi", "max_issues_repo_name": "LaGuer/francy", "max_issues_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 29, "max_issues_repo_issues_event_min_datetime": "2018-10-09T22:37:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:44:50.000Z", "max_forks_repo_path": "gap/graph.gi", "max_forks_repo_name": "LaGuer/francy", "max_forks_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-12-15T12:04:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-28T10:51:50.000Z", "avg_line_length": 19.304136253, "max_line_length": 77, "alphanum_fraction": 0.5534408873, "num_tokens": 2127, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.25091278688527247, "lm_q2_score": 0.027169231634144433, "lm_q1q2_score": 0.0068171076268546855}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    _\n    \n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n%End\n\n%Headers\n    /.\n        //\n        // Each upper case letter is mapped into its corresponding\n        // lower case counterpart. For example, if an 'A' appears\n        // in the input, it is mapped into $sym_type.$prefix$a$suffix$ just\n        // like 'a'.\n        //\n        final static int tokenKind[] = new int[128];\n        static\n        {\n            tokenKind['$'] = $sym_type.$prefix$DollarSign$suffix$;\n            tokenKind['_'] = $sym_type.$prefix$_$suffix$;\n\n            tokenKind['a'] = $sym_type.$prefix$a$suffix$;\n            tokenKind['b'] = $sym_type.$prefix$b$suffix$;\n            tokenKind['c'] = $sym_type.$prefix$c$suffix$;\n            tokenKind['d'] = $sym_type.$prefix$d$suffix$;\n            tokenKind['e'] = $sym_type.$prefix$e$suffix$;\n            tokenKind['f'] = $sym_type.$prefix$f$suffix$;\n            tokenKind['g'] = $sym_type.$prefix$g$suffix$;\n            tokenKind['h'] = $sym_type.$prefix$h$suffix$;\n            tokenKind['i'] = $sym_type.$prefix$i$suffix$;\n            tokenKind['j'] = $sym_type.$prefix$j$suffix$;\n            tokenKind['k'] = $sym_type.$prefix$k$suffix$;\n            tokenKind['l'] = $sym_type.$prefix$l$suffix$;\n            tokenKind['m'] = $sym_type.$prefix$m$suffix$;\n            tokenKind['n'] = $sym_type.$prefix$n$suffix$;\n            tokenKind['o'] = $sym_type.$prefix$o$suffix$;\n            tokenKind['p'] = $sym_type.$prefix$p$suffix$;\n            tokenKind['q'] = $sym_type.$prefix$q$suffix$;\n            tokenKind['r'] = $sym_type.$prefix$r$suffix$;\n            tokenKind['s'] = $sym_type.$prefix$s$suffix$;\n            tokenKind['t'] = $sym_type.$prefix$t$suffix$;\n            tokenKind['u'] = $sym_type.$prefix$u$suffix$;\n            tokenKind['v'] = $sym_type.$prefix$v$suffix$;\n            tokenKind['w'] = $sym_type.$prefix$w$suffix$;\n            tokenKind['x'] = $sym_type.$prefix$x$suffix$;\n            tokenKind['y'] = $sym_type.$prefix$y$suffix$;\n            tokenKind['z'] = $sym_type.$prefix$z$suffix$;\n\n            tokenKind['A'] = $sym_type.$prefix$a$suffix$;\n            tokenKind['B'] = $sym_type.$prefix$b$suffix$;\n            tokenKind['C'] = $sym_type.$prefix$c$suffix$;\n            tokenKind['D'] = $sym_type.$prefix$d$suffix$;\n            tokenKind['E'] = $sym_type.$prefix$e$suffix$;\n            tokenKind['F'] = $sym_type.$prefix$f$suffix$;\n            tokenKind['G'] = $sym_type.$prefix$g$suffix$;\n            tokenKind['H'] = $sym_type.$prefix$h$suffix$;\n            tokenKind['I'] = $sym_type.$prefix$i$suffix$;\n            tokenKind['J'] = $sym_type.$prefix$j$suffix$;\n            tokenKind['K'] = $sym_type.$prefix$k$suffix$;\n            tokenKind['L'] = $sym_type.$prefix$l$suffix$;\n            tokenKind['M'] = $sym_type.$prefix$m$suffix$;\n            tokenKind['N'] = $sym_type.$prefix$n$suffix$;\n            tokenKind['O'] = $sym_type.$prefix$o$suffix$;\n            tokenKind['P'] = $sym_type.$prefix$p$suffix$;\n            tokenKind['Q'] = $sym_type.$prefix$q$suffix$;\n            tokenKind['R'] = $sym_type.$prefix$r$suffix$;\n            tokenKind['S'] = $sym_type.$prefix$s$suffix$;\n            tokenKind['T'] = $sym_type.$prefix$t$suffix$;\n            tokenKind['U'] = $sym_type.$prefix$u$suffix$;\n            tokenKind['V'] = $sym_type.$prefix$v$suffix$;\n            tokenKind['W'] = $sym_type.$prefix$w$suffix$;\n            tokenKind['X'] = $sym_type.$prefix$x$suffix$;\n            tokenKind['Y'] = $sym_type.$prefix$y$suffix$;\n            tokenKind['Z'] = $sym_type.$prefix$z$suffix$;\n        };\n    \n        final int getKind(char c)\n        {\n            return (c < 128 ? tokenKind[c] : 0);\n        }\n    ./\n%End\n\n", "meta": {"hexsha": "04794325e8ddbfa9860628c12662253a279c8076", "size": 3804, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/include/java/unsupported/KWLexerFoldedCaseMap.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/include/java/unsupported/KWLexerFoldedCaseMap.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/include/java/unsupported/KWLexerFoldedCaseMap.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 44.7529411765, "max_line_length": 75, "alphanum_fraction": 0.5160357518, "num_tokens": 1122, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1847675196261571, "lm_q2_score": 0.03676946924216766, "lm_q1q2_score": 0.0067938036298455925}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# slab allocator.\n\n\n_LuaInit := function(datas, slab, opts)\n    local init;\n\n    Error(\"haha\");\n\n\nend;\n\n#\n## _DefaultWrapInitCompute\n#\n# this is the first function which gets called on the code. It wraps\n# the pure transform code in a function and also extracts any necessary\n# init code.\n#\n# in addition, for the slab allocator, this code defines the slab struct.\n\nClass(_SlabInitCompute, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, io, params, datas, slab_struct,\n            slab, sub, initsub, init, compute, stackvars,\n            replacer,  type, length;\n\n        # replacer function: replaces reference of a slab\n        # variable in the code with a reference to the variable\n        # in the slab. EG: X ==> slab->X\n        replacer := (slab, code) ->\n            DoForAll(slab.t.t.getVars(), e -> \n                SubstTopDown(code, e, ee -> fld(e.t, slab, e.id))\n            );\n\n        type := (a) -> a;\n        length := (a) -> a;\n\n        # -------\n        # here we build the slab structure\n        # -------\n\n        # get the standard input output\n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, x, Concat(y, x));\n\n        # any parameters in our sigma-spl expression\n        params := Set(Collect(sums, param));\n\n        # any data required by the transform\n        datas := Collect(sums, FDataOfs);\n\n        [stackvars, code] := Pull(code, \n\n            # compare shape\n            @(1, decl, e -> ForAny(e.vars, ee -> ObjId(ee.t) = TArray)),\n\n            # subst shape: always drop array declarations, possibly drop decl.\n            e -> let(nonarrayvars := Filtered(e.vars, ee -> ObjId(ee.t) <> TArray),\n                When(nonarrayvars = [],\n                    @(1).val.cmd,\n                    decl(nonarrayvars, @(1).val.cmd)\n                )\n            ),\n\n            # pull shape: pull out the array vars\n            e -> Filtered(@(1).val.vars, ee -> ObjId(ee.t) = TArray)\n        );\n\n        stackvars := Flat(stackvars);\n\n        # build the slab structure, and a variable for it\n        slab_struct := T_Struct(\"slab_t\", Concat(params, List(datas, e -> e.var), io, stackvars));\n        slab := var(\"slab\", TPtr(slab_struct));\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # generate the 'init' code\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n\n            if IsBound(opts.luaInit) and opts.luaInit then\n                init := _LuaInit(datas, slab, opts);\n            else\n                init := chain( List(datas, e -> SReduce(e.var.init, opts)) );\n                replacer(slab, init);\n            fi;\n\n            init := func(TVoid, initsub, [slab], init);\n\n        else\n            init := func(TVoid, initsub, [slab], code);\n        fi;\n\n        # convert the direct array references to input, output, and data to\n        # references to fields inside the slab alloced block.\n\n        replacer(slab, code);\n\n        compute := func(TVoid, sub, [slab], code);\n\n        return program(\n            define([slab_struct]),\n            init,\n            compute\n        );\n\n    end\n));\n\nClass(_SlabAlloc, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local sub, initsub, funcs, slab_struct, slab, pslab, alloc, free, tmp;\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # we expect a program wrapper\n        Constraint(ObjId(code) = program);\n\n        # we expect a slab to be defined first.\n        Constraint(ObjId(code.cmds[1]) = define);\n        Constraint(ObjId(code.cmds[1].types[1]) = T_Struct);\n\n        # extract functions for additional checks.\n        funcs := Collect(code, func);\n\n        # ensure ordering, code must already be wrapped by init/compute\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = sub or e.id = initsub)));\n\n        slab_struct := code.cmds[1].types[1];\n        slab := var(\"slab\", TPtr(slab_struct));\n        pslab := var(\"pslab\", TPtr(TPtr(slab_struct)));\n        tmp := var(\"tmp\", slab_struct);\n        tmp.size := 1;\n\n        # allocation function.\n        alloc := func(TVoid, \"alloc\", [pslab],\n            allocate(deref(pslab), tmp)\n        );\n\n        free := func(TVoid, \"dealloc\", [slab], \n            deallocate(slab, slab_struct)\n        );\n\n        Add(code.cmds, alloc);\n        Add(code.cmds, free);\n\n        return code;\n    end\n));\n\nClass(_SlabTimer, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local sub, initsub, funcs, i, numruns, slab_struct, slab, t, timer;\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"compute\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        # we expect a program wrapper\n        Constraint(ObjId(code) = program);\n\n        # we expect a slab to be defined first.\n        Constraint(ObjId(code.cmds[1]) = define);\n        Constraint(ObjId(code.cmds[1].types[1]) = T_Struct);\n\n        # extract functions.\n        funcs := Collect(code, func);\n\n        # ensure ordering, make sure we have an init and compute\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = sub or e.id = initsub)));\n\n        # ensure ordering, make sure we have the alloc/dealloc functions too!\n        Constraint(2 = Length(Filtered(funcs, e -> e.id = \"alloc\" or e.id = \"dealloc\")));\n\n        # these two are used interchangably, MUST be same type.\n        i := var.fresh_t(\"i\", TInt);\n        numruns := var.fresh_t(\"numruns\", TInt);\n\n        slab_struct := code.cmds[1].types[1];\n        slab := var(\"slab\", TPtr(slab_struct));\n\n        t := var(\"t\", TPtr(TVoid));\n\n        timer := func(TVoid, \"timer\", [t, numruns],\n            decl([slab], chain(\n                _fCall(\"alloc\", [addrof(slab)]),\n                _fCall(initsub, [slab]),\n                # this is used by simics to switch from a fast functional\n                # to a slow timed execute mode\n                When(IsBound(opts.extraTimerCall) and opts.extraTimerCall,\n                    _fCall(\"timer_start\", [t]),\n                    skip()\n                ),\n                When(IsBound(opts.coldcache) and opts.coldcache,\n                    skip(),\n                    _fCall(sub, [slab]) # warmup the cache by default.\n                ),\n                _fCall(\"timer_start\", [t]),\n                loop(i, numruns, \n                    _fCall(sub, [slab])\n                ),\n                _fCall(\"timer_end\", [t]),\n                _fCall(\"dealloc\", [slab])\n            ))\n        );\n    \n        Add(code.cmds, timer);\n\n        return code;\n    end,\n));\n\n\nClass(_SlabVerify, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        Add(code.cmds, func(TVoid, \"verify\", [], chain()));\n        return code;\n    end\n));\n\n#\n## _SlabHackInit\n#\n# this object removes the sines/cosines from the init function. It was written to support\n# the simplescalar backend. Simplescalar takes forever (and a day) to compute sin/cos, so\n# this hack was necessary to improve the execution turnaround time.\n#\n# NOTE: It ONLY removes cos/sin calls from the init function, not any other.\n#\nClass(_SlabHackInit, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local initsub, init;\n\n        # get the init func name, and find it in the code.\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n        init := Collect(code, @1(1, func, e -> e.id = initsub));\n\n        # replace all sin/cos calculations with constant 1.0\n        SubstTopDown(init, sinpi, e -> V(1.0));\n        SubstTopDown(init, cospi, e -> V(1.0));\n\n        # replace the init function in the main code.\n#        SubstTopDown(code, @(1, func, e -> e.id = initsub), e -> Error(\"a\"));\n\n        return code;\n    end\n));\n", "meta": {"hexsha": "9c89e843ae785aaca54184e56e77c19021d9bada", "size": 8077, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/cgslab.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/cgslab.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/cgslab.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.55078125, "max_line_length": 98, "alphanum_fraction": 0.5573851678, "num_tokens": 2062, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.23091976292927183, "lm_q2_score": 0.029312231811314076, "lm_q1q2_score": 0.006768773620796507}}
{"text": "#\n# francy: Interactive Discrete Mathematics in GAP\n#\n\n#############################################################################\n##\n#M  Canvas( <title>, <options> ) . . . . . a new graphic canvas\n##\nInstallMethod(Canvas,\n  \"a title string, a default configurations record\",\n  true,\n  [IsString,\n   IsCanvasDefaults],\n  0,\nfunction(title, options)\n  return MergeObjects(Objectify(CanvasObjectType, rec(\n    id       := GenerateID(),\n    menus    := rec(),\n    graph    := rec(),\n    chart    := rec(),\n    messages := rec(),\n    title    := title\n  )), options);\nend);\n\nInstallOtherMethod(Canvas,\n  \"a title string\",\n  true,\n  [IsString],\n  0,\nfunction(title)\n  return Canvas(title, CanvasDefaults);\nend);\n\n#############################################################################\n##\n#M  Add( <canvas>, <francy object> ) . . . . . add objects to canvas\n##\nInstallOtherMethod(Add,\n  \"a canvas, a graph\",\n  true,\n  [IsCanvas,\n   IsFrancyGraph],\n  0,\nfunction(canvas, graph)\n  canvas!.graph := graph;\n  # unbind the chart, only graph should exist!\n  Unbind(canvas!.chart);\n  return canvas;\nend);\n\nInstallOtherMethod(Add,\n  \"a canvas, a chart\",\n  true,\n  [IsCanvas,\n   IsChart],\n  0,\nfunction(canvas, chart)\n  canvas!.chart := chart;\n  # unbind the graph, only chart should exist!\n  Unbind(canvas!.graph);\n  return canvas;\nend);\n\nInstallOtherMethod(Add,\n  \"a canvas, a menu\",\n  true,\n  [IsCanvas,\n   IsMenu],\n  0,\nfunction(canvas, menu)\n  canvas!.menus!.(menu!.id) := menu;\n  return canvas;\nend);\n\nInstallOtherMethod(Add,\n  \"a canvas, a message\",\n  true,\n  [IsCanvas,\n   IsFrancyMessage],\n  0,\nfunction(canvas, message)\n  canvas!.messages!.(message!.id) := message;\n  return canvas;\nend);\n\nInstallOtherMethod(Add,\n  \"a canvas, a list of francy objects\",\n  true,\n  [IsCanvas,\n   IsList],\n  0,\nfunction(canvas, objects)\n  local object;\n  for object in objects do\n    Add(canvas, object);\n  od;\n  return canvas;\nend);\n\n#############################################################################\n##\n#M  Remove( <canvas>, <francy object> ) . . . . . remove object from canvas\n##\nInstallOtherMethod(Remove,\n  \"a canvas, a graph\",\n  true,\n  [IsCanvas,\n   IsFrancyGraph],\n  0,\nfunction(canvas, graph)\n  Unbind(canvas!.graph);\n  canvas!.graph := rec();\n  canvas!.chart := rec();\n  return canvas;\nend);\n\nInstallOtherMethod(Remove,\n  \"a canvas, a chart\",\n  true,\n  [IsCanvas,\n   IsChart],\n  0,\nfunction(canvas, chart)\n  Unbind(canvas!.chart);\n  canvas!.graph := rec();\n  canvas!.chart := rec();\n  return canvas;\nend);\n\nInstallOtherMethod(Remove,\n  \"a canvas, a menu\",\n  true,\n  [IsCanvas,\n   IsMenu],\n  0,\nfunction(canvas, menu)\n  Unbind(canvas!.menus!.(menu!.id));\n  return canvas;\nend);\n\nInstallOtherMethod(Remove,\n  \"a canvas, a message\",\n  true,\n  [IsCanvas,\n   IsFrancyMessage],\n  0,\nfunction(canvas, message)\n  Unbind(canvas!.messages!.(message!.id));\n  return canvas;\nend);\n\nInstallOtherMethod(Remove,\n  \"a canvas, a list of francy objects\",\n  true,\n  [IsCanvas,\n   IsList],\n  0,\nfunction(canvas, objects)\n  local object;\n  for object in objects do\n    Remove(canvas, object);\n  od;\n  return canvas;\nend);\n\n#############################################################################\n##\n#M  Draw( ) . . . . . \n##\nInstallMethod(Draw,\n  \"a canvas\",\n  true,\n  [IsCanvas],\n  0,\nfunction(canvas)\n  local object;\n  object := rec();\n  object!.mime    := FrancyMIMEType;\n  object!.version := InstalledPackageVersion(\"francy\");\n  object!.canvas  := Sanitize(canvas);\n  return Objectify(\n    JupyterRenderableType, \n    rec(\n      data := rec((FrancyMIMEType) := GapToJsonString(object)),\n      metadata := rec((FrancyMIMEType) := rec())\n    )\n  );\nend);\n\n#############################################################################\n##\n#M  DrawSplash( ) . . . . . \n##\nInstallMethod(DrawSplash,\n  \"a canvas\",\n  true,\n  [IsCanvas],\n  0,\nfunction(canvas)\n    local name, result, page;\n\n    name := Filename(DirectoryTemporary(), Concatenation(\"francy_\", LowercaseString(ReplacedString(canvas!.title, \" \", \"_\")) ,\".html\"));\n    \n    result := Draw(canvas);\n\n    page := Concatenation(\n    \"<!DOCTYPE html>\\n\\\n    <html>\\n\\\n      <head>\\n\\\n        <meta charset=\\\"utf-8\\\" content=\\\"text/html\\\" property=\\\"GAP,francy,d3.v5\\\"></meta>\\n\\\n        <link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"https://cdn.rawgit.com/mcmartins/francy/develop/js/extensions/browser/index.css\\\"></link>\\n\\\n        <script src=\\\"https://d3js.org/d3.v5.js\\\"></script>\\n\\\n        <script src=\\\"https://cdn.rawgit.com/mcmartins/francy/master/js/extensions/browser/francy.bundle.js\\\"></script>\\n\\\n        <title>Francy</title>\\n\\\n      </head>\\n\\\n      <body>\\n\\\n        <div id=\\\"francy\\\"></div>\\n\\\n        <script>\\n\\\n          var francy = new Francy({verbose: true, appendTo: 'body', callbackHandler: console.log});\\n\\\n          francy.load(\", result!.data!.(FrancyMIMEType), \").render();\\n\\\n        </script>\\n\\\n      </body>\\n\\\n    </html>\");\n    \n    PrintTo(name, page);\n\n    if ARCH_IS_MAC_OS_X() or ARCH_IS_UNIX() then\n        Exec(\"open \",name);\n    elif ARCH_IS_WINDOWS() then\n        Exec(\"start \",name);\n    fi;\n\n    return page;\nend);\n", "meta": {"hexsha": "18d5f159bcd5ab2a10346b6576434c2aa34a99ec", "size": 5113, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/canvas.gi", "max_stars_repo_name": "LaGuer/francy", "max_stars_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2016-12-15T12:04:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-14T19:19:24.000Z", "max_issues_repo_path": "gap/canvas.gi", "max_issues_repo_name": "LaGuer/francy", "max_issues_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 29, "max_issues_repo_issues_event_min_datetime": "2018-10-09T22:37:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:44:50.000Z", "max_forks_repo_path": "gap/canvas.gi", "max_forks_repo_name": "LaGuer/francy", "max_forks_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-12-15T12:04:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-28T10:51:50.000Z", "avg_line_length": 21.6652542373, "max_line_length": 150, "alphanum_fraction": 0.5761783689, "num_tokens": 1373, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.22270013882530884, "lm_q2_score": 0.029760095667014454, "lm_q1q2_score": 0.006627577436498591}}
{"text": "# As is, will not work if val is a String\nAssign := function(var, val)\n\tRead(InputTextString(Concatenation(var, \" := \", String(val), \";\")));\nend;\n", "meta": {"hexsha": "33e9f11fe835068d6c984cc3f36c9c49233e6cb0", "size": 146, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Dynamic-variable-names/GAP/dynamic-variable-names.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Dynamic-variable-names/GAP/dynamic-variable-names.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Dynamic-variable-names/GAP/dynamic-variable-names.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 29.2, "max_line_length": 69, "alphanum_fraction": 0.6575342466, "num_tokens": 40, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.19682621306573764, "lm_q2_score": 0.03358950190134912, "lm_q1q2_score": 0.006611294458006942}}
{"text": "\n# Copyright 2018-2019, Carnegie Mellon University\n# See LICENSE for details\n\n_HCOLProof_apply := (R, nt, children, nonterms) -> Checked(IsRule(R), IsSPL(nt),\n    When(IsNewRule(R),\n     R.apply(nt, children, nonterms),\n     When(NumGenArgs(R.rule)=2,\n          R.rule(nt.params, children),\n          R.rule(nt.params, children, nonterms)))\n);\n\nHCOLProof_Codegen := function(ss, opts) \n    local c;\n    trace_log.beginStage(\"Sigma-SPL\",\"icode\", ss);    \n    c := opts.funcgen.generate(ss, opts);\n    trace_log.endStage(\"Sigma-SPL\",\"icode\", c);\n    return c;\nend;\n\nHCOLProof_CodeConversion := function(c, visitor, opts) \n    local c2;\n    # dead code?\n    trace_log.beginStage(\"icode\",\"icode\", c);    \n    c2 := visitor(c, opts);\n    trace_log.beginStage(\"icode\",\"icode\", c2);\n    return c2;\nend;\n", "meta": {"hexsha": "c68272b13cdc4e113e371fb2937d40eb063a0988", "size": 796, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "proof.gi", "max_stars_repo_name": "spiral-software/spiral-package-hcol", "max_stars_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "proof.gi", "max_issues_repo_name": "spiral-software/spiral-package-hcol", "max_issues_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "proof.gi", "max_forks_repo_name": "spiral-software/spiral-package-hcol", "max_forks_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-26T05:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T05:21:02.000Z", "avg_line_length": 27.4482758621, "max_line_length": 80, "alphanum_fraction": 0.6381909548, "num_tokens": 222, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.3007455914759599, "lm_q2_score": 0.02194825467449645, "lm_q1q2_score": 0.006600840833946436}}
{"text": "# Apparently GAP can only remove a file, not a directory\nRemoveFile(\"input.txt\");\n# true\nRemoveFile(\"docs\");\n# fail\n", "meta": {"hexsha": "b536263ffa46a820bbc931f6903ded301fc54929", "size": 116, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Delete-a-file/GAP/delete-a-file.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Delete-a-file/GAP/delete-a-file.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Delete-a-file/GAP/delete-a-file.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 19.3333333333, "max_line_length": 56, "alphanum_fraction": 0.724137931, "num_tokens": 30, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.16885694377651222, "lm_q2_score": 0.03904829636066302, "lm_q1q2_score": 0.006593575983141063}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(DPBench);\n\n#F DPBench(rec(experiment1 := opts1, ...), <dpopts>)\n#F\n#F d := DPBench(rec(default := SpiralDefaults), rec())\n#F\n#F DPBench Interface:\n#F\n#F     .build(transforms, opts, bopts, name, dpopts),\n#F\n#F     .generateCfiles := [true, false],  default = true\n#F     .matrixVerify   := [true, false],  default = false\n#F     .fftwVerify     := [true, false],  default = false\n#F     .quickVerify     := [true, false],  default = false\n#F\n#F     .fileTransform(exp, t, opts),    .c filenames:   override in a subclass\n#F     .funcTransform(exp, t, opts),    function names: override in a subclass\n#F     .txtFileName(exp, runMethod),    timing file name\n#F\n#F     .runAll()                        run all transforms from every experiment's opts.benchTransforms\n#F     .resumeAll()                     same as .runAll() but try to reload hash from disk\n#F\n#F     .run(transforms)                 run given transforms in all experiments\n#F     .resume(transforms)              same as .run() but try to relaod hash from disk\n#F\n#F      .runRandomAll(),  .runRandom()    run a random ruletree\n#F      .runExhaustiveAll(), .runExhaustive()   run all ruletrees\n#F\n#F     .generateCode(transforms, exp)\n#F     .generateProductionCode(transforms, exp)   same as .generateCode() but will use opts.production()\n#F\n#F     .entries(transforms, exp)\n#F     .times(transforms, exp)\n#F     .alltimes(transforms)\n#F     .speedup(transforms, baselineExp)\n#F\n#F     .flopcyc(transforms)      # FLoating point Operations Per Cycle\n#F     .mflops(transforms, mhz)\n#F     .scaledTimes(transforms, scaleFunc)\n#F\n#F      getResult(i)                    returns \"rec(t, opts, rt)\" for the <i>th experiment run by runAll()\nClass(DPBench, rec(\n    ##\n    ## Private methods\n    ##\n    _checkExp := exp ->\n        Cond(not IsRec(exp),        Error(\"Experiments record <exp> must be a record\"),\n         NumRecFields(exp) < 1, Error(\"Experiments record is empty\"),\n         not ForAll(UserRecFields(exp), f -> IsRec(exp.(f))),\n                 Error(\"Each entry must be a valid Spiral options record (ie. SpiralDefaults)\"),\n         exp),\n\n    _startHashFile := (self, hfile, exp, d) >> PrintTo(hfile,\n        \"<# DPBench experiment '\", exp, \"'\\n\",\n        \" # Started \", d[2], \" \", d[3], \" \", d[1], \"  \", d[4], \":\", d[5], \"\\n\",\n        \" # Transforms: \", Cond(IsBound(self.transforms), self.transforms, \"\"), \"#> \\n\\n\",\n        \"ImportAll(spiral); Import(paradigms.common, paradigms.smp, platforms.sse, platforms.avx, paradigms.vector, nontransforms.ol); \\n\",\n        \"ImportAll(platforms.scalar); \\n\",\n        \"ImportAll(paradigms.vector); \\n\\n\",\n        \"hash := HashTableDP(); \\n\"\n    ),\n\n    _loadHash := meth(self, hfile, opts)\n        local b, bkdowns, ns, result;\n\t# Create a package that contains mappings from breakdown names to the corresponding\n\t# objects. This is needed because global names map to global breakdown rule objects\n\t# which might have different settings from the ones in opts.breakdownRules\n\t# Note: package is essentially a namespace that is always on top of imports\n\t#       so imports within a hash file will be superceded by it\n\tbkdowns := ConcatList(UserRecFields(opts.breakdownRules), f->opts.breakdownRules.(f));\n        ns := tab();\n\tfor b in bkdowns do ns.(b.name) := b; od;\n\n        result := READ(hfile, ns);\n        if result = false or not IsBound(ns.hash) then return false;\n        else return ns.hash;\n        fi;\n    end,\n\n    _saveHash := meth(self, hfile, exp, date, hash)\n        local bucket, e;\n        var.print := var.printFull;\n        self._startHashFile(hfile, exp, date);\n        for bucket in hash.entries do\n            for e in bucket do\n                if e.data<>[] then\n                    AppendTo(hfile, \"HashAdd(hash, \", e.key, \", [\", e.data[1], \"]);\\n\");\n                fi;\n            od;\n        od;\n        var.print := var.printShort;\n    end,\n\n    # merging two hash files by taking fastest entries, returns resulting hash\n    _mergeHashes := meth(self, src_file1, src_file2, opts)\n        local h1, h2;\n        h1 := self._loadHash(src_file1, opts);\n        h2 := self._loadHash(src_file2, opts);\n        Checked(h1<>false and h2<>false,\n            HashWalk(h1, function(key, data)\n                local d;\n                d := HashLookup(h2, key);\n                if d=false or (d[1].measured>data[1].measured and data[1].measured>0) then\n                    HashAdd(h2, key, data);\n                fi;\n            end));\n        return h2;\n    end,\n\n    _reloadAllHashes := meth(self)\n       local hash, exp, e;\n       for e in UserRecFields(self.exp) do\n           exp := self.exp.(e);\n           hash := self._loadHash(exp.hashFile, exp);\n           if (self.verbosity>0) then\n              PrintLine(When(hash=false, \"Could not load \", \"Loaded \"), e, \" (\", exp.hashFile, \")\");\n           fi;\n           if hash <> false then\n               exp.hashTable := hash;\n           fi;\n       od;\n    end,\n\n    _generateCode := meth(self, transforms, exp, opts)\n         local entries, e, c, r, t;\n         for t in transforms do\n             e := self.entries([HashAsSPL(t)], exp)[1];\n             if e = false then Error(\"Transform \", t, \" not found in hashTable for experiment '\", exp, \"'\"); fi;\n             r := ApplyRuleTreeSPL(e.ruletree, t, opts);\n             c := CodeRuleTree(r, opts);\n             PrintLine(t, \" -> \", self.prodFileTransform(exp, t, opts));\n             PrintTo(self.prodFileTransform(exp, t, opts), PrintCode(self.prodFuncTransform(exp, t, opts), c, opts));\n         od;\n    end,\n\n    ##\n    ## Public methods\n    ##\n    __call__ := meth(self, experiments, dpopts)\n        local e, exp;\n        self._checkExp(experiments);\n        exp:=rec();\n        for e in UserRecFields(experiments) do\n           exp.(e) := CopyFields(experiments.(e));\n           if not IsBound(exp.(e).hashTable) then\n               exp.(e).hashTable := HashTableDP(); fi;\n           if not IsBound(exp.(e).hashFile) then\n               exp.(e).hashFile := Concat(e, \".hash\"); fi;\n        od;\n\n        return WithBases(self,\n            rec(dpopts:=dpopts, ran:=false, exp:=exp, transforms:=[], verbosity:=1, callbacks:=[]));\n    end,\n\n    resume := meth(self, transforms)\n        if not ForAll(UserRecFields(self.exp), e -> ForAll(self.entries(transforms, e), e->e<>false))\n            then self._reloadAllHashes();\n        fi;\n        self.run(transforms);\n    end,\n\n    generateCfiles := true,\n    measureFinal := true,\n\t\n\t_fileRoot := meth(self, exp, t, opts)\n\t\tif IsBound(opts.vector) and IsBound(opts.vector.conf) and IsBound(opts.vector.conf.functionNameRoot) then\n\t\t\treturn opts.vector.conf.functionNameRoot;\n\t\telse\n\t\t\treturn Concat(exp, \"_\", Drop(CodeletName(CodeletShape(t)), 1));\n\t\tfi;\n\tend,\n\t\n\t_freq := meth(self, opts)\n\t\tif IsBound(opts.vector) and IsBound(opts.vector.conf) and IsBound(opts.vector.conf.target) and IsBound(opts.vector.conf.target.freq) then\n\t\t\treturn opts.vector.conf.target.freq;\n\t\telif IsBound(LocalConfig.cpuinfo.freq) then\n\t\t\treturn LocalConfig.cpuinfo.freq;\n\t\telse\n\t\t\treturn 1000;\n\t\tfi;\t\n\tend,\n\n    fileTimer     := (self, exp, t, opts) >> Concat(self._fileRoot(exp, t, opts), \".timer\"),\n    fileVerifierf := (self, exp, t, opts) >> Concat(self._fileRoot(exp, t, opts), \".verifier\"),\n    fileStub      := (self, exp, t, opts) >> Concat(self._fileRoot(exp, t, opts), \".h\"),\n    fileTransform := (self, exp, t, opts) >> Concat(self._fileRoot(exp, t, opts), \".c\"),\n    funcTransform := (self, exp, t, opts) >> self._fileRoot(exp, t, opts),\n    prodFileTransform := (self, exp, t, opts) >> self.fileTransform(exp, t, opts), # used in generateProductionCode\n    prodFuncTransform := (self, exp, t, opts) >> self.funcTransform(exp, t, opts),\n\n    txtFileName   := (exp, runMethod) -> Concat(exp, \".\", SubString(runMethod, 5), \".txt\"),\n\n    verify := meth(self, opts, ruletree, code)\n        local mat;\n        mat := When(ruletree.node.isReal() or opts.dataType = \"complex\" or opts.generateComplexCode,\n                    MatSPL(ruletree.node),\n                    RCMatCyc(MatSPL(ruletree.node)));\n        return VerifyMatrixCode(code, mat, opts);\n    end,\n\n    #NOTE: Slightly hacked in. Check for opts.profile being bound etc. Look at VerifyMatrixRuleTree.\n    verifyfftw := (self, opts, code) >> opts.profile.verifyfftw(code, opts),\n    verifyquick := (self, opts, code) >> opts.profile.verifyquick(code, opts),\n\n    resumeAll := meth(self)\n        local e;\n        for e in UserRecFields(self.exp) do\n            if (self.verbosity>0) then\n               PrintLine(\"Resuming \", e);\n            fi;\n            self.resume(self.exp.(e).benchTransforms);\n        od;\n    end,\n\n    _runAll := meth(self, runMethod)\n        local e;\n        for e in UserRecFields(self.exp) do\n            PrintLine(\"Running \", e);\n            self.(runMethod)(self.exp.(e).benchTransforms);\n        od;\n    end,\n\n    allTrees := (self) >> let(exp := self.exp.(UserRecFields(self.exp)[1]),\n    List(exp.benchTransforms, t ->\n        ApplyRuleTreeSPL( HashLookup(exp.hashTable, HashAsSPL(t))[1].ruletree,\n        t, exp))),\n\n    runAll            := (self) >> self._runAll(\"run\"),\n    runExhaustiveAll  := (self) >> self._runAll(\"runExhaustive\"),\n    runRandomAll      := (self) >> self._runAll(\"runRandom\"),\n    runRandomSaveAll  := (self) >> self._runAll(\"runRandomSave\"),\n    pickRandomSaveAll := (self) >> self._runAll(\"pickRandomSave\"),\n\n    run            := (self, transforms) >> self._run(transforms, \"_runDP\", true),\n    runExhaustive  := (self, transforms) >> self._run(transforms, \"_runExhaustive\", true),\n    runRandom      := (self, transforms) >> self._run(transforms, \"_runRandom\", false),\n    runRandomSave  := (self, transforms) >> self._run(transforms, \"_runRandomSave\", true),\n    pickRandomSave := meth(self, transforms)\n        local generateCfiles;\n\n        #NOTE: once generateCfiles quits measuring things, this can be removed\n        generateCfiles := self.generateCfiles;\n        self.generateCfiles := false;\n        self._run(transforms, \"_pickRandomSave\", true);\n        self.generateCfiles := generateCfiles;\n    end,\n\n\n    # Find best using DP\n    _runDP         := (self, e, t, opts) >> TimedAction(DP(t, self.dpopts, opts)),\n\n    # Find best using an exhaustive search\n    outputExhaustive := false,\n    _runExhaustive := meth(self, e, t, opts)\n       local r, searchTime, mincycles, mintree, rt, c, compiletime, cm, measuretime;\n\n       r := AllRuleTrees(t, opts);\n       searchTime := 0;\n       mincycles := 10^100;\n\n       for rt in r do\n          [c,  compiletime] := TimedAction(CodeRuleTreeOpts(rt, opts));\n          [cm, measuretime] := TimedAction(CMeasure(c, opts));\n          if self.outputExhaustive then _seqPerfStatsGflops(Concat(e, \".Exhaustive-all.txt\"), t, self._freq(opts), self.artcost(rt), cm, compiletime+measuretime); fi;\n          if (cm < mincycles) then\n              mincycles := cm; mintree := Copy(rt);\n          fi;\n          searchTime:=searchTime+compiletime+measuretime;\n       od;\n       HashDelete(opts.hashTable,t);\n       HashAdd(opts.hashTable, t, [rec(ruletree:=mintree, measured:=mincycles)]);\n       return([mintree, searchTime, c, mincycles]);\n    end,\n\n    # Run a Random ruletree. Useful for quick, dirty, non-comprehensive tests.\n    _runRandom := meth(self, e, t, opts)\n       local r, c, rrtime, codetime, runtime, cycles;\n\n       [r, rrtime]      := TimedAction(RandomRuleTree(t, opts));\n       [c, codetime]    := TimedAction(CodeRuleTreeOpts(r, opts));\n       [cycles, runtime]:= TimedAction(CMeasure(c, opts));\n\n       return([r, (rrtime+codetime+runtime), c, cycles]);\n     end,\n\n    # Run random search and save result in hash.\n    _runRandomSave := meth(self, e, t, opts)\n       local r, c, rrtime, codetime, runtime, cycles;\n\n       [r, rrtime]      := TimedAction(RandomRuleTree(t, opts));\n       [c, codetime]    := TimedAction(CodeRuleTreeOpts(r, opts));\n       [cycles, runtime]:= TimedAction(CMeasure(c, opts));\n\n       HashDelete(opts.hashTable, t);\n       HashAdd(opts.hashTable, t, [rec(ruletree:=r, measured:=runtime)]);\n\n       return([r, (rrtime+codetime+runtime), c, cycles]);\n    end,\n\n    # Pick random and save result in hash (NOT measured).\n    _pickRandomSave := meth(self, e, t, opts)\n       local r, searchtime;\n       [r, searchtime] := TimedAction(RandomRuleTree(t, opts));\n\n       HashDelete(opts.hashTable,t);\n       HashAdd(opts.hashTable,t,[rec(ruletree:=r)]);\n\n       return([r, searchtime, false, -1]);\n    end,\n\n    _run := meth(self, transforms, runMethod, useHash)\n        local code, t, e, outf, res, opts, cycles, hentry,  date, i, searchTime, acc, optsForFile, f, ruletree, randomRes;\n\n        Constraint(ForAll(transforms, IsSPL));\n\n        for f in self.callbacks do \n\t\t\tf(self);\n\t\tod;\n\n        for e in UserRecFields(self.exp) do\n            opts := self.exp.(e);\n            date := Date();\n\n            for t in transforms do\n\t\t\t\tcode := false;\n\t\t\t\tt := SumsUnification(t, opts);\n\t\t\t\tif useHash then\n\t\t\t\t\t# For run methods that use hash tables\n\t\t\t\t\thentry := HashLookup(opts.hashTable, HashAsSPL(t));\n\t\t\t\t\tif hentry = false or hentry = [] then\n\t\t\t\t\t\tres := self.(runMethod)(e, HashAsSPL(t), opts);\n\t\t\t\t\t\tif res[1] = [] then\n\t\t\t\t\t\t\tError(\"DP did not find any ruletrees for <t> (\", t, \")\");\n\t\t\t\t\t\tfi;\n\t\t\t\t\t\tself._saveHash(opts.hashFile, e, date, opts.hashTable);\n\t\t\t\t\t\thentry := HashLookup(opts.hashTable, HashAsSPL(t))[1];\n\t\t\t\t\t\thentry.searchTime := res[2];\n\t\t\t\t\t\tsearchTime := res[2];\n\t\t\t\t\t\tif Length(res) >= 3 then\n\t\t\t\t\t\t\t# _runDP doesn't return code\n\t\t\t\t\t\t\tcode := res[3];\n\t\t\t\t\t\tfi; \n\t\t\t\t\telse\n\t\t\t\t\t\thentry := hentry[1];\n\t\t\t\t\t\tsearchTime := -1;\n\t\t\t\t\tfi;\n\t\t\t\t\thentry.spectree := ApplyRuleTreeSPL(hentry.ruletree, t, opts);\n                    #NOTE: exhaustive search will not update cycles\n\t\t\t\t\tcycles := When(IsBound(hentry.measured), hentry.measured, 0);\n\t\t\t\t\tif not t in self.transforms then\n\t\t\t\t\t\tAdd(self.transforms, t);\n\t\t\t\t\tfi;\n\t\t\t\t\truletree := hentry.spectree;\n\t\t\t\telse\n\t\t\t\t\t# For run methods that don't use hash tables\n\t\t\t\t\trandomRes  := self.(runMethod)(e, HashAsSPL(t), opts);\n\t\t\t\t\truletree   := ApplyRuleTreeSPL(randomRes[1], t, opts);\n\t\t\t\t\tsearchTime := randomRes[2];\n\t\t\t\t\tcode       := randomRes[3];\n\t\t\t\t\tcycles     := randomRes[4];\n\t\t\t\tfi;\n\n\t\t\t\t#HACK: It's a pain to do this in a cleaner way\n\t\t\t\tif runMethod = \"_pickRandomSave\" then \n\t\t\t\t\treturn; \n\t\t\t\tfi;\n\n\t\t\t\tif self.generateCfiles then\n\t\t\t\t\t#NOTE: Should also output stub.h as <filename.h>\n\t\t\t\t\tcompiler.CMEASURE_CURRENT_TREE := ruletree;\n\t\t\t\t\tcompiler.CMEASURE_LAST_CODE := false;\n\t\t\t\t\tif (code=false or HashAsSPL(t)<>t) then\n\t\t\t\t\t\tcode := CodeRuleTree(ruletree, opts);\n\t\t\t\t\tfi;\n\t\t\t\t\tcompiler.CMEASURE_LAST_CODE := code;\n\t\t\t\t\tif (self.measureFinal and (runMethod <> \"_runRandom\"))then \n\t\t\t\t\t\tcycles := CMeasure(code, opts);\n\t\t\t\t\tfi;\n\n\t\t\t\t\tif useHash then\n\t\t\t\t\t\thentry.measured := cycles;\n\t\t\t\t\tfi;\n\n\t\t\t\t\topts.fileinfo := rec(\n\t\t\t\t\t\tcycles  := cycles,\n\t\t\t\t\t\tflops   := self.artcost(ruletree),\n\t\t\t\t\t\tfile    := self.fileTransform(e,t,opts),\n\t\t\t\t\t\talgorithm := ruletree\n\t\t\t\t\t);\n\t\t\t\t\tPrintTo(self.fileTransform(e,t,opts), PrintCode(self.funcTransform(e,t,opts), code, opts));\n\t\t\t\t\tUnbind(opts.fileinfo);\n\t\t\t\tfi;\n\n\t\t\t\tif self.matrixVerify or self.fftwVerify or self.quickVerify then\n\t\t\t\t\tif code=false then\n\t\t\t\t\t\tcode := CodeRuleTree(ruletree, opts);\n\t\t\t\t\tfi;\n\t\t\t\t\tif self.matrixVerify then\n\t\t\t\t\t\tacc := self.verify(opts, ruletree, code);\n\t\t\t\t\telif self.fftwVerify then\n                        acc := self.verifyfftw(opts, code);\n                    else \n                        acc := self.verifyquick(opts, code);\n                    fi;\n                    if IsBound(opts.outputVecStatistics) and opts.outputVecStatistics then\n                        _seqPerfStatsGflopsAccCount(self.txtFileName(e, runMethod), t,\n                                [self.artcost(ruletree), code.countedArithCost(opts.vector.isa.countrec)*opts.vector.vlen], cycles, searchTime, acc,\n                                    code.countOps(opts.vector.isa.countrec), opts.vector.isa.countrec);\n                    else\n                        _seqPerfStatsGflopsAcc(self.txtFileName(e, runMethod), t,\n                                [self.artcost(ruletree), self.countedArithCost(code, opts)], cycles, searchTime, acc);\n                    fi;\n                else\n\t\t\t\t\tif (opts.verbosity>-1) then\n                       if IsBound(opts.outputVecStatistics) and opts.outputVecStatistics then\n                            _seqPerfStatsGflopsCount(self.txtFileName(e, runMethod), t,\n                                    [self.artcost(ruletree), code.countedArithCost(opts.vector.isa.countrec)*opts.vector.vlen], cycles, searchTime,\n                                        code.countOps(opts.vector.isa.countrec), opts.vector.isa.countrec);\n                       else\n                            _seqPerfStatsGflops(self.txtFileName(e, runMethod), t, self._freq(opts),\n                                    [self.artcost(ruletree), self.countedArithCost(code, opts)], cycles, searchTime);\n                       fi;\n                    fi;\n                fi;\n            od;\n        od;\n        self.ran := true;\n    end,\n\n    generateCode := (self, transforms, exp) >> self._generateCode(transforms, exp, self.exp.(exp)),\n\n    generateProductionCode := (self, transforms, exp) >> self._generateCode(transforms, exp, self.exp.(exp).production()),\n\n    generateAllCode := self >> DoForAll(UserRecFields(self.exp), exp ->\n        self._generateCode(self.exp.(exp).benchTransforms, exp, self.exp.(exp))),\n\n    generateAllProductionCode := self >> DoForAll(UserRecFields(self.exp), exp ->\n        self._generateCode(self.exp.(exp).benchTransforms, exp, self.exp.(exp).production())),\n\n    entries := (self, transforms, exp) >>\n        When(not IsBound(self.exp.(exp)), Error(\"No such experiment '\",exp, \"'\"),\n         Map(transforms,\n         x -> let(lookup := MultiHashLookup(Concatenation([self.exp.(exp).hashTable], self.exp.(exp).baseHashes), x),\n                When(lookup = false, false,\n                #Error(\"Transform '\", x, \"' not found in the '\", exp, \"' table\"),\n                lookup[1])))),\n\n    times := (self, transforms, exp) >> Map(self.entries(transforms, exp), x->x.measured),\n\n    alltimes := (self, transforms) >>\n        let(tr := When(IsList(transforms), transforms, [transforms]),\n            Map(UserRecFields(self.exp), e -> Concatenation([e], self.times(tr, e)))),\n\n    speedup := (self, transforms, baselineExp) >>\n        let(b := self.times(transforms, baselineExp),\n        Map(self.alltimes(transforms),\n            times -> Map([1..Length(times)],\n                         i -> When(not IsInt(times[i]), times[i], times[i] / b[i-1])))),\n\n    flopcyc := (self, transforms) >>\n        self.scaledTimes(transforms, e -> self.acost(e) / e.measured),\n\n    mflops := (self, transforms, mhz) >>\n        self.scaledTimes(transforms, e -> self.acost(e) * mhz / e.measured),\n\n    # FLoating point Operations Per Cycle\n    scaledTimes := (self, transforms, scaleFunc) >>\n        let(tr := When(IsList(transforms), transforms, [transforms]),\n            Map(UserRecFields(self.exp),\n                e -> Concatenation([e], Map(self.entries(tr, e), scaleFunc)))),\n\n    # Use NonTerminal.normalizedArithCost() if it is there, otherwise return 0\n    acost := entry -> let(\n        t := entry.ruletree.node,\n        When(IsBound(t.normalizedArithCost), t.normalizedArithCost(), 0)\n    ),\n\n    artcost := ruletree -> let(\n        t := ruletree.node,\n        When(IsBound(t.normalizedArithCost), t.normalizedArithCost(), 0)\n    ),\n\n    countedArithCost := (self, c, opts) >>\n        When(IsRec(c) and\n             IsBound(c.countedArithCost) and\n             IsBound(opts.vector) and IsBound(opts.vector.isa) and IsBound(opts.vector.isa.countrec) and IsBound(opts.vector.vlen),\n             c.countedArithCost(opts.vector.isa.countrec)*opts.vector.vlen, 0),\n\n    matrixVerify := false,\n    setMatrixVerify := self >> CopyFields(self, rec(matrixVerify := true)),\n\n    fftwVerify   := false,\n    quickVerify   := false,\n\n    getOpts := self >> self.exp.(UserRecFields(self.exp)[1]),\n\n    _getResult := meth(arg)\n        local self, t, exp, lookup, rt;\n        self := arg[1];\n        exp := UserRecFields(self.exp)[1];\n        t := When(Length(arg) >= 2, self.exp.(exp).benchTransforms[arg[2]], self.exp.(exp).benchTransforms[1]);\n        lookup := MultiHashLookup(Concatenation([ self.exp.(exp).hashTable ], self.exp.(exp).baseHashes), HashAsSPL(t));\n        rt := When(lookup = false, false, lookup[1].ruletree);\n        return rec(opts := self.exp.(exp), t := t, rt:= rt);\n    end,\n\n    getResult := meth(arg)\n        local self, l, rt, opts, c;\n        self := arg[1];\n        l := When(Length(arg)>1, self._getResult(arg[2]), self._getResult());\n        rt := l.rt;\n        opts := l.opts;\n        c := CodeRuleTree(rt, opts);\n        return CopyFields(l, rec(c := c, opcount := c.countOps(opts.vector.isa.countrec)));\n    end,\n\n    _runAll := meth(self, runMethod)\n        local e;\n        for e in UserRecFields(self.exp) do\n            PrintLine(\"Running \", e);\n            self.(runMethod)(self.exp.(e).benchTransforms);\n        od;\n    end,\n\n    build := function(arg)\n        local transforms, opts, bopts, name, dpr;\n\n        transforms := When(IsList(arg[1]), arg[1], [arg[1]]);\n        opts := When(Length(arg) >= 2, arg[2], SpiralDefaults);\n        opts.benchTransforms := transforms;\n        bopts := When(Length(arg) >= 3, arg[3], rec());\n        name := When(Length(arg) >= 4, arg[4], \"spiral\");\n        dpr := When(Length(arg) >= 5, arg[5], rec(verbosity := 0, timeBaseCases:=true));\n\n        return CopyFields(DPBench(rec((name) := opts), dpr), bopts);\n\n    end\n\n));\n\n# Class(NewDPBench, DPBench, rec(\n#     measureNtimes := 10,\n#     remeasure := (self, c, opts) >> List([1..self.measureNtimes],\n#         i -> CMeasure(c, opts)),\n\n#     runHooks := [\n#         meth(self, t, c, hentry, opts)\n#             hentry.remeasure := self.remeasure(c, opts);\n#             PrintLine(\"remeasure : \", hentry.remeasure);\n#         end\n#     ]\n# ));\n\n#opts := SpiralDefaults; opts2 := CopyFields(opts, rec(declareConstants := true));\n#d := NewDPBench(rec(default:=opts,pullconst:=opts2), rec(timeBaseCases := false, verbosity := 0));\nsampleDPBench := DPBench(rec(default := SpiralDefaults), rec(timeBaseCases := false, verbosity := 0));\nsampleDPBench.transforms := [DFT(2), DFT(3), DFT(4)];\n", "meta": {"hexsha": "b98cc83e1747a536c61248fcbf6e90d3b25e0c5e", "size": 22532, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/libgen/dpbench.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/libgen/dpbench.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/libgen/dpbench.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 40.0213143872, "max_line_length": 166, "alphanum_fraction": 0.5912480028, "num_tokens": 6012, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.18952107301879195, "lm_q2_score": 0.03461883784317106, "lm_q1q2_score": 0.00656099929470134}}
{"text": "Class(OpenMP_POWERUnparser, paradigms.smp.OpenMP_UnparseMixin, packages.powerisa.power9.p9macro.POWER9Unparser);\nClass(OpenMP_POWERUnparser_ParFor, paradigms.smp.OpenMP_UnparseMixin_ParFor, packages.powerisa.power9.p9macro.POWER9Unparser);\n\n", "meta": {"hexsha": "7e60f72cec93f18f178d4edfed55e991b508c86a", "size": 241, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "platforms/power/openmp.gi", "max_stars_repo_name": "franzfranchetti/spiral-package-fftx", "max_stars_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-06-15T12:40:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-15T12:40:19.000Z", "max_issues_repo_path": "platforms/power/openmp.gi", "max_issues_repo_name": "franzfranchetti/spiral-package-fftx", "max_issues_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2021-01-05T20:58:29.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-18T20:10:45.000Z", "max_forks_repo_path": "platforms/power/openmp.gi", "max_forks_repo_name": "franzfranchetti/spiral-package-fftx", "max_forks_repo_head_hexsha": "3149606d3d60a9b50c225ec1e8450628d543698b", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:24:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-15T12:40:20.000Z", "avg_line_length": 60.25, "max_line_length": 126, "alphanum_fraction": 0.8796680498, "num_tokens": 72, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.20689404881588808, "lm_q2_score": 0.031618766812386526, "lm_q1q2_score": 0.00654173468438008}}
{"text": "#############################################################################\n####\n##\n#W  streams.gi                 ACE Package                        Greg Gamble\n##\n##  This file installs non-user functions used in interactions with streams.\n##    \n#Y  Copyright (C) 2000  Centre for Discrete Mathematics and Computing\n#Y                      Department of Information Technology & Electrical Eng.\n#Y                      University of Queensland, Australia.\n##\n\n\n#############################################################################\n####\n##\n#F  ACE_PRINT_AND_EVAL( <varname>, <expr> ) . . . print and evaluate a string\n##\n##  emulates a user typing at the `gap> ' prompt: `<varname> := <expr>;'  and\n##  prints and returns the evaluation of <expr>; <varname> and <expr>  should\n##  be strings.\n##\nInstallGlobalFunction(ACE_PRINT_AND_EVAL, function(varname, expr)\n\n  Print(\"gap> \", varname, \" := \", ReplacedString(expr, \"\\n \", \"\\n>\"), \";\\n\");\n  expr := EvalString(expr);\n  Print(expr, \"\\n\");\n  return expr;\nend);\n\n#############################################################################\n####\n##\n#F  ACE_READ_NEXT_LINE(<iostream>) . read complete line but never return fail\n##\n##  We know there is a complete line to be got; so we  wait  for  it,  before\n##  returning.\n##\nInstallGlobalFunction(ACE_READ_NEXT_LINE, function(iostream)\n  return ReadAllLine(iostream, true);\nend);\n\n#############################################################################\n####\n##\n#F  FLUSH_ACE_STREAM_UNTIL(<iostream>, <infoLevelFlushed>, <infoLevelMyLine>,\n##    <readline>, <IsMyLine>) . . . . . . flush a stream until a desired line\n##\n##  reads lines in iostream <iostream> via function  <readline>  and  `Info's\n##  those lines at `InfoACELevel' <infoLevelFlushed> until a line <line>  for\n##  which `<IsMyLine>(<line>) is `true'. The line <line> is then `Info'-ed at\n##  `InfoACELevel' <infoLevelMyLine> and returned.\n##\nInstallGlobalFunction(FLUSH_ACE_STREAM_UNTIL, \nfunction(iostream, infoLevelFlushed, infoLevelMyLine, readline, IsMyLine)\nlocal line;\n\n  line := readline(iostream);\n  while not IsMyLine(line) do\n    Info(InfoACE, infoLevelFlushed, Chomp(line));\n    line := readline(iostream);\n  od;\n  if line <> fail and infoLevelMyLine < 10 then\n    Info(InfoACE, infoLevelMyLine, Chomp(line));\n  fi;\n  return line;\nend);\n\n#############################################################################\n####\n##\n#F  WRITE_LIST_TO_ACE_STREAM( <stream>, <list> ) . . . write to an ACE stream\n##\n##  writes the list <list> to the iostream <stream>, `Info's <list> following\n##  a `ToACE> ' ``prompt'' at `InfoACE' level 4, returns `true' if successful\n##  or `fail' otherwise.\n##\nInstallGlobalFunction(WRITE_LIST_TO_ACE_STREAM, function(stream, list)\nlocal string;\n\n  if not IsOutputTextStream(stream) and IsEndOfStream(stream) then\n    Info(InfoACE + InfoWarning, 1, \"Sorry. Process stream has died!\");\n    Info(InfoACE + InfoWarning, 1, \n         \"You might like to try using 'ACEResurrectProcess(<i>);'\");\n    return fail;\n  fi;\n  string := Concatenation( List(list, String) );\n  Info(InfoACE, 4, \"ToACE> \", string);\n  return WriteLine(stream, string);\nend);\n\n#E  streams.gi  . . . . . . . . . . . . . . . . . . . . . . . . . . ends here \n", "meta": {"hexsha": "02280ecef0919b796361c39c7c99db2985e74a57", "size": 3246, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/streams.gi", "max_stars_repo_name": "wilfwilson/ace", "max_stars_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2016-10-11T23:08:47.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-01T16:47:18.000Z", "max_issues_repo_path": "gap/streams.gi", "max_issues_repo_name": "wilfwilson/ace", "max_issues_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 25, "max_issues_repo_issues_event_min_datetime": "2016-02-26T09:00:39.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-23T12:28:10.000Z", "max_forks_repo_path": "gap/streams.gi", "max_forks_repo_name": "wilfwilson/ace", "max_forks_repo_head_hexsha": "3a35d159e97bc8b05c2a57fc3903f83f82c49b6b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2017-04-17T21:40:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-11T21:10:37.000Z", "avg_line_length": 34.9032258065, "max_line_length": 78, "alphanum_fraction": 0.5751694393, "num_tokens": 831, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.23651622568252118, "lm_q2_score": 0.02675928464072173, "lm_q1q2_score": 0.006329005005187763}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# \n#################################\n#\n# CodegenStrategy Stages\n#\n# NOTE: these are wrapped in classes because their names are simpler in a list.\n#################################\n\n#\n## _EnumBlocks\n#\n# Add a bbnum tag to each BB, enumerating them. \n#\n# changes the sums INPLACE. Has to appear before _ApplyCodegen \n# to be effective.\nClass(_EnumBlocks, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        EnumBlocks(sums, opts);\n\n        return code;\n    end,\n));\n\n#\n## Apply Codegen\n#\n# convert SigmaSPL to Code using opts.codegen\n#\nClass(_ApplyCodegen, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local X, Y;\n\n        [X, Y] := _getXY(sums, opts);\n\n        return opts.codegen(sums, StripList(Y), StripList(X), opts);\n    end,\n));\n\n#\n## _BlockSums\n#\n#\nClass(_BlockSums, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        return BlockSums(code, opts);\n    end,\n));\n\n#\n## _ESReduce\n#\n#\nClass(_ESReduce, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        return ESReduce(code, opts);\n    end,\n));\n\n#\n## _RemoveAssignAcc\n#\n#\nClass(_RemoveAssignAcc, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        return RemoveAssignAcc(code);\n    end\n));\n\n#\n## __BlockUnroll\n#\n#\nClass(__BlockUnroll, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        return BlockUnroll(code, opts);\n    end,\n));\n\n#\n## _DeclareHidden\n#\n#\nClass(_DeclareHidden, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        return DeclareHidden(code);\n    end,\n));\n\n#\n## _FixedPointCode\n#\n#\nClass(_FixedPointCode, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        if IsBound(opts.isFixedPoint) and opts.isFixedPoint then\n            code := FixedPointCode(code, opts.bits, opts.fracbits);\n        fi;\n\n        return code;\n    end,\n));\n\n\n#\n## new legacy wrap\n#\n# temporaries on stack\n# out of place arrays, global ptrs, malloced on 128b boundary\n#\n# format is that used in the new type, with all the new functions\n#\nClass(_NewLegacyWrap, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, io, params, datas, sub, initsub, init, compute, alloc, free, timer, data, prog;\n\n        # data from sums\n        [x, y] := _getXY(sums, opts);\n        io := When(x=y, [x], [y, x]);\n        params := Set(Collect(sums, param));\n        datas := Collect(sums, FDataOfs);\n\n        # names\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n\n        #\n        # code sections start here:\n        #\n\n        # generate the 'init' code.\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            init := func(TVoid, initsub, params, chain(\n                List(datas, x -> SReduce(x.var.init, opts))\n            ));\n        else\n            init := func(TVoid, initsub, params, code);\n        fi;\n        \n\n        # wrap the 'compute'\n        compute := func(TVoid, sub, Concatenation(io, params), code);\n\n        # create the allocs/free\n        alloc := skip();\n        free := skip();\n\n        # setup timer\n        timer := skip();\n\n        # generate data\n        data := List(datas, x -> x.var);\n\n        #\n        # put pieces together\n        #\n\n        prog := program(\n            decl(data, chain(\n                init,\n                compute,\n                alloc,\n                free,\n                timer\n            ))\n        );\n\n        return prog;\n    end,\n));\n\n#\n## _LegacyWrap\n#\n#\nClass(_LegacyWrap, CodegenStrat, rec(\n    __call__ := function(code, sums, opts)\n        local x, y, params, datas, io, sub, initsub, prog;\n\n        [x, y] := _getXY(sums, opts);\n\n        params := Set(Collect(sums, param));\n        datas := Collect(sums, FDataOfs);\n\n        io := When(x=y, [x], [y, x]);\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"initz\");\n        code := func(TVoid, sub, Concatenation(io, params), code);\n\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            prog := program(\n                decl(List(datas, x->x.var),\n                    chain(\n                        func(TVoid, initsub, params, chain(List(datas, \n                            x -> SReduce(x.var.init, opts)\n                        ))), \n                        code\n                    )));\n        else\n            prog := program( func(TVoid, initsub, params, chain()), code);\n        fi;\n\n        prog.dimensions := sums.dims();\n\n        return prog;\n    end,\n));\n\n###\n#\n#\n_BasicCodegenStrat := [\n    _EnumBlocks, \n    _ApplyCodegen,\n    _ESReduce,\n    _RemoveAssignAcc,\n    __BlockUnroll,\n    _DeclareHidden,\n    _FixedPointCode\n];\n\n# these functions are in cgwrap.gi\n_DefaultWrapStrat := [\n    _DefaultWrapInitCompute,\n    _DefaultWrapData,\n    _DefaultWrapAlloc,\n    _DefaultWrapTimer,\n    _DefaultWrapVerify\n];\n\n_SlabWrapStrat := [\n    _SlabInitCompute,\n    _SlabAlloc,\n    _SlabTimer,\n    _SlabVerify\n];\n\n\nDefaultCodegenStrat := Concat(_BasicCodegenStrat, _DefaultWrapStrat);\nSlabCodegenStrat := Concat(_BasicCodegenStrat, _SlabWrapStrat);\n\n# a version where all sin/cos computation has been removed from the init function\n# ::: useful for getting something running on the simulator.\nSlabHackedCodegenStrat := Flat([_BasicCodegenStrat, _SlabWrapStrat, _SlabHackInit]);\n\n#\n## ApplyCodegenStrat\n#\n# applies the codegen strategy.\n#\nApplyCodegenStrat := function(sums, opts)\n    local code, s;\n\n    # some default\n    code := skip();\n\n    # apply each function in the strategy in order\n    # sums and opts do not change (hopefully), but code does.\n    for s in opts.codegenStrat do\n        code := s(code, sums, opts);\n    od;\n    \n    return code;\nend;\n", "meta": {"hexsha": "74bd5c1807d690ff336b4baf9c3e828598b35b94", "size": 5940, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/cgstrat.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/cgstrat.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/cgstrat.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 22.0817843866, "max_line_length": 99, "alphanum_fraction": 0.5831649832, "num_tokens": 1557, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.22815650216092537, "lm_q2_score": 0.027585285024786247, "lm_q1q2_score": 0.006293762142367386}}
{"text": "\n# Copyright 2018-2019, Carnegie Mellon University\n# See LICENSE for details\n\nClass(loopc, loop_base, rec(\n   __call__ := (self, loopvar, range, cnd, cmd) >> WithBases(self,\n               rec(operations := CmdOps, cmd := cmd, var := loopvar, range := listRange(range), cnd := cnd)),\n   rChildren := self >> [self.var, self.range, self.cnd, self.cmd],\n   rSetChild := rSetChildFields(\"var\", \"range\", \"cnd\", \"cmd\"),\n\n   print := (self, i, si) >> Print(self.__name__, \"(\", self.var, \", \",\n       self.range, \", \", self.cnd, \",\\n\", Blanks(i+si),\n       self.cmd.print(i+si, si),\n       Print(\"\\n\", Blanks(i), \")\")),\n   free := self >> self.cmd.free()\n));\n\nClass(creturn, throw);\nClass(creturnCond, throw);\n\nClass(isinf, AutoFoldExp, rec(\n  ev := self >> self._ev(self.args).ev(), \n  computeType := self >> TBool,\n));\n\nClass(isnan, AutoFoldExp, rec(\n  ev := self >> self._ev(self.args).ev(), \n  computeType := self >> TBool,\n));\n", "meta": {"hexsha": "957e60cfaceac8bc9e3b9efc4d19992a5f82aa2c", "size": 925, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "code.gi", "max_stars_repo_name": "spiral-software/spiral-package-hcol", "max_stars_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "code.gi", "max_issues_repo_name": "spiral-software/spiral-package-hcol", "max_issues_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "code.gi", "max_forks_repo_name": "spiral-software/spiral-package-hcol", "max_forks_repo_head_hexsha": "b4a0118382e3bba91ecd82a6c667f2cdb6389ceb", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-11-26T05:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T05:21:02.000Z", "avg_line_length": 30.8333333333, "max_line_length": 109, "alphanum_fraction": 0.5945945946, "num_tokens": 279, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.29421495978593404, "lm_q2_score": 0.021287351793451054, "lm_q1q2_score": 0.0062630573518592325}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nImportAll(paradigms.scratchpad);\n\nClass(ScratchX86CMContext, rec (\n\tgetOpts := meth(arg)\n\t\tlocal opts, elem, lssize, nrsgmts, vlen, size, swp, globalUnrolling, ttype;\n\t\t\n\t\tlssize := When (Length(arg) >= 2, arg[2], 2);\n\t\tnrsgmts := When (Length(arg) >= 3, arg[3], 1);\n\t\tvlen := When (Length(arg) >= 4, arg[4], 1);\n\t\tsize:= When (Length(arg) >= 5, arg[5], 2);\n         \tttype := When (Length(arg) >= 6, arg[6], 'R');\n\t\tswp := When (Length(arg) >= 7, arg[7], false);\n\t\tglobalUnrolling := When(Length(arg) >=8, arg[8], 1);\n\t\telem := ScratchpadGlobals.getOpts(lssize,nrsgmts,vlen,size,ttype,swp,globalUnrolling);\n        \n        \topts := CopyFields(elem);\n\n\t\topts.unparser := CCMContextScratchUnparserProg;\n\t\topts.codegen := CMContextScratchCodegen;\n        \n        \topts.profile.makeopts.CFLAGS := \"-O2 -Wall -fomit-frame-pointer -msse4.1 -std=gnu99 -static\";\n        \n        \topts.includes := [ \"<include/omega64.h>\" ];\n        \tAdd(opts.includes, \"\\\"scratchc.h\\\"\");\n        \n\t\treturn opts;\n\tend,\n));\n\nClass(ScratchX86Globals, rec(\n\tgetOpts := meth(arg)\n\t\tlocal opts, elem, lssize, nrsgmts, vlen, size, swp, globalUnrolling, ttype;\n\t\t\n\t\tlssize := When (Length(arg) >= 2, arg[2], 2);\n\t\tnrsgmts := When (Length(arg) >= 3, arg[3], 1);\n\t\tvlen := When (Length(arg) >= 4, arg[4], 1);\n\t\tsize:= When (Length(arg) >= 5, arg[5], 2);\n         \tttype := When (Length(arg) >= 6, arg[6], 'R');\n\t\tswp := When (Length(arg) >= 7, arg[7], false);\n\t\tglobalUnrolling := When(Length(arg) >=8, arg[8], 1);\n\t\telem := ScratchpadGlobals.getOpts(When(swp,lssize/2,lssize),nrsgmts,vlen,size,ttype,swp,globalUnrolling);\n\n        opts := CopyFields(elem);\n        \n        opts.swp_var := swp;\n        \n        opts.profile.name := \"linux-x86-thread\";\n\n\t\topts.unparser := BarrierScratchUnparserProg;\n\t\topts.codegen := SWPBarrierScratchCodegen;\n\n        opts.register := (self, opts) >> \"REG_thread\";\t\n\n        opts.profile.makeopts.CFLAGS := \"-O2 -Wall -fomit-frame-pointer -msse4.1 -std=gnu99 -static -lpthread\";\n        \n        opts.barrierCMD := (self, opts) >> \"BARRIER\";\n        opts.initialization := (self, opts) >> \"INITIAL\";\n\n        opts.includes := [];\n        Add(opts.includes, \"\\\"scratch_barrier.h\\\"\");\n\t\tAdd(opts.includes, \"<include/omega64.h>\");\n        \n\t\treturn opts;\n\tend,\n));\n", "meta": {"hexsha": "0cbb714bbd15c4fb47049b540c76cb5956e5a2a6", "size": 2350, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/scratch_x86/opts.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/scratch_x86/opts.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/scratch_x86/opts.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 33.5714285714, "max_line_length": 111, "alphanum_fraction": 0.6029787234, "num_tokens": 736, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.21733751090819797, "lm_q2_score": 0.028436030780608818, "lm_q1q2_score": 0.006180216149966423}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    Percent ::= '%'\n    _\n    a b c d e f g h i j k l m n o p q r s t u v w x y z\n    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\n%End\n\n%Headers\n    /.\n        inline static int tokenKind[128] ={};\n       \n        static  bool init()\n        {\n            tokenKind['$'] = $sym_type::$prefix$DollarSign$suffix$;\n            tokenKind['%'] = $sym_type::$prefix$Percent$suffix$;\n            tokenKind['_'] = $sym_type::$prefix$_$suffix$;\n\n            tokenKind['a'] = $sym_type::$prefix$a$suffix$;\n            tokenKind['b'] = $sym_type::$prefix$b$suffix$;\n            tokenKind['c'] = $sym_type::$prefix$c$suffix$;\n            tokenKind['d'] = $sym_type::$prefix$d$suffix$;\n            tokenKind['e'] = $sym_type::$prefix$e$suffix$;\n            tokenKind['f'] = $sym_type::$prefix$f$suffix$;\n            tokenKind['g'] = $sym_type::$prefix$g$suffix$;\n            tokenKind['h'] = $sym_type::$prefix$h$suffix$;\n            tokenKind['i'] = $sym_type::$prefix$i$suffix$;\n            tokenKind['j'] = $sym_type::$prefix$j$suffix$;\n            tokenKind['k'] = $sym_type::$prefix$k$suffix$;\n            tokenKind['l'] = $sym_type::$prefix$l$suffix$;\n            tokenKind['m'] = $sym_type::$prefix$m$suffix$;\n            tokenKind['n'] = $sym_type::$prefix$n$suffix$;\n            tokenKind['o'] = $sym_type::$prefix$o$suffix$;\n            tokenKind['p'] = $sym_type::$prefix$p$suffix$;\n            tokenKind['q'] = $sym_type::$prefix$q$suffix$;\n            tokenKind['r'] = $sym_type::$prefix$r$suffix$;\n            tokenKind['s'] = $sym_type::$prefix$s$suffix$;\n            tokenKind['t'] = $sym_type::$prefix$t$suffix$;\n            tokenKind['u'] = $sym_type::$prefix$u$suffix$;\n            tokenKind['v'] = $sym_type::$prefix$v$suffix$;\n            tokenKind['w'] = $sym_type::$prefix$w$suffix$;\n            tokenKind['x'] = $sym_type::$prefix$x$suffix$;\n            tokenKind['y'] = $sym_type::$prefix$y$suffix$;\n            tokenKind['z'] = $sym_type::$prefix$z$suffix$;\n\n            tokenKind['A'] = $sym_type::$prefix$A$suffix$;\n            tokenKind['B'] = $sym_type::$prefix$B$suffix$;\n            tokenKind['C'] = $sym_type::$prefix$C$suffix$;\n            tokenKind['D'] = $sym_type::$prefix$D$suffix$;\n            tokenKind['E'] = $sym_type::$prefix$E$suffix$;\n            tokenKind['F'] = $sym_type::$prefix$F$suffix$;\n            tokenKind['G'] = $sym_type::$prefix$G$suffix$;\n            tokenKind['H'] = $sym_type::$prefix$H$suffix$;\n            tokenKind['I'] = $sym_type::$prefix$I$suffix$;\n            tokenKind['J'] = $sym_type::$prefix$J$suffix$;\n            tokenKind['K'] = $sym_type::$prefix$K$suffix$;\n            tokenKind['L'] = $sym_type::$prefix$L$suffix$;\n            tokenKind['M'] = $sym_type::$prefix$M$suffix$;\n            tokenKind['N'] = $sym_type::$prefix$N$suffix$;\n            tokenKind['O'] = $sym_type::$prefix$O$suffix$;\n            tokenKind['P'] = $sym_type::$prefix$P$suffix$;\n            tokenKind['Q'] = $sym_type::$prefix$Q$suffix$;\n            tokenKind['R'] = $sym_type::$prefix$R$suffix$;\n            tokenKind['S'] = $sym_type::$prefix$S$suffix$;\n            tokenKind['T'] = $sym_type::$prefix$T$suffix$;\n            tokenKind['U'] = $sym_type::$prefix$U$suffix$;\n            tokenKind['V'] = $sym_type::$prefix$V$suffix$;\n            tokenKind['W'] = $sym_type::$prefix$W$suffix$;\n            tokenKind['X'] = $sym_type::$prefix$X$suffix$;\n            tokenKind['Y'] = $sym_type::$prefix$Y$suffix$;\n            tokenKind['Z'] = $sym_type::$prefix$Z$suffix$;\n            return true;\n        };\n     inline const static bool dd = init();\n         int getKind(int c)\n        {\n            return (((c & 0xFFFFFF80) == 0) /* 0 <= c < 128? */ ? tokenKind[c] : 0);\n        }\n\n    ./\n%End\n\n", "meta": {"hexsha": "3d57729087f7c29dc44fe8bf371fc6561db545bc", "size": 3774, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/rt_cpp/KWLexerMapF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/rt_cpp/KWLexerMapF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/rt_cpp/KWLexerMapF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.4698795181, "max_line_length": 84, "alphanum_fraction": 0.5129835718, "num_tokens": 1135, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1688569605068544, "lm_q2_score": 0.035678548570655874, "lm_q1q2_score": 0.0060245712669371254}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(ScratchSumsGen, LegacySumsGen);\n", "meta": {"hexsha": "75adb3330f98b9d942a8846b94a71a902b0ae4b6", "size": 121, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/sumsgen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/sumsgen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/sumsgen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 17.2857142857, "max_line_length": 53, "alphanum_fraction": 0.7768595041, "num_tokens": 36, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.13846178345871912, "lm_q2_score": 0.043365796600284716, "lm_q1q2_score": 0.00600450553838348}}
{"text": "ReadByLines := function(name)\n\tlocal file, line, count;\n\tfile := InputTextFile(name);\n\tcount := 0;\n\twhile true do\n\t\tline := ReadLine(file);\n\t\tif line = fail then\n\t\t\tbreak;\n\t\tfi;\n\t\tcount := count + 1;\n\tod;\n\tCloseStream(file);\n\treturn count;\nend;\n\n# With [http://www.ibiblio.org/pub/docs/misc/amnesty.txt amnesty.txt]\nReadByLines(\"amnesty.txt\");\n# 384\n", "meta": {"hexsha": "5826acc3fd39c8c38a9d395fa32a5e2644930170", "size": 350, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Read-a-file-line-by-line/GAP/read-a-file-line-by-line.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Read-a-file-line-by-line/GAP/read-a-file-line-by-line.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Read-a-file-line-by-line/GAP/read-a-file-line-by-line.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 18.4210526316, "max_line_length": 69, "alphanum_fraction": 0.6685714286, "num_tokens": 101, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.17781086076419853, "lm_q2_score": 0.033589505650103976, "lm_q1q2_score": 0.005972578912288898}}
{"text": "InstallGlobalFunction(MEMO_DiskCache,\nfunction(memo, path)\n  local dir, cache, type;\n\n  # Directory for this function\n  dir := Filename(Directory(path), memo!.funcname);\n\n  # Make cache object\n  cache := rec(memo := memo,  # memoised function\n               dir := dir);  # directory for storing results\n  # Objectify\n  type := NewType(DictionariesFamily, MEMO_IsDiskCache);\n  cache := Objectify(type, cache);\n\n  return cache;\nend);\n\nInstallMethod(AddDictionary,\n\"for a memoisation disk cache and two objects\",\n[MEMO_IsDiskCache, IsObject, IsObject],\nfunction(cache, key, val)\n  local memo, filename, str, write, key_filename, key_str, metadata_filename,\n        metadata_str;\n  memo := cache!.memo;\n\n  # Create directory if needed\n  if not IsDirectoryPath(cache!.dir) then\n    MEMO_CreateDirRecursively(cache!.dir);\n  fi;\n\n  # Get filename for storage\n  filename := MEMO_KeyToFilename(cache, key, MEMO_OUT);\n  Info(InfoMemoisation, 3, \"Using filename \", filename);\n\n  # Write to disk\n  str := memo!.pickle(val);\n  write := FileString(filename, str);\n  if write = fail then\n    Error(\"Memoisation: could not write result to \", filename);\n    # user can \"return;\" and result will still be returned\n  else\n    Info(InfoMemoisation, 3, \"Result stored in file\");\n  fi;\n\n  # OPTION: storekey\n  if memo!.storekey then\n    key_filename := MEMO_KeyToFilename(cache, key, MEMO_KEY);\n    key_str := memo!.pickle(key);\n    FileString(key_filename, key_str);\n    Info(InfoMemoisation, 3, \"Key stored at \", key_filename);\n  fi;\n\n  # OPTION: metadata\n  if memo!.metadata <> fail then\n    metadata_filename := MEMO_KeyToFilename(cache, key, MEMO_META);\n    metadata_str := memo!.metadata();\n    FileString(metadata_filename, metadata_str);\n    Info(InfoMemoisation, 3, \"Metadata stored at \", metadata_filename);\n  fi;\n\n  # no return value\nend);\n\nInstallMethod(KnowsDictionary,\n\"for a memoisation disk cache and an object\",\n[MEMO_IsDiskCache, IsObject],\nfunction(cache, key)\n  local filename;\n  filename := MEMO_KeyToFilename(cache, key, MEMO_OUT);\n  return IsReadableFile(filename);\nend);\n\nInstallMethod(LookupDictionary,\n\"for a memoisation disk cache and an object\",\n[MEMO_IsDiskCache, IsObject],\nfunction(cache, key)\n  local memo, filename, key_filename, key_str, storedkey, str, val;\n  memo := cache!.memo;\n\n  # Get filename\n  filename := MEMO_KeyToFilename(cache, key, MEMO_OUT);\n  Info(InfoMemoisation, 3, \"Using filename \", filename);\n  if not IsReadableFile(filename) then\n    # We shouldn't normally get here, as we usually check KnowsDictionary first\n    Info(InfoMemoisation, 1, \"File \", filename, \" not readable\");\n    return fail;\n  fi;\n\n  # OPTION: storekey\n  if memo!.storekey then\n    key_filename := MEMO_KeyToFilename(cache, key, MEMO_KEY);\n    key_str := StringFile(key_filename);\n    storedkey := memo!.unpickle(key_str);\n    # check if key still matches\n    if key <> storedkey then\n      ErrorNoReturn(\"Hash collision: <key> does not match <storedkey>\");\n    fi;\n    Info(InfoMemoisation, 3, \"Key matches \", key_filename);\n  fi;\n\n  # OPTION: unhash\n  if memo!.unhash <> fail then\n    # unhash and check if key still matches\n    storedkey := MEMO_FilenameToKey(cache, filename);\n    if key <> storedkey then\n      ErrorNoReturn(\"Hash collision: <key> does not match <storedkey>\");\n    fi;\n  fi;\n\n  # Load result\n  str := StringFile(filename);\n  Info(InfoMemoisation, 4, \"Got \", Length(str), \" bytes from file\");\n  val := memo!.unpickle(str);\n\n  return val;\nend);\n\nInstallMethod(MEMO_ClearCache,\n\"for a memoisation disk cache\",\n[MEMO_IsDiskCache],\nfunction(cache)\n  local dir, file, ext, path, result;\n  dir := cache!.dir;\n  if not IsDirectoryPath(dir) then\n    return true;\n  fi;\n  for file in DirectoryContents(dir) do\n    for ext in [MEMO_OUT, MEMO_KEY, MEMO_META] do\n      if EndsWith(file, ext) then\n        path := Filename(Directory(dir), file);\n        if RemoveFile(path) <> true then\n          Info(InfoMemoisation, 1, \"Failed to delete \", path);\n        fi;\n      fi;\n    od;\n  od;\n  result := RemoveDir(dir);\n  if result = true then\n    return true;\n  fi;\n  return false;\nend);\n\nInstallGlobalFunction(MEMO_KeyToFilename,\nfunction(cache, key, ext)\n  local h, fname;\n  h := cache!.memo!.hash(key);\n  fname := Concatenation(h, ext);\n  return Filename(Directory(cache!.dir), fname);\nend);\n\nInstallGlobalFunction(MEMO_FilenameToKey,\nfunction(cache, filename)\n  local pos, h;\n  if StartsWith(filename, cache!.dir) then  # remove directory\n    filename := filename{[Length(cache!.dir) + 2 .. Length(filename)]};\n  fi;\n  # Remove extension\n  pos := Remove(Positions(filename, '.'));  # position of final dot\n  h := filename{[1 .. pos - 1]};\n  return cache!.memo!.unhash(h);\nend);\n\nInstallGlobalFunction(MEMO_CreateDirRecursively,\nfunction(dir)\n  # Borrowed from PackageManager\n  local path, newdir, i, res;\n  path := SplitString(dir, \"/\");\n  newdir := \"\";\n  for i in [1 .. Length(path)] do\n    Append(newdir, path[i]);\n    Append(newdir, \"/\");\n    if not IsDirectoryPath(newdir) then\n      res := CreateDir(newdir);\n      if res <> true then\n        return fail;\n      fi;\n    fi;\n  od;\n  return true;\nend);\n", "meta": {"hexsha": "94a4a2c85c7c4a4ad3c09cf5f17f7b694e3cc460", "size": 5116, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/DiskCache.gi", "max_stars_repo_name": "gap-packages/Memoisation", "max_stars_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-08-20T21:02:33.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-19T09:25:15.000Z", "max_issues_repo_path": "gap/DiskCache.gi", "max_issues_repo_name": "gap-packages/Memoisation", "max_issues_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2018-08-06T11:56:51.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-04T15:04:36.000Z", "max_forks_repo_path": "gap/DiskCache.gi", "max_forks_repo_name": "gap-packages/Memoisation", "max_forks_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.1098901099, "max_line_length": 79, "alphanum_fraction": 0.6854964816, "num_tokens": 1379, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.20434189993684582, "lm_q2_score": 0.028870903812866937, "lm_q1q2_score": 0.005899535338015156}}
{"text": "# Several ways to do it\n\"Hello world!\";\n\nPrint(\"Hello world!\\n\"); # No EOL appended\n\nDisplay(\"Hello world!\");\n\nf := OutputTextUser();\nWriteLine(f, \"Hello world!\\n\");\nCloseStream(f);\n", "meta": {"hexsha": "de057aff9f9ee19461f8f2172851691f7dffac9c", "size": 182, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Hello-world-Text/GAP/hello-world-text.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 81, "max_stars_repo_stars_event_min_datetime": "2017-10-01T14:07:28.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-20T15:47:33.000Z", "max_issues_repo_path": "Task/Hello-world-Text/GAP/hello-world-text.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": 333, "max_issues_repo_issues_event_min_datetime": "2017-10-01T13:37:50.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-27T21:48:55.000Z", "max_forks_repo_path": "Task/Hello-world-Text/GAP/hello-world-text.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 739, "max_forks_repo_forks_event_min_datetime": "2017-10-01T13:42:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-24T11:39:49.000Z", "avg_line_length": 16.5454545455, "max_line_length": 42, "alphanum_fraction": 0.6648351648, "num_tokens": 50, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.11596072436426733, "lm_q2_score": 0.05033063455613047, "lm_q1q2_score": 0.005836376840842113}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2010, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   See (or edit) Notice Declaration below\n-- *\n-- * </copyright>\n-- */\n--\n-- The Complete OCL Lexer\n--\n\n%options escape=$\n%options la=2\n%options fp=OCLLexer,prefix=Char_\n%options single-productions\n%options noserialize\n%options package=org.eclipse.ocl.xtext.essentialocl.parser\n%options template=../lpg/LexerTemplateF.gi\n%options filter=OCLKWLexer.gi\n%options export_terminals=(\"OCLParsersym.java\", \"TK_\")\n%options include_directory=\"../lpg\"\n\n%Import\n\tEssentialOCLLexer.gi\n%End\n\n%Define\n\n\t--\n\t-- Definition of macro used in the included file LexerBasicMap.g\n\t-- We redefine that one defined by EssentialOCLLexer\n\t--\n\t$kw_lexer_class /.OCLKWLexer./\n\n%End\n\n%Notice\n\t/./**\n * Complete OCL Lexer\n * <copyright>\n *\n * Copyright (c) 2010, 2009 IBM Corporation and others.\n * All rights reserved.   This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v2.0\n * which accompanies this distribution, and is available at\n * http://www.eclipse.org/legal/epl-v20.html\n *\n * Contributors:\n *   IBM - Initial API and implementation\n *   E.D.Willink - Bug 292112, 292594\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - Introducing new LPG templates (299396)\n $copyright_contributions\n *******************************************************************************/\n\t./\n%End\n\n%Export\n\tAT\n\tCARET\n\tCARETCARET\n\tQUESTIONMARK\n%End\n\n%Rules\n\tToken ::= '@'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_AT);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '^'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_CARET);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '^' '^'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_CARETCARET);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '?'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_QUESTIONMARK);\n\t\t  $EndAction\n\t\t./\n%End\n", "meta": {"hexsha": "ac84a795f628daa3124732aa8c165bce26525c7a", "size": 2167, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/OCLLexer.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/OCLLexer.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/OCLLexer.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.3402061856, "max_line_length": 92, "alphanum_fraction": 0.6658975542, "num_tokens": 613, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.20434190478229486, "lm_q2_score": 0.02843603098644916, "lm_q1q2_score": 0.00581067273621938}}
{"text": "# Return the time passed in last function\ntime;\n", "meta": {"hexsha": "25723b14e2554e0edbb2b854b620a6a76563eb2b", "size": 48, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Time-a-function/GAP/time-a-function.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Time-a-function/GAP/time-a-function.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Time-a-function/GAP/time-a-function.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 16.0, "max_line_length": 41, "alphanum_fraction": 0.7708333333, "num_tokens": 11, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.1581743527484317, "lm_q2_score": 0.035144847032410394, "lm_q1q2_score": 0.005559013431794154}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(swp_loop, loop);\n\nClass(dma_signal, ExpCommand);\nClass(dma_wait, ExpCommand);\n\nClass(cpu_signal, ExpCommand);\nClass(cpu_wait, ExpCommand);\n\nClass(barrier_cmd, ExpCommand);\nClass(nop_cmd, ExpCommand);\n\nClass(dma_fence, skip);\n\nClass(dma_transfer, Command, rec(\n    isAssign := false, # transfers are not assignments, since they take >2 params\n    __call__ := (self, loc, exp, size) >> WithBases(self, rec(\n        operations := CmdOps,\n        loc := toAssignTarget(loc),\n                exp := toExpArg(exp),\n        size := toExpArg(size)\n   )),\n\n   rChildren := self >> [self.loc, self.exp, self.size],\n   rSetChild := rSetChildFields(\"loc\", \"exp\", \"size\"),\n   unroll := self >> self,\n\n   print := (self,i,is) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.exp, \", \", self.size, \")\"))\n));\n\nClass(dma_load, dma_transfer);\nClass(dma_store, dma_transfer);\n\n# wrapper for dma_xfer, includes the dma transfer size.\n# dma_size( dma_xfer(a,b), c);\nClass(dma_size, ExpCommand);\nClass(par_exec, chain);\n\n#The next two dma_jump and cpu_jump are used only in the CM stuff in ScratchX86\nClass(dma_jump,ExpCommand);\nClass(cpu_jump,ExpCommand);\n\n#For thread registration using the Fast Barrier\nClass(register,ExpCommand);\nClass(initialization, ExpCommand);\nClass(add_buffer,skip);\n", "meta": {"hexsha": "d6194db917428a3dc84ff31d3bf30e75cf04bc4d", "size": 1913, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/scratchpad/code.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/scratchpad/code.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/scratchpad/code.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 32.9827586207, "max_line_length": 97, "alphanum_fraction": 0.5974908521, "num_tokens": 433, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.23370636758849891, "lm_q2_score": 0.023330767789847086, "lm_q1q2_score": 0.005452548993215914}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nClass(ABuf, AGenericTag, rec(\n    __call__ := (self, bs) >> WithBases(self, rec(bs:=bs)),\n    print := (self) >> When(IsBound(self.bs), Print(self.name, \"(\", self.bs, \")\"), Print(self.name)),\n#D    isBuffer := true,\n    operations := Inherit(PrintOps, rec(\\= := (self, other) >> ObjId(other) = ObjId(self) and (Same(other, self) or IsBound(self.bs) and IsBound(other.bs) and self.bs = other.bs)))\n));\n\nClass(AVecMem, AVec, rec(\n    __call__ := (self, v) >> WithBases(self, rec(v:=v)),\n    print := (self) >> When(IsBound(self.v), Print(self.name, \"(\", self.v, \")\"), Print(self.name)),\n#D    isMem := true,\n    operations := Inherit(PrintOps, rec(\\= := (self, other) >> ObjId(other) = ObjId(self) and (Same(other, self) or IsBound(self.v) and IsBound(other.v) and self.v = other.v)))\n));\n\nClass(AVecMemL, AVec, rec(\n    __call__ := (self, v) >> WithBases(self, rec(v:=v)),\n    print := (self) >> When(IsBound(self.v), Print(self.name, \"(\", self.v, \")\"), Print(self.name)),\n#D    isMemL := true,\n    operations := Inherit(PrintOps, rec(\\= := (self, other) >> ObjId(other) = ObjId(self) and (Same(other, self) or IsBound(self.v) and IsBound(other.v) and self.v = other.v)))\n));\n\nClass(AVecMemR, AVec, rec(\n    __call__ := (self, v) >> WithBases(self, rec(v:=v)),\n    print := (self) >> When(IsBound(self.v), Print(self.name, \"(\", self.v, \")\"), Print(self.name)),\n#D    isMemR := true,\n    operations := Inherit(PrintOps, rec(\\= := (self, other) >> ObjId(other) = ObjId(self) and (Same(other, self) or IsBound(self.v) and IsBound(other.v) and self.v = other.v)))\n));\n", "meta": {"hexsha": "0533790ccceef3c1ee1dffa14dcb65de975fc36d", "size": 1646, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/loops/tags.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/paradigms/loops/tags.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/paradigms/loops/tags.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 49.8787878788, "max_line_length": 180, "alphanum_fraction": 0.6136087485, "num_tokens": 512, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.28140560742914383, "lm_q2_score": 0.019124035178585755, "lm_q1q2_score": 0.005381610735926239}}
{"text": "#############################################################################\n##\n##                         equivalent mappings\n##  named-pipes.gi\n##                                                          Sergio Siccha\n##\n##  Copyright 2017 by the authors.\n##  This file is free software, see license file.\n##\n##  Provides a means to communicate with another process\n##  via a named pipe.\n##\n#############################################################################\n\n## Recognize whether we're running HPCGAP\nif IsBound( HPCGAP ) then\n    ## Transfer IO record to the public region.\n    MakeImmutable( IO );\nfi;\n\n## Opens a pipe for both read and write access\n## TODO change this later to include parameter for RDONLY or WRONLY\nPipeOpen := function( pipeFilename )\n    local pipe;\n    ## Use `mkfifo pipe-test` to create named pipe\n    pipe := IO_open( pipeFilename, IO.O_RDWR, 0 );\n    if pipe = fail then\n        Error( \"Could not open \", pipeFilename );\n    fi;\n    ## 2^16 corresponds to the default buffer size\n    pipe := IO_WrapFD( pipe, 2^16, 2^16 );\n    return pipe;\nend;\n\n##################################################\n# Operation NamedPipeHandle\n# Input:\n#   pipeFilename - string\n#   options - an options record\n# Filters:\n#   IsString, IsRecord\n#\n# Output:\n#   newPipeHandle\n##################################################\nInstallMethod( NamedPipeHandle,\n\"for a pipe-filename string\",\n[ IsString ],\nfunction( pipeFilename )\n    return NamedPipeHandle( pipeFilename, rec() );\nend );\n\n##################################################\n# Operation NamedPipeHandle\n# Input:\n#   pipeFilename - string\n#   options - an options record\n# Filters:\n#   IsString, IsRecord\n#\n# Output:\n#   newPipeHandle\n##################################################\nInstallMethod( NamedPipeHandle,\n\"for a pipe-filename string and an options record\",\n[ IsString, IsRecord ],\nfunction( pipeFilename, options )\n    local pipe, newPipeHandle, type;\n    pipe := PipeOpen( pipeFilename );\n    newPipeHandle := rec( pipe := pipe );\n    type := NamedPipeHandleType;\n    Objectify( type, newPipeHandle );\n    return newPipeHandle;\nend );\n\n##################################################\n# Operation ReadLine\n# Input:\n#   namedPipeHandle\n# Filters:\n#   IsNamedPipeHandle\n#\n# Output:\n#   string\n##################################################\nInstallMethod( ReadLine,\n\"for a named-pipe-handle\",\n[ IsNamedPipeHandle ],\nfunction( namedPipeHandle )\n    local string;\n    string := IO_ReadLine( namedPipeHandle!.pipe );\n    ## Ignore lines that start with a '#'\n    if string[1] = '#' then\n        Info( InfoWarning, 1, \"Ignoring input starting with '#'.\" );\n        return ReadLine( namedPipeHandle );\n    fi;\n    ## Ctrl-D character was passed into pipe\n    if string[1] = '\\004' and Length( string ) = 2 then\n        ## TODO propagate '\\004' signal?\n        IO_close( namedPipeHandle!.pipe );\n        return fail;\n    fi;\n    return string;\nend );\n#IO_ReadLine( pipe );\n#IO_Flush\n", "meta": {"hexsha": "42d7b5817b1b89c73e8c00d397a43fd5f1fcb9ad", "size": 2978, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/named-pipes/named-pipes.gi", "max_stars_repo_name": "ssiccha/equivalent-mappings", "max_stars_repo_head_hexsha": "0fd2dd4946980604e9378c29f16244521d6bbf76", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/named-pipes/named-pipes.gi", "max_issues_repo_name": "ssiccha/equivalent-mappings", "max_issues_repo_head_hexsha": "0fd2dd4946980604e9378c29f16244521d6bbf76", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/named-pipes/named-pipes.gi", "max_forks_repo_name": "ssiccha/equivalent-mappings", "max_forks_repo_head_hexsha": "0fd2dd4946980604e9378c29f16244521d6bbf76", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.8317757009, "max_line_length": 77, "alphanum_fraction": 0.5503693754, "num_tokens": 663, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.17553809087592986, "lm_q2_score": 0.030214589687167153, "lm_q1q2_score": 0.005303811390284881}}
{"text": "IsExistingFile(\"input.txt\");\nIsDirectoryPath(\"docs\");\nIsExistingFile(\"/input.txt\");\nIsDirectoryPath(\"/docs\");\n", "meta": {"hexsha": "f1df7217b8dcb8287c60371f7bd7766d447ae2a7", "size": 110, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Check-that-file-exists/GAP/check-that-file-exists.gap", "max_stars_repo_name": "mullikine/RosettaCodeData", "max_stars_repo_head_hexsha": "4f0027c6ce83daa36118ee8b67915a13cd23ab67", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Check-that-file-exists/GAP/check-that-file-exists.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Check-that-file-exists/GAP/check-that-file-exists.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 22.0, "max_line_length": 29, "alphanum_fraction": 0.7454545455, "num_tokens": 26, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.16667541296674693, "lm_q2_score": 0.031618764074832884, "lm_q1q2_score": 0.005270070559670913}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nClass(CMScratchMainCodegen, ScratchMainCodegen, rec(\n    genMain := (self, opts, sub, func1, func2, xy, params) >>\n        func(TVoid, sub, Concatenation(xy, params), par_exec(\n            ApplyFunc(call, Flat(Concatenation([func1],[false]))),\n            ApplyFunc(call, Flat(Concatenation([func2], xy)))\n        ))\n));\n\nClass(CMContextScratchCodegen, ScratchCodegen, rec(\n    CPUCodegen := CPUCodegen,\n    DMACodegen := DMACodegen,\n    MainCodegen := CMScratchMainCodegen,\n    Formula := meth(self, o, y, x, opts)\n        local main, initfunc, cpufunc, dmafunc, auxfunc, prog, params, sub, initsub, memvars, scratchvars, v, io, loadvar, storevar, v, substrec, svars, initcode, datas, dvars, dv, tag;\n\n        datas := Collect(o, FDataOfs);\n        params := Set(Concatenation(Collect(o, param), Filtered(Collect(o, var), IsParallelLoopIndex)));\n        sub := Cond(IsBound(opts.subName), opts.subName, \"transform\");\n\n        initsub := Cond(IsBound(opts.subName), Concat(\"init_\", opts.subName), \"init\");\n        if IsBound(opts.generateInitFunc) and opts.generateInitFunc then\n            initcode := chain(List(datas, x -> SReduce(x.var.init, opts)));\n            initfunc := func(TVoid, initsub, params :: Set(Collect(initcode, param)), initcode);\n        else\n            initfunc := func(TVoid, initsub, params, chain());\n        fi;\n\n        dvars := List(datas, x->x.var);\n        for dv in dvars do\n            dv.t.qualifiers := [opts.romModifier];\n        od;\n\n        self.DMACodegen.loadbuffers := Set([]);\n        self.DMACodegen.storebuffers := Set([]);\n        self.DMACodegen.membuffers := Set([]);\n        dmafunc := self.DMACodegen.Formula(o, y, x, opts);\n        self.DMACodegen.membuffers := Set(self.DMACodegen.membuffers);\n        SubtractSet(self.DMACodegen.membuffers, Set([x, y]));\n        for v in self.DMACodegen.membuffers do v.t.qualifiers := [opts.memModifier]; od;\n\n        self.CPUCodegen.loadbuffers := Set([]);\n        self.CPUCodegen.storebuffers := Set([]);\n        cpufunc := self.CPUCodegen.Formula(o, y, x, opts);\n\n        memvars := Set(Concat(\n            Filtered(Flat(List(Collect(cpufunc, decl), i->i.vars)), j->IsBound(j.t.qualifiers) and opts.memModifier in j.t.qualifiers),\n            self.DMACodegen.membuffers));\n        scratchvars := Set(Filtered(Flat(List(Collect(cpufunc, decl), i->i.vars)), j->IsBound(j.t.qualifiers) and opts.scratchModifier in j.t.qualifiers));\n        \n        tag := opts.tags[1];\n\n        loadvar := var.fresh_t(\"S\", TArray(opts.XType.t, Cond(tag.isRegCx, 2 * tag.size, tag.size)));\n        loadvar.t.qualifiers := [opts.scratchModifier];\n        storevar := var.fresh_t(\"S\", TArray(opts.XType.t, Cond(tag.isRegCx, 2 * tag.size, tag.size)));\n        storevar.t.qualifiers := [opts.scratchModifier];\n\n        substrec := rec();\n        for v in self.CPUCodegen.loadbuffers do substrec.(v.id) := loadvar; od;\n        for v in self.CPUCodegen.storebuffers do substrec.(v.id) := storevar; od;\n        for v in self.DMACodegen.loadbuffers do substrec.(v.id) := loadvar; od;\n        for v in self.DMACodegen.storebuffers do substrec.(v.id) := storevar; od;\n        cpufunc :=  SubstVars(cpufunc, substrec);\n        dmafunc :=  SubstVars(dmafunc, substrec);\n\n        cpufunc := SubstTopDown(cpufunc, @(1, decl), e->decl(Filtered(@(1).val.vars, i->not i in Concat(memvars, scratchvars, [loadvar, storevar])), @(1).val.cmd));\n        dmafunc := SubstTopDown(dmafunc, @(1, decl), e->decl(Filtered(@(1).val.vars, i->not i in Concat(memvars, scratchvars, [loadvar, storevar])), @(1).val.cmd));\n\n        [cpufunc, dmafunc, svars] := When(opts.swp,_double_buffer(cpufunc, dmafunc, [loadvar, storevar], opts),[cpufunc,dmafunc,[loadvar,storevar]]);\n\n        x.t.qualifiers := Set(x.t.qualifiers);\n        y.t.qualifiers := Set(y.t.qualifiers);\n\n        main := self.MainCodegen.genMain(opts, sub, func(TVoid,\"DMA_jump\",[ false ],dma_jump(false)), dmafunc, [y,x], params);\n        prog := program(\n            decl(Concat(Set(memvars), svars, dvars), chain(\n                initfunc,\n                cpufunc,\n\t\tdmafunc,\n                main\n        )));\n\n        prog.dimensions := o.dims();\n        return prog;\n    end\n));\n", "meta": {"hexsha": "791dbc8d0ec8200a6038737a38ce2830c8152797", "size": 4268, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/platforms/scratch_x86/cmcodegen.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/platforms/scratch_x86/cmcodegen.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/platforms/scratch_x86/cmcodegen.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 47.4222222222, "max_line_length": 185, "alphanum_fraction": 0.6216026242, "num_tokens": 1196, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.26284183737131667, "lm_q2_score": 0.020023440046763433, "lm_q1q2_score": 0.005262997772385704}}
{"text": "#\n# Memoisation: Shared persistent memoisation library for GAP and other systems\n#\n# Implementations\n#\n\nInstallGlobalFunction(MemoisedFunction,\nfunction(func, args...)\n  local opts, funcname, key, storekey, pickle, unpickle, hash, unhash, metadata,\n        rnam, memo, type, pos, typestring, path, cachetypes, cachetype;\n\n  # Default options\n  opts := rec(cache := MEMO_DefaultCache,\n              funcname := NameFunction(func),\n              key := {args...} -> args,  # default: use list of args as key\n              storekey := false,\n              pickle := IO_Pickle,\n              unpickle := IO_Unpickle,\n              hash := MEMO_Hash,\n              unhash := fail,  # TODO: iterate through keys (storekey or unhash)\n              metadata := fail);\n\n  # Process optional argument\n  if Length(args) = 1 then\n    if not IsRecord(args[1]) then\n      ErrorNoReturn(\"Memoisation: MemoisedFunction: \",\n                    \"2nd argument <opts> should be a record\");\n    fi;\n    # Import user options\n    for rnam in RecNames(args[1]) do\n      opts.(rnam) := args[1].(rnam);\n    od;\n  elif Length(args) > 1 then\n    ErrorNoReturn(\"Memoisation: MemoisedFunction takes 1 or 2 arguments, not \",\n                  Length(args) + 1);\n  fi;\n\n  # Checks\n  if opts.funcname = \"unknown\" then\n    ErrorNoReturn(\"Memoisation: memoised function <func> has no name,\\n\",\n                  \"and no funcname was specified\");\n  fi;\n\n  # Make the record\n  memo := rec(\n               func := func,\n               funcname := opts.funcname,\n               key := opts.key,\n               storekey := opts.storekey,\n               pickle := opts.pickle,\n               unpickle := opts.unpickle,\n               hash := opts.hash,\n               unhash := opts.unhash,\n               metadata := opts.metadata\n             );\n\n  # Objectify\n  type := NewType(FunctionsFamily, IsMemoisedFunction);\n  memo := Objectify(type, memo);\n\n  # Determine which backend to use\n  pos := PositionSublist(opts.cache, \"://\");\n  if pos = fail then  # no backend specified: use disk\n    typestring := \"file\";\n    path := opts.cache;\n  else\n    typestring := opts.cache{[1 .. pos-1]};\n    path := opts.cache{[pos+3 .. Length(opts.cache)]};\n  fi;\n  cachetypes := rec(file := MEMO_DiskCache, mongodb := MEMO_MongoDBCache);\n  if not typestring in RecNames(cachetypes) then\n    ErrorNoReturn(\"Memoisation: MemoisedFunction: <cache> cannot start with \\\"\",\n                  typestring, \"://\\\"\");\n  fi;\n  cachetype := cachetypes.(typestring);\n\n  # Create backend\n  memo!.cache := cachetype(memo, path);\n\n  return memo;\nend);\n\nInstallMethod(CallFuncList,\n\"for a memoised function\",\n[IsMemoisedFunction, IsList],\nfunction(memo, args)\n  local key, val;\n\n  # In case IO_Pickle was recently interrupted\n  if memo!.pickle = IO_Pickle or memo!.unpickle = IO_Unpickle then\n    IO_ClearPickleCache();\n  fi;\n\n  # Compute key\n  key := CallFuncList(memo!.key, args);\n  Info(InfoMemoisation, 2, \"Memo key: \", key);\n\n  # Search in cache\n  if KnowsDictionary(memo!.cache, key) then\n    # Retrieve cached result\n    Info(InfoMemoisation, 2, \"Key known!  Loading result from cache...\");\n    val := LookupDictionary(memo!.cache, key);\n  else\n    # Compute and store result\n    Info(InfoMemoisation, 2, \"Key unknown.  Computing result...\");\n    val := CallFuncList(memo!.func, args);\n    AddDictionary(memo!.cache, key, val);\n  fi;\n\n  # Set attribute/property\n  if Size(args) = 1 and\n     (IsAttribute(memo!.func) or IsProperty(memo!.func)) and\n     not Tester(memo!.func)(args[1]) then\n    Info(InfoMemoisation, 4, \"Setting attribute \", NameFunction(memo!.func));\n    Setter(memo!.func)(args[1], val);\n  fi;\n\n  return val;\nend);\n\nInstallMethod(ClearMemoisedFunction,\n\"for a memoised function\",\n[IsMemoisedFunction],\nfunction(memo)\n  return MEMO_ClearCache(memo!.cache);\nend);\n\nInstallMethod(ViewObj,\n\"for a memoised function\",\n[IsMemoisedFunction],\nfunction(memo)\n  Print(\"<memoised \");\n  ViewObj(memo!.func);\n  Print(\">\");\nend);\n\nInstallMethod(PrintObj,\n\"for a memoised function\",\n[IsMemoisedFunction],\nfunction(memo)\n  Print(\"MemoisedFunction(\\n\");\n  PrintObj(memo!.func);\n  Print(\",\\nrec(funcname := \\\"\", memo!.funcname, \"\\\") )\");\nend);\n\nfor delegated_function in [NamesLocalVariablesFunction,\n                           NumberArgumentsFunction] do\n  InstallMethod(delegated_function,\n                \"for a memoised function\",\n                [IsMemoisedFunction],\n                memo -> delegated_function(memo!.func));\nod;\n", "meta": {"hexsha": "be513d8d5070dd288728576df14a93ff9eb3c225", "size": 4470, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/MemoisedFunction.gi", "max_stars_repo_name": "gap-packages/Memoisation", "max_stars_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-08-20T21:02:33.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-19T09:25:15.000Z", "max_issues_repo_path": "gap/MemoisedFunction.gi", "max_issues_repo_name": "gap-packages/Memoisation", "max_issues_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2018-08-06T11:56:51.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-04T15:04:36.000Z", "max_forks_repo_path": "gap/MemoisedFunction.gi", "max_forks_repo_name": "gap-packages/Memoisation", "max_forks_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.2156862745, "max_line_length": 80, "alphanum_fraction": 0.6275167785, "num_tokens": 1156, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.22815649166448126, "lm_q2_score": 0.02297736991002562, "lm_q1q2_score": 0.005242436106348463}}
{"text": "#\n# JupyterKernel: Jupyter kernel using ZeroMQ\n#\n# Implementations\n#\n\n# This is a bit ugly: The global variable _KERNEL is assigned to\n# the jupyter kernel object at so that we can use it from everywhere.\n_KERNEL := \"\";\n\n## This is plainly wrong, it just reessembles the behaviour of\n## `UPDATE_STAT` in newer GAP version we need here.\nif not IsBound( UPDATE_STAT ) then\n    BindGlobal( \"UPDATE_STAT\",\n      function( string, value )\n        time := value;\n    end );\nfi;\n\n\nBindConstant( \"JUPYTER_KERNEL_MODE_CONTROL\", 1 );\nBindConstant( \"JUPYTER_KERNEL_MODE_EXEC\", 2 );\n\n\nInstallGlobalFunction( JUPYTER_LogProtocol,\nfunction(filename)\n    _KERNEL!.ProtocolLog := OutputTextFile(filename, false);\n    SetPrintFormattingStatus(_KERNEL!.ProtocolLog, false);\nend);\n\nInstallGlobalFunction( JUPYTER_UnlogProtocol,\nfunction()\n    local tmp;\n    # In case `CloseStream` causes messages to be printed\n    tmp := _KERNEL!.ProtocolLog;\n    Unbind(_KERNEL!.ProtocolLog);\n    CloseStream(tmp);\nend);\n\nInstallGlobalFunction( NewJupyterKernel,\nfunction(conf)\n    local pid, address, kernel, poll, msg, status, res;\n\n    address := Concatenation(conf.transport, \"://\", conf.ip, \":\");\n    kernel := rec( config := Immutable(conf)\n                 , Username := \"username\"\n                 , ProtocolVersion := \"5.3\"\n                 , ZmqIdentity := HexStringUUID( RandomUUID() )\n                 , SessionKey := conf.key\n                 , SessionID := \"\"\n                 , ExecutionCount := 0);\n\n\n    kernel.MsgHandlers := rec( kernel_info_request := function(msg)\n                                 kernel!.SessionID := msg.header.session;\n                                 return JupyterMsg( kernel\n                                                  , \"kernel_info_reply\"\n                                                  , msg.header\n                                                  , rec( protocol_version := kernel!.ProtocolVersion\n                                                       , implementation := \"GAP\"\n                                                       , implementation_version := GAPInfo.PackagesInfo.jupyterkernel[1].Version\n                                                       , language_info := rec( name := \"GAP 4\"\n                                                                             , version := GAPInfo.Version\n                                                                             , mimetype := \"text/x-gap\"\n                                                                             , file_extension := \".g\"\n                                                                             , pygments_lexer := \"gap\"\n                                                                             , codemirror_mode := \"gap\"\n                                                                             , nbconvert_exporter := \"\" )\n                                                       , banner := Concatenation( \"GAP Jupyter kernel \", GAPInfo.PackagesInfo.jupyterkernel[1].Version, \"\\n\",\n                                                                                  \"Running on GAP \", GAPInfo.BuildVersion, \"\\n\")\n                                                       , help_links := [ rec( text := \"GAP website\", url := \"https://www.gap-system.org/\")\n                                                                       , rec( text := \"GAP documentation\", url := \"https://www.gap-system.org/Doc/doc.html\")\n                                                                       , rec( text := \"GAP tutorial\", url := \"https://www.gap-system.org/Manuals/doc/chap0.html\")\n                                                                       , rec( text := \"GAP reference\", url := \"https://www.gap-system.org/Manuals/doc/ref/chap0.html\") ]\n                                                       , status := \"ok\" )\n                                                  , rec() );\n                               end,\n\n                               history_request := function(msg)\n                                   msg.header.msg_type := \"history_reply\";\n                                   msg.content := rec( history := [] );\n                               end,\n\n                               execute_request := function(msg)\n                                   local publ, res, rep, r, str, data, metadata, t;\n\n                                   JupyterMsgSend(kernel, kernel!.IOPub, JupyterMsg( kernel\n                                                                       , \"execute_input\"\n                                                                       , msg.header\n                                                                       , rec( code := msg.content.code\n                                                                            , execution_count := kernel!.ExecutionCount )\n                                                                       , rec() ) );\n                                   str := InputTextString(msg.content.code);\n\n                                   # READ_ALL_COMMANDS was changed from 4.10. We make\n                                   # JupyterKernel compatible for the time being (until\n                                   # 4.10 is released at least)\n                                   t := NanosecondsSinceEpoch();\n                                   if CompareVersionNumbers(GAPInfo.Version, \"4.10\") then\n                                       res := READ_ALL_COMMANDS(str, false, false, IdFunc);\n                                   else\n                                       res := READ_ALL_COMMANDS(str, false);\n                                   fi;\n                                   # This is probably supremely naughty; we overwrite GAP's\n                                   # global time variable\n                                   UPDATE_STAT( \"time\", QuoInt((NanosecondsSinceEpoch() - t), 1000000) );\n\n                                   # Flush StdOut...\n                                   Print(\"\\c\");\n                                   for r in res do\n                                       if r[1] = true then\n                                           kernel!.ExecutionCount := kernel!.ExecutionCount + 1;\n\n                                           # r[2] contains the result, r[3] is true if a dual semicolon was parsed\n                                           if IsBound(r[2]) and r[3] = false then\n                                               # FIXME: This is probably doable slightly more nicely\n                                               rep := JupyterRender(r[2]);\n                                               metadata := JupyterRenderableMetadata(rep);\n                                               data := JupyterRenderableData(rep);\n                                               # Only send a result message when there is a result\n                                               # value\n                                               # publ.execution_count := kernel!.ExecutionCount;\n                                               JupyterMsgSend(kernel, kernel!.IOPub, JupyterMsg( kernel\n                                                                                   , \"execute_result\"\n                                                                                   , msg.header\n                                                                                   , rec( transient := rec()\n                                                                                        , data := data\n                                                                                        , metadata := metadata\n                                                                                        , execution_count := kernel!.ExecutionCount )\n                                                                                   , rec() ) );\n                                           fi;\n                                       fi;\n                                   od;\n                                   publ := JupyterMsg( kernel\n                                                     , \"execute_reply\"\n                                                     , msg.header\n                                                     , rec( status := \"ok\"\n                                                          , execution_count := kernel!.ExecutionCount )\n                                                     , rec() );\n                                   return publ;\n                               end,\n\n                               inspect_request := function(msg)\n                                   return JupyterMsg( kernel\n                                                    , \"inspect_reply\"\n                                                    , msg.header\n                                                    , JUPYTER_Inspect( msg.content.code\n                                                                     , msg.content.cursor_pos )\n                                                    , rec() );\n                               end,\n\n                               complete_request := function(msg)\n                                   return JupyterMsg( kernel\n                                                    , \"complete_reply\"\n                                                    , msg.header\n                                                    , JUPYTER_Complete( msg.content.code\n                                                                      , msg.content.cursor_pos )\n                                                    , rec() );\n                               end,\n\n                               history_request := function(msg)\n                                   return JupyterMsg( kernel\n                                                    , \"history_reply\"\n                                                    , msg.header\n                                                    , rec( history := [] )\n                                                    , rec() );\n                               end,\n\n                               is_complete_request := function(msg)\n                                   return JupyterMsg( kernel\n                                                    , \"is_complete_reply\"\n                                                    , msg.header\n                                                    , rec( status := \"complete\" )\n                                                    , rec() );\n                               end,\n\n                               comm_open := function(msg)\n                                   return JupyterMsg( kernel\n                                                    , \"comm_open_reply\"\n                                                    , msg.header\n                                                    , rec( status := \"ok\" )\n                                                    , rec() );\n                               end,\n\n                               comm_info_request := function(msg)\n                                   return JupyterMsg( kernel\n                                                    , \"comm_info_reply\"\n                                                    , msg.header\n                                                    , rec( comms := rec(), status := \"ok\" )\n                                                    , rec() );\n                               end,\n\n                               interrupt_request := function(msg)\n                                   local status;\n                                   # This is SIGINT\n                                   status := IO_kill(pid, 2);\n                                   return JupyterMsg( kernel\n                                                    , \"interrupt_reply\"\n                                                    , msg.header\n                                                    , rec()\n                                                    , rec() );\n\n                               end,\n                               shutdown_request := function(msg)\n                                   kernel!.quitting := true;\n                                   return JupyterMsg( kernel\n                                                 , \"shutdown_reply\"\n                                                 , msg.header\n                                                 , rec( restart := msg.content.restart )\n                                                 , rec() );\n                               end );\n\n    kernel.SignalBusy := function()\n        JupyterMsgSend( kernel, kernel!.IOPub\n                      , JupyterMsg( kernel\n                                  , \"status\"\n                                  , kernel!.CurrentMsg\n                                  , rec( execution_state := \"busy\" )\n                                  , rec() ) );\n    end;\n    kernel.SignalIdle := function()\n        JupyterMsgSend( kernel, kernel!.IOPub\n                      , JupyterMsg( kernel\n                                  , \"status\"\n                                  , kernel!.CurrentMsg\n                                  , rec( execution_state := \"idle\" )\n                                  , rec() ) );\n    end;\n\n    kernel.HandleShellMsg := function(msg)\n        local hdl_dict, f, t, reply;\n\n        # We store the currently processed\n        # message header, because we need it\n        # for replies\n        kernel!.CurrentMsg := msg.header;\n\n        kernel!.SignalBusy();\n        t := msg.header.msg_type;\n        if IsBound(kernel!.MsgHandlers.(t)) then\n            # Currently we send the \"reply\" to each \"request\" on the Shell socket\n            # here. We might opt to move the sending into the handler functions,\n            # since at least \"execute\" has to send more than one message anyway\n            JupyterMsgSend(kernel, kernel!.Shell, kernel!.MsgHandlers.(t)(msg) );\n\n            kernel!.SignalIdle();\n            return true;\n        else\n            Print(\"unhandled message type: \", msg.header.msg_type, \"\\n\");\n            kernel!.SignalIdle();\n            return fail;\n        fi;\n\n    end;\n\n    kernel.HandleControlMsg := function(msg)\n        local hdl_dict, f, t, reply;\n\n        kernel!.CurrentMsg := msg.header;\n\n        t := msg.header.msg_type;\n        if IsBound(kernel!.MsgHandlers.(t)) then\n            if t in [ \"interrupt_request\", \"shutdown_request\" ] then \n                JupyterMsgSend(kernel, kernel!.Control, kernel!.MsgHandlers.(t)(msg) );\n            fi;\n            return true;\n        fi;\n\n    end;\n\n    _KERNEL := kernel;\n\n    # This should happen in \"Run\" somehow, as currently the creation\n    # of a Jupyter Kernel breaks the running GAP session, taking\n    # every hope of debugging the kernel\n    pid := IO_fork();\n    if pid = fail then\n        return fail;\n    elif pid > 0 then # we are the parent and do heartbeat and control messages\n        kernel.mode := JUPYTER_KERNEL_MODE_CONTROL;\n        kernel.HB := ZmqRouterSocket( Concatenation(address, String(conf.hb_port) ) );\n        kernel.Control := ZmqRouterSocket( Concatenation(address, String(conf.control_port) )\n                                         , kernel!.ZmqIdentity);\n        kernel.quitting := false;\n        kernel.Loop := function()\n            local topoll, poll, i, msg, res;\n            topoll := [ kernel!.HB, kernel!.Control ];\n            while true do\n                poll := ZmqPoll( topoll, [], 5000 );\n                if 1 in poll then\n                    msg := ZmqReceiveList(kernel!.HB);\n                    ZmqSend(kernel!.HB, msg);\n                fi;\n                if 2 in poll then\n                    msg := JupyterMsgRecv(kernel, kernel!.Control);\n                    res := kernel!.HandleControlMsg(msg);\n                    if res = fail then\n                        Print(\"failed to handle message\\n\");\n                    fi;\n                fi;\n                if kernel!.quitting then\n                    IO_kill(pid, 3);\n                    status := IO_WaitPid(pid, true);\n                    QUIT_GAP(0);\n                fi;\n                # Check whether child has gone away\n                status := IO_WaitPid(pid, false);\n                if IsRecord(status) then\n                    # TODO find out what these statuses mean\n                    if status.pid = pid and status.status in [ 3, 9, 15, 131 ] then\n                        QUIT_GAP(0);\n                    fi;\n                fi;\n            od;\n        end;\n    else\n        kernel.mode  := JUPYTER_KERNEL_MODE_EXEC; # Handler\n        kernel.IOPub := ZmqPublisherSocket( Concatenation(address, String(conf.iopub_port))\n                                          , kernel!.ZmqIdentity);\n        kernel.Shell := ZmqDealerSocket( Concatenation(address, String(conf.shell_port))\n                                       , kernel!.ZmqIdentity);\n        kernel.StdIn := ZmqRouterSocket( Concatenation(address, String(conf.stdin_port))\n                                       , kernel!.ZmqIdentity);\n\n        # TODO: This is of course still hacky, but better than before\n        kernel!.StdOut := OutputStreamZmq(kernel, kernel!.IOPub);\n        kernel!.StdErr := OutputStreamZmq(kernel, kernel!.IOPub, \"stderr\");\n        # TODO: Hack to be able to change ERROR_OUTPUT.\n        MakeReadWriteGlobal(\"ERROR_OUTPUT\");\n        ERROR_OUTPUT := kernel!.StdErr;\n        MakeReadOnlyGlobal(\"ERROR_OUTPUT\");\n        OutputLogTo(kernel!.StdOut);\n\n        # Jupyter Heartbeat and Control channel is handled by a fork'ed GAP process\n        # (yes, really, its better than starting a separate thread, because it\n        # doesn't need special pthread code downside is that it doesn't work on\n        # cygwin, of course, but maybe we could just ExecuteProcess on windows, or\n        # wait for bash on windows to become popular enoug.\n        kernel.Loop := function()\n            # To catch SIGINT when the kernel is idle\n            while true do\n                CALL_WITH_CATCH(function()\n                                   local topoll, poll, i, msg, res;\n\n                                   topoll := [ kernel!.Shell, kernel!.StdIn ];\n                                   while true do\n                                       poll := ZmqPoll(topoll, [], 5000);\n                                       if 1 in poll then\n                                           msg := JupyterMsgRecv(kernel, topoll[1]);\n                                           res := kernel!.HandleShellMsg(msg);\n                                           if res = fail then\n                                               Print(\"failed to handle message\\n\");\n                                           fi;\n                                       fi;\n                                       if 2 in poll then\n                                           msg := ZmqReceiveList(topoll[2]);\n                                       fi;\n                                   od;\n                               end, []);\n            od;\n        end;\n    fi;\n\n    Objectify(GAPJupyterKernelType, kernel);\n    return kernel;\nend);\n\nInstallMethod( ViewString\n             , \"for Jupyter kernels\"\n             , [ IsGAPJupyterKernel ]\n             , x -> \"<GAP Jupyter Kernel>\" );\n\nInstallMethod( Run\n             , \"for Jupyter kernel\"\n             , [ IsGAPJupyterKernel ]\n             , function(x)\n                 # TODO: we should really not be doing this.\n                 MakeReadWriteGlobal(\"HELP_SHOW_MATCHES\");\n                 UnbindGlobal(\"HELP_SHOW_MATCHES\");\n                 DeclareSynonym(\"HELP_SHOW_MATCHES\", JUPYTER_HELP_SHOW_MATCHES);\n\n                 MakeReadWriteGlobal(\"HELP\");\n                 UnbindGlobal(\"HELP\");\n                 DeclareSynonym(\"HELP\", JUPYTER_HELP);\n\n                 SetUserPreference(\"browse\", \"SelectHelpMatches\", false);\n                 SetUserPreference(\"Pager\", \"tail\");\n                 SetUserPreference(\"PagerOptions\", \"\");\n                 # This is of course complete nonsense if you're running the jupyter notebook\n                 # on your local machine.\n                 SetHelpViewer(\"jupyter_online\");\n                 x!.Loop();\n             end);\n\nInstallGlobalFunction( JUPYTER_KernelStart_HPC,\nfunction(conf)\n    Error(\"HPC-GAP is not supported with this code.\");\n    QUIT_GAP(0);\nend);\n\nInstallGlobalFunction( JUPYTER_KernelStart_GAP,\nfunction(configfile)\n    local instream, conf, address, kernel, s;\n\n    instream := InputTextFile(configfile);\n    conf := JsonStreamToGap(instream);\n\n    kernel := NewJupyterKernel(conf);\n    Run(kernel);\nend);\n", "meta": {"hexsha": "2d47f49e5a1c4ccda0f067c63d8e8a5eb9f5b60e", "size": 20509, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterKernel.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterKernel.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterKernel.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 49.900243309, "max_line_length": 168, "alphanum_fraction": 0.3849041884, "num_tokens": 3274, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.18713267762907493, "lm_q2_score": 0.02800751807063954, "lm_q1q2_score": 0.00524112185030348}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nsaveComment := function(r, fld)\n    local str, last;\n    str := CommentBuffer();\n    last := Position(List(str), \"\");\n    ClearCommentBuffer();\n    r.(fld) := str{[3..last-3]};\nend;\n\n\nDeclare(AsmX86Unparser);\n\nUnparse := function(code, unparser, i, is)\n    local o, res;\n    # D($(..)) magic allows to deal with functions that do not return a value. \n    # In this case res := D(_bag_0) without gap complaining. \n    # We need this so that cx_leave runs before the function returns\n    if not IsBound(unparser.cx) then unparser := WithBases(unparser, rec(cx := empty_cx())); fi;\n    if IsRec(code) then\n    cx_enter(unparser.cx, code);\n        o := ObjId(code);\n    if IsBound(unparser.(o.name)) then\n            res := D($(unparser.(o.name)(code, i, is)));\n\n    elif IsBound(o.unparse) and IsBound(unparser.(o.unparse)) then\n            res := D($(unparser.(o.unparse)(code, i, is)));\n\n    else return Error(\"Cannot unparse <o>. Unparser \", unparser, \" does not have field '\",\n                o.name, \"'\", When(IsBound(o.unparse), Concat(\" or \",o.unparse), \"\"));\n    fi;\n    else\n    res := D($(unparser.atomic(code, i, is)));\n    fi;\n    cx_leave(unparser.cx, code);\n    return $res;\nend;\n\nClass(Unparser, rec(\n   gen := meth(self, subname, o, opts)\n        local oo;\n        # using WithBases prevents mem leaks, by avoiding of keeping extra state around\n    self := WithBases(self, rec(opts := opts, cx := empty_cx())); \n        oo := self.preprocess(o);\n        Print(\n            self.header(subname, oo),\n            Unparse(oo, self, 4, 2),\n            self.footer(subname, oo)\n        );\n    end,\n\n   __call__ := (self, o, i, is) >> Unparse(o,self,i,is),\n   fileinfo := (self,opts) >> Print(\"\"),\n\n    # str = format string with $n for arguments ($1 = first argument)\n    # list of arguments , arguments are printed using this unparser\n    printf := (self, str, args) >> ApplyFunc(PrintEvalF, Concatenation([str],\n        List(args, a -> \n        Cond(IsFunc(a), a, \n         () -> Cond(IsType(a), self.declare(a, [], 0, 0), self(a, 0, 0)))))),\n\n    # printf with initial indentation\n    indprintf := (self, i, is, str, args) >> Print(Blanks(i),\n        ApplyFunc(PrintEvalF, Concatenation([str],\n                List(args, a-> Cond(IsFunc(a), a, \n         () -> Cond(IsType(a), self.declare(a, [], i+is, is), self(a, i+is, is))))))),\n\n    prefix := meth(self, f, lst)\n        local first, c;\n        Print(f, \"(\");\n        first := true;\n        for c in lst do\n            if first then first := false; else Print(\", \"); fi;\n            self(c,0,4);\n        od;\n        Print(\")\");\n    end,\n\n\n    infixbreak := 8,\n\n    #F infix(<lst>, <sep>, <i>)\n    #F infix takes 2 - 3 arguments. the 3rd argument specifies the number of spaces to indent, otherwise 0\n    #F\n    infix := meth(arg)\n        local self, lst, sep, i, count, c, first;\n        if not Length(arg) in [3, 4] then\n            Error(\"Usage: infix(<lst>, <sep>, [<i>])\\n\");\n        fi;\n\n        if Length(arg)=3 then\n            [self, lst, sep] := arg;\n            i := 0;\n        else\n            [self, lst, sep, i] := arg; \n        fi;\n\n        count := 0;\n        first := true;\n        for c in lst do\n            if (count > 0) then\n                if ((count mod self.infixbreak) = 0) then\n                    Print(sep, \"\\n\",Blanks(i+4));\n                    first := true;\n                fi;\n\t\t\t\tif not first then\n                    Print(sep);\n                fi;\n            fi;\n            count := count + 1;\n            self(c,0,4);\n            first := false;\n        od;\n    end,\n\n    # finfix( <list>, <func>, <separator> ) - applying <func> to each element of <list>\n    # and printing <separator> in between.\n\n    finfix := meth(self, lst, func, sep)\n        local first, c;\n        first := true;\n        for c in lst do\n            if first then first := false; else Print(sep); fi;\n            func(c);\n        od;\n    end,\n\n    # pinfix(<lst>, <sep>), similar to infix, but parenthesizes the expression\n    pinfix := meth(self, lst, sep)\n        Print(\"(\");\n        self.finfix(lst, c -> self(c, 0, 4), sep);\n        Print(\")\");\n    end,\n\n    # ppinfix(<lst>, <sep>), similar to infix, but parenthesizes inside the expression\n    ppinfix := meth(self, lst, sep)\n        Print(\"(\");\n        self.finfix(lst, c -> Print(\"(\", self(c, 0, 4), \")\"), sep);\n        Print(\")\");\n    end,\n\n    # condinfix(<lst>, <sep>), for conditions like leq.\n    # condinfix([a,b,c], \" sep1 \", \" sep2 \") unparses to\n    # (a sep1 b) sep2 (b sep1 c)\n    #\n    condinfix := meth(self, lst, sep1, sep2)\n        local first, c, i;\n        Print(\"(\");\n        for i in [1..Length(lst)-1] do\n            if i<>1 then Print(sep2); fi;\n            self.pinfix([lst[i], lst[i+1]], sep1);\n        od;\n        Print(\")\");\n    end,\n));\n\n#F LayeredUnparser(<unparser-class1>, <unparser-class2>, ...)\n#F\n#F This creates an unnamed class with superclasses listed in arguments.\n#F unparser-class1 takes priority over 2, etc.\n#F\nClass(LayeredUnparser, rec(\n    __call__ := arg >> Checked(Length(arg)>1, ForAll(Drop(arg, 1), IsClass),\n        WithBases(arg, rec(operations := PrintOps, __call__ := Unparser.__call__))),\n\n    print := self >> Print(\"LayeredUnparser(\", PrintCS(Drop(self.__bases__,1)), \")\")\n));\n\n\nLoc.unparse     := \"Loc\";\nExp.unparse     := \"Exp\";\nCommand.unparse := \"Command\";\n\nClass(CUnparserBase, Unparser, rec(\n    preprocess := (self, o) >> o,\n    preprocess_init := (self, o) >> o,\n\n    # example: includes := [ \"<math.h>\" ]\n    includes := [],\n\n    generated_by := Concat(\"\\\n/*\\\n * This code was generated by Spiral \", SpiralVersion, \", www.spiral.net\\\n */\\\n\\n\"),\n\n    extraHeader := \"\",\n\n    header_top := meth(self, subname, o)\n        local precomputed_data;\n        Print(self.generated_by);\n\n        self.fileinfo(self.opts);\n\n        DoForAll(Concatenation(self.includes, self.opts.includes),\n             inc -> Print(\"#include \", inc, \"\\n\"));\n\n        if IsBound(o.dimensions) then Print(\"/* \", o.dimensions, \" */\\n\"); fi;\n\n        if IsBound(o.runtime_data) then\n            DoForAll(o.runtime_data, x->Print(self.opts.arrayDataModifier, \" \",\n                                              self.declare(x.t, x, 0, 4), \";\\n\"));\n            Print(\"\\n\");\n        fi;\n\n        precomputed_data := List(Collect(o, data), x->[x.var, x.value]);\n    DoForAll(precomputed_data, d -> When(IsArrayT(d[1].t), self.genData(d[1], d[2])));\n    end,\n\n    header_func := meth(self, subname, o)\n        local loopvars;\n        Print(\"void \", self.opts.funcModifier, \" \", subname, \"(\",\n          self.declare(Y.t, Y, 0, 0), \", \", self.declare(X.t, X, 0, 0));\n\n        if IsBound(self.opts.sig) then\n            DoForAll(self.opts.sig, p -> Print(\", \", self.declare(p.t, p, 0, 0)));\n        fi;\n        Print(\") {\\n\");\n\n        loopvars := Set(List(Collect(o, @(1).cond(IsLoop)), x->x.var));\n        if loopvars <> [] then Print(Blanks(4), \"int \", PrintCS(loopvars), \";\\n\"); fi;\n    end,\n\n    header := meth(self, subname, o)\n        self.header_top(subname, o);\n        self.header_func(subname, o);\n    end,\n\n    footer := meth(self, subname, o)\n        local init, loopvars;\n        Print(\"}\\n\");\n        Print(\"void init_\", subname, \"() {\\n\");\n        if IsBound(o.runtime_init) then # unparse initialization code\n\n            loopvars := Union(List(o.runtime_init, cc -> List(Collect(cc, @(1).cond(IsLoop)), x->x.var)));\n            if loopvars <> [  ]  then\n                Print(Blanks(4), \"int \", PrintCS(loopvars), \";\\n\"); fi;\n            for init in o.runtime_init do\n                init := self.preprocess_init(init);\n                self(SReduce(init, o), 4, 4);\n            od;\n        fi;\n        Print(\" }\\n\");\n    end,\n\n    genData := (self, v, val) >> Print(\n        When(IsArrayT(val.t), self.opts.arrayDataModifier, self.opts.scalarDataModifier), \" \",\n        self.declare(val.t, v, 0, 4), \" = \", self(val,2,2), \";\\n\",\n        When(IsArrayT(val.t), \"\\n\", \"\")),\n\n    ####################\n    ## General\n    ####################\n    atomic  := (self,o,i,is) >> Print(o),\n    param   := (self,o,i,is) >> Print(o.id),\n    var     := (self,o,i,is) >> Print(o.id),\n    Loc     := (self,o,i,is) >> o.cprint(),\n\n    ####################\n    ## Commands\n    ####################\n\n    asmvolatile := (self,o,i,is) >> AsmX86Unparser.asmvolatile(o.asm),\n\n    skip := (self,o,i,is) >> Print(Blanks(i), \"/* skip */\\n\"),\n\n    noUnparse :=(self,o,i,is) >> Print(o.str),\n\n    assign := (self,o,i,is) >> Print(Blanks(i), self(o.loc,i,is), \" = \", self(o.exp,i,is), \";\\n\"),\n\n    assign_acc := (self,o,i,is) >> Print(Blanks(i), self(o.loc,i,is), \" += \", self(o.exp,i,is), \";\\n\"),\n\n    chain    := (self,o,i,is) >> DoForAll(o.cmds, c -> self(c, i, is)),\n    brackets := (self,o,i,is) >> self.printf(\"($1)\", [o.args[1]]),\n\n    unparseChain := (self,o,i,is) >> DoForAll(o.cmds, c -> self(c, i, is)),\n\n    kern := (self, o, i, is) >> When( IsBound(self.opts.SimFlexKernelFlag) and IsBound(o.bbnum),\n        Print(\n            \"#if !defined(KERN) || defined(KERN\", String(o.bbnum), \")\\n\",\n            self(o.cmd, i, is),\n            \"#endif\\n\"\n        ),\n        self(o.cmd, i, is)\n    ),\n    unroll_cmd := ~.chain,\n\n    # all datas are handled in the header, just proceed to children\n    data := (self,o,i,is) >> Print(\n        When(not IsArrayT(o.var.t), Print(Blanks(i), self.genData(o.var, o.value))),\n        self(o.cmd, i, is)\n    ),\n\n    _lt := \" <= \",\n    loop := (self,o,i,is) >> Checked(IsRange(o.range),\n        let(v := o.var, lo := o.range[1], hi := Last(o.range),\n            Print(Blanks(i), \"for(\", v, \" = \", lo, \"; \", v, self._lt, hi, \"; \", v, \"++) {\\n\",\n                self(o.cmd,i+is,is),\n                Blanks(i), \"}\\n\"))),\n\n    loopn := (self,o,i,is) >>\n        let(v := o.var, n := o.range,\n            Print(Blanks(i), \"for(\", v, \" = \", 0, \"; \", v, self._lt, self(n-1,i,is), \"; \", v, \"++) {\\n\",\n                self(o.cmd,i+is,is),\n                Blanks(i), \"}\\n\")),\n\n    doloop := (self,o,i,is) >>\n        let(v := o.var, n := o.range,\n            Print(Blanks(i), \"do {\\n\",\n                self(o.cmd,i+is,is),\n                Blanks(i), \"} while( \", self(v,i,is), \"<\", self(n,i,is), \" );\\n\")),\n\n    loopn := (self, o, i, is) >> self.loop(o, i, is),\n\n    IF := (self,o,i,is) >> Print(Blanks(i),\n        \"if (\", self(o.cond,i,is), \") {\\n\", self(o.then_cmd,i+is,is), Blanks(i), \"}\",\n        When(o.else_cmd = skip(),\n             \"\\n\",\n             Print(\" else {\\n\", self(o.else_cmd,i+is,is), Blanks(i), \"}\\n\"))),\n\n    DOWHILE := (self,o,i,is) >> Print(Blanks(i),\n    \"do \\n\",  Blanks(i), \"{\\n\", self(o.then_cmd,i+is,is), Blanks(i), \"}\",\n        \"while (\", self(o.cond,i,is), \");\\n\" ),\n\n    WHILE := (self,o,i,is) >> Print(Blanks(i),\n    \"while (\", self(o.cond,i,is), \")\\n\" ,\n    Blanks(i), \"{\\n\", self(o.then_cmd,i+is,is), Blanks(i), \"}\\n\"),\n\n    PRINT := (self,o, i, is) >> Print(Blanks(i),\n        \"printf(\\\"\", o.fmt, \"\\\"\",\n            When(o.vars <> [],\n                Print(\", \",\n                    DoForAll( DropLast(o.vars,1),\n                        e -> Print(self(e,i,is), \", \")\n                    ),\n                    self(Last(o.vars),i,is)\n                ),\n                Print(\"\")\n            ),\n            \");\\n\"\n    ),\n\n    multi_if := meth(self,o,i,is)\n        local j, conds;\n    conds := o.args { [1..Int(Length(o.args)/2)]*2 - 1 };\n\n        # degenerate case, no conditions, else branch only\n        if Length(o.args)=1 then \n        self(o.args[1], i, is);\n\n    # generate switch stmt\n    elif ForAll(conds, c -> ObjId(c)=eq and ObjId(c.args[1]) in [var,param] and c.args[1]=conds[1].args[1] and IsValue(c.args[2])) then\n        Print(Blanks(i), \"switch(\", self(conds[1].args[1], i, is), \") { \\n\");\n            j := 1;\n            while j < Length(o.args) do\n                Print(Blanks(i+Int(is/2)), \"case \", self(o.args[j].args[2], i, is), \": \");\n        Cond(ObjId(o.args[j+1])=ret, \n             Print(self(o.args[j+1],0,is), Blanks(i+is), \"break;\\n \"),\n             Print(\"{\\n\", self(o.args[j+1],i+is,is), Blanks(i+is), \"break; }\\n\"));\n        j := j+2;\n            od;\n            # Print out the else branch if it exists (j=Length)\n            if j = Length(o.args) then \n        Print(Blanks(i+Int(is/2)), \"default: \");\n        Cond(ObjId(o.args[j])=ret, \n             Print(self(o.args[j], 0, is)),\n             Print(\"{\\n\", self(o.args[j], i+is, is), Blanks(i+Int(is/2)), \"}\\n\"));\n            fi;\n        Print(Blanks(i), \"}\\n\");\n\n    # general IF cascade\n    else\n\n            j := 1;\n            while j < Length(o.args) do\n                Print(Blanks(i), When(j<>1, \"else \"), \"if (\",\n                      self(o.args[j],  i+is,is), \") {\\n\",\n                      self(o.args[j+1],i+is,is), Blanks(i), \"}\\n\");\n        j := j+2;\n            od;\n            # Print out the else branch if it exists (j=Length)\n            if j = Length(o.args) then \n        Print(Blanks(i), \"else {\\n\",\n                      self(o.args[j],  i+is, is), Blanks(i), \"}\\n\");\n            fi;\n    fi;\n    end,\n\n    zallocate := (self, o, i, is) >> Print(\n        self(allocate(o.loc,o.exp),i,is),\n        Blanks(i),\"memset(\",self(o.loc, i, is),\" ,'\\\\0', sizeof(\",\n        self.declare(o.exp.t,[],0,0), \") * \", self(o.exp.size,i,is), \");\\n\"),\n#        Blanks(i),\"for(int iinit = 0; iinit <  \",self(o.exp.size,i,is),\"; iinit++)\\n\",\n#        Blanks(i),\"    \", self(o.loc, i, is),\"[iinit]=0;\\n\"),\n\n    ####################\n    ## Expressions\n    ####################\n\n    RewritableObjectExp := (self,o,i,is) >> Print(o.name, self.pinfix(o.rChildren(), \", \")),\n    Exp := (self,o,i,is) >> Print(o.name, self.pinfix(o.args, \", \")),\n    ExpCommand := (self,o,i,is) >> Print(Blanks(i), o.name, self.pinfix(o.args, \", \"), \";\\n\"),\n    Command := (self,o,i,is) >> Print(Blanks(i), o.name, self.pinfix(o.rChildren(), \", \"), \";\\n\"),\n    call := (self,o,i,is) >> Print(Blanks(i), self(o.args[1],i,is), self.pinfix(Drop(o.args,1), \", \"), \";\\n\"),\n    errExp := (self, o, i, is) >> self(o.t.zero(), i, is),\n\n    eq  := (self, o, i, is) >> self.condinfix(o.args, \" == \", \" && \"),\n    neq := (self, o, i, is) >> self.condinfix(o.args, \" != \", \" && \"),\n    geq := (self, o, i, is) >> self.condinfix(o.args, \" >= \", \" && \"),\n    leq := (self, o, i, is) >> self.condinfix(o.args, \" <= \", \" && \"),\n    gt  := (self, o, i, is) >> self.condinfix(o.args, \" > \",  \" && \"),\n    lt  := (self, o, i, is) >> self.condinfix(o.args, \" < \",  \" && \"),\n\n    nth := (self,o,i,is) >> Print(self(o.loc,i,is), \"[\", self(o.idx,i,is), \"]\"),\n    deref := (self,o,i,is) >> Print(\"*(\", self(o.loc,i,is), \")\"),\n    addrof := (self,o,i,is) >> Print(\"&(\", self(o.loc,i,is), \")\"),\n    fdiv := (self,o,i,is) >> Print(\"(((\", self.declare(TReal, [],i,is), \")\",\n    self(o.args[1],i,is), \") / \", self(o.args[2],i,is), \")\"),\n    add := (self,o,i,is) >> self.pinfix(o.args, \" + \"),\n    logic_and := (self,o,i,is) >> self.ppinfix(o.args, \" && \"),\n    logic_or := (self,o,i,is) >> self.ppinfix(o.args, \" || \"),\n    logic_neg := (self,o,i,is) >> Print(\"( !(\",self(o.args[1],i,is), \") )\"),\n    sub := (self,o,i,is) >> self.pinfix(o.args, \" - \"),\n    neg := (self,o,i,is) >> Print(\"-(\", self(o.args[1],i,is), \")\"),\n\n    mul := (self,o,i,is) >> self.pinfix(o.args, \"*\"),\n    div := (self,o,i,is) >> self.pinfix(o.args, \" / \"),\n    idiv := (self,o,i,is) >> self.pinfix(o.args, \" / \"),\n    imod := (self,o,i,is) >> self.pinfix(List(o.args, x -> When(IsPtrT(x.t), tcast(TSym(\"size_t\"),x) ,x)), \" % \"),\n    no_mod := (self,o,i,is) >> self(o.args[1],i,is),\n    re     := (self,o,i,is) >> self.printf(\"creal($1)\", [o.args[1]]),\n    im     := (self,o,i,is) >> self.printf(\"cimag($1)\", [o.args[1]]),\n    cxpack := (self,o,i,is) >> self.printf(\"($1) + _Complex_I*($2)\", [o.args[1], o.args[2]]),\n\n    bin_and := (self,o,i,is) >> Print(\"((\", self.pinfix(List(o.args, x -> When(IsPtrT(x.t), tcast(TSym(\"size_t\"),x) ,x)), \")&(\"), \"))\"),\n    bin_or := (self,o,i,is) >> Print(\"((\", self.pinfix(List(o.args, x -> When(IsPtrT(x.t), tcast(TSym(\"size_t\"),x) ,x)), \")|(\"), \"))\"),\n    bin_xor := (self,o,i,is) >> Print(\"((\", self(o.args[1],i,is), \")^(\", self(o.args[2],i,is),\"))\"),\n\n    abs := (self,o,i,is) >> Print(\"abs(\", self(o.args[1],i,is), \")\"),\n\n    floor := (self,o,i,is) >> Print(\"((int)(\", self(o.args[1],i,is), \"))\"),\n\n    lShift := (self,o,i,is) >> Cond(IsBound(o.args[3]),\n            Error(\"non implemented\"),\n            Print(\"((\",self(o.args[1],i,is),\") << (\",self(o.args[2],i,is), \"))\")),\n\n    rShift := (self,o,i,is) >> Cond(IsBound(o.args[3]),\n            Error(\"non implemented\"),\n            Print(\"((\",self(o.args[1],i,is),\") >> (\",self(o.args[2],i,is), \"))\")),\n\n    arith_shr := (self, o, i, is) >> Cond( o.t.isSigned(), self.printf(\"(($1) >> ($2))\", [o.args[1], o.args[2]]),\n                                           Error(\"implement arith_shr for unsigned data type\")),\n    arith_shl := (self, o, i, is) >> Cond( o.t.isSigned(), self.printf(\"(($1) \\<\\< ($2))\", [o.args[1], o.args[2]]),\n                                           Error(\"implement arith_shl for unsigned data type\")),\n    \n    xor := meth(self,o,i,is)\n        Print(\"((\", self(o.args[1],i,is));\n        DoForAll(o.args{[2..Length(o.args)]}, e -> Print(\")^(\", self(e,i,is)));\n        Print(\"))\");\n    end,\n\n    max := (self,o,i,is) >> self(cond(geq(o.args[1],o.args[2]),o.args[1],o.args[2]),i,is),\n\n    min := (self,o,i,is) >> self(cond(leq(o.args[1],o.args[2]),o.args[1],o.args[2]),i,is),\n\n    log := (self,o,i,is) >> Cond( Length(o.args)=1,\n        Cond( o.t = T_Real(32) or (IsBound(self.opts.TRealCtype) and self.opts.TRealCtype = \"float\"),\n                self.printf(\"logf($1)\", [o.args[1]]),\n              # else\n              self.printf(\"log((double)($1))\", [o.args[1]])),\n        Cond( o.t = T_Real(32) or (IsBound(self.opts.TRealCtype) and self.opts.TRealCtype = \"float\"),\n                self.printf(\"logf($1)/logf($2)\", [o.args[1], o.args[2]]),\n              # else\n              self.printf(\"log((double)($1))/log((double)($2))\", [o.args[1], o.args[2]]))),\n    \n    pow := (self,o,i,is) >> Cond( \n        o.args[2]=2, \n            self(mul(o.args[1], o.args[1]), i, is),\n        # else\n            Error(\"Implement pow()\")),\n\n    sqrt  := (self,o,i,is) >> self.printf(\"sqrt($1)\",    [o.args[1]]),\n    rsqrt := (self,o,i,is) >> self.printf(\"$1/sqrt($2)\", [o.t.one(), o.args[1]]),\n    \n    cond := (self,o,i,is) >> Cond(\n      Length(o.args)=3,\n          Cond(ObjId(o.args[3]) = errExp, \n           self(o.args[2], i, is), \n               Print(\"((\",self(o.args[1],i,is),\") ? (\",self(o.args[2],i,is),\") : (\",self(o.args[3],i,is),\"))\")),\n\n      # NOTE: no else case here, maybe just leave it like this?\n      Length(o.args)=2, \n          self(o.args[2],i,is),\n\n      # more than 3 args: do a binsplit trick\n      Print(\"((\",self(o.args[1],i,is),\") ? (\",self(o.args[2],i,is),\") : \",\n      self(ApplyFunc(cond, Drop(o.args, 2)), i,is),\")\")),\n\n    _decval :=(self, v) >> let(pf := When(IsBound(self.opts.valuePostfix), self.opts.valuePostfix, \"\"),\n            Print(v, pf)),\n\n    Value := (self,o,i,is) >>\n        Cond(\n        o.t = TComplex, let(c:=Complex(o.v), re:=ReComplex(c), im:=ImComplex(c),\n            Cond(re=0 and im=1,  Print(self.opts.c99.I),\n                 re=0 and im=-1, Print(\"(- \", self.opts.c99.I, \")\"),\n                 im=0,           Print(self._decval(re)),\n                 re=0,           Print(\"(\", self._decval(im), \" * \", self.opts.c99.I, \")\"),\n                 im < 0,         Print(\"(\", self._decval(re), \" - \", self.opts.c99.I, \" * \", self._decval(-im), \")\"),\n                 Print(\"(\", self._decval(re), \" + \", self.opts.c99.I, \" * \", self._decval(im), \")\"))),\n\n        o.t = TReal, let(\n        v := Cond(IsCyc(o.v), ReComplex(Complex(o.v)), o.v),\n        Cond(v < 0, \n         Print(\"(\", self._decval(v), \")\"),\n         Print(self._decval(v)))),\n\n        IsArray(o.t),                      Print(\"{\", WithBases(self, rec(infixbreak:=4)).infix(o.v, \", \", i), \"}\"),\n        o.v < 0,                           Print(\"(\", o.v, \")\"),\n        o.t = TBool,                       When(o.v in [true, 1], Print(\"1\"), Print(\"0\")),\n\n        o.t = TUInt,                       Print(o.v, \"u\"), \n                                           Print(o.v)\n    ),\n\n    ##########################\n    ## Types and declarations\n    ##########################\n\n    # This function unparses the standard decl(var, value, code) Command.\n    # First, we unparse array variables then group variables by their type,\n    # and then call CUnparserBase.declare on each group\n\n    decl := meth(self,o,i,is)\n        local arrays, other, l, arri, myMem;\n        [arrays, other] := SplitBy(o.vars, x->IsArray(x.t));\n        DoForAll(arrays, v -> Print(Blanks(i), \n                                    When(self.opts.arrayBufModifier <> \"\", self.opts.arrayBufModifier::\" \", \"\"), \n                                    self.declare(v.t, v, i, is), \";\\n\"));\n\n        if (Length(other)>0) then\n            other:=SortRecordList(other,x->x.t);\n            for l in other do\n               Sort(l, (a,b)->a.id < b.id);\n               Print(Blanks(i), self.declare(l[1].t, l, i, is), \";\\n\");\n            od;\n        fi;\n\n        self(o.cmd, i, is);\n\n        #Pop arena for this decl\n        if IsBound(self.opts.useMemoryArena) and self.opts.useMemoryArena and Length(arrays) > 0 and arrays[1].id[1] <> 'D' then\n          myMem := 0;\n          for arri in arrays do \n             # Account for vector allocations in memory arena (which is scalar)\n             myMem := myMem + (arri.t.size * When(IsBound(arri.t.t) and ObjId(arri.t.t)=TVect, arri.t.t.size, 1));\n          od;\n          if ObjId(myMem) = Value then myMem := myMem.v; fi;\n          Print(Blanks(i));\n          Print(\"arenalevel += \", myMem, \";\\n\" );\n        fi;\n    end,\n\n    # defines a struct\n    define := meth(self, o, i, is)\n        local e, ee;\n        for e in o.types do\n            Print(Blanks(i), \"typedef struct {\\n\");\n            for ee in e.getVars() do\n                Print(Blanks(i+is));\n                Print(self.declare(ee.t, [ee], i, is), \";\\n\");\n            od;\n\n            Print(Blanks(i), \"} \", e.getName(), \";\\n\");\n        od;\n    end,\n\n    tcast := (self, o, i, is) >> Print(\"((\", self.declare(o.args[1], [], i, is), \") \", self(o.args[2],i,is), \")\"),\n\n    sizeof := (self, o, i, is) >> Print(\"sizeof(\", self.declare(o.args[1], [], i, is), \")\"),\n\n    declare := (self, t, vars, i, is) >> When(\n        IsBound(self.(t.name)),\n        self.(t.name)(t, When(IsList(vars), vars, [vars]), i, is),\n        Error(\"Can't declare \", vars, \" no method '\", t.name, \"' in \", self)),\n\n    TVect := (self, t, vars, i, is) >> Print(\"__m128 \", self.infix(vars, \", \", i+is)),\n\n    TComplex := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TComplexCtype), self.opts.TComplexCtype, \"complex_t \"), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    T_Complex := (self, t, vars, i, is) >> Print(\"_Complex \", self.declare(t.params[1], vars, i, is)), \n\n    T_Real  := (self, t, vars, i, is) >> Print(Cond(\n            t.params[1] = 128, \"long double\",\n            t.params[1] = 80, \"long double\",   #x86 specific\n            t.params[1] = 64, \"double\",\n            t.params[1] = 32, \"float\",\n            Error(\"Type is not supported\")\n        ),\" \",self.infix(vars, \", \",i+is)),\n\n    T_Int  := (self, t, vars, i, is) >> Print(Cond(\n            t.params[1] = 64, \"__int64\",\n            t.params[1] = 32, \"__int32\",\n            t.params[1] = 16, \"__int16\",\n            t.params[1] = 8, \"__int8\",\n            Error(\"Type is not supported\")\n        ), \" \", self.infix(vars, \", \",i+is)),\n\n    T_UInt  := (self, t, vars, i, is) >> Print(\"unsigned \", Cond(\n            t.params[1] = 64, \"__int64\",\n            t.params[1] = 32, \"__int32\",\n            t.params[1] = 16, \"__int16\",\n            t.params[1] = 8, \"__int8\",\n            t.params[1] = 1, \"__bit\",\n            Error(\"Type is not supported\")\n        ), \" \", self.infix(vars, \", \",i+is)),\n\n    T_Struct := (self, t, vars, i, is) >> Print(\n        t.getName(), \" \", self.infix(vars, \", \", i+is)\n    ),\n\n    TReal  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TRealCtype), self.opts.TRealCtype, TReal.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TInt  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TIntCtype), self.opts.TIntCtype, TInt.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TDummy := ~.TInt,\n\n    TBool  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TIntCtype), self.opts.TIntCtype, TInt.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TUInt  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TUIntCtype), self.opts.TUIntCtype, TUInt.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TULongLong  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TULongLongCtype), self.opts.TULongLongCtype, TULongLong.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TChar  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TCharCtype), self.opts.TCharCtype, TChar.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TUChar  := (self, t, vars, i, is) >> Print(\n        When(IsBound(self.opts.TUCharCtype), self.opts.TUCharCtype, TUChar.ctype), \" \",\n        self.infix(vars, \", \",i+is)),\n\n    TVoid  := (self, t, vars, i, is) >> Print(\"void \", self.infix(vars, \", \",i+is)),\n\n    _restrict := (self, t) >> let(opts := self.opts, rst := Concat(When(IsBound(opts.restrict),\n                    opts.restrict(), \"restrict\"), \" \"), When(t._restrict, rst, \"\")),\n\n    TPtr  := (self, t, vars, i, is) >>\n        Print(Cond(not IsBound(t.qualifiers) or t.qualifiers=[], \"\", Print(self.infix(t.qualifiers, \" \"), \" \")),\n          Cond(vars=[],\n          Print(self.declare(t.t, [], i, is), \" *\", self._restrict(t)),\n          Print(self.declare(t.t, [], i, is),\n              Print(\" *\", self._restrict(t) ),\n              self.infix(vars, Concatenation(\", *\", self._restrict(t)), i+is)))),\n\n    TSym := (self, t, vars, i, is) >> Print(t.id, \" \", self.infix(vars, \", \")),\n\n    _TFunc_args := (self, t, i, is) >> let(params := DropLast(t.params, 1),\n        Print(\n            DoForAllButLast(params, p -> Print(self.declare(p, [], i, is), \", \")),\n            self.declare(Last(params), [], i, is))),\n\n    TFunc  := (self, t, vars, i, is) >>\n        Cond(Length(vars) in [0,1],\n               PrintEvalF(\"$1 (*$2)($3)\",\n                 () -> self.declare(Last(t.params), [], i, is),\n                 When(vars=[], \"\", vars[1].id),\n                 () -> self._TFunc_args(t, i, is)),\n               Print(\n                   DoForAllButLast(vars, v -> Print(self.declare(t, v, i, is), \", \")),\n                   self.declare(t, [Last(vars)], i, is))),\n\n    TArray := meth(self,t,vars,i,is)\n        local dims, elt, v, ptype, vsize;\n        if Length(vars) > 1 then DoForAll(vars, v->Print(self.TArray(t, [v], i, is), \"; \"));\n        elif Length(vars) = 0 then\n            Print(self.declare(t.t, [], i, is), \" *\");\n        else\n            # at this point Length(vars)=1\n            v := When(IsList(vars), vars[1], vars);\n            dims := []; elt := t;\n            while IsArray(elt) do Add(dims, elt.size); elt := elt.t; od;\n\n          #NOTE: Ignoring twiddles by looking for \"D\" in .id\n          # Better way: look for func.name=\"init\" in parent/context\n          if IsBound(self.opts.useMemoryArena) and self.opts.useMemoryArena and v.id[1] <> 'D' then\n            #NOTE: Arena currently doesn't handle multiple dims.\n            #NOTE: Slightly ugly hack to get this to be a pointer\n\n            # To handle vectors. Arena is declared only for scalars. For\n            # vectors, we must manually scale the allocation by vector length.\n            vsize := 1; if ObjId(elt)=TVect then vsize := elt.size; fi;\n#            ptype := Concatenation(elt.name, \"Pointer\");\n#            self.(ptype)(elt, [v], i, is);\n            self.TPtr(TPtr(elt), [v], i, is);\n            Print(\" =  &(ARENA[ (arenalevel-=\",self(dims[1]*vsize,i,is),\") ])\");\n          else\n            self.(elt.name)(elt, [v], i, is);\n            DoForAll(dims, d->Print(\"[\",self(d,i,is),\"]\"));\n          fi;\n\n        fi;\n    end,\n\n    # comments embedded in code\n\n    comment := (self, o, i, is) >> When(Length(o.exp) = 0,\n        PrintLine(),\n        PrintLine(Blanks(i), \"/* \", o.exp, \" */\")\n    ),\n\n    quote := (self, o, i, is) >> Print(\"\\\"\", self(o.cmd,i,is), \"\\\"\")\n));\n\n# Locate instances of assign(loc, Value), where types of Value and loc\n# do not match. Fix the value to be of correct type.\n# Note: For linear transforms the only possible Value is 0 (otherwise\n# transform is not linear)\nFixAssign0 := c -> SubstTopDownNR(c, [assign, @(1), @(2,Value,e->e.t <> @(1).val.t)],\n    e -> assign(@(1).val,\n            When(@(2).val.v = 0, @(1).val.t.zero(),\n                                 @(1).val.t.value(@(2).val.v))));\n\nClass(CMacroUnparser, CUnparserBase, rec(\n    preprocess := (self, c) >> FixAssign0(PropagateTypes(c)),\n    preprocess_init := (self, c) >> FixAssign0(PropagateTypes(c)),\n\n    # Split non-binary \"+\" into nested binary ops\n    add := (self,o,i,is) >> Cond(\n        o.t=TInt or IsPtrT(o.t), Inherited(o, i, is), \n        Length(o.args)=2, self.prefixTT(\"ADD\", o.args[1].t, o.args[2].t, o.args),\n        let(rem := ApplyFunc(add, Drop(o.args, 1)),\n            self.prefixTT(\"ADD\", o.args[1].t, rem.t, [o.args[1], rem]))),\n\n    sub := (self,o,i,is) >> Cond(o.t=TInt or IsPtrT(o.t), Inherited(o, i, is), \n    self.prefixTT(\"SUB\", o.args[1].t, o.args[2].t, o.args)),\n\n    nth := (self,o,i,is) >> Cond(o.t=TInt or IsPtrT(o.t), Inherited(o, i, is), self.prefixT(\"NTH\", o.t, [o.loc, o.idx])),\n    neg := (self,o,i,is) >> Cond(o.t=TInt or IsPtrT(o.t), Inherited(o, i, is), self.prefixT(\"NEG\", o.t, o.args)),\n\n    bin_and := (self, o, i, is) >> Cond(o.t=TInt or ObjId(o.t) in [T_Int, T_UInt], Inherited(o, i, is), self.prefixT(\"AND\", o.t, o.args)),\n    bin_xor := (self, o, i, is) >> Cond(o.t=TInt or ObjId(o.t) in [T_Int, T_UInt], Inherited(o, i, is), self.prefixT(\"XOR\", o.t, o.args)),\n    div  := (self,o,i,is) >> Cond(o.t=TInt, Inherited(o, i, is), self.prefixTT(\"DIV\", o.args[1].t, o.args[2].t, o.args)),\n    imod := (self,o,i,is) >> self.prefixT(\"IMOD\", o.t, o.args),\n    max  := (self,o,i,is) >> self.prefixTT(\"MAX\", o.args[1].t, o.args[2].t, o.args),\n    min  := (self,o,i,is) >> self.prefixTT(\"MIN\", o.args[1].t, o.args[2].t, o.args),\n    \n    idiv := (self,o,i,is) >> Cond(o.t=TInt and ForAll(o.args,x->x.t=TInt), Inherited(o, i, is), \n        self.prefixT(\"IDIV\", o.t, o.args)),\n\n    fdiv := (self,o,i,is) >> self.prefixTT(\"FDIV\", o.args[1].t, o.args[2].t, o.args),\n\n    re     := (self,o,i,is) >> self.prefixT(\"RE\", o.args[1].t, o.args),\n    im     := (self,o,i,is) >> self.prefixT(\"IM\", o.args[1].t, o.args),\n    cxpack := (self,o,i,is) >> self.prefixT(\"C\", o.t, o.args),\n\n    no_mod := (self,o,i,is) >> self(o.args[1],i,is),\n\n    Value := (self, o, i, is) >> Cond(\n        IsArray(o.t), Print(\"{\", self.infix(o.v, \", \"), \"}\"),\n        let(fmt := self._const(o),\n        pfx := Cond(self.cx.isInside(data), \"CD_\", \"C_\"),\n            Cond(fmt[2]=[], Print(pfx, fmt[1]),\n                 fmt[1]=\"INT\", Print(fmt[2][1]), \n                 self.prefix(Concat(pfx, fmt[1]), fmt[2])))),\n\n    # mults by different constants are unparsed differently\n    # Split non-binary \"*\" into nested binary ops\n    mul := (self,o,i,is) >> Cond(\n        o.t=TInt, Inherited(o, i, is), \n        Length(o.args)<>2, self(mul(o.args[1], ApplyFunc(mul, Drop(o.args, 1))), i, is),\n        let(\n         # check if constant ended up in slot #2\n         a := When(IsValue(o.args[2]), o.args[2], o.args[1]),\n         b := When(IsValue(o.args[2]), o.args[1], o.args[2]),\n         When(not (IsValue(a) or (IsVar(a) and IsBound(a.value))),\n            # <a> is not a constant\n            self.prefix(Concat(\"MUL_\", self._pfx(a.t), \"_\", self._pfx(b.t)), [a,b]),\n            # <a> is a constant\n            let(fmt := self._const( When(IsValue(a), a, a.value) ),\n                self.prefix(Concat(\"MUL_\", fmt[1], \"_\", self._pfx(b.t)),\n                     # check if constant is special, and does not go into MUL args\n                     # for example fmt[1]=\"I\" denotes sqrt(-1), one such constant\n                     When(fmt[2]=[], [b], [a, b])))))),\n\n    prefixT := (self, funcname, t, args) >>\n        self.prefix(Concat(funcname, \"_\", self._pfx(t)), args),\n\n    prefixTT := (self, funcname, t1, t2, args) >>\n        self.prefix(Concat(funcname, \"_\", self._pfx(t1), \"_\", self._pfx(t2)), args),\n\n    prefixTTT := (self, funcname, t1, t2, t3, args) >> \n        self.prefix(Concat(funcname, \"_\", self._pfx(t1), \"_\", self._pfx(t2), \"_\", self._pfx(t3)), args),\n    # this is getting really ugly\n    prefixTTTT := (self, funcname, t1, t2, t3, t4, args) >> \n        self.prefix(Concat(funcname, \"_\", self._pfx(t1), \"_\", self._pfx(t2), \"_\", self._pfx(t3), \"_\", self._pfx(t4)), args),\n\n    prefix_T := (self, funcname, args) >>\n        self.prefix(funcname :: ConcatList(args, a -> \"_\" :: self._pfx(a.t)), args),\n\n    _pfx := (self, t) >> Cond(\n        IsComplexT(t),   \"CPX\",\n        IsRealT(t),      \"FLT\",\n        IsOrdT(t),       \"INT\",\n        t = TUnknown,    \"UNK\",\n        ObjId(t) = TSym, \"SYM\",\n        IsPtrT(t),       \"P\" :: self._pfx(t.t),\n        IsArrayT(t),     \"A\" :: self._pfx(t.t),\n        IsVecT(t), Cond(\n            IsComplexT(t.t), \"FC\" :: StringInt(t.size),\n            IsRealT(t.t),    \"FV\" :: StringInt(t.size),\n            IsOrdT(t.t),     \"IV\" :: StringInt(t.size),\n            Error(\"Can't handle type \", t)\n        ),\n        Error(\"Can't handle type \", t)),\n\n    # returns a tuple [suffix, args], where suffix is used for MUL_XXX or C_XXX,\n    # and args are additional parameters into C_XXX\n    _const := (self,o) >> Cond(\n        # we assume here that complex constants with 0 imaginary parts have\n        # been converted to TReal already\n        o.t = TComplex, let(c:=Complex(o.v), re:=ReComplex(c), im:=ImComplex(c),\n            Cond(re=0 and im=1,  [\"I\", []],\n                re=0 and im=-1, [\"NI\", []],\n                re=0,           [\"IM\", [im]],\n                im < 0,         [\"CPXN\", [re, -im]],\n                               [\"CPX\", [re, im]])),\n        ObjId(o.t) = T_Complex, let(c:=Complex(o.v), re:=ReComplex(c), im:=ImComplex(c),\n            Cond(re=0 and im=1,  [\"I\", []],\n                re=0 and im=-1, [\"NI\", []],\n                re=0,           [\"IM\", [im]],\n                im < 0,         [\"CPXN\", [re, -im]],\n                               [\"CPX\", [re, im]])),\n        o.t = TReal and IsCyc(o.v),        [\"FLT\", [ReComplex(Complex(o.v))]],\n        o.t = TReal,                       [\"FLT\", [o.v]],\n        o.t = TInt,                        [\"INT\", [o.v]],\n        o.t = TUnknown,                    [\"INT\", [o.v]], # NOTE: there is a bug that creates V(0) with TUnknown\n        o.t = TString,                     [\"STR\", [o.v]],\n        o.t = TBool,                       [\"INT\", [When(o.v in [true, 1], 1, 0)]],\n        IsVecT(o.t), Cond(\n            o.t.t = TReal, [Concat(\"FV\",StringInt(o.t.size)), List(o.v, x->x.v)],\n            o.t.t = TComplex, [Concat(\"FC\",StringInt(o.t.size)), List(o.v, x->x.v)],\n            o.t.t = TInt, [Concat(\"IV\",StringInt(o.t.size)), List(o.v, x->x.v)],\n            Error(\"Don't know how to handle constant of type \", o.t)\n        ),\n        Error(\"Don't know how to handle constant of type \", o.t)\n    ),\n\n    tcast := (self, o, i, is) >> Print(\"((\", self.declare(o.args[1], [], i, is), \") \", self(o.args[2],i,is), \")\"),\n\n    TVect    := (self, t, vars, i, is) >> Print(self._pfx(t), \" \", self.infix(vars, \", \")),\n    TComplex := (self, t, vars, i, is) >> Print(self._pfx(t), \" \", self.infix(vars, \", \")),\n    TReal    := (self, t, vars, i, is) >> Print(self._pfx(t), \" \", self.infix(vars, \", \")),\n    TInt     := (self, t, vars, i, is) >> Print(\"int \", self.infix(vars, \", \")),\n\n    gen := meth(self, subname, o, opts)\n        local oo;\n        self.opts := CopyFields(opts, rec(subName := subname));\n        oo := self.preprocess(o);\n        Print(self.header(subname, oo), Unparse(oo, self, 0, 4), self.footer(subname, oo));\n    end,\n\n    fld := (self, o, i, is) >> Print(self(o.loc, i, is), When(IsPtrT(o.loc.t), \"->\", \".\"), o.id),\n    ufld := ~.fld,\n\n    header := (self, subname, o) >> Print(\n        self.generated_by,\n        self.extraHeader,\n        self.fileinfo(self.opts),\n        DoForAll(self.includes, inc -> Print(\"#include \", inc, \"\\n\")),\n        DoForAll(self.opts.includes, inc -> Print(\"#include \", inc, \"\\n\"))\n    ),\n\n    footer := Ignore,\n\n    data := (self,o,i,is) >> Print(Blanks(i), self.genData(o.var, o.value), self(o.cmd, i, is)),\n\n    func := (self, o, i, is) >> let(\n        parameters:=Flat(o.params),\n        id := Cond(o.id=\"transform\" and IsBound(self.opts.subName),\n                     self.opts.subName,\n                   o.id=\"init\"      and IsBound(self.opts.subName),\n                     Concat(\"init_\",self.opts.subName),\n                   o.id=\"destroy\"   and IsBound(self.opts.subName),\n                     Concat(\"destroy_\",self.opts.subName),\n                   o.id),\n        Print(\"\\n\", Blanks(i),\n            When(IsBound(o.inline) and o.inline,\"inline \",\"\"),\n            self.opts.funcModifier, self.declare(o.ret, var(id, o.ret), i, is), \"(\",\n            DoForAllButLast(parameters, p->Print(self.declare(p.t, p,i,is), \", \")),\n            When(Length(parameters)>0, self.declare(Last(parameters).t, Last(parameters),i,is), \"\"), \") \",\n            \"{\\n\",\n            self(o.cmd, i+is, is),\n            Blanks(i),\n            \"}\\n\")),\n\n    # C99 style, loop var declared inside\n    # - needed for correct operation of OpenMP\n    # - simplifies function declarations (no need to worry about declaring loop vars)\n    loop := (self, o, i, is) >> let(v := o.var, lo := o.range[1], hi := Last(o.range),\n        Print(Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")),\n\n    loopn := (self, o, i, is) >> let(v := o.var, lo := 0, hi := o.range, #NOTE: YSV what is the right thing here?\n        Print(Blanks(i), \"for(int \", self(v, i, is), \" = \", self(lo, i, is), \"; \", self(v, i, is), \" < \", self(hi, i, is), \"; \", self(v, i, is), \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")),\n\n    program := (self,o,i,is) >> DoForAll(o.cmds, c -> self(c,i,is)),\n\n    allocate := (self, o, i, is) >> Print(Blanks(i),\n        self(o.loc, i, is), \" = (\", self.declare(o.exp.t, [],0,0), \"*) MALLOC(sizeof(\",\n        self.declare(o.exp.t,[],0,0), \") * \", self(o.exp.size,i,is), \");\\n\"),\n\n#        Blanks(i),\"for(int iinit = 0; iinit <  \",self(o.exp.size,i,is),\"; iinit++)\\n\",\n#        Blanks(i),\"    \", self(o.loc, i, is),\"[iinit]=0;\\n\"),\n\n    deallocate := (self, o, i, is) >> Print(\n        Blanks(i),\n        \"FREE(\",\n        self(o.loc, i, is),\n        \");\\n\"\n    ),\n\n    ret := (self, o, i, is) >> Print(Blanks(i), \"return \", self(o.args[1], i+is, is), \";\\n\"),\n\n    tcvt := (self, o, i, is) >> self.printf(\"(($1)($2))\", [ o.args[1], o.args[2] ])\n));\n\n# can handle program/func, etc\n#\nClass(CUnparser, CUnparserBase, rec(\n    gen := meth(self, subname, o, opts)\n        local oo;\n        self.opts := CopyFields(opts, rec(subName := subname));\n        oo := self.preprocess(o);\n\t\tself.checkPrintRuleTree(o, opts);\n        Print(self.header(subname, oo), Unparse(oo, self, 0, 4), self.footer(subname, oo));\n    end,\n\n    fld := (self, o, i, is) >> Print(self(o.loc, i, is), When(IsPtrT(o.loc.t), \"->\", \".\"), o.id),\n    ufld := ~.fld,\n\n    header := (self, subname, o) >> Print(\n        self.generated_by,\n        self.extraHeader,\n        self.fileinfo(self.opts),\n        DoForAll(self.includes, inc -> Print(\"#include \", inc, \"\\n\")),\n        DoForAll(self.opts.includes, inc -> Print(\"#include \", inc, \"\\n\"))\n    ),\n\t\n\tcheckPrintRuleTree := meth(self, o, opts)\n\t\tif IsBound(opts.printRuleTree) and opts.printRuleTree and IsBound(o.ruletree) then\n\t\t\tPrint(\"/* RuleTree:\\nrt :=\\n\");\n\t\t\tPrint(o.ruletree);\n\t\t\tPrint(\"\\n;\\n*/\\n\\n\");\n\t\tfi;\n\tend,\n\n    footer := Ignore,\n\n    data := (self,o,i,is) >> Print(Blanks(i), self.genData(o.var, o.value), self(o.cmd, i, is)),\n\n    func := (self, o, i, is) >> let(\n        parameters:=Flat(o.params),\n        id := Cond(o.id=\"transform\" and IsBound(self.opts.subName),\n                     self.opts.subName,\n                   o.id=\"init\"      and IsBound(self.opts.subName),\n                     Concat(\"init_\",self.opts.subName),\n                   o.id=\"destroy\"   and IsBound(self.opts.subName),\n                     Concat(\"destroy_\",self.opts.subName),\n                   o.id),\n        Print(\"\\n\", Blanks(i),\n            self.opts.funcModifier, self.declare(o.ret, var(id, o.ret), i, is), \"(\",\n            DoForAllButLast(parameters, p->Print(self.declare(p.t, p,i,is), \", \")),\n            When(Length(parameters)>0, self.declare(Last(parameters).t, Last(parameters),i,is), \"\"), \") \",\n            \"{\\n\",\n            When(IsBound(self.opts.postalign), DoForAll(parameters, p->self.opts.postalign(p,i+is,is))),\n            self(o.cmd, i+is, is),\n            Blanks(i),\n            \"}\\n\")),\n\n    # C99 style, loop var declared inside\n    loop := (self, o, i, is) >> let(v := o.var, lo := o.range[1], hi := Last(o.range),\n        Print(When(IsBound(self.opts.looppragma), self.opts.looppragma(o,i,is)),\n          Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")),\n\n    loopn := (self, o, i, is) >> let(v := o.var.id, lo := 0, hi := o.range,\n        Print(Blanks(i), \"for(int \", v, \" = \", lo, \"; \", v, \" < \", self(hi,i,is), \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}\\n\")),\n\n    program := (self,o,i,is) >> DoForAll(o.cmds, c -> self(c,i,is)),\n\n    allocate := (self, o, i, is) >> Print(Blanks(i),\n        self(o.loc, i, is), \" = (\", self.declare(o.exp.t, [],0,0),\n        \"*) calloc(\", self(o.exp.size,i,is), \", sizeof(\", self.declare(o.exp.t,[],0,0), \"));\\n\"),\n\n    deallocate := (self, o, i, is) >> Print(\n        Blanks(i),\n        \"free(\",\n        self(o.loc, i, is),\n        \");\\n\"\n    ),\n\n    ret := (self, o, i, is) >> Print(Blanks(i), \"return \", self(o.args[1], i+is, is), \";\\n\"),\n\n    call := (self, o, i, is) >> Print(Blanks(i), o.args[1].id, self.pinfix(Drop(o.args, 1), \", \"), \";\\n\"),\n\n    fcall := (self, o, i, is) >> Print(self(o.args[1],0,0), \"(\", self.infix(Drop(o.args, 1), \", \"), \")\"),\n\n    # structure definition\n    struct := (self, o, i, is) >> Print(\n        Blanks(i), \"typedef struct {\\n\",\n        DoForAll(o.fields, f ->\n            Print(Blanks(i+is), self.declare(f.t, f, i+is, is), \";\\n\")\n        ),\n        Blanks(i), \"} \", o.id, \";\\n\\n\"\n    )\n));\n\n# old style variable declarations. this is for older/stricter compilers (like gcc-2.5.2 used by simplescalar)\n# {int v; for(v=0; ....  rather than for(int v=0; ...\n# and\n# { double x; .... rather than double x\nClass(C89Unparser, CUnparser, rec(\n\n    loop := (self, o, i, is) >> let(v := o.var, lo := o.range[1], hi := Last(o.range),\n        Print(Blanks(i), \"{int \", v, \"; for(\", v, \" = \", lo, \"; \", v, \" <= \", hi, \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}}\\n\")),\n\n    loopn := (self, o, i, is) >> let(v := o.var.id, lo := 0, hi := o.range,\n        Print(Blanks(i), \"{int \", v, \"; for(\", v, \" = \", lo, \"; \", v, \" < \", self(hi,i,is), \"; \", v, \"++) {\\n\",\n          self(o.cmd,i+is,is),\n          Blanks(i), \"}}\\n\")),\n\n    # exactly like the normal decl except wrapped in {}\n#   decl := meth(self,o,i,is)\n#       local arrays, other, l;\n#       Print(\"{\");\n#       [arrays, other] := SplitBy(o.vars, x->IsArray(x.t));\n#       DoForAll(arrays, v -> Print(Blanks(i), self.opts.arrayBufModifier, \" \", self.declare(v.t, v, i, is), \";\\n\"));\n\n#       if (Length(other)>0) then\n#           other:=SortRecordList(other,x->x.t);\n#           for l in other do\n#              Sort(l, (a,b)->a.id < b.id);\n#              Print(Blanks(i), self.declare(l[1].t, l, i, is), \";\\n\");\n#           od;\n#       fi;\n\n#       self(o.cmd, i, is);\n#       Print(\"}\");\n#   end,\n));\n\n# FFTX: Temporary to handle idiv(imod()).\nCUnparser.(\"idivmod\") := (self,o,i,is) >> self(imod(idiv(o.args[1], o.args[3]), o.args[2]), i, is);\n\n#\n# NOTE: These are obsolete names\n#\nCUnparserProg := CUnparser;\nCMacroUnparserProg := CMacroUnparser;\nC89UnparserProg := C89Unparser;\n", "meta": {"hexsha": "66016a4584fa33d5f06cdafed8a0f357b62b9c9f", "size": 44583, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/compiler/unparse.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/compiler/unparse.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/compiler/unparse.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 41.1282287823, "max_line_length": 155, "alphanum_fraction": 0.4888634681, "num_tokens": 13720, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.2068940537061185, "lm_q2_score": 0.025178840054740276, "lm_q1q2_score": 0.005209352286543202}}
{"text": "InstallGlobalFunction(MEMO_MongoDBCache,\nfunction(memo, path)\n  local url, cache, type;\n\n  # Full URL including function name\n  url := path;\n  if not EndsWith(url, \"/\") then\n    Add(url, '/');\n  fi;\n  Append(url, memo!.funcname);\n\n  # Make cache object\n  cache := rec(memo := memo,  # memoised function\n               url := url);  # URL of the database\n  # Objectify\n  type := NewType(DictionariesFamily, MEMO_IsMongoDBCache);\n  cache := Objectify(type, cache);\n\n  return cache;\nend);\n\nInstallMethod(AddDictionary,\n\"for a memoisation disk cache and two objects\",\n[MEMO_IsMongoDBCache, IsObject, IsObject],\nfunction(cache, key, val)\n  local memo, h, storedkey, query, namespace, result, args, post_string, url,\n        db_response, res;\n  memo := cache!.memo;\n\n  # Get hash\n  h := memo!.hash(key);\n\n  # Construct MongoDB query as record\n  query := rec(hash := h,\n               namespace := MEMO_MongoDBNamespace,\n               result := memo!.pickle(val));\n\n  # OPTION: storekey\n  if memo!.storekey then\n    query.key := memo!.pickle(key);\n  fi;\n\n  # OPTION: metadata\n  if memo!.metadata <> fail then\n    query.metadata := memo!.metadata();\n  fi;\n\n  # Query the server\n  args := List(RecNames(query), rnam -> Concatenation(rnam, \"=\", query.(rnam)));\n  post_string := JoinStringsWithSeparator(args, \"&\");\n  url := cache!.url;\n  Info(InfoMemoisation, 3, \"Posting to \", url);\n  Info(InfoMemoisation, 4, \"(including \",\n       JoinStringsWithSeparator(RecNames(query), \", \"), \")\");\n  db_response := PostToURL(cache!.url, post_string);\n  if db_response.success = false then\n    # No valid response from server\n    Error(\"AddDictionary (MongoDB cache): \", db_response.error);\n  fi;\n  res := JsonStringToGap(db_response.result);\n\n  if res._status = \"ERR\" then\n    # Problem with database\n    Error(\"AddDictionary (MongoDB cache): \", res);\n  elif res._status = \"OK\" then\n    # Success\n    return;\n  fi;\n  Error(\"AddDictionary (MongoDB cache): \",\n        \"<res>._status should be \\\"ERR\\\" or \\\"OK\\\"\");\n\n  # no return value\nend);\n\nInstallMethod(KnowsDictionary,\n\"for a memoisation disk cache and an object\",\n[MEMO_IsMongoDBCache, IsObject],\nfunction(cache, key)\n  local item;\n  item := MEMO_MongoDBQuery(cache, key);\n  return item <> fail;\nend);\n\nInstallMethod(LookupDictionary,\n\"for a memoisation disk cache and an object\",\n[MEMO_IsMongoDBCache, IsObject],\nfunction(cache, key)\n  local memo, item, storedkey;\n  memo := cache!.memo;\n\n  # Request item from database\n  item := MEMO_MongoDBQuery(cache, key);\n  if item = fail then\n    # We shouldn't normally get here, as we usually check KnowsDictionary first\n    Info(InfoMemoisation, 1, \"No entry found in database\");\n    return fail;\n  fi;\n\n  # OPTION: storekey\n  if memo!.storekey then\n    storedkey := memo!.unpickle(item.key);\n    # check if key still matches\n    if key <> storedkey then\n      ErrorNoReturn(\"Hash collision: <key> does not match <storedkey>\");\n    fi;\n    Info(InfoMemoisation, 3, \"Key matches that stored on the server\");\n  fi;\n\n  # OPTION: unhash\n  if memo!.unhash <> fail then\n    # unhash and check if key still matches\n    storedkey := memo!.unhash(item.hash);\n    if storedkey <> key then\n      ErrorNoReturn(\"Hash collision: <key> does not match <storedkey>\");\n    fi;\n  fi;\n\n  return memo!.unpickle(item.result);\nend);\n\nInstallMethod(MEMO_ClearCache,\n\"for a memoisation disk cache\",\n[MEMO_IsMongoDBCache],\nfunction(cache)\n  local db_response;\n  db_response := DeleteURL(cache!.url);\n  if db_response.success <> true then\n    Error(\"MongoDB cache: failed to clear\");\n  fi;\n  return db_response.success;\nend);\n\nInstallGlobalFunction(MEMO_MongoDBQuery,\nfunction(cache, key)\n  local memo, query, url, db_response, item;\n  memo := cache!.memo;\n\n  # Construct the arguments\n  query := rec(namespace := MEMO_MongoDBNamespace);\n  query := List(RecNames(query), rnam -> Concatenation(\"%22\",\n                                                      rnam,\n                                                      \"%22=%22\",\n                                                      query.(rnam),\n                                                      \"%22\"));\n  query := JoinStringsWithSeparator(query, \",\");\n  url := Concatenation(cache!.url, \"/\", memo!.hash(key),\n                       \"?where={\", query, \"}\");\n  Info(InfoMemoisation, 4, \"Querying \", url);\n  db_response := DownloadURL(url);\n  if db_response.success = false then\n    # No valid response from server\n    Error(\"MongoDB cache: \", db_response.error);\n  fi;\n  item := JsonStringToGap(db_response.result);\n  if IsBound(item._status) and item._status = \"ERR\" then\n    if item._error.code = 404 then\n      # No result for this hash on server (no problem!)\n      return fail;\n    else\n      # Something else went wrong\n      Error(\"MongoDB cache: \", item._error.code, \" \", item._error.message);\n    fi;\n  fi;\n\n  # Return a single item as a record\n  return item;\nend);\n", "meta": {"hexsha": "bc911a1c9d90f8b226dd3f02651b9c412bb7f2d1", "size": 4878, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/MongoDBCache.gi", "max_stars_repo_name": "gap-packages/Memoisation", "max_stars_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-08-20T21:02:33.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-19T09:25:15.000Z", "max_issues_repo_path": "gap/MongoDBCache.gi", "max_issues_repo_name": "gap-packages/Memoisation", "max_issues_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2018-08-06T11:56:51.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-04T15:04:36.000Z", "max_forks_repo_path": "gap/MongoDBCache.gi", "max_forks_repo_name": "gap-packages/Memoisation", "max_forks_repo_head_hexsha": "0b1c1c172d52d57376876fd345aaa7db81792df1", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.0357142857, "max_line_length": 80, "alphanum_fraction": 0.6385813858, "num_tokens": 1256, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.27825678173200435, "lm_q2_score": 0.018546563325443563, "lm_q1q2_score": 0.005160707023126747}}
{"text": "--\n-- The $LANG_NAME$ Keyword Lexer\n--\n%options package=$PACKAGE_NAME$\n%options template=$TEMPLATE$F.gi\n\n%Include\n    KWLexerLowerCaseMapF.gi\n%End\n\n%Export\n    -- List all the keywords the kwlexer will export to the lexer and parser\n    boolean\n    double\n    else\n    false\n    if\n    int\n    return\n    true\n    void\n    while\n%End\n\n%Terminals\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n%End\n\n%Start\n    -- The Goal for the parser is a single Keyword\n    Keyword\n%End\n\n%Rules\n    Keyword ::= b o o l e a n  /.$setResult($_boolean);./\n              | d o u b l e    /.$setResult($_double);./\n              | e l s e        /.$setResult($_else);./\n              | f a l s e      /.$setResult($_false);./\n              | i f            /.$setResult($_if);./\n              | i n t          /.$setResult($_int);./\n              | v o i d        /.$setResult($_void);./\n              | r e t u r n    /.$setResult($_return);./\n              | t r u e        /.$setResult($_true);./\n              | w h i l e      /.$setResult($_while);./\n%End\n", "meta": {"hexsha": "d725b180a90658a314c32d7fde4260f28882411c", "size": 1128, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "example/java/kwlexer.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "example/java/kwlexer.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example/java/kwlexer.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.0, "max_line_length": 76, "alphanum_fraction": 0.4565602837, "num_tokens": 351, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.15817436862177234, "lm_q2_score": 0.032100708800430956, "lm_q1q2_score": 0.0050775093468195375}}
{"text": "f:=function (  )\n    Print( \"f:=\", f, \";;\\nf();\\n\" );\n    return;\nend;;\nf();\n", "meta": {"hexsha": "230243ec482b4aa4e88ce54b9e06ca9907c9fe78", "size": 77, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Quine/GAP/quine.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-05-05T13:42:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-05T13:42:20.000Z", "max_issues_repo_path": "Task/Quine/GAP/quine.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Quine/GAP/quine.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 12.8333333333, "max_line_length": 36, "alphanum_fraction": 0.3766233766, "num_tokens": 31, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.19193276795852135, "lm_q2_score": 0.02635535102983882, "lm_q1q2_score": 0.005058455473675431}}
{"text": "\n##  Copyright (c) 2018-2021, Carnegie Mellon University\n##  See LICENSE for details\n\nClass(cu_allocate_managed, assign);\n\ncudaMemcpyHostToHost     := \"cudaMemcpyHostToHost\";\ncudaMemcpyHostToDevice   := \"cudaMemcpyHostToDevice\";\ncudaMemcpyDeviceToHost   := \"cudaMemcpyDeviceToHost\";\ncudaMemcpyDeviceToDevice := \"cudaMemcpyDeviceToDevice\";\n\nClass(cu_check_errors, call);\n\nClass(T_Class, T_Type, rec(\n    \n    fields := rec(),\n\n    updateParams := meth(self)\n        Constraint(IsString(self.params[1]));\n        Constraint(When(Length(self.params)>1, IsRec(self.params[2]), true));\n    end,\n));\n\n\nClass(Dim3, T_Class, rec(\n\n    __call__ := (self) >> let(fields := rec(x := TUInt, y := TUInt, z := TUInt), Inherited(\"Dim3\", fields)),    \n\n    )\n);\n\nvar.(\"fresh_t_obj\") := meth(self,id,t,params) \n    local v, f;\n    if IsType(t) and IsRec(params) and ForAll(RecFields(params), f->f in RecFields(t.params[2])) then\n        v := var.fresh_t(id, t);\n        for f in Filtered(RecFields(params), e -> IsType(t.params[2].(e))) do \n            v.(f) := var.fresh_t(f, t.params[2].(f));\n            v.(f).setValue(params.(f));\n        od;\n        return v;\n    else\n        Error(\"<t> must be a type or an integer that represents an interval\");\n    fi;\nend;\n\nClass(T_CudaEvent, T_Type);\nClass(cu_event_create, call);\nClass(cu_event_record, call);\nClass(cu_event_destroy, call);\nClass(cu_event_synchronize, call);\nClass(cu_device_synchronize, call);\nClass(cu_event_elapsed_time, call);\n\nClass(cu_allocate, assign, rec(\n   isAssign := true,\n   __call__ := (self, loc, type, size) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc  := toAssignTarget(loc),\n       type  := type,\n       size := size)\n       ),\n\n   rChildren := self >> [self.loc, self.type, self.size],\n   rSetChild := rSetChildFields(\"loc\", \"type\", \"size\"),\n\n   print := (self,i,si) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.type, \", \", self.size, \")\"))\n));\n\nClass(cu_memcpy, assign, rec(\n   isAssign := true,\n   __call__ := (self, loc, exp, size, kind) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc  := toAssignTarget(loc),\n       exp  := toExpArg(exp),\n       size := size,\n       kind := kind)),\n\n   rChildren := self >> [self.loc, self.exp, self.size, self.kind],\n   rSetChild := rSetChildFields(\"loc\", \"exp\", \"size\", \"kind\"),\n\n   print := (self,i,si) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.exp, \", \", self.size, \", \", self.kind, \")\"))\n));\n\nClass(cu_memcpy_to_sym, assign, rec(\n   isAssign := true,\n   __call__ := (self, loc, exp, size) >> WithBases(self,\n       rec(operations := CmdOps,\n       loc  := toAssignTarget(loc),\n       exp  := toExpArg(exp),\n       size := size)),\n\n   rChildren := self >> [self.loc, self.exp, self.size],\n   rSetChild := rSetChildFields(\"loc\", \"exp\", \"size\"),\n\n   print := (self,i,si) >> let(name := Cond(IsBound(self.isCompute) and self.isCompute,\n                                            gap.colors.DarkYellow(self.__name__),\n                                            IsBound(self.isLoad) and self.isLoad,\n                                            gap.colors.DarkRed(self.__name__),\n                                            IsBound(self.isStore) and self.isStore,\n                                            gap.colors.DarkGreen(self.__name__),\n                                            self.__name__),\n                                Print(name, \"(\", self.loc, \", \", self.exp, \", \", self.size, \")\"))\n));\n\nClass(cu_free, call);\n\nClass(cu_call, call, rec(\n    __call__ := arg >> let(\n        len := Length(arg),\n        self := arg[1],\n        f := arg[2],\n        dim_grid := Checked(IsList(arg[3]) or IsVar(arg[3]), arg[3]),\n        dim_block := Checked(IsList(arg[4]) or IsVar(arg[4]), arg[4]),\n        args := arg{[5..len]},\n        WithBases(self, rec(\n            func := f,\n            dim_grid := dim_grid,\n            dim_block := dim_block,\n            operations := CmdOps,\n            args := List(args, toExpArg)))\n        ),\n\n    rChildren := self >> [self.func, self.dim_grid, self.dim_block]::self.args,\n    \n    rSetChild := meth(self, n, newChild)\n        local len;\n        len := Length(self.args);\n        if n > len+3 then Error(); fi;\n        if n = 1 then\n            self.func := newChild;\n        elif n = 2 then\n            self.dim_grid := newChild;\n        elif n = 3 then\n            self.dim_block := newChild;\n        elif n > 3 and n <= len+3 then\n            self.args[n-3] := newChild;\n        fi;\n    end,\n\n    print := (self,i,si) >> Print(self.func, \"<<<\", self.dim_grid, \",\", self.dim_block, \">>>\", \"(\", PrintCS(self.args), \")\")\n\n));\n", "meta": {"hexsha": "04aa53ad749afb50883f56f5d018197ea746c8a9", "size": 5728, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "cuda_icode.gi", "max_stars_repo_name": "mikefranusich/spiral-package-simt", "max_stars_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cuda_icode.gi", "max_issues_repo_name": "mikefranusich/spiral-package-simt", "max_issues_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-03-30T14:16:00.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-30T14:16:00.000Z", "max_forks_repo_path": "cuda_icode.gi", "max_forks_repo_name": "mikefranusich/spiral-package-simt", "max_forks_repo_head_hexsha": "54e446407c5d6cc984fc502a8ba77c4c8408d7f5", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2020-12-14T18:26:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-05T12:02:48.000Z", "avg_line_length": 36.4840764331, "max_line_length": 124, "alphanum_fraction": 0.5129189944, "num_tokens": 1370, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1602660403494035, "lm_q2_score": 0.031143827612209376, "lm_q1q2_score": 0.004991297932733215}}
{"text": "\ufeff{\"geometry\":{\"num_positions\":6362,\"triangles\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[4973,4974,4975],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[4964,5026,5027],[4964,5025,5026],[4964,5024,5025],[4964,5023,5024],[4964,4965,5023],[4965,4966,5023],[4966,4967,5023],[4967,5021,5023],[4967,4968,5021],[5021,5022,5023],[5021,5017,5022],[4968,5020,5021],[4968,4998,5020],[4998,4999,5020],[4999,5005,5020],[5005,5019,5020],[5005,5018,5019],[5005,4985,5018],[4985,5006,5018],[5006,5007,5018],[5007,5008,5018],[5008,5009,5018],[5009,5010,5018],[5010,5011,5018],[5011,5012,5018],[5012,5013,5018],[5013,5014,5018],[5014,5015,5018],[5015,5017,5018],[5015,5016,5017],[5016,5022,5017],[4999,5004,5005],[4999,5003,5004],[4999,5001,5003],[4999,5000,5001],[5001,5002,5003],[5001,4996,5002],[4968,4969,4998],[4969,4997,4998],[4969,4970,4997],[4970,4971,4997],[4971,4976,4997],[4976,4996,4997],[4976,5002,4996],[4976,4995,5002],[4976,4986,4995],[4976,4994,4986],[4976,4990,4994],[4976,4993,4990],[4976,4977,4993],[4977,4992,4993],[4977,4978,4992],[4978,4979,4992],[4979,4980,4992],[4980,4991,4992],[4980,4981,4991],[4981,4989,4991],[4981,4988,4989],[4981,4987,4988],[4981,4982,4987],[4982,4983,4987],[4983,4984,4987],[4984,5006,4987],[5006,4985,4987],[4989,4990,4991],[4989,4994,4990],[4985,4986,4987],[4985,4995,4986],[4971,4972,4976],[4972,4973,4976],[4973,4975,4976],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"vertices\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,2829,2889,2888,2887,2886,2885,2884,2883,2882,2881,2880,2879,2878,2877,2876,2875,2874,2873,2872,2871,2870,2852,2864,2409,2410,2411,2866,2869,2868,2867,2865,2863,2857,2862,2861,2860,2859,2858,2856,2855,2854,2853,2851,2850,2849,2848,2847,2846,2845,2844,2843,2842,2841,2836,2840,2839,2838,2837,2835,2834,2833,2832,2831,2830,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,5369,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"edges\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[4964,4965],[4965,4966],[4966,4967],[4967,4968],[4968,4969],[4969,4970],[4970,4971],[4971,4972],[4972,4973],[4973,4974],[4974,4975],[4975,4976],[4976,4977],[4977,4978],[4978,4979],[4979,4980],[4980,4981],[4981,4982],[4982,4983],[4983,4984],[4984,5006],[4985,4995],[4986,4987],[4987,4988],[4988,4989],[4989,4994],[4990,4991],[4991,4992],[4992,4993],[4993,4990],[4994,4986],[4995,5002],[4996,4997],[4997,4998],[4998,4999],[4999,5000],[5000,5001],[5001,4996],[5002,5003],[5003,5004],[5004,5005],[5005,4985],[5006,5007],[5007,5008],[5008,5009],[5009,5010],[5010,5011],[5011,5012],[5012,5013],[5013,5014],[5014,5015],[5015,5016],[5016,5022],[5017,5018],[5018,5019],[5019,5020],[5020,5021],[5021,5017],[5022,5023],[5023,5024],[5024,5025],[5025,5026],[5026,5027],[5027,4964],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"wires\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[5022,5023,5024,5025,5026,5027,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,4981,4982,4983,4984],[4996,4997,4998,4999,5000,5001],[5006,5007,5008,5009,5010,5011,5012,5013,5014,5015,5016],[5017,5018,5019,5020,5021],[4986,4987,4988,4989],[5002,5003,5004,5005],[4990,4991,4992,4993],[4995],[4994],[4985],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"faces\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[1029,1030,1031,1032,1033,1034,1035,1036,1037,1038],[1029,9015,9016,9017,9018,9019,9020,9021,9022,9023,9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039,9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055,9056,9057,9058,9059,9060,9061,9062,9063,9064,9065,9066,9067,9068,9069,9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085]],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"points\":[],\"polylines\":[],\"polygons\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1029,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"collections\":[null,null,null,null,null,null,null,null,null,null,null]},\"attributes\":{\"positions\":[{\"name\":\"xyz\",\"data_type\":\"Float\",\"data_size\":3,\"data\":[[[2862],[-242.593017578125,-591.970703125,0]],[[2853],[-129.5400390625,-650.999267578125,0]],[[5369],[-395.22998046875,617.93017578125,0]],[[2888],[-37.556884765625,-569.5986328125,0]],[[2864],[-224.8515625,-693.020751953125,0]],[[2842],[-63.7939453125,-611.358642578125,0]],[[2866],[-218.9921875,-726.39501953125,0]],[[2887],[-39.834716796875,-569.086181640625,0]],[[2875],[-209.46142578125,-773.685791015625,0]],[[2833],[-36.65185546875,-575.138427734375,0]],[[2872],[-150.2021484375,-719.65478515625,0]],[[2849],[-117.964599609375,-680.312744140625,0]],[[2871],[-149.489990234375,-718.905517578125,0]],[[2881],[-247.76171875,-590.828857421875,0]],[[2877],[-210.8388671875,-774.70654296875,0]],[[2873],[-151.06640625,-720.564208984375,0]],[[2848],[-117.88427734375,-680.21435546875,0]],[[2870],[-147.52392578125,-716.498779296875,0]],[[2882],[-246.714111328125,-588.796630859375,0]],[[2841],[-60.91943359375,-607.632080078125,0]],[[2884],[-242.669677734375,-586.2333984375,0]],[[2863],[-225.502685546875,-689.3125,0]],[[2860],[-137.169677734375,-613.16650390625,0]],[[2855],[-203.51611328125,-641.056884765625,0]],[[2851],[-120.760498046875,-683.7353515625,0]],[[2835],[-51.107177734375,-594.9111328125,0]],[[2410],[-152.49267578125,-716.258544921875,0]],[[2874],[-182.73876953125,-753.886474609375,0]],[[2861],[-143.1396484375,-583.564208984375,0]],[[2830],[-34.111328125,-571.663330078125,0]],[[2411],[-153.182373046875,-716.984130859375,0]],[[2867],[-211.321044921875,-770.08544921875,0]],[[2856],[-233.527099609375,-643.608154296875,0]],[[2852],[-123.571044921875,-680.598388671875,0]],[[2889],[-37.158203125,-569.6884765625,0]],[[2865],[-219.643310546875,-722.686767578125,0]],[[2869],[-157.075439453125,-721.080078125,0]],[[2850],[-119.455322265625,-682.1376953125,0]],[[2832],[-36.3544921875,-574.73193359375,0]],[[2843],[-75.43115234375,-626.445556640625,0]],[[2847],[-116.777099609375,-678.85888671875,0]],[[2840],[-65.572021484375,-607.114501953125,0]],[[2880],[-248.159912109375,-593.36083984375,0]],[[2831],[-35.652099609375,-573.77099609375,0]],[[2854],[-200.702392578125,-657.0830078125,0]],[[2839],[-131.151611328125,-612.65771484375,0]],[[2879],[-247.908203125,-596.39404296875,0]],[[2409],[-126.650146484375,-684.62255859375,0]],[[2836],[-54.305908203125,-592.5087890625,0]],[[2837],[-41.48486328125,-574.9716796875,0]],[[2845],[-84.01416015625,-637.57275390625,0]],[[2857],[-234.568603515625,-637.675048828125,0]],[[2878],[-215.937744140625,-778.484375,0]],[[2858],[-204.5576171875,-635.123779296875,0]],[[2868],[-185.39892578125,-750.879150390625,0]],[[2834],[-36.765869140625,-575.29443359375,0]],[[2829],[-34.912109375,-570.87890625,0]],[[2846],[-86.410400390625,-640.59228515625,0]],[[2859],[-207.370849609375,-619.1005859375,0]],[[2885],[-239.673095703125,-585.702392578125,0]],[[2844],[-77.77978515625,-629.490478515625,0]],[[2883],[-245.0166015625,-587.264404296875,0]],[[2876],[-210.547607421875,-774.49072265625,0]],[[2838],[-137.121337890625,-583.055419921875,0]],[[2886],[-42.94091796875,-569.0732421875,0]]]}],\"vertices\":[{\"name\":\"rgb\",\"data_type\":\"Float\",\"data_size\":3,\"data\":[[[9736,9737,9738,9739,9740,9741,9742,9743,9744,9745,9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,9759,9760,9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776,9777,9778,9779,9780,9781,9782,9783,9784,9785,9786,9787,9788,9789,9790,9791,9792,9793,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806,9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822,9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838,9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854,9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,9869,9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885,9886,9887,9888,9889,9890,9891,9892,9893,9894,9895,9896,9897,9898,9899,9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,9915,9916,9917,9918,9919,9920,9921,9922,9923,9924,9925,9926,9927,9928,9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944,9945,9946,9947,9948,9949,9950,9951,9952,9953,9954,9955,9956,9957,9958,9959,9960,9961,9962,9963,9964,9965,9966,9967,9968,9969,9970,9971,9972,9973,9974,9975,9976,9977,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987,9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001,10002,10003,10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,10061,10062,10063,10064,10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10080,10081,10082,10083,10084,10085,10086,10087,10088,10089,10090,10091,10092,10093,10094,10095,10096,10097,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110,10111,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125,10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,10141,10142,10143,10144,10145,10146,10147,10148,10149,10150,10151,10152,10153,10154,10155,10156,10157,10158,10159,10160,10161,10162,10163,10164,10165,10166,10167,10168,10169,10170,10171,10172,10173,10174,10175,10176,10177,10178,10179,10180,10181,10182,10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,10193,10194,10195,10196,10197,10198,10199,10200,10201,10202,10203,10204,10205,10206,10207,10208,10209,10210,10211,10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10224,10225,10226,10227,10228,10229,10230,10231,10232,10233,10234,10235,10236,10237,10238,10239,10240,10241,10242,10243,10244,10245,10246,10247,10248,10249,10250,10251,10252,10253,10254,10255,10256,10257,10258,10259,10260,10261,10262,10263,10264,10265,10266,10267,10268,10269,10270,10271,10272,10273,10274,10275,10276,10277,10278,10279,10280,10281,10282,10283,10284,10285,10286,10287,10288,10289,10290,10291,10292,10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303,10304,10305,10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,10317,10318,10319,10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333,10334,10335,10336,10337,10338,10339,10340,10341,10342,10343,10344,10345,10346,10347,10348,10349,10350,10351,10352,10353,10354,10355,10356,10357,10358,10359,10360,10361,10362,10363,10364,10365,10366,10367,10368,10369,10370,10371,10372,10373,10374,10375,10376,10377,10378,10379,10380,10381,10382,10383,10384,10385,10386,10387,10388,10389,10390,10391,10392,10393,10394,10395,10396,10397,10398,10399,10400,10401,10402,10403,10404,10405,10406,10407,10408,10409,10410,10411,10412,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422,10423,10424,10425,10426,10427,10428,10429,10430,10431,10432,10433,10434,10435,10436,10437,10438,10439,10440,10441,10442,10443,10444,10445,10446,10447,10448,10449,10450,10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466,10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482,10483,10484,10485,10486,10487,10488,10489,10490,10491,10492,10493,10494,10495,10496,10497,10498,10499,10500,10501,10502,10503,10504,10505,10506,10507,10508,10509,10510,10511,10512,10513,10514,10515,10516,10517,10518,10519,10520,10521,10522,10523,10524,10525,10526,10527,10528,10529,10530,10531,10532,10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543,10544,10545,10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557,10558,10559,10560,10561,10562,10563,10564,10565,10566,10567,10568,10569,10570,10571,10572,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584,10585,10586,10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602,10603,10604,10605,10606,10607,10608,10609,10610,10611,10612,10613,10614,10615,10616,10617,10618,10619,10620,10621,10622,10623,10624,10625,10626,10627,10628,10629,10630,10631,10632,10633,10634,10635,10636,10637,10638,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648,10649,10650,10651,10652,10653,10654,10655,10656,10657,10658,10659,10660,10661,10662,10663,10664,10665,10666,10667,10668,10669,10670,10671,10672,10673,10674,10675,10676,10677,10678,10679,10680,10681,10682,10683,10684,10685,10686,10687,10688,10689,10690,10691,10692,10693,10694,10695,10696,10697,10698,10699,10700,10701,10702,10703,10704,10705,10706,10707,10708,10709,10710,10711,10712,10713,10714,10715,10716,10717,10718,10719,10720,10721,10722,10723,10724,10725,10726,10727,10728,10729,10730,10731,10732,10733,10734,10735,10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751,10752,10753,10754,10755,10756,10757,10758,10759,10760,10761,10762,10763,10764,10765,10766,10767,10768,10769,10770,10771,10772,10773,10774,10775,10776,10777,10778,10779,10780,10781,10782,10783,10784,10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796,10797,10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810,10811,10812,10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823,10824,10825,10826,10827,10828,10829,10830,10831,10832,10833,10834,10835,10836,10837,10838,10839,10840,10841,10842,10843,10844,10845,10846,10847,10848,10849,10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860,10861,10862,10863,10864,10865,10866,10867,10868,10869,10870,10871,10872,10873,10874,10875,10876,10877,10878,10879,10880,10881,10882,10883,10884,10885,10886,10887,10888,10889,10890,10891,10892,10893,10894,10895,10896,10897,10898,10899,10900,10901,10902,10903,10904,10905,10906,10907,10908,10909,10910,10911,10912,10913,10914,10915,10916,10917,10918,10919,10920,10921,10922,10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,10933,10934,10935,10936,10937,10938,10939,10940,10941,10942,10943,10944,10945,10946,10947,10948,10949,10950,10951,10952,10953,10954,10955,10956,10957,10958,10959,10960,10961,10962,10963,10964,10965,10966,10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982,10983,10984,10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998,10999,11000,11001,11002,11003,11004,11005,11006,11007,11008,11009,11010,11011,11012,11013,11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11028,11029,11030,11031,11032,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044,11045,11046,11047,11048,11049,11050,11051,11052,11053,11054,11055,11056,11057,11058,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069,11070,11071,11072,11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088,11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104,11105,11106,11107,11108,11109,11110,11111,11112],[1,1,0.625]],[[11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913,11914,11915,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928,11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944,11945,11946,11947,11948,11949,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959,11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975,11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,11988,11989,11990,11991,11992,11993,11994,11995,11996,11997,11998,11999,12000,12001,12002,12003,12004,12005,12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021,12022,12023,12024,12025,12026,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037,12038,12039,12040,12041,12042,12043,12044,12045,12046,12047,12048,12049,12050,12051,12052,12053,12054,12055,12056,12057,12058,12059,12060,12061,12062,12063,12064,12065,12066,12067,12068,12069,12070,12071,12072,12073,12074,12075,12076,12077,12078,12079,12080,12081,12082,12083,12084,12085,12086,12087,12088,12089,12090,12091,12092,12093,12094,12095,12096,12097,12098,12099,12100,12101,12102,12103,12104,12105,12106,12107,12108,12109,12110,12111,12112,12113,12114,12115,12116,12117,12118,12119,12120,12121,12122,12123,12124,12125,12126,12127,12128,12129,12130,12131,12132,12133,12134,12135,12136,12137,12138,12139,12140,12141,12142,12143,12144,12145,12146,12147,12148,12149,12150,12151,12152,12153,12154,12155,12156,12157,12158,12159,12160,12161,12162,12163,12164,12165,12166,12167,12168,12169,12170,12171,12172,12173,12174,12175,12176,12177,12178,12179,12180,12181,12182,12183,12184,12185,12186,12187,12188,12189,12190,12191,12192,12193,12194,12195,12196,12197,12198,12199,12200,12201,12202,12203,12204,12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220,12221,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,12246,12247,12248,12249,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264,12265,12266,12267,12268,12269,12270,12271,12272,12273,12274,12275,12276,12277,12278,12279,12280,12281,12282,12283,12284,12285,12286,12287,12288,12289,12290,12291,12292,12293,12294,12295,12296,12297,12298,12299,12300,12301,12302,12303,12304,12305,12306,12307,12308,12309,12310,12311,12312,12313,12314,12315,12316,12317,12318,12319,12320,12321,12322,12323,12324,12325,12326,12327,12328,12329,12330,12331,12332,12333,12334,12335,12336,12337,12338,12339,12340,12341,12342,12343,12344,12345,12346,12347,12348,12349,12350,12351,12352,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380],[0.10000000149011612,0.10000000149011612,0.10000000149011612]],[[9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240,9241,9242,9243,9244,9245,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255,9256,9257,9258,9259,9260,9261,9262,9263,9264,9265,9266,9267,9268,9269,9270,9271,9272,9273,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283,9284,9285,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311],[0,0.25999999046325684,0]],[[12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,12436,12437,12438,12439,12440,12441,12442,12443,12444,12445,12446,12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539,12540,12541,12542,12543,12544,12545,12546,12547,12548,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,12586,12587,12588,12589,12590,12591,12592,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616,12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679,12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695,12696,12697,12698,12699,12700,12701,12702,12703,12704,12705,12706,12707,12708,12709,12710,12711,12712,12713,12714,12715,12716,12717,12718,12719,12720,12721,12722,12723,12724,12725,12726,12727,12728,12729,12730,12731,12732,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742,12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758,12759,12760,12761,12762,12763,12764,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774,12775,12776,12777,12778,12779,12780,12781,12782,12783,12784,12785,12786,12787,12788,12789,12790,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803,12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819,12820,12821,12822,12823,12824,12825,12826,12827,12828,12829,12830,12831,12832,12833,12834,12835,12836,12837,12838,12839,12840,12841,12842,12843,12844,12845,12846,12847,12848,12849,12850,12851,12852,12853,12854,12855,12856,12857,12858,12859,12860,12861,12862,12863,12864,12865,12866,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12879,12880,12881,12882,12883,12884,12885,12886,12887,12888,12889,12890,12891,12892,12893,12894,12895,12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911,12912,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,12924,12925,12926,12927,12928,12929,12930,12931,12932,12933,12934,12935,12936,12937,12938,12939,12940,12941,12942,12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,12957,12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973,12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989,12990,12991,12992,12993,12994,12995,12996,12997,12998,12999,13000,13001,13002,13003,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,13018,13019,13020,13021,13022,13023,13024,13025,13026,13027,13028,13029,13030,13031,13032,13033,13034,13035,13036,13037,13038,13039,13040,13041,13042,13043,13044,13045,13046,13047,13048,13049,13050,13051,13052,13053,13054,13055,13056,13057,13058,13059,13060,13061,13062,13063,13064,13065,13066,13067,13068,13069,13070,13071,13072,13073,13074,13075,13076,13077,13078,13079,13080,13081,13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13095,13096,13097,13098,13099,13100,13101,13102,13103,13104,13105,13106,13107,13108,13109,13110,13111,13112,13113,13114,13115,13116,13117,13118,13119,13120,13121,13122,13123,13124,13125,13126,13127,13128,13129,13130,13131,13132,13133,13134,13135,13136,13137,13138,13139,13140,13141,13142,13143,13144,13145,13146,13147,13148,13149,13150,13151,13152,13153,13154,13155,13156,13157,13158,13159,13160,13161,13162,13163,13164,13165,13166,13167,13168,13169,13170,13171,13172,13173,13174,13175,13176,13177,13178,13179,13180,13181,13182,13183,13184,13185,13186,13187,13188,13189,13190,13191,13192,13193,13194,13195,13196,13197,13198,13199,13200,13201,13202,13203,13204,13205,13206,13207,13208,13209,13210,13211,13212,13213,13214,13215,13216,13217,13218,13219,13220,13221,13222,13223,13224,13225,13226,13227,13228,13229,13230,13231,13232,13233,13234,13235,13236,13237,13238,13239,13240,13241,13242,13243,13244,13245,13246,13247,13248,13249,13250,13251,13252,13253,13254,13255,13256,13257,13258,13259,13260,13261,13262,13263,13264],[0.3330000042915344,0.3330000042915344,0.3330000042915344]],[[9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,9347,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,9374,9375,9376,9377,9378,9379,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405,9406,9407,9408,9409,9410,9411,9412,9413,9414,9415,9416,9417,9418,9419,9420,9421,9422,9423,9424,9425,9426,9427,9428,9429,9430,9431,9432,9433,9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446,9447,9448,9449,9450,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461,9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,9473,9474,9475,9476,9477,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,9489,9490,9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506,9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599,9600,9601,9602,9603,9604,9605,9606,9607,9608,9609,9610,9611,9612,9613,9614,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628,9629,9630,9631,9632,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658,9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,9673,9674,9675,9676,9677,9678,9679,9680,9681,9682,9683,9684,9685,9686,9687,9688,9689,9690,9691,9692,9693,9694,9695,9696,9697,9698,9699,9700,9701,9702,9703,9704,9705,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715,9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731,9732,9733,9734,9735,11654,11655,11656,11657,11658,11659,11660,11661,11662,11663,11664,11665,11666,11667,11668,11669,11670,11671,11672,11673,11674,11675,11676,11677,11678,11679,11680,11681,11682,11683,11684,11685,11686,11687,11688,11689,11690,11691,11692,11693,11694,11695,11696,11697,11698,11699,11700,11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,11716,11717,11718,11719,11720,11721,11722,11723,11724,11725,11726,11727,11728,11729,11730,11731,11732,11733,11734,11735,11736,11737,11738,11739,11740,11741,11742,11743,11744,11745,11746,11747,11748,11749,11750,11751,11752,11753,11754,11755,11756,11757,11758,11759,11760,11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776,11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11788,11789,11790,11791,11792,11793,11794,11795,11796,11797,11798,11799,11800,11801,11802,11803,11804,11805,11806,11807,11808,11809,11810,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821,11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,11835,11836,11837,11838,11839,11840,11841,11842,11843,11844,11845],[0.8999999761581421,0.24899999797344208,0]],[[11532,11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548,11549,11550,11551,11552,11553,11554,11555,11556,11557,11558,11559,11560,11561,11562,11563,11564,11565,11566,11567,11568,11569,11570,11571,11572,11573,11574,11575,11576,11577,11578,11579,11580,11581,11582,11583,11584,11585,11586,11587,11588,11589,11590,11591,11592,11593,11594,11595,11596,11597,11598,11599,11600,11601,11602,11603,11604,11605,11606,11607,11608,11609,11610,11611,11612,11613,11614,11615,11616,11617,11618,11619,11620,11621,11622,11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,11634,11635,11636,11637,11638,11639,11640,11641,11642,11643,11644,11645,11646,11647,11648,11649,11650,11651,11652,11653],[0,0.44999998807907104,0.8999999761581421]],[[11846,11847,11848,11849,11850,11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866,11867,11868,11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882,11883,11884,11885,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897,11898,11899,11900],[0.20000000298023224,0.20000000298023224,0.546999990940094]],[[4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,4981,4982,4983,4984,4985,4986,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,5000,5001,5002,5003,5004,5005,5006,5007,5008,5009,5010,5011,5012,5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,5040,5041,5042,5043,5044,5045,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,5056,5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072,5073,5074,5075,5076,5077,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,5113,5114,5115,5116,5117,5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149,5150,5151,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177,5178,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192,5193,5194,5195,5196,5197,5198,5199,5200,5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,5211,5212,5213,5214,5215,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,5248,5249,5250,5251,5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283,5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385,5386,5387,5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440,5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488,5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552,5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600,5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632,5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664,5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712,5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728,5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744,5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760,5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776,5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116,6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132,6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164,6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180,6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196,6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212,6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,6224,6225,6226,6227,6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243,6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259,6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275,6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,6286,6287,6288,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305,6306,6307,6308,6309,6310,6311,6312,6313,6314,6315,6316,6317,6318,6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334,6335,6336,6337,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349,6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365,6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381,6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397,6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,6411,6412,6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,6426,6427,6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6455,6456,6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474,6475,6476,6477,6478,6479,6480,6481,6482,6483,6484,6485,6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,6497,6498,6499,6500,6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516,6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532,6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548,6549,6550,6551,6552,6553,6554,6555,6556,6557,6558,6559,6560,6561,6562,6563,6564,6565,6566,6567,6568,6569,6570,6571,6572,6573,6574,6575,6576,6577,6578,6579,6580,6581,6582,6583,6584,6585,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,6621,6622,6623,6624,6625,6626,6627,6628,6629,6630,6631,6632,6633,6634,6635,6636,6637,6638,6639,6640,6641,6642,6643,6644,6645,6646,6647,6648,6649,6650,6651,6652,6653,6654,6655,6656,6657,6658,6659,6660,6661,6662,6663,6664,6665,6666,6667,6668,6669,6670,6671,6672,6673,6674,6675,6676,6677,6678,6679,6680,6681,6682,6683,6684,6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,6698,6699,6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715,6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731,6732,6733,6734,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761,6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777,6778,6779,6780,6781,6782,6783,6784,6785,6786,6787,6788,6789,6790,6791,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,6810,6811,6812,6813,6814,6815,6816,6817,6818,6819,6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,6847,6848,6849,6850,6851,6852,6853,6854,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,6878,6879,6880,6881,6882,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894,6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,6905,6906,6907,6908,6909,6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925,6926,6927,6928,6929,6930,6931,6932,6933,6934,6935,6936,6937,6938,6939,6940,6941,6942,6943,6944,6945,6946,6947,6948,6949,6950,6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968,6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984,6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,6995,6996,6997,6998,6999,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042,7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074,7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138,7139,7140,7141,7142,7143,7144,7145,7146,7147,7148,7149,7150,7151,7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167,7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183,7184,7185,7186,7187,7188,7189,7190,7191,7192,7193,7194,7195,7196,7197,7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213,7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261,7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277,7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7294,7295,7296,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308,7309,7310,7311,7312,7313,7314,7315,7316,7317,7318,7319,7320,7321,7322,7323,7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339,7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,7354,7355,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369,7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385,7386,7387,7388,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400,7401,7402,7403,7404,7405,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415,7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431,7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447,7448,7449,7450,7451,7452,7453,7454,7455,7456,7457,7458,7459,7460,7461,7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491,7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503,7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551,7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567,7568,7569,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582,7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615,7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631,7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659,7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,7671,7672,7673,7674,7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690,7691,7692,7693,7694,7695,7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7706,7707,7708,7709,7710,7711,7712,7713,7714,7715,7716,7717,7718,7719,7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,7732,7733,7734,7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750,7751,7752,7753,7754,7755,7756,7757,7758,7759,7760,7761,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778,7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794,7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,7806,7807,7808,7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855,7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887,7888,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920,7921,7922,7923,7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983,7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047,8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271,8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325,8326,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673,8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749,8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,8764,8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780,8781,8782,8783,8784,8785,8786,8787,8788,8789,8790,8791,8792,8793,8794,8795,8796,8797,8798,8799,8800,8801,8802,8803,8804,8805,8806,8807,8808,8809,8810,8811,8812,8813,8814,8815,8816,8817,8818,8819,8820,8821,8822,8823,8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839,8840,8841,8842,8843,8844,8845,8846,8847,8848,8849,8850,8851,8852,8853,8854,8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870,8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901,8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917,8918,8919,8920,8921,8922,8923,8924,8925,8926,8927,8928,8929,8930,8931,8932,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,8944,8945,8946,8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962,8963,8964,8965,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977,8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,9022,9023,9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039,9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055,9056,9057,9058,9059,9060,9061,9062,9063,9064,9065,9066,9067,9068,9069,9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085,9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101,9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117,9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133,9134,9135,9136,9137,9138,9139,9140,9141,9142,9143,9144,9145,9146,9147,9148,9149,9150,9151,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163,9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,9176,9177,9178,9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194,9195,9196,9197,9198,9199,9200,9201,9202,9203,9204,9205,9206,9207,9208,9209,9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,9223,9224,9225],[0.8999999761581421,0,0.44999998807907104]],[[1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855,1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,2118,2119,2120,2121,2122,2123,2124,2125,2126,2127,2128,2129,2130,2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142,2143,2144,2145,2146,2147,2148,2149,2150,2151,2152,2153,2154,2155,2156,2157,2158,2159,2160,2161,2162,2163,2164,2165,2166,2167,2168,2169,2170,2171,2172,2173,2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2186,2187,2188,2189,2190,2191,2192,2193,2194,2195,2196,2197,2198,2199,2200,2201,2202,2203,2204,2205,2206,2207,2208,2209,2210,2211,2212,2213,2214,2215,2216,2217,2218,2219,2220,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2290,2291,2292,2293,2294,2295,2296,2297,2298,2299,2300,2301,2302,2303,2304,2305,2306,2307,2308,2309,2310,2311,2312,2313,2314,2315,2316,2317,2318,2319,2320,2321,2322,2323,2324,2325,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335,2336,2337,2338,2339,2340,2341,2342,2343,2344,2345,2346,2347,2348,2349,2350,2351,2352,2353,2354,2355,2356,2357,2358,2359,2360,2361,2362,2363,2364,2365,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2384,2385,2386,2387,2388,2389,2390,2391,2392,2393,2394,2395,2396,2397,2398,2399,2400,2401,2402,2403,2404,2405,2406,2407,2408,2409,2410,2411,2412,2413,2414,2415,2416,2417,2418,2419,2420,2421,2422,2423,2424,2425,2426,2427,2428,2429,2430,2431,2432,2433,2434,2435,2436,2437,2438,2439,2440,2441,2442,2443,2444,2445,2446,2447,2448,2449,2450,2451,2452,2453,2454,2455,2456,2457,2458,2459,2460,2461,2462,2463,2464,2465,2466,2467,2468,2469,2470,2471,2472,2473,2474,2475,2476,2477,2478,2479,2480,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507,2508,2509,2510,2511,2512,2513,2514,2515,2516,2517,2518,2519,2520,2521,2522,2523,2524,2525,2526,2527,2528,2529,2530,2531],[0.8999999761581421,0,0]],[[11113,11114,11115,11116,11117,11118,11119,11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132,11133,11134,11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150,11151,11152,11153,11154,11155,11156,11157,11158,11159,11160,11161,11162,11163,11164,11165,11166,11167,11168,11169,11170,11171,11172,11173,11174,11175,11176,11177,11178,11179,11180,11181,11182,11183,11184,11185,11186,11187,11188,11189,11190,11191,11192,11193,11194,11195,11196,11197,11198,11199,11200,11201,11202,11203,11204,11205,11206,11207,11208,11209,11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225,11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241,11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,11252,11253,11254,11255,11256,11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272,11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288,11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304,11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,11315,11316,11317,11318,11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334,11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,11348,11349,11350,11351,11352,11353,11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365,11366,11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,11378,11379,11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395,11396,11397,11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410,11411,11412,11413,11414,11415,11416,11417,11418,11419,11420,11421,11422,11423,11424,11425,11426,11427,11428,11429,11430,11431,11432,11433,11434,11435,11436,11437,11438,11439,11440,11441,11442,11443,11444,11445,11446,11447,11448,11449,11450,11451,11452,11453,11454,11455,11456,11457,11458,11459,11460,11461,11462,11463,11464,11465,11466,11467,11468,11469,11470,11471,11472,11473,11474,11475,11476,11477,11478,11479,11480,11481,11482,11483,11484,11485,11486,11487,11488,11489,11490,11491,11492,11493,11494,11495,11496,11497,11498,11499,11500,11501,11502,11503,11504,11505,11506,11507,11508,11509,11510,11511,11512,11513,11514,11515,11516,11517,11518,11519,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,11530,11531],[1,1,1]],[[2532,2533,2534,2535,2536,2537,2538,2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,2586,2587,2588,2589,2590,2591,2592,2593,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612,2613,2614,2615,2616,2617,2618,2619,2620,2621,2622,2623,2624,2625,2626,2627,2628,2629,2630,2631,2632,2633,2634,2635,2636,2637,2638,2639,2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674,2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690,2691,2692,2693,2694,2695,2696,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,2754,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2782,2783,2784,2785,2786,2787,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,2861,2862,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,2944,2945,2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961,2962,2963,2964,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976,2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066,3067,3068,3069,3070,3071,3072,3073,3074,3075,3076,3077,3078,3079,3080,3081,3082,3083,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,3109,3110,3111,3112,3113,3114,3115,3116,3117,3118,3119,3120,3121,3122,3123,3124,3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172,3173,3174,3175,3176,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187,3188,3189,3190,3191,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217,3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232,3233,3234,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248,3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264,3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295,3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311,3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327,3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343,3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359,3360,3361,3362,3363,3364,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374,3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,3388,3389,3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3410,3411,3412,3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3439,3440,3441,3442,3443,3444,3445,3446,3447,3448,3449,3450,3451,3452,3453,3454,3455,3456,3457,3458,3459,3460,3461,3462,3463,3464,3465,3466,3467,3468,3469,3470,3471,3472,3473,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486,3487,3488,3489,3490,3491,3492,3493,3494,3495,3496,3497,3498,3499,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,3512,3513,3514,3515,3516,3517,3518,3519,3520,3521,3522,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541,3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573,3574,3575,3576,3577,3578,3579,3580,3581,3582,3583,3584,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679,3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,3701,3702,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3715,3716,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743,3744,3745,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,3767,3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,3779,3780,3781,3782,3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795,3796,3797,3798,3799,3800,3801,3802,3803,3804,3805,3806,3807,3808,3809,3810,3811,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,3822,3823,3824,3825,3826,3827,3828,3829,3830,3831,3832,3833,3834,3835,3836,3837,3838,3839,3840,3841,3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887,3888,3889,3890,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942,3943,3944,3945,3946,3947,3948,3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964,3965,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,3978,3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,3992,3993,3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079,4080,4081,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098,4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,4138,4139,4140,4141,4142,4143,4144,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157,4158,4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173,4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189,4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205,4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,4220,4221,4222,4223,4224,4225,4226,4227,4228,4229,4230,4231,4232,4233,4234,4235,4236,4237,4238,4239,4240,4241,4242,4243,4244,4245,4246,4247,4248,4249,4250,4251,4252,4253,4254,4255,4256,4257,4258,4259,4260,4261,4262,4263,4264,4265,4266,4267,4268,4269,4270,4271,4272,4273,4274,4275,4276,4277,4278,4279,4280,4281,4282,4283,4284,4285,4286,4287,4288,4289,4290,4291,4292,4293,4294,4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310,4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326,4327,4328,4329,4330,4331,4332,4333,4334,4335,4336,4337,4338,4339,4340,4341,4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357,4358,4359,4360,4361,4362,4363,4364,4365,4366,4367,4368,4369,4370,4371,4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387,4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,4417,4418,4419,4420,4421,4422,4423,4424,4425,4426,4427,4428,4429,4430,4431,4432,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,4443,4444,4445,4446,4447,4448,4449,4450,4451,4452,4453,4454,4455,4456,4457,4458,4459,4460,4461,4462,4463,4464,4465,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476,4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,4490,4491,4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507,4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,4519,4520,4521,4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,4536,4537,4538,4539,4540,4541,4542,4543,4544,4545,4546,4547,4548,4549,4550,4551,4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567,4568,4569,4570,4571,4572,4573,4574,4575,4576,4577,4578,4579,4580,4581,4582,4583,4584,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611,4612,4613,4614,4615,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626,4627,4628,4629,4630,4631,4632,4633,4634,4635,4636,4637,4638,4639,4640,4641,4642,4643,4644,4645,4646,4647,4648,4649,4650,4651,4652,4653,4654,4655,4656,4657,4658,4659,4660,4661,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672,4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,4683,4684,4685,4686,4687,4688,4689,4690,4691,4692,4693,4694,4695,4696,4697,4698,4699,4700,4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,4712,4713,4714,4715,4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730,4731,4732,4733,4734,4735,4736,4737,4738,4739,4740,4741,4742,4743,4744,4745,4746,4747,4748,4749,4750,4751,4752,4753,4754,4755,4756,4757,4758,4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,4769,4770,4771,4772,4773,4774,4775,4776,4777,4778,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788,4789,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803,4804,4805,4806,4807,4808,4809,4810,4811,4812,4813,4814,4815,4816,4817,4818,4819,4820,4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832,4833,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847,4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863,4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879,4880,4881,4882,4883,4884,4885,4886,4887,4888,4889,4890,4891,4892,4893,4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909,4910,4911,4912,4913,4914,4915,4916,4917,4918,4919,4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,4932,4933,4934,4935,4936,4937,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4955,4956,4957,4958,4959,4960,4961,4962,4963],[0,0.5,0]],[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727],[0.8999999761581421,0.8999999761581421,0]]]}],\"edges\":[],\"wires\":[],\"faces\":[],\"points\":[],\"polylines\":[],\"polygons\":[{\"name\":\"block_index\",\"data_type\":\"Float\",\"data_size\":1,\"data\":[[[1029],-1]]}],\"collections\":[{\"name\":\"name\",\"data_type\":\"String\",\"data_size\":1,\"data\":[]}],\"model\":[[\"longitude\",100.3232],[\"latitude\",5.453]]}}", "meta": {"hexsha": "e9610e5eb864ae9486998abceeb604fc28236391", "size": 290140, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "assets/testing/test/test.gi", "max_stars_repo_name": "design-automation/mobius-parametric-modeller-0-4-30", "max_stars_repo_head_hexsha": "e3d048f68dfc6b32978d95543d06a2b5122367b3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2018-11-19T02:30:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-15T03:38:39.000Z", "max_issues_repo_path": "assets/testing/test/test.gi", "max_issues_repo_name": "design-automation/mobius-parametric-modeller-0-4-30", "max_issues_repo_head_hexsha": "e3d048f68dfc6b32978d95543d06a2b5122367b3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 654, "max_issues_repo_issues_event_min_datetime": "2018-12-10T04:06:51.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-07T14:47:20.000Z", "max_forks_repo_path": "assets/testing/test/test.gi", "max_forks_repo_name": "design-automation/mobius-parametric-modeller-0-4-30", "max_forks_repo_head_hexsha": "e3d048f68dfc6b32978d95543d06a2b5122367b3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2018-12-20T02:12:13.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-25T23:15:11.000Z", "avg_line_length": 290140.0, "max_line_length": 290140, "alphanum_fraction": 0.7991176673, "num_tokens": 85114, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.28457600421652673, "lm_q2_score": 0.017442480841664682, "lm_q1q2_score": 0.004963711501544256}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    Percent ::= '%'\n    _\n    a b c d e f g h i j k l m n o p q r s t u v w x y z\n    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\n%End\n\n%Headers\n    /.\n        static readonly int[] tokenKind = new int[128];\n        static bool __b_init = init_block();\n        static bool init_block()\n        {\n            tokenKind['$'] = $sym_type.$prefix$DollarSign$suffix$;\n            tokenKind['%'] = $sym_type.$prefix$Percent$suffix$;\n            tokenKind['_'] = $sym_type.$prefix$_$suffix$;\n\n            tokenKind['a'] = $sym_type.$prefix$a$suffix$;\n            tokenKind['b'] = $sym_type.$prefix$b$suffix$;\n            tokenKind['c'] = $sym_type.$prefix$c$suffix$;\n            tokenKind['d'] = $sym_type.$prefix$d$suffix$;\n            tokenKind['e'] = $sym_type.$prefix$e$suffix$;\n            tokenKind['f'] = $sym_type.$prefix$f$suffix$;\n            tokenKind['g'] = $sym_type.$prefix$g$suffix$;\n            tokenKind['h'] = $sym_type.$prefix$h$suffix$;\n            tokenKind['i'] = $sym_type.$prefix$i$suffix$;\n            tokenKind['j'] = $sym_type.$prefix$j$suffix$;\n            tokenKind['k'] = $sym_type.$prefix$k$suffix$;\n            tokenKind['l'] = $sym_type.$prefix$l$suffix$;\n            tokenKind['m'] = $sym_type.$prefix$m$suffix$;\n            tokenKind['n'] = $sym_type.$prefix$n$suffix$;\n            tokenKind['o'] = $sym_type.$prefix$o$suffix$;\n            tokenKind['p'] = $sym_type.$prefix$p$suffix$;\n            tokenKind['q'] = $sym_type.$prefix$q$suffix$;\n            tokenKind['r'] = $sym_type.$prefix$r$suffix$;\n            tokenKind['s'] = $sym_type.$prefix$s$suffix$;\n            tokenKind['t'] = $sym_type.$prefix$t$suffix$;\n            tokenKind['u'] = $sym_type.$prefix$u$suffix$;\n            tokenKind['v'] = $sym_type.$prefix$v$suffix$;\n            tokenKind['w'] = $sym_type.$prefix$w$suffix$;\n            tokenKind['x'] = $sym_type.$prefix$x$suffix$;\n            tokenKind['y'] = $sym_type.$prefix$y$suffix$;\n            tokenKind['z'] = $sym_type.$prefix$z$suffix$;\n\n            tokenKind['A'] = $sym_type.$prefix$A$suffix$;\n            tokenKind['B'] = $sym_type.$prefix$B$suffix$;\n            tokenKind['C'] = $sym_type.$prefix$C$suffix$;\n            tokenKind['D'] = $sym_type.$prefix$D$suffix$;\n            tokenKind['E'] = $sym_type.$prefix$E$suffix$;\n            tokenKind['F'] = $sym_type.$prefix$F$suffix$;\n            tokenKind['G'] = $sym_type.$prefix$G$suffix$;\n            tokenKind['H'] = $sym_type.$prefix$H$suffix$;\n            tokenKind['I'] = $sym_type.$prefix$I$suffix$;\n            tokenKind['J'] = $sym_type.$prefix$J$suffix$;\n            tokenKind['K'] = $sym_type.$prefix$K$suffix$;\n            tokenKind['L'] = $sym_type.$prefix$L$suffix$;\n            tokenKind['M'] = $sym_type.$prefix$M$suffix$;\n            tokenKind['N'] = $sym_type.$prefix$N$suffix$;\n            tokenKind['O'] = $sym_type.$prefix$O$suffix$;\n            tokenKind['P'] = $sym_type.$prefix$P$suffix$;\n            tokenKind['Q'] = $sym_type.$prefix$Q$suffix$;\n            tokenKind['R'] = $sym_type.$prefix$R$suffix$;\n            tokenKind['S'] = $sym_type.$prefix$S$suffix$;\n            tokenKind['T'] = $sym_type.$prefix$T$suffix$;\n            tokenKind['U'] = $sym_type.$prefix$U$suffix$;\n            tokenKind['V'] = $sym_type.$prefix$V$suffix$;\n            tokenKind['W'] = $sym_type.$prefix$W$suffix$;\n            tokenKind['X'] = $sym_type.$prefix$X$suffix$;\n            tokenKind['Y'] = $sym_type.$prefix$Y$suffix$;\n            tokenKind['Z'] = $sym_type.$prefix$Z$suffix$;\n            return true;\n        }\n    \n         public   static int getKind(char c)\n        {\n            return (((c & 0xFFFFFF80) == 0) /* 0 <= c < 128? */ ? tokenKind[c] : 0);\n        }\n    ./\n%End\n\n", "meta": {"hexsha": "77a23e259f58fa23803a2f0d4f700cd3dbf1cad3", "size": 3748, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/include/csharp/KWLexerMapF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/include/csharp/KWLexerMapF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/include/csharp/KWLexerMapF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.7073170732, "max_line_length": 84, "alphanum_fraction": 0.5240128068, "num_tokens": 1141, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.14414884567931804, "lm_q2_score": 0.033589505408248815, "lm_q1q2_score": 0.004841888431538277}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\n# Configuration of system dependent parameters\n# ============================================\n\n#F Global code generation options record\n#F\nSpiralDefaults := rec();\n\n\nSPL_DEFAULTS := SpiralDefaults;\n", "meta": {"hexsha": "181b1c3d92f6c98a467a7a088bef81f0c3eccf48", "size": 281, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/config.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/config.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/config.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 18.7333333333, "max_line_length": 53, "alphanum_fraction": 0.640569395, "num_tokens": 60, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.1403362566809061, "lm_q2_score": 0.03410042706203434, "lm_q1q2_score": 0.004785526285106168}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    Percent ::= '%'\n    _\n    a b c d e f g h i j k l m n o p q r s t u v w x y z\n%End\n\n%Headers\n    /.\n        //\n        // Each upper case letter is mapped into its corresponding\n        // lower case counterpart. For example, if an 'A' appears\n        // in the input, it is mapped into $sym_type::$prefix$a$suffix$ just\n        // like 'a'.\n        //\n         inline static int tokenKind[128] = {};\n        \n        static bool static_init()\n        {\n            tokenKind['$'] = $sym_type::$prefix$DollarSign$suffix$;\n            tokenKind['%'] = $sym_type::$prefix$Percent$suffix$;\n            tokenKind['_'] = $sym_type::$prefix$_$suffix$;\n\n            tokenKind['a'] = $sym_type::$prefix$a$suffix$;\n            tokenKind['b'] = $sym_type::$prefix$b$suffix$;\n            tokenKind['c'] = $sym_type::$prefix$c$suffix$;\n            tokenKind['d'] = $sym_type::$prefix$d$suffix$;\n            tokenKind['e'] = $sym_type::$prefix$e$suffix$;\n            tokenKind['f'] = $sym_type::$prefix$f$suffix$;\n            tokenKind['g'] = $sym_type::$prefix$g$suffix$;\n            tokenKind['h'] = $sym_type::$prefix$h$suffix$;\n            tokenKind['i'] = $sym_type::$prefix$i$suffix$;\n            tokenKind['j'] = $sym_type::$prefix$j$suffix$;\n            tokenKind['k'] = $sym_type::$prefix$k$suffix$;\n            tokenKind['l'] = $sym_type::$prefix$l$suffix$;\n            tokenKind['m'] = $sym_type::$prefix$m$suffix$;\n            tokenKind['n'] = $sym_type::$prefix$n$suffix$;\n            tokenKind['o'] = $sym_type::$prefix$o$suffix$;\n            tokenKind['p'] = $sym_type::$prefix$p$suffix$;\n            tokenKind['q'] = $sym_type::$prefix$q$suffix$;\n            tokenKind['r'] = $sym_type::$prefix$r$suffix$;\n            tokenKind['s'] = $sym_type::$prefix$s$suffix$;\n            tokenKind['t'] = $sym_type::$prefix$t$suffix$;\n            tokenKind['u'] = $sym_type::$prefix$u$suffix$;\n            tokenKind['v'] = $sym_type::$prefix$v$suffix$;\n            tokenKind['w'] = $sym_type::$prefix$w$suffix$;\n            tokenKind['x'] = $sym_type::$prefix$x$suffix$;\n            tokenKind['y'] = $sym_type::$prefix$y$suffix$;\n            tokenKind['z'] = $sym_type::$prefix$z$suffix$;\n\n            tokenKind['A'] = $sym_type::$prefix$a$suffix$;\n            tokenKind['B'] = $sym_type::$prefix$b$suffix$;\n            tokenKind['C'] = $sym_type::$prefix$c$suffix$;\n            tokenKind['D'] = $sym_type::$prefix$d$suffix$;\n            tokenKind['E'] = $sym_type::$prefix$e$suffix$;\n            tokenKind['F'] = $sym_type::$prefix$f$suffix$;\n            tokenKind['G'] = $sym_type::$prefix$g$suffix$;\n            tokenKind['H'] = $sym_type::$prefix$h$suffix$;\n            tokenKind['I'] = $sym_type::$prefix$i$suffix$;\n            tokenKind['J'] = $sym_type::$prefix$j$suffix$;\n            tokenKind['K'] = $sym_type::$prefix$k$suffix$;\n            tokenKind['L'] = $sym_type::$prefix$l$suffix$;\n            tokenKind['M'] = $sym_type::$prefix$m$suffix$;\n            tokenKind['N'] = $sym_type::$prefix$n$suffix$;\n            tokenKind['O'] = $sym_type::$prefix$o$suffix$;\n            tokenKind['P'] = $sym_type::$prefix$p$suffix$;\n            tokenKind['Q'] = $sym_type::$prefix$q$suffix$;\n            tokenKind['R'] = $sym_type::$prefix$r$suffix$;\n            tokenKind['S'] = $sym_type::$prefix$s$suffix$;\n            tokenKind['T'] = $sym_type::$prefix$t$suffix$;\n            tokenKind['U'] = $sym_type::$prefix$u$suffix$;\n            tokenKind['V'] = $sym_type::$prefix$v$suffix$;\n            tokenKind['W'] = $sym_type::$prefix$w$suffix$;\n            tokenKind['X'] = $sym_type::$prefix$x$suffix$;\n            tokenKind['Y'] = $sym_type::$prefix$y$suffix$;\n            tokenKind['Z'] = $sym_type::$prefix$z$suffix$;\n            return true;\n        };\n        inline static bool ddddd = static_init();\n         int getKind(wchar_t c)\n        {\n            return (c < 128 ? tokenKind[c] : 0);\n        }\n    ./\n%End\n\n", "meta": {"hexsha": "8dbda68720f5135ea6c84099113684535620ee73", "size": 3954, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/include/rt_cpp/KWLexerFoldedCaseMapF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/include/rt_cpp/KWLexerFoldedCaseMapF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/include/rt_cpp/KWLexerFoldedCaseMapF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.4482758621, "max_line_length": 76, "alphanum_fraction": 0.5199797673, "num_tokens": 1134, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.15817436068510185, "lm_q2_score": 0.030214586084979088, "lm_q1q2_score": 0.004779172837356542}}
{"text": "#\n# AoC: Advent of Code solutions in GAP\n#\n# Implementations\n#\nAoC.Year2019 := rec();\n\nInstallMethod( Puzzle,\n    [IsString, IsString, IsFunction, IsFunction],\n    function( Year, Day, PartOne, PartTwo )\n        local puzzle;\n        puzzle := rec(\n            Input := function( )\n                return InputTextFile(\n                    Filename(\n                        DirectoriesPackageLibrary( \"AoC\", StringFormatted( \"input/{1}\", Year ) )[1],\n                        StringFormatted( \"day{1}.txt\", Day )\n                    )\n                );\n            end,\n            PartOne := PartOne,\n            PartTwo := PartTwo\n        );\n        Objectify( TYPE_PUZZLE, puzzle );\n        return puzzle;\n    end );\nInstallMethod( Input,\n  \"of a puzzle\",\n  [ IsPuzzle ],\n  puzzle -> puzzle!.Input() );\nInstallMethod( PartOne,\n  \"of a puzzle\",\n  [ IsPuzzle ],\n  puzzle -> puzzle!.PartOne );\nInstallMethod( PartTwo,\n  \"of a puzzle\",\n  [ IsPuzzle ],\n  puzzle -> puzzle!.PartTwo );\n", "meta": {"hexsha": "760f6670e1cf04e5aaa5ef7836229116f05e3011", "size": 982, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/AoC.gi", "max_stars_repo_name": "yurrriq/advent-of-code", "max_stars_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-11-04T10:32:47.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-05T07:36:22.000Z", "max_issues_repo_path": "gap/AoC.gi", "max_issues_repo_name": "yurrriq/aoc19", "max_issues_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/AoC.gi", "max_forks_repo_name": "yurrriq/aoc19", "max_forks_repo_head_hexsha": "ee83efa138322b5dbbda9f4aeac75481a9cd49fe", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-02-26T19:27:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-26T19:27:21.000Z", "avg_line_length": 25.1794871795, "max_line_length": 100, "alphanum_fraction": 0.5264765784, "num_tokens": 237, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.17781085205034783, "lm_q2_score": 0.026759286193018966, "lm_q1q2_score": 0.0047580914782398105}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nDeclare(_StandardMeasureVerify);\n\nSetMakeOptsPThreads:=function(opts)\n   opts.profile.makeopts.LDFLAGS:=Concat(When(IsBound(opts.profile.makeopts.LDFLAGS),opts.profile.makeopts.LDFLAGS,\"\"),\" -lpthread -L/lib/tls -lm\");\n   opts.profile.makeopts.ADDSRC:=Concat(\"../../../lib/smp2.c \",When(IsBound(opts.profile.makeopts.ADDSRC),opts.profile.makeopts.ADDSRC,\"\"));\n   opts.profile.makeopts.TIMER:=\"../common/time_threads.c\";\n   opts.profile.makeopts.TIMER_OPTS:=\"\";\nend;\n\nSetMakeOptsSSE:=function(opts)\n   opts.profile.makeopts.CFLAGS:=Concat(opts.profile.makeopts.CFLAGS,\" -msse3 -vec-report=0\");\nend;\n\nSetMakeOptsOpenMP:=function(opts)\n   opts.profile.makeopts.CFLAGS:=Concat(opts.profile.makeopts.CFLAGS,\" -openmp -openmp-report0\");\nend;\n\nSetMakeOptsAffinity:=function(opts)\n   opts.profile.makeopts.CFLAGS:=Concat(opts.profile.makeopts.CFLAGS,\" -DUSE_SCHED_AFFINITY\");\nend;\n\nSetMakeOptsLibgen:=function(opts)\n   opts.profile.makeopts.CFLAGS:=Concat(opts.profile.makeopts.CFLAGS,\" -fno-alias -fno-fnalias -fno-inline-functions\");\nend;\n\nSetMakeOptsAssembly:=function(opts)\n   opts.profile.makeopts.CFLAGS:=Concat(opts.profile.makeopts.CFLAGS,\" -save-temps\");\nend;\n\n\n\n\n_default_makeopts := rec(\n    GAP := \"gap.c\",\n    STUB := \"stub.h\",\n);\n\n#\n## default options for sim-outorder\n#\n# simple scalar uses a parametrized architecture. these params\n# were inferred from details in the following paper:\n#\n# \"Efficient Resource Sharing in Concurrent Error Detecting\n# Superscalar Microarchitectures\"\n#\n# Jared C. Smolens, Jangwoo Kim, James C. Hoe, and Babak Falsafi\n#\n# 37th Annual IEEE/ACM International Symposium on Microarchitecture\n#\n\ndefault_profiles := rec(\n    no_compile := rec(\n        name := \"no-compile\",\n        meas := (a,b) -> 1000,\n        verify := (a,b) -> false,\n        makeopts := rec( CFLAGS := \"\" )\n    ),\n\n    # LINUX profiles\n    ###############\n\n    linux_power_gcc:=\n    rec(\n        name := \"linux-power-gcc\",\n        makeopts := rec(\n            CFLAGS := \"\",\n            CC := \"gcc\" ),\n        outdir := \"/tmp/spiral/power\",\n        meas := (a, b) -> _StandardMeasureVerify(a, b, \"\"),\n        verify := (a, b) -> _StandardMeasureVerify(a, b, \"verify\") ),\n\n    arm_icount := rec(\n        name := \"arm-icount\",\n        makeopts := rec(\n            CFLAGS := \"-O2 -std=c99 -fomit-frame-pointer\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_arm := rec(\n        name := \"linux-arm\",\n        makeopts := rec(\n            CFLAGS := \"-O2 -std=c99 -fomit-frame-pointer\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_icc := rec(\n        name := \"linux-x86\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O3 -w -std=c99 -fomit-frame-pointer -vec-report0\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_avx_icc := rec(\n        name := \"linux-x86\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O3 -w -mavx -std=c99 -fomit-frame-pointer -vec-report0\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_arm_pthread := rec(\n        name := \"linux-arm\",\n        makeopts := rec(\n            CFLAGS := \"-O3 -std=c99 -fomit-frame-pointer\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"pthread\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verifyPThread\")\n    ),\n\n    linux_x86_icc_openmp := rec(\n        name := \"linux-x86\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O -openmp -w -std=c99 -fomit-frame-pointer\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_gcc := rec(\n        name := \"linux-x86\",\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O2 -Wall -fomit-frame-pointer -march=native -std=c99\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_cuda := rec(\n        name := \"linux-cuda\",\n        makeopts := rec(\n            CC := \"nvcc\",\n            CFLAGS := \"-O2 \",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_threads := rec(\n        name := \"linux-x86\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O -Wall -w -std=c99 -msse2\",\n            LDFLAGS := \"-lpthread -L/lib/tls -lm\",\n            ADDSRC := \"../../../lib/smp2.c\",\n            TIMER := \"../common/time_threads.c\",\n            TIMER_OPTS := \"\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_icc_threads := rec(\n        name := \"linux-x86\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O -Wall -std=c99 -openmp\",\n            LDFLAGS := \"-lguide -lpthread -L/lib/tls -lm\",\n            ADDSRC := \"../../../lib/smp2.c\",\n            TIMER := \"../common/time_threads.c\",\n            TIMER_OPTS := \"\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_perfmon2 := rec(\n        name := \"linux-x86-perfmon2\",\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O3 -fomit-frame-pointer -std=c99\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_newtimer := rec(\n        name := \"linux-x86-newtimer\",\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O3 -fomit-frame-pointer -std=c99\",\n            HOST := \"localhost\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_lrb_icc := rec(\n      name := \"linux-lrb-icc\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-std=c99 -w -vec-report0 -O\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n     linux_lrb_icc_openmp := rec(\n        name := \"linux-lrb-icc\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O2 -openmp -w -std=c99 -fomit-frame-pointer\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_lrb_icc_threads := rec(\n        name := \"linux-lrb-icc\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O2 -Wall -std=c99 -openmp\",\n            LDFLAGS := \"-lguide -lpthread -L/lib/tls -lm\",\n            ADDSRC := \"../../../lib/smp2.c\",\n            TIMER := \"../common/time_threads.c\",\n            TIMER_OPTS := \"\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_x86_vtune := rec(\n        name := \"linux-x86-vtune\",\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O2 -g -fomit-frame-pointer -std=c99\",\n            RUNS := 1000,\n            EVENT := \"L1D_REPL\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_arm_gcc := rec(\n        name := \"linux-arm-gcc\",\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O2 -std=c99 -fomit-frame-pointer\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    # LINUX embedded profiles\n    #########################\n\n    linux_xscale_gcc := rec(\n        name := \"linux-xscale-gcc\",\n        makeopts := rec(\n            CC := \"arm-xscale-linux-gnu-gcc\",\n            CFLAGS := \"-O2\",\n            COMPILER_DIR := \"\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    ti_dsk_tms320c6713 := rec(\n        name := \"ti-dsk-tms320c6713\",\n        makeopts := rec(\n            CFLAGS := \"-O3 -std=c99\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    # MS WINDOWS profiles\n    ##############\n\n    win_x86_vcc := rec(\n        name := \"win-x86-vcc\",\n        makeopts := rec(\n            CC := \"cl\",\n            CFLAGS := \"/O2\",\n        ),\n        outdir := \"/temp/vcc32\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x64_vcc := rec(\n        name := \"win-x64-vcc\",\n        makeopts := rec(\n            CC := \"cl\",\n            CFLAGS := \"/O3\",\n        ),\n        premake := () -> \"vcvarsall.bat amd64 > nul\",\n        outdir := \"/temp/vcc64\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x86_icc := rec(\n        name := \"win-x86-icc\",\n        makeopts := rec(\n            CC := \"icl\",\n            CFLAGS := \"/O3\", # /G7 /QxSSSE3\",\n        ),\n        premake := () -> spiral.IntelC.ia32().premake,\n        outdir := \"/temp/icc32\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x86_icc_openmp := rec(\n        name := \"win-x86-icc-openmp\",\n        makeopts := rec(\n            CC := \"icl\",\n            CFLAGS := \"/O3 /Qopenmp\", # /G7 /QxSSSE3\",\n#            LDFLAGS := \"/NODEFAULTLIB:libc /NODEFAULTLIB:libm /NODEFAULTLIB:libirc /DEFAULTLIB:libcmt /DEFAULTLIB:libmmt /DEFAULTLIB:libircmt\"\n        ),\n        premake := () -> spiral.IntelC.ia32().premake,\n        outdir := \"/temp/icc32omp\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x86_icc_threads := rec(\n        name := \"win-x86-icc-threads\",\n        makeopts := rec(\n            CC := \"icl\",\n            CFLAGS := \"/O3\", # /G7 /QxSSSE3\",\n        ),\n        premake := () -> spiral.IntelC.ia32().premake,\n        outdir := \"/temp/threads32\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x64_icc := rec(\n        name := \"win-x64-icc\",\n        makeopts := rec(\n            CC := \"icl\",\n            CFLAGS := \"/O3 /G7 /QxSSSE3\",\n        ),\n        premake := () -> spiral.IntelC.em64t().premake,\n        outdir := \"/temp/icc64\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x64_icc_openmp := rec(\n        name := \"win-x64-icc-openmp\",\n        makeopts := rec(\n            CC := \"icl\",\n            CFLAGS := \"/O3 /G7 /QxSSSE3 /Qopenmp\",\n#            LDFLAGS := \"/NODEFAULTLIB:libc /NODEFAULTLIB:libm /NODEFAULTLIB:libirc /DEFAULTLIB:libcmt /DEFAULTLIB:libmmt /DEFAULTLIB:libircmt\"\n        ),\n        premake := () -> spiral.IntelC.em64t().premake,\n        outdir := \"/temp/icc64omp\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x64_icc_threads := rec(\n        name := \"win-x64-icc-threads\",\n        makeopts := rec(\n            CC := \"icl\",\n            CFLAGS := \"/O3 /G7 /QxSSSE3\",\n        ),\n        premake := () -> spiral.IntelC.em64t().premake,\n        outdir := \"/temp/threads64\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x86_gcc := rec(\n        name := \"win-x86-gcc\",\n        target := rec(name := \"win-x86-gcc\"),\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O3 -march=native -std=c99 -Wno-implicit -Wno-aggressive-loop-optimizations\",\n        ),\n        outdir := \"/temp\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x86_llvm := rec(\n        name := \"win-x86-llvm\",\n        target := rec(name := \"win-x86-llvm\"),\n        makeopts := rec(\n            CC := \"clang\",\n            CFLAGS := \"-O2 -march=native -std=c99 -Wall\",\n        ),\n        outdir := \"/temp\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_x86_nvcc_gpu := rec(\n        name := \"win-x86-nvcc-gpu\",\n        makeopts := rec(\n            CC := \"nvcc\",\n            CFLAGS := \"\",\n            GAP:= \"gap.cu\"\n        ),\n#   premake := () -> spiral.IntelC.ia32().premake,\n        outdir := \"/temp/nvcc\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n  ),\n\n    win_x64_cuda := rec (\n\tname := \"win-x64-cuda\",\n\ttarget := rec(name := \"win-x64-cuda\"),\n\tmakeopts := rec (\n\t    CC := \"nvcc\",\n\t    CFLAGS := \"\",\n\t),\n        outdir := \"/temp\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    # altivec profiles\n    # ------------------------------------------------------------------------------\n    linux_altivec_gcc := rec(\n        name := \"linux-altivec-gcc\",\n        makeopts := rec(\n            CFLAGS := \"\"\n        ),\n        stubopts := rec(\n        ),\n        outdir := \"/tmp/spiral/altivec\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\"),\n        verifyfftw := (a,b) -> _StandardMeasureVerify(a,b, \"fftwverify\")\n    ),\n\n    # CELL processor profiles\n    ##############\n\n    linux_cellSPU_gcc := rec(\n        name := \"linux-cellSPU-gcc\",\n        makeopts := rec(\n            CFLAGS := \"\"\n        ),\n        stubopts := rec(\n        ),\n        outdir := \"/tmp/spiral/cellSPU\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_cellSPU_gcc_MMM := rec(\n        name := \"linux-cellSPU-gcc-MMM\",\n        makeopts := rec(\n            CFLAGS := \"\"\n        ),\n        stubopts := rec(\n        ),\n        outdir := \"/tmp/spiral/cellSPU\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    linux_cellmultiSPU_gcc := rec(\n        name := \"linux-cellmultiSPU-gcc\",\n        makeopts := rec(\n            CFLAGS := \"\",\n            GAP_PPE := \"gap_ppe.c\",\n            GAP_PPE_TWIDDLES_DECL := \"twiddles-declare.h\",\n            GAP_PPE_TWIDDLES_SET  := \"twiddles-set.h\",\n        ),\n        stubopts := rec(\n            SPUS := 1,\n            MULTIBUFFER_ITERATIONS := 1,\n        ),\n        outdir := \"/tmp/spiral/cellmultiSPU\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\"),\n        verifyfftw := (a,b) -> _StandardMeasureVerify(a,b, \"fftwverify\"),\n        verifyquick  := (a,b) -> _StandardMeasureVerify(a,b, \"quickverify\")\n    ),\n\n    linux_cellmultiSPU_speadk := rec(\n        name := \"linux-cellmultiSPU-speadk\",\n        makeopts := rec(\n            CFLAGS := \"\"\n        ),\n        stubopts := rec(\n            SPUS := 1,\n            MULTIBUFFER_ITERATIONS := 1,\n        ),\n        outdir := \"/tmp/spiral/cellmultiSPUspeadk\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\"),\n        verifyfftw := (a,b) -> _StandardMeasureVerify(a,b, \"fftwverify\")\n    ),\n\n    linux_cellPPU_gcc := rec(\n        name := \"linux-cellPPU-gcc\",\n        makeopts := rec(\n            CFLAGS := \"\"\n        ),\n        stubopts := rec(\n        ),\n        outdir := \"/tmp/spiral/cellPPU\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    win_remote := rec(\n        name := \"win-remote\",\n        host := \"host.domain\",\n        userid := \"user\",\n        passwd := \"password\",\n        outdir := \"S:/temp/win-remote\",\n        hostdir := \".\",\n        exec := \"makecmd.cmd\",\n        remote_cmd := \"remote.cmd\",\n#        meas := (a,b) -> _RemoteMeasureVerify(a,b, \"\"),\n#        verify := (a,b) -> _RemoteMeasureVerify(a,b, \"verify\"),\n#        runmake := (a,b) -> _RemoteRunMake(a,b),\n        remote := true,\n        library := \"vanilla\",\n        remote_library := \"vanilla\",\n        appendSymbol := \"$*\",\n#        download := opts -> _RemoteDownload(opts),\n#        clean := opts -> _RemoteClean(opts),\n        libdir := \"profiler\",\n        dload_cmd := \"download.cmd\",\n        clean_cmd := \"clean.cmd\"\n    ),\n\n    # SIMPLESCALAR 3.0 profiles\n    ##############\n\n    ssnix_simple_gcc_cachemiss := rec(\n        name := \"ssnix-simple-gcc\",\n        makeopts := rec(\n            SSDIR := \"~/ss\",\n            CFLAGS := \"-O2 -I~/ss/include\",\n            SSBIN := \"sim-cache\",\n            SSPARAM := \"dl1.misses\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b,\"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    ssnix_simple_gcc_instr := rec(\n        name := \"ssnix-simple-gcc\",\n        makeopts := rec(\n            SSDIR := \"~/ss\",\n            CFLAGS := \"-O2 -I~/ss/include\",\n            SSBIN := \"sim-outorder\",\n            SSPARAM := \"sim_cycle\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b,\"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    ssnix_simple_gcc_cachemissnew := rec(\n        name := \"ssnix-simple-gcc-new\",\n        makeopts := rec(\n            SSDIR := \"~/ss\",\n            CFLAGS := \"-O2 -I~/ss/include\",\n            SSBIN := \"sim-cache\",\n            SSPARAM := \"dl1.misses\",\n            TIMER_OPTS := \"-n 1\"\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b,\"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    # FPGA Hardware generator profile\n    ####################\n\n    fpga_splhdl := rec(\n        name := \"fpga-splhdl\",\n        outdir := \"/tmp/spiral\",\n        threshold := 2048,\n        makeopts := rec(\n            OUTNAME := \"gap.v\",\n            GAP := \"gap.spl\",\n            VLOGLIB := \"/Users/pam/eclwork/SPLHDL/support\",\n            NCV := \"ncverilog\",\n            SPLHDL := \"splhdl\",\n            GETRES := \"getRes\",\n            IVERILOG := \"iverilog\",\n            VVP := \"vvp\",\n            DATATYPE := \"fix 16\", #other possibility 'float'.\n            TWIDTYPE := \"\"\n        ),\n        meas := (a,b) -> _StandardMeasureVerify(a,b,\"\"),\n    ),\n\n    # INTEL MAC profiles\n    #######\n\n    darwin_x86_gcc := rec(\n        name := \"darwin-x86\",\n        makeopts := rec(\n            CC := \"gcc\",\n            CFLAGS := \"-O2 -fomit-frame-pointer -msse2 -std=c99\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    darwin_x86_icc := rec(\n        name := \"darwin-x86\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O3 -fomit-frame-pointer -std=c99\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    # PTLSim backend\n    ############\n\n    linux_ptlsim_icc := rec(\n        name := \"linux-ptlsim\",\n        makeopts := rec(\n            CC := \"icc\",\n            CFLAGS := \"-O3 -fomit-frame-pointer -std=c99\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\"),\n    ),\n\n    # Basilio's code analyzer.\n     linux_x86_anl := rec(\n         name := \"linux-x86-anl\",\n         makeopts := rec(\n             CC := \"gcc\",\n             CFLAGS := \"-O2 -msse2 -w -std=c99 -fomit-frame-pointer\",\n         ),\n         outdir := \"/tmp/spiral\",\n         meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n         verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n     ),\n\n    # DPA simulator profile\n    linux_dpa_sim := rec(\n        name := \"linux-dpa-simulator\",\n        makeopts := rec(\n            DPA_DIR := \"${HOME}/DPA\",\n            DPA_SPEC := \"lmvec_memvec_vecint\",\n            CC := \"gcc\",\n            CFLAGS := \"\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n    # DPA emulator (modelsim) profile\n    linux_dpa_emu := rec(\n        name := \"linux-dpa-modelsim\",\n        makeopts := rec(\n            DPA_DIR := \"${HOME}/DPA\",\n            DPA_SPEC := \"lmvec_memvec_vecint\",\n            XCC_DIR := \"/opt/sparc-elf-4.4.2\",\n            MODELSIM_DIR := \"/opt/modelsim\",\n            CC := \"sparc-elf-gcc\",\n            CFLAGS := \"\",\n        ),\n        outdir := \"/tmp/spiral\",\n        meas := (a,b) -> _StandardMeasureVerify(a,b, \"\"),\n        verify := (a,b) -> _StandardMeasureVerify(a,b, \"verify\")\n    ),\n\n);\n", "meta": {"hexsha": "92d5b10948233b7d3332dbd3e7707d85b794b1a9", "size": 22362, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/profiler/profiles.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/profiler/profiles.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/profiler/profiles.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.5401974612, "max_line_length": 148, "alphanum_fraction": 0.4951703783, "num_tokens": 6162, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.17328821873771574, "lm_q2_score": 0.026759285028796032, "lm_q1q2_score": 0.004637068837334889}}
{"text": "\n# Copyright (c) 2018-2020, Carnegie Mellon University\n# See LICENSE for details\n\n\n", "meta": {"hexsha": "2eb1cc63d4ffded84c1531899202d13b88693a3a", "size": 83, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/paradigms/loops/nonterms.gi", "max_stars_repo_name": "franzfranchetti/spiral-software", "max_stars_repo_head_hexsha": "5ad717954b8a14e82277c4bd82c7518d9e6c0a10", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "namespaces/spiral/paradigms/loops/nonterms.gi", "max_issues_repo_name": "franzfranchetti/spiral-software", "max_issues_repo_head_hexsha": "5ad717954b8a14e82277c4bd82c7518d9e6c0a10", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "namespaces/spiral/paradigms/loops/nonterms.gi", "max_forks_repo_name": "franzfranchetti/spiral-software", "max_forks_repo_head_hexsha": "5ad717954b8a14e82277c4bd82c7518d9e6c0a10", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 13.8333333333, "max_line_length": 53, "alphanum_fraction": 0.7469879518, "num_tokens": 23, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.19193279569159502, "lm_q2_score": 0.023330770845747428, "lm_q1q2_score": 0.004477940074064262}}
{"text": "#############################################################################\n##\n##  Magic.gi                                         AutoDoc package\n##\n##  Copyright 2013, Max Horn, JLU Giessen\n##                  Sebastian Gutsche, University of Kaiserslautern\n##\n#############################################################################\n\n# Check if a string has the given suffix or not. Another\n# name for this would \"StringEndsWithOtherString\".\n# For example, AUTODOC_HasSuffix(\"file.gi\", \".gi\") returns\n# true while AUTODOC_HasSuffix(\"file.txt\", \".gi\") returns false.\nBindGlobal( \"AUTODOC_HasSuffix\",\nfunction(str, suffix)\n    local n, m;\n    n := Length(str);\n    m := Length(suffix);\n    return n >= m and str{[n-m+1..n]} = suffix;\nend );\n\n# Given a string containing a \".\", , return its suffix,\n# i.e. the bit after the last \".\". For example, given \"test.txt\",\n# it returns \"txt\".\nBindGlobal( \"AUTODOC_GetSuffix\",\nfunction(str)\n    local i;\n    i := Length(str);\n    while i > 0 and str[i] <> '.' do i := i - 1; od;\n    if i < 0 then return \"\"; fi;\n    return str{[i+1..Length(str)]};\nend );\n\n# Check whether the given directory exists, and if not, attempt\n# to create it.\nBindGlobal( \"AUTODOC_CreateDirIfMissing\",\nfunction(d)\n    local tmp;\n    if not IsDirectoryPath(d) then\n        tmp := CreateDir(d); # Note: CreateDir is currently undocumented\n        if tmp = fail then\n            Error(\"Cannot create directory \", d, \"\\n\",\n                  \"Error message: \", LastSystemError().message, \"\\n\");\n            return false;\n        fi;\n    fi;\n    return true;\nend );\n\n\n# Scan the given (by name) subdirs of a package dir for\n# files with one of the given extensions, and return the corresponding\n# filenames, as relative paths (relative to the package dir).\n#\n# For example, the invocation\n#   AUTODOC_FindMatchingFiles(\"AutoDoc\", [ \"gap/\" ], [ \"gi\", \"gd\" ]);\n# might return a list looking like\n#  [ \"gap/AutoDocMainFunction.gd\", \"gap/AutoDocMainFunction.gi\", ... ]\nBindGlobal( \"AUTODOC_FindMatchingFiles\",\nfunction (pkg, subdirs, extensions)\n    local d_rel, d, tmp, files, result;\n\n    result := [];\n\n    for d_rel in subdirs do\n        # Get the absolute path to the directory in side the package...\n        d := DirectoriesPackageLibrary( pkg, d_rel );\n        if IsEmpty( d ) then\n            continue;\n        fi;\n        d := d[1];\n        # ... but also keep the relative path (such as \"gap\")\n        d_rel := Directory( d_rel );\n\n        files := DirectoryContents( d );\n        Sort( files );\n        for tmp in files do\n            if not AUTODOC_GetSuffix( tmp ) in [ \"g\", \"gi\", \"gd\", \"autodoc\" ] then\n                continue;\n            fi;\n            if not IsReadableFile( Filename( d, tmp ) ) then\n                continue;\n            fi;\n            Add( result, Filename( d_rel, tmp ) );\n        od;\n    od;\n    return result;\nend );\n\n\n# AutoDoc(pkg[, opt])\n#\n## Make this function callable with the package_name AutoDocWorksheet.\n## Which will then create a worksheet!\nInstallGlobalFunction( AutoDoc,\nfunction( arg )\n    local pkg, package_info, opt, scaffold, gapdoc, maketest,\n          autodoc, pkg_dir, doc_dir, doc_dir_rel, d, tmp,\n          title_page, tree, is_worksheet, position_document_class, i, gapdoc_latex_option_record;\n    \n    pkg := arg[1];\n    \n    if LowercaseString( pkg ) = \"autodocworksheet\" then\n        is_worksheet := true;\n        package_info := rec( );\n        pkg_dir := DirectoryCurrent( );\n    else\n        is_worksheet := false;\n        package_info := PackageInfo( pkg )[ 1 ];\n        pkg_dir := DirectoriesPackageLibrary( pkg, \"\" )[1];\n    fi;\n\n    if Length(arg) >= 2 then\n        opt := arg[2];\n    else\n        opt := rec();\n    fi;\n\n    # Check for certain user supplied options, and if present, add them\n    # to the opt record.\n    tmp := function( key )\n        local val;\n        val := ValueOption( key );\n        if val <> fail then\n            opt.(key) := val;\n        fi;\n    end;\n    \n    tmp( \"dir\" );\n    tmp( \"scaffold\" );\n    tmp( \"autodoc\" );\n    tmp( \"gapdoc\" );\n    tmp( \"maketest\" );\n    \n    #\n    # Setup the output directory\n    #\n    if not IsBound( opt.dir ) then\n        doc_dir := \"doc\";\n    elif IsString( opt.dir ) or IsDirectory( opt.dir ) then\n        doc_dir := opt.dir;\n    else\n        Error( \"opt.dir must be a string containing a path, or a directory object\" );\n    fi;\n    \n    if IsString( doc_dir ) then\n        # Record the relative version of the path\n        doc_dir_rel := Directory( doc_dir );\n\n        # We intentionally do not use\n        #   DirectoriesPackageLibrary( pkg, \"doc\" )\n        # because it returns an empty list if the subdirectory is missing.\n        # But we want to handle that case by creating the directory.\n        doc_dir := Filename(pkg_dir, doc_dir);\n        doc_dir := Directory(doc_dir);\n\n    else\n        # TODO: doc_dir_rel = ... ?\n    fi;\n\n    # Ensure the output directory exists, create it if necessary\n    AUTODOC_CreateDirIfMissing(Filename(doc_dir, \"\"));\n    \n    # Let the developer know where we are generating the documentation.\n    # This helps diagnose problems where multiple instances of a package\n    # are visible to GAP and the wrong one is used for generating the\n    # documentation.\n    # TODO: Using Info() instead of Print?\n    Print( \"Generating documentation in \", doc_dir, \"\\n\" );\n\n    #\n    # Extract scaffolding settings, which can be controlled via\n    # opt.scaffold or package_info.AutoDoc. The former has precedence.\n    #\n    if not IsBound(opt.scaffold) then\n        # Default: enable scaffolding if and only if package_info.AutoDoc is present\n        if IsBound( package_info.AutoDoc ) then\n            scaffold := rec( );\n        fi;\n    elif IsRecord(opt.scaffold) then\n        scaffold := opt.scaffold;\n    elif IsBool(opt.scaffold) then\n        if opt.scaffold = true then\n            scaffold := rec();\n        fi;\n    else\n        Error(\"opt.scaffold must be a bool or a record\");\n    fi;\n\n    # Merge package_info.AutoDoc into scaffold\n    if IsBound(scaffold) and IsBound( package_info.AutoDoc ) then\n        AUTODOC_APPEND_RECORD_WRITEONCE( scaffold, package_info.AutoDoc );\n    fi;\n    \n    if IsBound( scaffold ) then\n        AUTODOC_WriteOnce( scaffold, \"TitlePage\", true );\n        AUTODOC_WriteOnce( scaffold, \"MainPage\", true );\n    fi;\n\n    \n    #\n    # Extract AutoDoc settings\n    #\n    if not IsBound(opt.autodoc) and not is_worksheet then\n        # Enable AutoDoc support if the package depends on AutoDoc.\n        tmp := Concatenation( package_info.Dependencies.NeededOtherPackages,\n                              package_info.Dependencies.SuggestedOtherPackages );\n        if ForAny( tmp, x -> LowercaseString(x[1]) = \"autodoc\" ) then\n            autodoc := rec();\n        fi;\n    elif IsRecord(opt.autodoc) then\n        autodoc := opt.autodoc;\n    elif IsBool(opt.autodoc) and opt.autodoc = true then\n        autodoc := rec();\n    fi;\n    \n    if IsBound(autodoc) then\n        if not IsBound( autodoc.files ) then\n            autodoc.files := [ ];\n        fi;\n        \n        if not IsBound( autodoc.scan_dirs ) and not is_worksheet then\n            autodoc.scan_dirs := [ \"gap\", \"lib\", \"examples\", \"examples/doc\" ];\n        elif not IsBound( autodoc.scan_dirs ) and is_worksheet then\n            autodoc.scan_dirs := [ ];\n        fi;\n        \n        if not IsBound( autodoc.level ) then\n            autodoc.level := 0;\n        fi;\n        \n        PushOptions( rec( level_value := autodoc.level ) );\n        \n        if not is_worksheet then\n            Append( autodoc.files, AUTODOC_FindMatchingFiles(pkg, autodoc.scan_dirs, [ \"g\", \"gi\", \"gd\" ]) );\n        fi;\n    fi;\n\n    #\n    # Extract GAPDoc settings\n    #\n    if not IsBound( opt.gapdoc ) then\n        # Enable GAPDoc support by default\n        gapdoc := rec();\n    elif IsRecord( opt.gapdoc ) then\n        gapdoc := opt.gapdoc;\n    elif IsBool( opt.gapdoc ) and opt.gapdoc = true then\n        gapdoc := rec();\n    fi;\n    \n    #\n    # Extract test settings\n    #\n    \n    if IsBound( opt.maketest ) then\n        if IsRecord( opt.maketest ) then\n            maketest := opt.maketest;\n        elif opt.maketest = true then\n            maketest := rec( );\n        fi;\n    fi;\n    \n    if IsBound( gapdoc ) then\n\n        if not IsBound( gapdoc.main ) then\n            gapdoc.main := pkg;\n        fi;\n\n        # FIXME: the following may break if a package uses more than one book\n        if IsBound( package_info.PackageDoc ) and IsBound( package_info.PackageDoc[1].BookName ) then\n            gapdoc.bookname := package_info.PackageDoc[1].BookName;\n        elif not is_worksheet then\n            # Default: book name = package name\n            gapdoc.bookname := pkg;\n\n            Print(\"\\n\");\n            Print(\"WARNING: PackageInfo.g is missing a PackageDoc entry!\\n\");\n            Print(\"Without this, your package manual will not be recognized by the GAP help system.\\n\");\n            Print(\"You can correct this by adding the following to your PackageInfo.g:\\n\");\n            Print(\"PackageDoc := rec(\\n\");\n            Print(\"  BookName  := ~.PackageName,\\n\");\n            #Print(\"  BookName  := \\\"\", pkg, \"\\\",\\n\");\n            Print(\"  ArchiveURLSubset := [\\\"doc\\\"],\\n\");\n            Print(\"  HTMLStart := \\\"doc/chap0.html\\\",\\n\");\n            Print(\"  PDFFile   := \\\"doc/manual.pdf\\\",\\n\");\n            Print(\"  SixFile   := \\\"doc/manual.six\\\",\\n\");\n            Print(\"  LongTitle := ~.Subtitle,\\n\");\n            Print(\"),\\n\");\n            Print(\"\\n\");\n        fi;\n\n        if not IsBound( gapdoc.files ) then\n            gapdoc.files := [];\n        fi;\n\n        if not IsBound( gapdoc.scan_dirs ) and not is_worksheet then\n            gapdoc.scan_dirs := [ \"gap\", \"lib\", \"examples\", \"examples/doc\" ];\n        fi;\n        \n        if not is_worksheet then\n            Append( gapdoc.files, AUTODOC_FindMatchingFiles(pkg, gapdoc.scan_dirs, [ \"g\", \"gi\", \"gd\" ]) );\n        fi;\n\n        # Attempt to weed out duplicates as they may confuse GAPDoc (this\n        # won't work if there are any non-normalized paths in the list).\n        gapdoc.files := Set( gapdoc.files );\n        \n        # Convert the file paths in gapdoc.files, which are relative to\n        # the package directory, to paths which are relative to the doc directory.\n        # For this, we assume that doc_dir_rel is normalized (e.g.\n        # it does not contains '//') and relative.\n        d := Number( Filename( doc_dir_rel, \"\" ), x -> x = '/' );\n        d := Concatenation( ListWithIdenticalEntries(d, \"../\") );\n        gapdoc.files := List( gapdoc.files, f -> Concatenation( d, f ) );\n    fi;\n    \n    \n    # read tree\n    # FIXME: shouldn't tree be declared inside of an 'if IsBound(autodoc)' section?\n    tree := DocumentationTree( );\n    \n    if IsBound( autodoc ) then\n        if IsBound( autodoc.section_intros ) then\n            AUTODOC_PROCESS_INTRO_STRINGS( autodoc.section_intros : Tree := tree );\n        fi;\n    \n        AutoDocScanFiles( autodoc.files : PackageName := pkg, Tree := tree );\n    fi;\n    \n    if is_worksheet then\n        # FIXME: We use scaffold and autodoc here without checking whether\n        # they are bound. Does that mean worksheets always use them?\n        if IsRecord( scaffold.TitlePage ) and IsBound( scaffold.TitlePage.Title ) then\n            pkg := scaffold.TitlePage.Title;\n\n        elif IsBound( tree!.TitlePage.Title ) then\n            pkg := tree!.TitlePage.Title;\n\n        elif IsBound( autodoc.files ) and Length( autodoc.files ) > 0  then\n            pkg := autodoc.files[ 1 ];\n            \n            while Position( pkg, '/' ) <> fail do\n                Remove( pkg, 1 );\n            od;\n            \n            while Position( pkg, '.' ) <> fail do\n                Remove( pkg, Length( pkg ) );\n            od;\n\n        else\n            Error( \"could not figure out a title.\" );\n        fi;\n        \n        if not IsString( pkg ) then\n            pkg := JoinStringsWithSeparator( pkg, \" \" );\n        fi;\n        \n        gapdoc.main := ReplacedString( pkg, \" \", \"_\" );\n        gapdoc.bookname := ReplacedString( pkg, \" \", \"_\" );\n    fi;\n    \n    #\n    # Generate scaffold\n    #\n    gapdoc_latex_option_record := rec( );\n    \n    if IsBound( scaffold ) then\n        ## Syntax is [ \"class\", [ \"options\" ] ]\n        if IsBound( scaffold.document_class ) then\n            position_document_class := PositionSublist( GAPDoc2LaTeXProcs.Head, \"documentclass\" );\n            \n            if IsString( scaffold.document_class ) then\n                scaffold.document_class := [ scaffold.document_class ];\n            fi;\n            \n            if position_document_class = fail then\n                Error( \"something is wrong with the LaTeX header\" );\n            fi;\n            \n            GAPDoc2LaTeXProcs.Head := Concatenation(\n                  GAPDoc2LaTeXProcs.Head{[ 1 .. PositionSublist( GAPDoc2LaTeXProcs.Head, \"{\", position_document_class ) ]},\n                  scaffold.document_class[ 1 ],\n                  GAPDoc2LaTeXProcs.Head{[ PositionSublist( GAPDoc2LaTeXProcs.Head, \"}\", position_document_class ) .. Length( GAPDoc2LaTeXProcs.Head ) ]} );\n            \n            if Length( scaffold.document_class ) = 2 then\n                \n                GAPDoc2LaTeXProcs.Head := Concatenation(\n                      GAPDoc2LaTeXProcs.Head{[ 1 .. PositionSublist( GAPDoc2LaTeXProcs.Head, \"[\", position_document_class ) ]},\n                      scaffold.document_class[ 2 ],\n                      GAPDoc2LaTeXProcs.Head{[ PositionSublist( GAPDoc2LaTeXProcs.Head, \"]\", position_document_class ) .. Length( GAPDoc2LaTeXProcs.Head ) ]} );\n            fi;\n        fi;\n        \n        if IsBound( scaffold.latex_header_file ) then\n            GAPDoc2LaTeXProcs.Head := StringFile( scaffold.latex_header_file );\n        fi;\n        \n        if IsBound( scaffold.gapdoc_latex_options ) then\n            if IsRecord( scaffold.gapdoc_latex_options ) then\n                for i in RecNames( scaffold.gapdoc_latex_options ) do\n                    if not IsString( scaffold.gapdoc_latex_options.( i ) )\n                       and IsList( scaffold.gapdoc_latex_options.( i ) )\n                       and LowercaseString( scaffold.gapdoc_latex_options.( i )[ 1 ] ) = \"file\" then\n                        scaffold.gapdoc_latex_options.( i ) := StringFile( scaffold.gapdoc_latex_options.( i )[ 2 ] );\n                    fi;\n                od;\n                \n                gapdoc_latex_option_record := scaffold.gapdoc_latex_options;\n            fi;\n        fi;\n        \n        if not IsBound( scaffold.includes ) then\n            scaffold.includes := [ ];\n        fi;\n\n        if IsBound( autodoc ) then\n            # If scaffold.includes is already set, then we add\n            # AutoDocMainFile.xml to it, but *only* if it not already\n            # there. This way, package authors can control where\n            # it is put in their includes list.\n            if not \"AutoDocMainFile.xml\" in scaffold.includes then\n                Add( scaffold.includes, \"AutoDocMainFile.xml\" );\n            fi;\n        fi;\n\n        if IsBound( scaffold.bib ) and IsBool( scaffold.bib ) then\n            if scaffold.bib = true then\n                scaffold.bib := Concatenation( pkg, \".bib\" );\n            else\n                Unbind( scaffold.bib );\n            fi;\n        elif not IsBound( scaffold.bib ) then\n            # If there is a doc/PKG.bib file, assume that we want to reference it in the scaffold.\n            if IsReadableFile( Filename( doc_dir, Concatenation( pkg, \".bib\" ) ) ) then\n                scaffold.bib := Concatenation( pkg, \".bib\" );\n            fi;\n        fi;\n        \n        AUTODOC_WriteOnce( scaffold, \"index\", true );\n\n        if IsBound( gapdoc ) then\n            if AUTODOC_GetSuffix( gapdoc.main ) = \"xml\" then\n                scaffold.main_xml_file := gapdoc.main;\n            else\n                scaffold.main_xml_file := Concatenation( gapdoc.main, \".xml\" );\n            fi;\n        fi;\n\n        # TODO: It should be possible to only rebuild the title page. (Perhaps also only the main page? but this is less important)\n        if IsBound( scaffold.TitlePage ) then\n            if IsRecord( scaffold.TitlePage ) then\n                title_page := scaffold.TitlePage;\n            else\n                title_page := rec( );\n            fi;\n            \n            AUTODOC_WriteOnce( title_page, \"dir\", doc_dir );\n            AUTODOC_APPEND_RECORD_WRITEONCE( title_page, tree!.TitlePage );\n            \n            if not is_worksheet then\n                AUTODOC_APPEND_RECORD_WRITEONCE( title_page, ExtractTitleInfoFromPackageInfo( pkg ) );\n            fi;\n            \n            CreateTitlePage( title_page );\n        fi;\n        \n        if IsBound( scaffold.MainPage ) and scaffold.MainPage <> false then\n            scaffold.dir := doc_dir;\n            scaffold.book_name := pkg;\n            CreateMainPage( scaffold );\n        fi;\n    fi;\n    \n    #\n    # Run AutoDoc\n    #\n    if IsBound( autodoc ) then\n        WriteDocumentation( tree, doc_dir );\n    fi;\n    \n    \n    #\n    # Run GAPDoc\n    #\n    if IsBound( gapdoc ) then\n\n        # Ask GAPDoc to use UTF-8 as input encoding for LaTeX, as the XML files\n        # of the documentation are also in UTF-8 encoding, and may contain characters\n        # not contained in the default Latin 1 encoding.\n        SetGapDocLaTeXOptions( \"utf8\", gapdoc_latex_option_record );\n\n        MakeGAPDocDoc( doc_dir, gapdoc.main, gapdoc.files, gapdoc.bookname, \"MathJax\" );\n\n        CopyHTMLStyleFiles( Filename( doc_dir, \"\" ) );\n\n        # The following (undocumented) API is there for compatibility\n        # with old-style gapmacro.tex based package manuals. It\n        # produces a manual.lab file which those packages can use if\n        # they wish to link to things in the manual we are currently\n        # generating. This can probably be removed eventually, but for\n        # now, doing it does not hurt.\n        \n        # FIXME: It seems that this command does not work if pdflatex\n        #        is not present. Maybe we should remove it.\n        \n        if not is_worksheet then\n            GAPDocManualLab( pkg );\n        fi;\n\n    fi;\n    \n    if IsBound( maketest ) then\n        \n        AUTODOC_WriteOnce( maketest, \"filename\", \"maketest.g\" );\n        AUTODOC_WriteOnce( maketest, \"folder\", pkg_dir );\n        AUTODOC_WriteOnce( maketest, \"scan_dir\", doc_dir );\n        AUTODOC_WriteOnce( maketest, \"files_to_scan\", gapdoc.files );\n\n        if IsString( maketest.folder ) then\n            maketest.folder := Directory( maketest.folder );\n        fi;\n        \n        if IsString( maketest.scan_dir ) then\n            maketest.scan_dir := Directory( maketest.scan_dir );\n        fi;\n        \n        AUTODOC_WriteOnce( maketest, \"commands\", [ ] );\n        AUTODOC_WriteOnce( maketest, \"book_name\", gapdoc.main );\n        \n        CreateMakeTest( maketest );\n    fi;\n\n    return true;\nend );\n", "meta": {"hexsha": "5202a1de4cf45907115ee5688392baaa70eb0ebf", "size": 18970, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "src/test/resources/samples/langs/GAP/Magic.gi", "max_stars_repo_name": "JavascriptID/sourcerer-app", "max_stars_repo_head_hexsha": "9ad05f7c6a18c03793c8b0295a2cb318118f6245", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8271, "max_stars_repo_stars_event_min_datetime": "2015-01-01T15:04:43.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T06:18:14.000Z", "max_issues_repo_path": "src/test/resources/samples/langs/GAP/Magic.gi", "max_issues_repo_name": "JavascriptID/sourcerer-app", "max_issues_repo_head_hexsha": "9ad05f7c6a18c03793c8b0295a2cb318118f6245", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3238, "max_issues_repo_issues_event_min_datetime": "2015-01-01T14:25:12.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T17:37:51.000Z", "max_forks_repo_path": "src/test/resources/samples/langs/GAP/Magic.gi", "max_forks_repo_name": "JavascriptID/sourcerer-app", "max_forks_repo_head_hexsha": "9ad05f7c6a18c03793c8b0295a2cb318118f6245", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4070, "max_forks_repo_forks_event_min_datetime": "2015-01-01T11:40:51.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T13:45:53.000Z", "avg_line_length": 35.4579439252, "max_line_length": 160, "alphanum_fraction": 0.571270427, "num_tokens": 4621, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.17106120013047907, "lm_q2_score": 0.025957355879155805, "lm_q1q2_score": 0.004440296448902339}}
{"text": "#\n# Directory of where my stuff is\n#\nhome_dir:=Directory(\"~/Workspace/Chevalley.gap/\");\nlib_dir:=Directory(\"~/Workspace/Chevalley.gap/lib\");\ntest_dir:=Directory(\"~/Workspace/Chevalley.gap/test\");\ndata_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/data\");\ng2_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/g2\");\ng2_dir_char2:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/g2/char2\");\ng2_dir_char3:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/g2/char3\");\nf4_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/f4\");\nf4_dir_char2:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/f4/char2\");\nf4_dir_char3:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/f4/char3\");\ne6_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e6\");\ne6_dir_char2:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e6/char2\");\ne6_dir_char3:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e6/char3\");\ne7_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e7\");\ne7_dir_char2:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e7/char2\");\ne7_dir_char3:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e7/char3\");\ne8_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e8\");\ne8_dir_char2:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e8/char2\");\ne8_dir_char3:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e8/char3\");\ne8_dir_char5:=Directory(\"~/Workspace/Chevalley.gap/lib/cases/e8/char5\");\ncomponents_dir:=Directory(\"~/Workspace/Chevalley.gap/lib/components\");\n#\n# Read(\"~/Workspace/Chevalley.gap/init.gap\"); Read(Filename(home_dir,\"load.gap\"));\n#\n", "meta": {"hexsha": "5ffc0b5f7f6b3c650c7f40616e2fa724a51eed83", "size": 1521, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "init.gi", "max_stars_repo_name": "iuliansimion/Chevalley.gap", "max_stars_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "init.gi", "max_issues_repo_name": "iuliansimion/Chevalley.gap", "max_issues_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "init.gi", "max_forks_repo_name": "iuliansimion/Chevalley.gap", "max_forks_repo_head_hexsha": "dd237f36d69a42bcd6cb6a24c5e4bf7dfb3da186", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 54.3214285714, "max_line_length": 82, "alphanum_fraction": 0.7646285339, "num_tokens": 466, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1403362566809061, "lm_q2_score": 0.031618770006199386, "lm_q1q2_score": 0.004437259823524532}}
{"text": "--\n-- An instance of this template must have a %Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--     $super_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateF\n--\n%Options programming_Language=typescript,margin=4\n%Options table\n%options action-block=(\"*.ts\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.%_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.%file_prefix%LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.Object./\n\n    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream\n                  this.getPrsStream()./\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n                this.this.lexParser.setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                  this.this.lexParser.setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getLastToken\n               this.this.lexParser.getSym./\n    $getToken /. // macro getToken is deprecated. Use function getToken\n                 this.this.lexParser.getToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                    this.this.lexParser.getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                     this.this.lexParser.getLastToken./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule %rule_number:  %rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.%Header%case %rule_number: { ./\n\n    $BeginAction /.%DefaultAction./\n\n    $EndAction\n    /.            break;\n                }./\n\n    $BeginJava\n    /.%BeginAction\n                %symbol_declarations./\n\n    $EndJava /.%EndAction./\n\n    $NoAction\n    /.%Header%case %rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n        public  ruleAction(ruleNumber : number ) : void\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n                    default:\n                        this.ruleAction%rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n\n            public  ruleAction%rule_number(ruleNumber : number ) : void\n            {\n                switch (ruleNumber)\n                {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.\n  import { RuleAction, ParseTable, LexParser, ILexStream, IPrsStream, Monitor,LpgLexStream} from \"lpg2ts\";\n  import { %prs_type } from \".\\/%prs_type\";\n  import { %sym_type } from \".\\/%sym_type\";\n  import { %kw_lexer_class } from \".\\/%kw_lexer_class\";\n    ./\n%End\n\n%Headers\n    /.\n    export class %action_type extends %super_class implements RuleAction%additional_interfaces\n    {\n        private lexStream: %super_stream_class ;\n        \n        private static  prs : ParseTable = new %prs_type();\n        public  getParseTable() : ParseTable{ return %action_type.prs; }\n\n        private  lexParser  : LexParser= new LexParser();\n        public  getParser()  : LexParser{ return this.lexParser; }\n\n        public  getToken(i : number)  : number{ return this.lexParser.getToken(i); }\n        public  getRhsFirstTokenIndex(i : number) : number{ return this.lexParser.getFirstToken(i); }\n        public  getRhsLastTokenIndex(i : number)  : number{ return this.lexParser.getLastToken(i); }\n\n        public getLeftSpan() : number{ return this.lexParser.getToken(1); }\n        public getRightSpan() : number { return this.lexParser.getLastToken(); }\n  \n        public  resetKeywordLexer() : void\n        {\n            if (!this.kwLexer)\n                  this.kwLexer = new %kw_lexer_class(this.lexStream.getInputChars(), %_IDENTIFIER);\n             this.kwLexer.setInputChars(this.lexStream.getInputChars());\n        }\n  \n      \n        \n        public  reset( filename : string,  tab : number = 4, input_chars? : string) : void\n        {\n            this.lexStream = new %super_stream_class(filename,input_chars, tab);\n            this.lexParser.reset(<ILexStream>  this.lexStream, %action_type.prs, <RuleAction> this);\n            this.resetKeywordLexer();\n        }\n        \n       \n\n        constructor( filename : string,  tab : number =  4 ,input_chars? : string)\n        {\n            super();\n            this.lexStream = new %super_stream_class(filename,input_chars, tab);\n            this.lexParser.reset(<ILexStream>  this.lexStream, %action_type.prs, <RuleAction> this);\n            this.resetKeywordLexer();\n        }\n\n       \n\n        public  getILexStream()  : ILexStream{ return  this.lexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public  getLexStream()  : ILexStream{ return  this.lexStream; }\n\n        private initializeLexer(prsStream : %prs_stream_class ,  start_offset : number, end_offset : number) : void \n        {\n            if (this.lexStream.getInputChars() == null)\n                throw new ReferenceError(\"LexStream was not initialized\");\n            this.lexStream.setPrsStream(prsStream);\n            prsStream.makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n        private  addEOF(prsStream : %prs_stream_class, end_offset : number ) : void\n        {\n            prsStream.makeToken(end_offset, end_offset, %eof_token); // and end with the end of file token\n            prsStream.setStreamLength(prsStream.getSize());\n        }\n\n        public  lexerWithPosition(prsStream: %prs_stream_class , start_offset : number , end_offset : number, monitor? : Monitor) : void\n        {\n            if (start_offset <= 1)\n                 this.initializeLexer(prsStream, 0, -1);\n            else this.initializeLexer(prsStream, start_offset - 1, start_offset - 1);\n\n            this.lexParser.parseCharacters(start_offset, end_offset,monitor);\n\n            this.addEOF(prsStream, (end_offset >= this.lexStream.getStreamIndex() ? this.lexStream.getStreamIndex() : end_offset + 1));\n        }\n\n        public  lexer(prsStream: %prs_stream_class ,  monitor? : Monitor) : void\n        {\n           \n            this.initializeLexer(prsStream, 0, -1);\n            this.lexParser.parseCharactersWhitMonitor(monitor);\n            this.addEOF(prsStream, this.lexStream.getStreamIndex());\n        }\n       \n\n        /**\n         * If a parse stream was not passed to this Lexical analyser then we\n         * simply report a lexical error. Otherwise, we produce a bad token.\n         */\n        public  reportLexicalError( startLoc : number,  endLoc : number) : void {\n            let prs_stream = this.lexStream.getIPrsStream();\n            if (!prs_stream)\n                this.lexStream.reportLexicalError(startLoc, endLoc);\n            else {\n                //\n                // Remove any token that may have been processed that fall in the\n                // range of the lexical error... then add one error token that spans\n                // the error range.\n                //\n                for (let i : number = prs_stream.getSize() - 1; i > 0; i--) {\n                    if (prs_stream.getStartOffset(i) >= startLoc)\n                         prs_stream.removeLastToken();\n                    else break;\n                }\n                prs_stream.makeToken(startLoc, endLoc, 0); // add an error token to the this.prsStream\n            }        \n        }\n    ./\n%End\n\n%Rules\n    /.%BeginActions./\n%End\n\n%Trailers\n    /.\n        %EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "0ce331cfb2bb2ecc7030cf8b3c00e93270eddf0f", "size": 8339, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.3217054264, "max_line_length": 136, "alphanum_fraction": 0.5831634489, "num_tokens": 1962, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.12421300511003351, "lm_q2_score": 0.03567855356931779, "lm_q1q2_score": 0.004431740356824275}}
{"text": "package main\n\nimport (\n\t\"fmt\"\n)\n\ntype Bowser interface {\n\tHi()\n}\n\ntype Possum interface {\n\tHi()\n    Pebbles()\n}\n\ntype Unsat interface {\n\tHi()\n    Pebbles()\n    MissMe()\n}\n\ntype B struct{}\n\nfunc (b *B) Hi() {\n\tfmt.Printf(\"B.Hi called\\n\")\n}\nfunc (b *B) Pebbles() {}\n\n    chk := 0\n\tvar v Bowser = &B{}\n\tswitch v.(type) {\n    case Possum:\n\t\tfmt.Printf(\"ooh! it types as a Possum!\\n\")\n        chk = 2\n\tcase Bowser:\n\t\tfmt.Printf(\"yabadadoo! it types as a Bowser!\\n\")\n        chk = 1\n\t}\n    fmt.Printf(\"chk = '%v'\\n\", chk)\n\n    // and verify that v implements Bowser too:\n    asBowser, isBowser := v.(Bowser)\n    asIsNil := (asBowser == nil)\n\n    // negative check, should not convert:\n    asUn, isUn := v.(Unsat)\n    asUnNil := (asUn == nil)\n", "meta": {"hexsha": "940e62a18df01a620cc8f31a484ed90a4be8fd85", "size": 736, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "pkg/compiler/attic/wolf.gi", "max_stars_repo_name": "gijit/gi-minimal", "max_stars_repo_head_hexsha": "1aa4cc82ef6d45ce43cbf1744d50740fe8aff803", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 313, "max_stars_repo_stars_event_min_datetime": "2018-01-13T22:09:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-01T21:50:51.000Z", "max_issues_repo_path": "pkg/compiler/attic/wolf.gi", "max_issues_repo_name": "gijit/gi-minimal", "max_issues_repo_head_hexsha": "1aa4cc82ef6d45ce43cbf1744d50740fe8aff803", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 57, "max_issues_repo_issues_event_min_datetime": "2018-01-13T19:50:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-09T19:00:05.000Z", "max_forks_repo_path": "pkg/compiler/attic/wolf.gi", "max_forks_repo_name": "gijit/gi-minimal", "max_forks_repo_head_hexsha": "1aa4cc82ef6d45ce43cbf1744d50740fe8aff803", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-02-09T15:34:45.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-03T19:57:49.000Z", "avg_line_length": 15.3333333333, "max_line_length": 50, "alphanum_fraction": 0.5692934783, "num_tokens": 239, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1422318877380116, "lm_q2_score": 0.030675803372235404, "lm_q1q2_score": 0.004363077421513104}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nrSetChildFields := arg -> Checked(IsList(arg), \n\tSubst(\n\t\tmeth(self, n, newChild)\n\t\t\tif not n in [1..numfields] then \n\t\t\t\tError(\"<n> must be in \", [1..numfields]);\n\t\t\telse \n\t\t\t\tself.(RecName(fields[n])) := newChild;\n\t\t\tfi;\n\t\tend,\n\t\tnumfields => Length(arg),\n\t\tfields => arg)\n);\n\nrSetChildFieldsCh := arg -> Checked(IsList(arg), \n\tSubst(\n\t\tmeth(self, n, newChild)\n\t\t\tif not n in [1..chCount+numfields] then\n\t\t\t\tError(\"<n> must be in \", [1..chCount+numfields]);\n\t\t\telif n in [1..chCount] then\n\t\t\t\tself._children[n] := newChild;\n\t\t\telse \n\t\t\t\tself.(RecName(fields[n-chCount])) := newChild;\n\t\t\tfi;\n\t\tend,\n\t\tnumfields => Length(arg)-1,\n\t\tchCount => arg[1],\n\t\tfields => Drop(arg, 1))\n);\n\n#  rChildrenFieldsCh: gives rChildren method where rChildren is self.children() :: [self.field1, self.field2, ... ],\n#  arg[1] is \"field1\", arg[2] is \"field2\" etc.\n#  ex: rChildren := rChildrenFieldsCh(\"stride\", \"v\")\n#\nrChildrenFieldsCh := arg -> Checked(IsList(arg), \n\tSubst( (self) >> self._children :: List([1..numfields], i -> self.(RecName(fields[i]))),\n\t\tnumfields => Length(arg),\n\t\tfields => arg )\n);\n\nrSetChildFieldsF := arg -> Checked(IsList(arg), Length(arg)>1, \n\tSubst(\n\t\tmeth(self, n, newChild)\n\t\t\tif not n in [1..numfields] then\n\t\t\t\tError(\"<n> must be in \", [1..numfields]);\n\t\t\telse \n\t\t\t\tself.(RecName(fields[n])) := func(newChild);\n\t\t\tfi;\n\t\tend,\n\t\tnumfields => Length(arg)-1,\n\t\tfields => Drop(arg, 1),\n\t\tfunc => arg[1])\n);\n\nLocal._print := function(arg)\n\tlocal a;\n\tfor a in arg do \n\t\tif IsRec(a) and IsBound(a.__bases__) then\n\t\t\tPrint(a.__bases__[1]);\n\t\telse\n\t\t\tPrint(a);\n\t\tfi;\n\tod;\nend;\n\nLocal._children := function(obj)\n\tif IsRec(obj) then\n\t\tif not IsBound(obj.rChildren) then\n\t\t\treturn [];\n\t\telse\n\t\t\treturn obj.rChildren();\n\t\tfi;\n\telif BagType(obj) in [T_STRING, T_RANGE] then \n\t\treturn [];\n\telif IsList(obj) then\n\t\treturn obj;\n\telse\n\t\treturn [];\n\tfi;\nend;\n\nLocal._setChild := function(obj, n, newchild)\n\tif IsRec(obj) then\n\t\tif not IsBound(obj.rSetChild) then \n\t\t\tError(\"<obj> must have rSetChild(<n>, <newChild>) method\");\n\t\tfi;\n\t\tobj.rSetChild(n, newchild);\n\telif IsList(obj) then\n\t\tobj[n] := newchild;\n\telse\n\t\tError(\"<obj> must be a record or a list\");\n\tfi;\nend;\n\nLocal._fromChildren := function(obj, newchildren)\n\tif IsRec(obj) then\n\t\tif not IsBound(obj.from_rChildren) then \n\t\t\tError(\"<obj> must have from_rChildren(<newChildren>) method\");\n\t\tfi;\n\t\treturn obj.from_rChildren(newchildren); \n\telif BagType(obj) in [T_STRING, T_RANGE] then \n\t\treturn  obj;\n\telif IsList(obj) then\n\t\treturn newchildren;\n\telif newchildren=[] then\n\t\treturn obj;\n\telse\n\t\treturn Error(\"<obj> must be a record or a list\");\n\tfi;\nend;\n\n_PrintShape := function(obj, maxDepth, printCutoff, info, i, is)\n\tif maxDepth > 0 then \n\t\tPrint(Blanks(i));\n\t\t_print(obj, \" \", info(obj), \"\\n\");\n\t\tDoForAll(_children(obj), c -> _PrintShape(c, maxDepth-1, printCutoff, info, i+is, is));\n\telif printCutoff then\n\t\tPrint(Blanks(i));\n\t\tPrint(\"...\\n\");\n\tfi;\nend;\n\nPrintShape := (obj, maxDepth) -> Checked(IsInt(maxDepth) and maxDepth >= 0, \n\t_PrintShape(obj, maxDepth, true, x->\"\", 0, 4));\n\n# info is a function : obj -> what to print\nPrintShapeInfo := (obj, maxDepth, info) -> Checked(IsInt(maxDepth) and maxDepth >= 0, \n\t_PrintShape(obj, maxDepth, true, info, 0, 4));\n\nPrintShape2 := (obj, maxDepth) -> Checked(IsInt(maxDepth) and maxDepth >= 0, \n\t_PrintShape(obj, maxDepth, false, x->\"\", 0, 4));\n\nLocal.id := ObjId; # ObjId now handles lists\n\n#F ShapeObject(<obj>)\n#F   Convert an object to a list-based pattern,\n#F   i.e. add(X, Y) becomes [add, var, var]\n#F \nShapeObject := obj -> Cond(\n\tBagType(obj) in [T_STRING,T_RANGE], obj,\n\tIsRec(obj) or IsList(obj), let(\n\t\tres := Concatenation([ObjId(obj)], List(_children(obj), ShapeObject)),\n\t\tWhen(Length(res)=1, res[1], res)),\n\tobj\n);\n\n#F ShapeObject@(<obj>, <func>)\n#F \n#F Same as ShapeObject(obj) but takes a boolean function <func>, and objects\n#F for which <func> returns true are replaced by @.\n#F\nShapeObject@ := (obj, func_replace_by_wildcard) -> Cond(\n\tBagType(obj) in [T_STRING,T_RANGE], obj,\n\tfunc_replace_by_wildcard(obj), @,\n\tIsRec(obj) or IsList(obj), let(\n\t\tres := Concatenation([ObjId(obj)], List(_children(obj), x -> ShapeObject@(x, func_replace_by_wildcard))),\n\t\tWhen(Length(res)=1, res[1], res)),\n\tobj\n);\n\nClass(..., rec(\n\tleft := false,\n\tright := false\n));\n\nLeft := z -> z.left;\nRight := z -> z.right;\n\n# @ : basic pattern object\n# .parent is the pointer to the unique object in @.table \n# That table does not store any precondition functions\n#\nClass(@, rec(\n\tis@ := true,\n\n\ttable := WeakRef(tab()),\n\n\t__call__ := meth(arg)\n\t\tlocal res, self, num, target, precond;\n\t\tif Length(arg) < 2 or Length(arg) > 4 then \n\t\t\tError(\"Usage: @(<num>, [<target>], [<cond>])\");\n\t\tfi;\n\n\t\tself := arg[1];\n\t\tnum := arg[2];\n\t\tif Length(arg) >= 3 then\n\t\t\ttarget := arg[3];\n\t\tfi;\n\t\tif Length(arg) = 4 then\n\t\t\tprecond := arg[4];\n\t\tfi;\n\n\t\tif not IsBound(self.table.(num)) then\n\t\t\tres := self.new(num); \n\t\t\tself.table.(num) := res;\n\t\t\tif IsBound(target) then\n\t\t\t\tres := res.target(target);\n\t\t\tfi;\n\t\t\tif IsBound(precond) then\n\t\t\t\tres := res.cond(precond);\n\t\t\tfi;\n\t\t\treturn res;\n\t\telse\n\t\t\tres := self.table.(num);\n\t\t\tUnbind(res._target);\n\t\t\tUnbind(res._precond);\n\t\t\tif IsBound(target) then\n\t\t\t\tres := res.target(target);\n\t\t\tfi;\n\t\t\tif IsBound(precond) then\n\t\t\t\tres := res.cond(precond);\n\t\t\tfi;\n\t\t\treturn res;\n\t\tfi;\n\tend,\n\n\tnew := (self, num) >> CantCopy(\n\t\tWithBases(self, rec(num := num, operations := PrintOps))),\n\n\tmatch := meth(self, obj, cx)\n\t\tif (not IsBound(self._target) or ObjId(obj) in self._target) and\n\t\t   (not IsBound(self._precond) or self._precond(obj)) \n\t\tthen \n\t\t\tif IsBound(self.parent) then\n\t\t\t\tself.parent.val := obj;\n\t\t\telse\n\t\t\t\tself.val := obj;\n\t\t\tfi;\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t\tfi;\n\tend,\n\t\n\tcond := (self, precond_func) >> Checked(IsCallableN(precond_func, 1), CantCopy(\n\t\tWithBases(self, rec(_precond := precond_func, \n\t\t\t\t\t\t\t parent := When(IsBound(self.parent), self.parent, self))))),\n\n\ttarget := (self, target_id) >> CantCopy(\n\t\tWithBases(self, rec(#_taddr  := When(IsList(target_id), List(target_id,BagAddr), [BagAddr(target_id)]),\n\t\t\t\t\t\t\t_target := When(IsList(target_id), target_id,\t\t\t   [target_id]),\n\t\t\t\t\t\t\tparent := When(IsBound(self.parent), self.parent, self)))),\n\n\tval := false,\n\n\tprint := self >> Print(\"@(\", self.num, \")\", \n\t\t\t\t\t\t   When(IsBound(self._target), \n\t\t\t\t\t\t\t\tPrint(\".target(\", self._target, \")\"), \n\t\t\t\t\t\t\t\t\"\"),\n\t\t\t\t\t\t   When(IsBound(self._precond), \n\t\t\t\t\t\t\t\tPrint(\".cond(\", self._precond, \")\"), \n\t\t\t\t\t\t\t\t\"\")),\n\n\tclear := meth(self)\n\t\tlocal e, l;\n\t\tl := TabToList(self.table);\n\t\tfor e in l do\n\t\t\tif IsRec(e) and IsBound(e.val) then\n\t\t\t\te.val := false;\n\t\t\tfi;\n\t\tod;\n\t\tif IsBound(self.val) then\n\t\t\tself.val := false;\n\t\tfi;\n\tend\n));\n\n# @@ : basic pattern object for context sensitive matching\n# @@ has its own table.\n# It still uses a .parent to point into @@.table where matches are stored\n# That table does not store any precondition functions.\n# Both lhs and rhs of rewrite rules must use either @ or @@. Otherwise wrong\n# table will be used.\n\nClass(@@, @, rec(\n\ttable := WeakRef(tab()),\n\n\tmatch := meth(self, obj, cx)\n\t\tlocal base_match;\n\t\tbase_match := @.match;\n\t\tif not IsBound(self._cxcond) then\n\t\t\treturn base_match(self, obj, cx); \n\t\telse\n\t\t\treturn base_match(self, obj, cx) and self._cxcond(obj, cx);\n\t\tfi;\n\tend,\n\n\tcond := (self, cxcond_func) >> CantCopy(Checked(IsCallableN(cxcond_func, 2), \n\t\tWithBases(self, rec(_cxcond := cxcond_func, \n\t\t\t\t\t\t\t parent := When(IsBound(self.parent), self.parent, self))))),\n\n\tprint := self >> Print(\"@@(\", self.num, \")\", \n\t\t\t\t\t\t   When(IsBound(self._target), \n\t\t\t\t\t\t\t\tPrint(\".target(\", self._target, \")\"), \n\t\t\t\t\t\t\t\t\"\"),\n\t\t\t\t\t\t   When(IsBound(self._cxcond), \n\t\t\t\t\t\t\t\tPrint(\".cond(\", self._cxcond, \")\"), \n\t\t\t\t\t\t\t\t\"\"))\n));\n\n\nIs@ := x -> IsRec(x) and IsBound(x.is@) and x.is@;\n\nLocal._midmatch := arg->false;\nLocal._normalmatch := arg->false;\n\nLocal._match_id := (obj, shape, cx) -> Cond(\n\tIsRec(shape) and IsBound(shape.is@),\n\t\tshape.match(obj, cx), \n\tBagType(shape) < T_FUNCTION or BagType(shape) in [T_STRING,T_RANGE], \n\t\tBagType(shape) = BagType(obj) and shape=obj,\n\tSame(obj, shape) or Same(ObjId(obj), shape));\n\n##\nDeclare(cx_enter, cx_leave, empty_cx, apply_rules_ni, _SubstBottomUp, _SubstTopDown);\n##\n\n# PatternMatch(<obj>, <shape>, <cx>)\n#\tReturns true if <obj> matches the given <shape> in a given context <cx>.\n#\tFor plain matches use empty context table empty_cx().\n#\nPatternMatch := function(obj, shape, cx)\n\tlocal ch, numch, shlen, res;\n\t\n\tif not IsList(shape) or BagType(shape) in [T_STRING,T_RANGE] then\n\t\treturn _match_id(obj, shape, cx);\n\telif shape = [] then\n\t\treturn false; \n\telif not _match_id(obj, shape[1], cx) then\n\t\treturn false;\n\telse \n\t\tshlen := Length(shape);\n\t\tch := _children(obj);\n\t\tnumch := Length(ch);\n\t\tif shlen = 1 \n\t\t\tthen return numch = 0;\n\t\telse \n\t\t\tcx_enter(cx, obj);\n\t\t\tif shape[2] = ... then \n\t\t\t\tif shape[shlen] = ... then\n\t\t\t\t\tres := _midmatch(ch, shape{[3..shlen-1]}, cx);\n\t\t\t\telif numch < shlen-2 then\n\t\t\t\t\tres := false;\n\t\t\t\telse \n\t\t\t\t\t....left := numch-shlen+2;\n\t\t\t\t\t....right := numch+1;\n\t\t\t\t\tres := _normalmatch(ch, numch-shlen+3, shlen-2,  shape, 3, shlen-2, cx);\n\t\t\t\tfi;\n\t\t\telif Last(shape) = ... then\n\t\t\t\tif numch < shlen-2 then\n\t\t\t\t\tres := false;\n\t\t\t\telse  \n\t\t\t\t\t....left := 0;\n\t\t\t\t\t....right := shlen-1;\n\t\t\t\t\tres := _normalmatch(ch, 1, shlen-2,  shape, 2, shlen-2, cx);\n\t\t\t\tfi;\n\t\t\telse \n\t\t\t\t....left := false;\n\t\t\t\t....right := false;\n\t\t\t\tres := _normalmatch(ch, 1, numch,  shape, 2, shlen-1, cx);\n\t\t\tfi;\n\t\t\tcx_leave(cx, obj);\n\t\t\treturn res;\n\t\tfi;\n\tfi;\nend;\n\n_normalmatch := function(lst, lstart, llen, shape, sstart, slen, cx)\n\tlocal i, ch;\n\tif llen <> slen then\n\t\treturn false;\n\telse \n\t\tfor i in [0..slen-1] do\n\t\t\tif not PatternMatch(lst[lstart+i], shape[sstart+i], cx) then\n\t\t\t\treturn false;\n\t\t\tfi;\n\t\tod;\n\t\treturn true;\n\tfi;\nend;\n\n_midmatch := function(lst, shape, cx)\n\tlocal i, ch, shlen, res, llen;\n\tshlen := Length(shape);\n\tllen := Length(lst);\n\tif llen < shlen then\n\t\treturn false;\n\telif llen = shlen then \n\t\tres := _normalmatch(lst, 1, llen, shape, 1, shlen, cx);\n\t\tif res then\n\t\t\t....left := 0;\n\t\t\t....right := llen + 1;\n\t\tfi;\n\t\treturn res;\n\telse \n\t\tfor i in [1 .. llen - shlen + 1] do\n\t\t\tif PatternMatch(lst[i], shape[1], cx) then \n\t\t\t\tif shlen = 1 then \n\t\t\t\t\t....left := i-1;\n\t\t\t\t\t....right := i+shlen;\n\t\t\t\t\treturn true;\n\t\t\t\telse\n\t\t\t\t\tif _normalmatch(lst, i+1, shlen-1,  shape, 2, shlen-1, cx) then\n\t\t\t\t\t\t....left := i-1;\n\t\t\t\t\t\t....right := i+shlen;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tfi;\n\t\t\t\tfi;\n\t\t\tfi;\n\t\tod;\n\t\treturn false;\n\tfi;\nend;\n\n#F AlternativesRewrite( <expr>, <from>, <to_func> )\n#F\n#F Creates all alternatives for substitution of an expression tree.\n#F\t<expr> - expression to substitute in\n#F\t<from> - shape to substitute\n#F\t<to_func> - a substitution function of the form e->f(e), where\n#F\t\t\t as <e> will be passed the subtree matching <from>\n#F\n\nDeclare(_AlternativesRewrite, _ConditionalAlternativesRewrite);\n\nAlternativesRewrite := (expr, from, to_func) ->\n\t_AlternativesRewrite(expr, from, to_func, empty_cx(), []);\n\n_AlternativesRewrite := function(expr, from, to_func, cx, list)\n\tlocal ch, i, clist;\n\n\tch := _children(expr);\n\tif Length(ch) <> 0 then \n\t\t# not a leaf\n\t\tcx_enter(cx, expr);\n\t\tfor i in [1..Length(ch)] do\n\t\t\tclist := _AlternativesRewrite(ch[i], from, to_func, cx, []);\n\t\t\tAppend(list, List(clist, function(x) local a; a:=Copy(expr); _setChild(a, i, x); return a; end));\n\t\tod;\t\t\t\t\t \n\t\tcx_leave(cx, expr);\n\tfi;\n\n\tif PatternMatch(expr, from, cx) then\n\t\tAdd(list, When(NumArgs(to_func)=2, to_func(cx, expr), to_func(expr)));\n\tfi;\n\n\treturn list;\nend;\n\nConditionalAlternativesRewrite := (expr, from, condition_to_func, rewrite_to_func) ->\n\t_ConditionalAlternativesRewrite(expr, from, condition_to_func, rewrite_to_func, empty_cx(), []);\n\n_ConditionalAlternativesRewrite := function(expr, from, condition_to_func, rewrite_to_func, cx, list)\n\tlocal ch, i, clist;\n\n\tch := _children(expr);\n\tif Length(ch) <> 0 then \n\t\t# not a leaf\n\t\tcx_enter(cx, expr);\n\t\tfor i in [1..Length(ch)] do\n\t\t\tclist := _ConditionalAlternativesRewrite(ch[i], from, condition_to_func, rewrite_to_func, cx, []);\n\t\t\tAppend(list, List(clist, function(x) local a; a:=Copy(expr); _setChild(a, i, x[2]); return [x[1], a]; end));\n\t\tod;\n\t\tcx_leave(cx, expr);\n\tfi;\n\n\tif PatternMatch(expr, from, cx) then\n\t\tAdd(list, [When(NumArgs(condition_to_func)=2, condition_to_func(cx, expr), condition_to_func(expr)),\n\t\t\t\tWhen(NumArgs(rewrite_to_func)=2, rewrite_to_func(cx, expr), rewrite_to_func(expr))]);\n\tfi;\n\n\treturn list;\nend;\n\n\n# Return a list of rewrite rule objects, from either a list of a record\n# passing in a record has the advantage of clean rule naming\n#\n_parseRuleSet := rset -> Cond(\n\tIsList(rset), List(rset, Rule),\n\tIsRec(rset),  List(UserRecFields(rset), \n\tfunction(fld) local r; r := Rule(rset.(fld)); r.name := fld; return r; end),\n\tError(\"<rset> must be a list of rules, or a record rec(rule1 := Rule(...), ...)\")\n);\n\n#F SubstBottomUp( <expr>, <from>, <to_func> )\n#F\n#F Destructive bottom up substitution on an expression tree.\n#F\t<expr> - expression to substitute in\n#F\t<from> - shape to substitute\n#F\t<to_func> - a substitution function of the form e->f(e), where\n#F\t\t\t as <e> will be passed the subtree matching <from>\n#F\nSubstBottomUp := (expr, from, to_func) ->\n\t_SubstBottomUp(expr, [ Rule(from, to_func, \"unnamed(SubstBottomUp)\") ], empty_cx());\n\nSubstBottomUpRules := (expr, ruleset) ->\n\t_SubstBottomUp(expr, _parseRuleSet(ruleset), empty_cx());\n\n_SubstBottomUp := function(expr, rules, cx)\n\tlocal ch, i;\n\tch := _children(expr);\n\tif ch <> [] then\n\t\tcx_enter(cx, expr);\n\t\tfor i in [1..Length(ch)] do\n\t\t\t_setChild(expr, i, _SubstBottomUp(ch[i], rules, cx));\n\t\tod;\n\t\tcx_leave(cx, expr);\n\tfi;\n\treturn apply_rules_ni(rules, expr, cx);\nend;\n\n_SubstLeaves := function(expr, from, to_func, cx)\n\tlocal ch, i;\n\tch := _children(expr);\n\tif Length(ch) <> 0 then \n\t\t# not a leaf\n\t\tcx_enter(cx, expr);\n\t\tfor i in [1..Length(ch)] do\n\t\t\t_setChild(expr, i, _SubstLeaves(ch[i], from, to_func, cx));\n\t\tod;\n\t\tcx_leave(cx, expr);\n\t\treturn expr;\n\telse\n\t\t# a leaf\n\t\tif PatternMatch(expr, from, cx) then \n\t\t\treturn When(NumArgs(to_func)=2, to_func(cx, expr), to_func(expr));\n\t\telse \n\t\t\treturn expr;\n\t\tfi;\n\tfi;\nend;\n\nSubstLeaves := (expr, from, to_func) -> _SubstLeaves(expr, from, to_func, empty_cx());\n\nSubstChildren := function(expr, from, to_func)\n\tlocal ch, i;\n\tch := _children(expr);\n\t#expr := map_children_safe(expr, c -> When(PatternMatch(c,from,empty_cx()), to_func(c), c));\n\tfor i in [1..Length(ch)] do\n\t\t_setChild(expr, i, \n\t\t\tWhen(PatternMatch(ch[i],from,empty_cx()), to_func(ch[i]), ch[i]));\n\tod;\n\treturn expr;\nend;\n\nSubstTopDown := (expr, from, to_func) ->\n\t_SubstTopDown(expr, [ Rule(from, to_func, \"unnamed(SubstTopDown)\") ], empty_cx());\n\nSubstTopDown_named := (expr, from, to_func, name) ->\n\t_SubstTopDown(expr, [ Rule(from, to_func, name) ], empty_cx());\n\nSubstTopDownRules := (expr, ruleset) ->\n\t_SubstTopDown(expr, _parseRuleSet(ruleset), empty_cx());\n\n_SubstTopDown := function(expr, rules, cx)\n\tlocal ch, newch, res;\n\texpr := apply_rules_ni(rules, expr, cx);\n\n\tch := _children(expr);\n\tif ch <> [] then\n\t\tcx_enter(cx, expr);\n\t\tnewch :=  List(ch, c -> _SubstTopDown(c, rules, cx));\n\t\tres := _fromChildren(expr, newch);\n\t\tcx_leave(cx, expr);\n\telse \n\t\tres := expr;\n\tfi;\n\treturn res;\nend;\n\nDeclare(_SubstTopDownNR);\n\n# same as SubstTopDown but doesn't recurse on the substitution\nSubstTopDownNR := (expr, from, to_func) -> \n\t_SubstTopDownNR(expr, [ Rule(from, to_func, \"unnamed(SubstTopDownNR)\") ], empty_cx());\n\nSubstTopDownNR_named := (expr, from, to_func, name) -> \n\t_SubstTopDownNR(expr, [ Rule(from, to_func, name) ], empty_cx());\n\nSubstTopDownRulesNR := (expr, ruleset) -> \n\t_SubstTopDownNR(expr, _parseRuleSet(ruleset), empty_cx());\n\n_SubstTopDownNR := function(expr, rules, cx)\n\tlocal ch, newch, res, n_applied;\n\tn_applied := cx.applied;\n\tcx.rlimit := 1;\n\texpr := apply_rules_ni(rules, expr, cx);\n\tif cx.applied > n_applied then\n\t\treturn expr;\n\tfi;\n\n\tch := _children(expr);\n\tif ch <> [] then\n\t\tcx_enter(cx, expr);\n\t\tnewch :=  List(ch, c -> _SubstTopDownNR(c, rules, cx));\n\t\tres := _fromChildren(expr, newch);\n\t\tcx_leave(cx, expr);\n\telse\n\t\tres := expr;\n\tfi;\n\treturn res;\nend;\n\n\n#F MatchSubst(<expr>, <rulelist>)\n#F\n#F Attempts matching 1 of the rules from the list to <expr> if it\n#F succeeds the transformation is applied, otherwise original \n#F expression is returned.\n#F\n#F MatchSubst is similar to SubstTopDown, but it does not recurse\n#F on children.\n#F\nMatchSubst := function(expr, rules)\n\tlocal ch, i, r, cx;\n\tcx := empty_cx();\n\tfor r in _parseRuleSet(rules) do\n\t\tif PatternMatch(expr, r.from, cx) then \n\t\t\tRuleTrace(r);\n\t\t\treturn r.to(expr); \n\t\tfi;\n\tod;\n\treturn expr;\nend;\n\nDeclare(_Collect);\n\n#F Collect(<expr>, <shape>)\n#F\n#F Returns a list of all subtrees of <expr> that match <shape>\n#F\nCollect := (expr, shape) -> _Collect(expr, shape, empty_cx(), true);\n\n#F Contains(<expr>, <shape>)\n#F\n#F Returns 'true' if <expr> contains <shape>\n#F NOTE: optimize this\nContains := (expr, shape) -> _Collect(expr, shape, empty_cx(), false)<>[];\n\n#F CollectNR(<expr>, <shape>)\n#F\n#F Returns a list of all subtrees of <expr> that match <shape>.\n#F Unlike 'Collect', once 'CollectNR' finds an object matching <shape>,\n#F it does not search inside its children.\n#F\nCollectNR := (expr, shape) -> _Collect(expr, shape, empty_cx(), false);\n\n_Collect := function(expr, shape, cx, do_recurse)\n\tlocal res, ch, c;\n\tif PatternMatch(expr, shape, cx) then\n\t\tif not do_recurse then \n\t\t\treturn [expr];\n\t\telse \n\t\t\tcx_enter(cx, expr);\n\t\t\tres := Concatenation(List(_children(expr), c -> _Collect(c, shape, cx, do_recurse)));\n\t\t\tcx_leave(cx, expr);\n\t\t\treturn Concatenation([expr], res);\n\t\tfi;\n\telse \n\t\tcx_enter(cx, expr);\n\t\tres := Concatenation(List(_children(expr), c -> _Collect(c, shape, cx, do_recurse)));\n\t\tcx_leave(cx, expr);\n\t\treturn res;\n\tfi;\nend;\n\nDeclare(_Pull);\n\n#F Pull(<expr>, <shape>, <to_func>, <pull_func>)\n#F\n#F Pull is a hybrid of Collect and SubstBottomUp. First three parameters\n#F specify substitution, and the last one collection:\n#F\n#F\t<expr> - expression to substitute in\n#F\t<from> - shape to substitute\n#F\t<to_func> - a substitution function of the form e->f(e), where\n#F\t\t\t as <e> will be passed the subtree matching <from>\n#F\t<pull_func> - applied to matching subtree <e> to collect data\n#F\n#F Pull retuns a tuple [<data>, <newtree>], where <data> is a list \n#F of all matched subtrees (before substitutions) with <pull_func>\n#F applied, and <newtree> is a tree obtained by substitution.\n#F\n## Note: This is Top-down recursive Pull, same as PullTD\nPull := (expr, shape, to_func, pull_func) -> _Pull(expr, shape, to_func, pull_func, empty_cx(), \n\ttrue, true);\n# Top-down recursive Pull\nPullTD := (expr, shape, to_func, pull_func) -> _Pull(expr, shape, to_func, pull_func, empty_cx(), \n\ttrue, true);\n\t\n# Bottom-up recursive Pull (non-recursive bottom up does not exist)\nPullBU := (expr, shape, to_func, pull_func) -> _Pull(expr, shape, to_func, pull_func, empty_cx(), \n\ttrue, false);\n\t\n# Top-down non-recursive Pull\nPullNR := (expr, shape, to_func, pull_func) -> _Pull(expr, shape, to_func, pull_func, empty_cx(), \n\tfalse, true);\n\n_Pull := function(expr, shape, to_func, pull_func, cx, do_recurse, top_down)\n\tlocal ch, i, t, data, newdata, newexpr;\n\tdata := [];\n\n\tif top_down then\n\t\tif PatternMatch(expr, shape, cx) then\n\t\t\tAdd(data, When(NumArgs(pull_func)=2, pull_func(cx, expr), pull_func(expr)));\n\t\t\texpr := When(NumArgs(to_func)=2, to_func(cx, expr), to_func(expr));\n\t\t\tif not do_recurse then\n\t\t\t\treturn [ data, expr ];\n\t\t\tfi;\n\t\tfi;\n\tfi;\n\n\tcx_enter(cx, expr);\n\tch := _children(expr);\n\tfor i in [1..Length(ch)] do\n\t\tt := _Pull(ch[i], shape, to_func, pull_func, cx, do_recurse, top_down);\n\t\tAppend(data, t[1]);\n\t\t_setChild(expr, i, t[2]);\n\tod;\n\tcx_leave(cx, expr);\n\n\tif not top_down then\n\t\tif PatternMatch(expr, shape, cx) then\n\t\t\tAdd(data, When(NumArgs(pull_func)=2, pull_func(cx, expr), pull_func(expr)));\n\t\t\texpr := When(NumArgs(to_func)=2, to_func(cx, expr), to_func(expr));\n\t\t\tif not do_recurse then\n\t\t\t\treturn [ data, expr ];\n\t\t\tfi;\n\t\tfi;\n\tfi;\n\treturn [data, expr]; \nend;\n\n#F Harvest( <expr>, <shape-func-list> )\n#F\n#F Harvest is a generalization of Collect( <expr>, <shape> ).\n#F It returns concatenated list of <func>(child) for all children \n#F of <expr> that match <shape>, for each <shape>-<func> pair.\nHarvest := function( expr, shape_func_list )\n\tlocal res, sf, c;\n\tres := [];\n\tfor sf in shape_func_list do\n\t\tAppend(res, List(Collect(expr, sf[1]), sf[2]));\n\tod;\n\treturn res;\nend;\n\n#F SubstObj(<expr>, <obj>, <new_obj>\n#F replacing all occurences of <obj> by <new_obj>\nSubstObj := (expr, obj, new_obj) -> SubstTopDownNR_named(expr, @.cond(x -> x=obj), e -> new_obj, \"SubstObj\");\n", "meta": {"hexsha": "2f76829a37eb7e29629c83d52de49fd5befcd1da", "size": 20736, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/rewrite/rules.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/rewrite/rules.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/rewrite/rules.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 27.4285714286, "max_line_length": 116, "alphanum_fraction": 0.6497878086, "num_tokens": 6483, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1778108520503478, "lm_q2_score": 0.023689469317704676, "lm_q1q2_score": 0.004212244724001639}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nVerifier := rec(\n    MaxError := 6,\n    IgnoreRoots := false\n);\n\nif not IsBound(GenerateErrorReports) then\n    GenerateErrorReports := true;\nfi;\n\n#F HandleTestError ( <func-name>, <func-args>, <bool> )\n#F    Creates a directory and reports the given function call in\n#F    'test.g', backtrace in 'backtrace' and current configuration in\n#F    'conf.g'\n#F\n#F    Boolean parameter, if true, tells HandleTestError to all Error()\n#F    thus causing an exception, if false, program will continue\n#F    normally.  \n#F\nHandleTestError := function (FuncName, FuncArgs, doErr)\n    local dir,file,arg,n,k;\n    if IsBound(GenerateErrorReports) and GenerateErrorReports = false then\n\treturn;\n    fi;\n    dir := Concat(Conf(\"tmp_dir\"), Conf(\"path_sep\"), \"Error-\", \n\t\t  String(TimeInSecs()), Conf(\"path_sep\"));\n    file := Concat(dir, \"test.g\");\n    SysMkdir(dir);\n    # Create a file (truncate if it exists)\n    PrintTo(file, \"Import(spiral.spl, spiral.nt, spiral.code); \\n\");\n#F    AppendTo(file, \"config_update_val(\\\"remove_temporaries\\\", SRC_CMDLINE, int_val(0));\\n\");\n#F    AppendTo(file,\"config_update_val(\\\"tmp_dir\\\", SRC_CMDLINE, str_val(\\\"./tmp\\\"));\\n\");\n    AppendTo(file, \"GenerateErrorReports := false; \\n\");\n    AppendTo(file, \"SPL_DEFAULTS := \", SPL_DEFAULTS, \";\\n\");\n    # write function arguments\n    n := 1;\n    for arg in FuncArgs do\n\tAppendTo(file, \"arg\", String(n), \" := \");\n\tif IsString(arg) then\n\t    AppendTo(file, \"\\\"\", arg, \"\\\"\");\n\telse\n\t    AppendTo(file, arg);\n\tfi;\n\tAppendTo(file, \";\\n\\n\");\n\tn := n+1;\n    od;\n\n    # write function call\n    k := 1;\n    AppendTo(file, \"result := \", FuncName, \"( \");\n    while k<>n do\n\tAppendTo(file, \"arg\", String(k));\n\tif k <> n-1 then AppendTo(file, \", \"); fi;\n\tk := k + 1;\n    od;\n    AppendTo(file, \" );\\n\\n\");\n\n    # other info\n    # NOTE: implement a config dump in sys_conf\n#F    AppendTo(Concat(dir, \"conf.g\"), ConfigProfileList(), \";\\n\");\n    BacktraceTo(Concat(dir, \"backtrace.txt\"), 100);\n\n    if doErr then\n\tError(FuncName, \" failed, see \", dir);\n    else\n\tPrint(FuncName, \" failed, see \", dir, \"\\n\");\n    fi;\nend;\n\n#F DeriveSPLOptions ( <spl>, <spl-options-record> )\n#F    Merges the defaults with <spl-options-record>, derives other \n#F    fields, such as dataType, from <spl>, and returns a complete\n#F    options record.\n#F\nDeriveSPLOptions := function (S, R)\n    # set options\n    R := MergeSPLOptionsRecord(R);\n\n    # check if MPI req'd\n#    if IsDMP(S) then\n#\tR.language := \"c.mpi.mpich\";\n#    fi;\n  \n\n    # if user didn't specify data type determine it from S\n    if R.dataType = \"no default\" then\n\tif IsRealSPL(S) then R.dataType := \"real\";\n    \telse R.dataType := \"complex\"; \n\tfi;\n    else\n\t;# prevent user from doing nonsense\n\t#if not IsRealSPL(S) and R.dataType = \"real\" then\n\t#    Error(\"invalid combination: complex <S> and real data type\");\n\t#fi;   \n    fi;\n    return R;\nend;\n\n#F DeriveScalarType ( <spl-options-record> )\n#F \nDeriveScalarType := function(SPLOpts) \n    local suffix;\n    if IsBound(SPLOpts.customDataType) then return SPLOpts.customDataType;\n    elif IsBound(SPLOpts.customReal) and SPLOpts.dataType = \"real\" then return SPLOpts.customReal;\n    elif IsBound(SPLOpts.customComplex) and SPLOpts.dataType = \"complex\" then return SPLOpts.customComplex;\n    else\n\tif SPLOpts.dataType = \"real\" then suffix := \"\";\n\telif SPLOpts.dataType = \"complex\" then suffix := \"_cplx\";\n\telse Error(\"SPLOpts.dataType has invalid value '\", SPLOpts.dataType, \"'\");\n\tfi;\n\tif SPLOpts.precision = \"single\" then return Concat(\"float\",suffix);\n\telif SPLOpts.precision = \"double\" then return Concat(\"double\",suffix);\n\telif SPLOpts.precision = \"extended\" then return Concat(\"long_double\",suffix);\n\telse Error(\"SPLOpts.precision has invalid value '\", SPLOpts.dataType, \"'\");\n\tfi;\n    fi;\nend;\n\nProgInputType := rec(\n    SPLSource := 0,\n    TargetSource := 1,\n    ObjFile := 2\n);\n\n#F DeriveType ( <spl-options-record> )\nDeriveType := (opts)->When(IsBound(opts.vector), opts.vector.isa.ctype,\n    DeriveScalarType(opts));\n\n#F ProgSPL ( <spl> , <spl-options-record> )\n#F    Convert <spl> to a 'Prog' record used by xxxProg functions.\n#F    See gap/src/spiral_spl_prog.c for details.\n#F\nProgSPL := function (SPL, Opts)\n    local prog;\n    Opts := DeriveSPLOptions(SPL, Opts);\n    prog := rec();\n    prog.profile   := Opts.language;\n    prog.type      := ProgInputType.SPLSource;\n    prog.data_type := DeriveScalarType(Opts);\n\n    if IsBound(Opts.zeroBits) then prog.zero_bits := Opts.zeroBits;\n    else prog.zero_bits := 0; fi;\n\n    prog.dim_rows  := EvalScalar(SPL.dimensions[1]);\n    prog.dim_cols  := EvalScalar(SPL.dimensions[2]);\n    prog.auto_dim  := 0;\n\n    if IsBound(Opts.compflags) then prog.compiler_flags := Opts.compflags; fi;\n\n    if IsBound(Opts.file) then prog.file := Opts.file;\n    else prog.file := SysTmpName(); fi;\n\n    if IsBound(Opts.subName) then prog.sub_name := Opts.subName;\n    else prog.sub_name := \"sub\"; fi;\n\n    prog.spl_file := prog.file;\n    return prog;\nend;\n\n#F   Valid <compare-type>'s are\n#F     \"random\": compare on random vector (default)\n#F     \"basis\" : compare on standard basis\n#F     <int>   : compare on <int> random standard base vectors\n#F\nVerifierOpts := function (CO)\n    local opts;\n    opts := Concat(\"-g -e \", String(Verifier.MaxError), \" \");\n    if CO = \"basis\" then return Concat(opts, \" -b\");\n    elif CO = \"random\" then return Concat(opts, \" -r\");\n    elif IsInt(CO) then return Concat(opts, \" -s \", String(CO));\n    else Error(\"<CO> must be an integer, \\\"random\\\", or \\\"basis\\\"\");\n    fi;\nend;\n", "meta": {"hexsha": "71db13c7d456d17cf854f02ef62319931f273ab9", "size": 5591, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/formgen/external.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/formgen/external.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/formgen/external.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 31.4101123596, "max_line_length": 107, "alphanum_fraction": 0.6508674656, "num_tokens": 1622, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.13117322376181564, "lm_q2_score": 0.03210070775871955, "lm_q1q2_score": 0.004210753321747172}}
{"text": "%options la=15\n%options single-productions\n%options template=LexerTemplateF.gi\n%options filter=LPGKWLexer.gi\n\n%Globals\n    /.\n\n    ./\n%End\n\n%Define\n \n    $kw_lexer_class /.$LPGKWLexer./\n    $_IDENTIFIER /.$_MACRO_NAME./\n%End\n\n%Include\n   LexerBasicMapF.gi\n   --Utf8LexerBasicMapF.gi\n%End\n\n%Export\n    SINGLE_LINE_COMMENT\n    \n    MACRO_NAME\n    SYMBOL\n    BLOCK\n    EQUIVALENCE\n    PRIORITY_EQUIVALENCE\n    ARROW\n    PRIORITY_ARROW\n    OR_MARKER\n    EQUAL\n    COMMA\n    LEFT_PAREN\n    RIGHT_PAREN\n    LEFT_BRACKET\n    RIGHT_BRACKET\n    SHARP\n    VBAR\n%End\n\n%Terminals\n    CtlCharNotWS\n\n    LF   CR   HT   FF\n\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n    _\n\n    A    B    C    D    E    F    G    H    I    J    K    L    M\n    N    O    P    Q    R    S    T    U    V    W    X    Y    Z\n\n    0    1    2    3    4    5    6    7    8    9\n\n    AfterASCII   ::= '\\u0080..\\ufffe'\n    Space        ::= ' '\n    LF           ::= NewLine\n    CR           ::= Return\n    HT           ::= HorizontalTab\n    FF           ::= FormFeed\n    DoubleQuote  ::= '\"'\n    SingleQuote  ::= \"'\"\n    Percent      ::= '%'\n    VerticalBar  ::= '|'\n    Exclamation  ::= '!'\n    AtSign       ::= '@'\n    BackQuote    ::= '`'\n    Tilde        ::= '~'\n    Sharp        ::= '#'\n    DollarSign   ::= '$'\n    Ampersand    ::= '&'\n    Caret        ::= '^'\n    Colon        ::= ':'\n    SemiColon    ::= ';'\n    BackSlash    ::= '\\'\n    LeftBrace    ::= '{'\n    RightBrace   ::= '}'\n    LeftBracket  ::= '['\n    RightBracket ::= ']'\n    QuestionMark ::= '?'\n    Comma        ::= ','\n    Dot          ::= '.'\n    LessThan     ::= '<'\n    GreaterThan  ::= '>'\n    Plus         ::= '+'\n    Minus        ::= '-'\n    Slash        ::= '/'\n    Star         ::= '*'\n    LeftParen    ::= '('\n    RightParen   ::= ')'\n    Equal        ::= '='\n%End\n\n%Start\n    Token\n%End\n\n%Notice\n/.\n////////////////////////////////////////////////////////////////////////////////\n// Copyright (c) 2007 IBM Corporation.\n// All rights reserved. This program and the accompanying materials\n// are made available under the terms of the Eclipse Public License v1.0\n// which accompanies this distribution, and is available at\n// http://www.eclipse.org/legal/epl-v10.html\n//\n//Contributors:\n//    Philippe Charles (pcharles@us.ibm.com) - initial API and implementation\n\n////////////////////////////////////////////////////////////////////////////////\n./\n%End\n\n%Rules\n    Token ::= white /.$BeginJava skipToken(); $EndJava./\n    Token ::= singleLineComment /.$BeginJava makeComment($_SINGLE_LINE_COMMENT); $EndJava./\n\n    Token ::= OptionLines\n    Token ::= MacroSymbol       /.$BeginJava checkForKeyWord();$EndJava./\n    Token ::= Symbol            /.$BeginJava checkForKeyWord($_SYMBOL);$EndJava./\n    Token ::= Block             /.$BeginJava makeToken($_BLOCK);$EndJava./\n    Token ::= Equivalence       /.$BeginJava makeToken($_EQUIVALENCE);$EndJava./\n    Token ::= Equivalence ?     /.$BeginJava makeToken($_PRIORITY_EQUIVALENCE);$EndJava./\n    Token ::= '#'               /.$BeginJava makeToken($_SHARP);$EndJava./\n    Token ::= Arrow             /.$BeginJava makeToken($_ARROW);$EndJava./\n    Token ::= Arrow ?           /.$BeginJava makeToken($_PRIORITY_ARROW);$EndJava./\n    Token ::= '|'               /.$BeginJava makeToken($_OR_MARKER);$EndJava./\n    Token ::= '['               /.$BeginJava makeToken($_LEFT_BRACKET);$EndJava./\n    Token ::= ']'               /.$BeginJava makeToken($_RIGHT_BRACKET);$EndJava./\n\n    digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n    aA -> a | A\n    bB -> b | B\n    cC -> c | C\n    dD -> d | D\n    eE -> e | E\n    fF -> f | F\n    gG -> g | G\n    hH -> h | H\n    iI -> i | I\n    jJ -> j | J\n    kK -> k | K\n    lL -> l | L\n    mM -> m | M\n    nN -> n | N\n    oO -> o | O\n    pP -> p | P\n    qQ -> q | Q\n    rR -> r | R\n    sS -> s | S\n    tT -> t | T\n    uU -> u | U\n    vV -> v | V\n    wW -> w | W\n    xX -> x | X\n    yY -> y | Y\n    zZ -> z | Z\n\n--  lower ::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z\n--  upper ::= A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z\n\n    letter -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | nN | oO | pP | qQ | rR | sS | tT | uU | vV | wW | xX | yY | zZ\n\n    anyNonWhiteChar -> letter | digit | special\n\n    special -> specialNoDotOrSlash | '.' | '/'\n\n    --    special -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' | '/' |\n    --               '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n    --               '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoExclamationDotColonDollar -> '+' | '-' | '(' | ')' | '\"' | '@' | '`' | '~' | '/' |\n                                          '%' | '&' | '^' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                                          '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*'\n\n    specialNoColonDollar -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' | '/' |\n                            '%' | '&' | '^' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                            '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*'\n\n    specialNoEqualDollar -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' | '/' |\n                            '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                            '[' | ']' | '?' | ',' | '<' | '>' | '#' | '*'\n\n    specialNoQuestionDollar -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' | '/' |\n                               '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                               '[' | ']' | ',' | '<' | '>' | '=' | '#' | '*'\n\n    specialNoMinusRightAngleDollar -> '+' | '(' | ')' | '!' | '@' | '`' | '~' | '.' | '/' |\n                                      '%' | '&' | '^' | ':' | ';' | '\"' | '\\' | '|' | '{' | '}' |\n                                      '[' | ']' | '?' | ',' | '<' | \"'\" | '=' | '#' | '*' | '$'\n\n    specialNoDollar -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' | '/' |\n                       '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                       '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*'\n\n    specialNoDollarBracketSharp -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' | '/' |\n                       '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                       '?' | ',' | '<' | '>' | '=' | '*'\n\n    specialNoDotOrSlash -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n                           '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                           '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoColonOrSlash -> '+' | '-' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' | '.' |\n                             '%' | '&' | '^' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                             '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoExclamationOrSlash -> '+' | '-' | '(' | ')' | '\"' | '@' | '`' | '~' | '.' |\n                                   '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                                   '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoDoubleQuote -> '+' | '-' | '(' | ')' | '!' | '@' | '`' | '~' | '.' | '/' |\n                            '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                            '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoSingleQuote -> '+' | '-' | '(' | ')' | '!' | '@' | '`' | '~' | '.' | '/' |\n                            '%' | '&' | '^' | ':' | ';' | '\"' | '\\' | '|' | '{' | '}' |\n                            '[' | ']' | '?' | ',' | '<' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoRightAngle -> '+' | '-' | '(' | ')' | '!' | '@' | '`' | '~' | '.' | '/' |\n                           '%' | '&' | '^' | ':' | ';' | '\"' | '\\' | '|' | '{' | '}' |\n                           '[' | ']' | '?' | ',' | '<' | \"'\" | '=' | '#' | '*' | '$'\n\n    specialNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen -> '+' | '!' | '@' | '`' | '~' | '.' | '/' |\n                                                                      '%' | '&' | '^' | ':' | ';' | '\\' | '|' | '{' | '}' |\n                                                                      '[' | ']' | '?' | '>' | '=' | '#' | '*' | '$'\n\n    specialNoColonMinusSingleQuoteDoublequoteLeftAngleLRBracketOrSlashDollarPercent -> '+' | '(' | ')' | '!' | '@' | '`' | '~' | '.' |\n                                                                              '&' | '^' | ';' | '\\' | '{' | '}' |\n                                                                              '?' | ',' | '>' | '=' | '*'\n\n    Eol -> LF | CR\n\n    whiteChar -> Space | Eol | HT | FF\n\n    white ::= whiteChar\n            | white whiteChar\n\n    notEOL -> letter | digit | special | Space | HT | FF\n\n    notEOLOrQuote -> letter | digit | specialNoSingleQuote | Space | HT | FF\n\n    notEOLOrDoubleQuote -> letter | digit | specialNoDoubleQuote | Space | HT | FF\n\n    notEOLOrRightAngle -> letter | digit | specialNoRightAngle | Space | HT | FF\n\n    notEOLOrQuotes ::= %Empty\n                     | notEOLOrQuotes notEOLOrQuote\n\n    notEOLOrDoubleQuotes ::= %Empty\n                           | notEOLOrDoubleQuotes notEOLOrDoubleQuote\n\n    notEOLOrRightAngles ::= notEOLOrRightAngle\n                          | notEOLOrRightAngles notEOLOrRightAngle\n\n    singleLineComment ::= '-' '-'\n                        | singleLineComment notEOL\n\n    Equivalence ::= ':' ':' '='\n    Arrow       ::= '-' '>'\n\n    Exclamations ::= '!'\n                   | Exclamations '!'\n\n    InsideExclamationBlockChar -> letter | whiteChar | digit | specialNoExclamationOrSlash\n\n    InsideExclamationBlock ::= %Empty\n                             | InsideExclamationBlock InsideExclamationBlockChar\n                             | InsideExclamationBlock Exclamations InsideExclamationBlockChar\n                             | InsideExclamationBlock '/'\n\n    Dots ::= '.'\n           | Dots '.'\n\n    InsideDotBlockChar -> letter | whiteChar | digit | specialNoDotOrSlash\n\n    InsideDotBlock ::= %Empty\n                     | InsideDotBlock InsideDotBlockChar\n                     | InsideDotBlock Dots InsideDotBlockChar\n                     | InsideDotBlock '/'\n\n    Colons ::= ':'\n             | Colons ':'\n\n    InsideColonBlockChar -> letter | whiteChar | digit | specialNoColonOrSlash\n\n    InsideColonBlock ::= %Empty\n                       | InsideColonBlock InsideColonBlockChar\n                       | InsideColonBlock Colons InsideColonBlockChar\n                       | InsideColonBlock '/'\n\n    Block ::= '/' '.' InsideDotBlock Dots '/'\n            | '/' ':' InsideColonBlock Colons '/'\n            | '/' '!' InsideExclamationBlock Exclamations '/'\n\n    Symbol -> delimitedSymbol\n            | specialSymbol\n            | normalSymbol\n\n    delimitedSymbol ::= \"'\" notEOLOrQuotes \"'\"\n                      | '\"' notEOLOrDoubleQuotes '\"'\n                      | '<' letter notEOLOrRightAngles '>'\n\n    MacroSymbol ::= '$'\n                  | MacroSymbol letter\n                  | MacroSymbol digit\n\n    anyNonWhiteNoColonMinusSingleQuoteDoublequoteLeftAngleLRBracketOrSlashDollarPercent -> letter | digit | specialNoColonMinusSingleQuoteDoublequoteLeftAngleLRBracketOrSlashDollarPercent\n    normalSymbol ::= anyNonWhiteNoColonMinusSingleQuoteDoublequoteLeftAngleLRBracketOrSlashDollarPercent\n                   | normalSymbol anyNonWhiteNoDollarBracketSharp\n\n    --\n    -- Below, we write special rules to recognize initial \n    -- prefixes of these special metasymbols as valid symbols.\n    --\n    --    BLOCK            /.  ...\n    --    EQUIVALENCE      ::=[?]\n    --    ARROW            ->[?]\n    --    COMMENT          -- ...\n    --    OR_MARKER        |\n    --    OPTIONS_KEY      %options\n    --    bracketed symbol < ... >\n    --\n\n    letterNoOo -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | nN | pP | qQ | rR | sS | tT | uU | vV | wW | xX | yY | zZ\n    letterNoPp -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | nN | oO | qQ | rR | sS | tT | uU | vV | wW | xX | yY | zZ\n    letterNoTt -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | nN | oO | pP | qQ | rR | sS | uU | vV | wW | xX | yY | zZ\n    letterNoIi -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | jJ | kK | lL | mM | nN | oO | pP | qQ | rR | sS | tT | uU | vV | wW | xX | yY | zZ\n    letterNoNn -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | oO | pP | qQ | rR | sS | tT | uU | vV | wW | xX | yY | zZ\n    letterNoSs -> AfterASCII | '_' | aA | bB | cC | dD | eE | fF | gG | hH | iI | jJ | kK | lL | mM | nN | oO | pP | qQ | rR | tT | uU | vV | wW | xX | yY | zZ\n\n    anyNonWhiteNoLetterDollar -> digit | specialNoDollar\n    anyNonWhiteNoExclamationDotColonDollar -> letter | digit | specialNoExclamationDotColonDollar\n    anyNonWhiteNoColonDollar -> letter | digit | specialNoColonDollar\n    anyNonWhiteNoEqualDollar -> letter | digit | specialNoEqualDollar\n    anyNonWhiteNoQuestionDollar -> letter | digit | specialNoQuestionDollar\n    anyNonWhiteNoMinusRightAngleDollar -> letter | digit | specialNoMinusRightAngleDollar\n    anyNonWhiteNoDollar -> letter | digit | specialNoDollar\n    anyNonWhiteNoDollarBracketSharp -> letter | digit | specialNoDollarBracketSharp\n\n    anyNonWhiteNoOoDollar -> letterNoOo | digit | specialNoDollar\n    anyNonWhiteNoPpDollar -> letterNoPp | digit | specialNoDollar\n    anyNonWhiteNoTtDollar -> letterNoTt | digit | specialNoDollar\n    anyNonWhiteNoIiDollar -> letterNoIi | digit | specialNoDollar\n    anyNonWhiteNoNnDollar -> letterNoNn | digit | specialNoDollar\n    anyNonWhiteNoSsDollar -> letterNoSs | digit | specialNoDollar\n\n    specialSymbol -> simpleSpecialSymbol\n                   | complexSpecialSymbol\n\n    simpleSpecialSymbol ::= '<'\n                          | '/'\n                          | ':'\n                          | ':' ':'\n                          | '-'\n                          | '%'\n                          | '%' oO\n                          | '%' oO pP\n                          | '%' oO pP tT\n                          | '%' oO pP tT iI\n                          | '%' oO pP tT iI oO\n                          | '%' oO pP tT iI oO nN\n\n    complexSpecialSymbol ::= '<' anyNonWhiteNoLetterDollar\n                           | '/' anyNonWhiteNoExclamationDotColonDollar\n                           | ':' anyNonWhiteNoColonDollar\n                           | ':' ':' anyNonWhiteNoEqualDollar\n                           | ':' ':' '=' anyNonWhiteNoQuestionDollar\n                           | ':' ':' '=' '?' anyNonWhiteNoDollar\n                           | '-' anyNonWhiteNoMinusRightAngleDollar\n                           | '-' '>' anyNonWhiteNoQuestionDollar\n                           | '-' '>' '?' anyNonWhiteNoDollar\n                           | '|' anyNonWhiteNoDollar\n                           | '%' anyNonWhiteNoOoDollar\n                           | '%' oO anyNonWhiteNoPpDollar\n                           | '%' oO pP anyNonWhiteNoTtDollar\n                           | '%' oO pP tT anyNonWhiteNoIiDollar\n                           | '%' oO pP tT iI anyNonWhiteNoOoDollar\n                           | '%' oO pP tT iI oO anyNonWhiteNoNnDollar\n                           | '%' oO pP tT iI oO nN anyNonWhiteNoSsDollar\n                           | '%' oO pP tT iI oO nN sS anyNonWhiteNoDollar\n                           | complexSpecialSymbol anyNonWhiteNoDollar\n\n    number ::= digit\n             | number digit\n\n   --\n   -- The following rules are used for processing options.\n   --\n   OptionLines ::= OptionLineList\n          /.$BeginJava\n                      // What ever needs to happen after the options have been \n                      // scanned must happen here.\n            $EndJava\n          ./\n\n   OptionLineList ::= OptionLine\n                    | OptionLineList OptionLine\n   OptionLine ::= options Eol\n                | OptionsHeader Eol\n                | OptionsHeader optionList Eol\n                | OptionsHeader OptionComment Eol\n                | OptionsHeader optionList optionWhiteChar OptionComment Eol\n\n   OptionsHeader ::= options optionWhiteChar optionWhite\n   \n   options ::= '%' oO pP tT iI oO nN sS\n          /.$BeginJava\n                      makeToken(getLeftSpan(), getRightSpan(), $_OPTIONS_KEY);\n            $EndJava\n          ./\n\n   OptionComment ::= singleLineComment /.$BeginJava makeComment($_SINGLE_LINE_COMMENT); $EndJava./\n   \n   _opt -> %Empty\n         | '_'\n         | '-'\n\n   no ::= nN oO\n\n   none ::= nN oO nN eE\n\n   anyNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen -> letter\n                                                               | digit\n                                                               | specialNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen\n\n   optionSymbol ::= anyNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen\n                  | '-' anyNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen\n                  | optionSymbol '-' anyNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen\n                  | optionSymbol anyNoMinusSingleQuoteDoublequoteLeftAngleCommaLparenRparen\n\n   Value ::= delimitedSymbol\n           | '-'\n           | optionSymbol\n           | optionSymbol '-'\n\n   optionWhiteChar -> Space | HT | FF\n   optionWhite ::= %Empty\n                 | optionWhite optionWhiteChar\n\n   optionList ::= option\n                | optionList separator option\n   separator ::= ','$comma /.$BeginJava  makeToken(getLeftSpan(), getRightSpan(), $_COMMA); $EndJava./\n   --\n   -- action_block\n   -- ast_directory\n   -- ast_type\n   -- automatic_ast\n   -- attributes\n   --\n   option ::= action_block$ab optionWhite '='$eq optionWhite '('$lp optionWhite filename$fn optionWhite ','$comma1 optionWhite block_begin$bb optionWhite ','$comma2 optionWhite block_end$be optionWhite ')'$rp optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($ab), getRhsLastTokenIndex($ab), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($lp), getRhsLastTokenIndex($lp), $_LEFT_PAREN);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma1), getRhsLastTokenIndex($comma1), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($bb), getRhsLastTokenIndex($bb), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma2), getRhsLastTokenIndex($comma2), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($be), getRhsLastTokenIndex($be), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($rp), getRhsLastTokenIndex($rp), $_RIGHT_PAREN);\n            $EndJava\n          ./\n   action_block ::= aA cC tT iI oO nN _opt bB lL oO cC kK\n                  | aA bB\n   filename -> Value\n   block_begin -> Value\n   block_end -> Value\n\n   option ::= ast_directory$ad optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($ad), getRhsLastTokenIndex($ad), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   ast_directory ::= aA sS tT _opt dD iI rR eE cC tT oO rR yY\n                   | aA dD \n\n   option ::= ast_type$at optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($at), getRhsLastTokenIndex($at), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   ast_type ::= aA sS tT _opt tT yY pP eE\n              | aA tT \n\n   option ::= attributes$a optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($a), getRhsLastTokenIndex($a), $_SYMBOL); $EndJava./\n            | no attributes$a optionWhite  /.$BeginJava  makeToken(getRhsFirstTokenIndex($a), getRhsLastTokenIndex($a), $_SYMBOL); $EndJava./\n   attributes ::= aA tT tT rR iI bB uU tT eE sS\n\n   option ::= automatic_ast$a optionWhite  /.$BeginJava  makeToken(getRhsFirstTokenIndex($a), getRhsLastTokenIndex($a), $_SYMBOL); $EndJava./\n            | no automatic_ast$a optionWhite  /.$BeginJava  makeToken(getRhsFirstTokenIndex($a), getRhsLastTokenIndex($a), $_SYMBOL); $EndJava./\n   option ::= automatic_ast$aa optionWhite '='$eq optionWhite automatic_ast_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($aa), getRhsLastTokenIndex($aa), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   automatic_ast ::= aA uU tT oO mM aA tT iI cC _opt aA sS tT\n                   | aA aA\n   automatic_ast_value ::= none\n                         | nN eE sS tT eE dD\n                         | tT oO pP _opt lL eE vV eE lL\n\n   --\n   -- backtrack\n   -- byte\n   --\n   option ::= backtrack$b optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($b), getRhsLastTokenIndex($b), $_SYMBOL); $EndJava./\n            | no backtrack$b optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($b), getRhsLastTokenIndex($b), $_SYMBOL); $EndJava./\n   backtrack ::= bB aA cC kK tT rR aA cC kK\n\n   option ::= byte$b optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($b), getRhsLastTokenIndex($b), $_SYMBOL); $EndJava./\n            | no byte$b optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($b), getRhsLastTokenIndex($b), $_SYMBOL); $EndJava./\n   byte ::= bB yY tT eE\n   \n\n   --\n   -- conflicts\n   --\n   option ::= conflicts$c optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($c), getRhsLastTokenIndex($c), $_SYMBOL); $EndJava./\n            | no conflicts$c optionWhite  /.$BeginJava  makeToken(getRhsFirstTokenIndex($c), getRhsLastTokenIndex($c), $_SYMBOL); $EndJava./\n   conflicts ::= cC oO nN fF lL iI cC tT sS\n\n   --\n   -- dat_directory\n   -- dat_file\n   -- dcl_file\n   -- def_file\n   -- debug\n   --\n   option ::= dat_directory$dd optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($dd), getRhsLastTokenIndex($dd), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   dat_directory ::= dD aA tT _opt dD iI rR eE cC tT oO rR yY \n                   | dD dD\n\n   option ::= dat_file$df optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($df), getRhsLastTokenIndex($df), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   dat_file ::= dD aA tT _opt fF iI lL eE\n\n   option ::= dcl_file$df optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($df), getRhsLastTokenIndex($df), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   dcl_file ::= dD cC lL _opt fF iI lL eE\n\n   option ::= def_file$df optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($df), getRhsLastTokenIndex($df), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   def_file ::= dD eE fF _opt fF iI lL eE\n\n   option ::= debug$d optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($d), getRhsLastTokenIndex($d), $_SYMBOL); $EndJava./\n            | no debug$d optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($d), getRhsLastTokenIndex($d), $_SYMBOL); $EndJava./\n   debug ::= dD eE bB uU gG\n\n   --\n   -- edit\n   -- error_maps\n   -- escape\n   -- export_terminals\n   -- extends_parsetable\n   --\n   option ::= edit$e optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL); $EndJava./\n            | no edit$e optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL); $EndJava./\n   edit ::= eE dD iI tT\n\n   option ::= error_maps$e optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL); $EndJava./\n            | no error_maps$e optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL); $EndJava./\n   error_maps ::= eE rR rR oO rR _opt mM aA pP sS\n                | eE mM\n\n   option ::= escape$e optionWhite '='$eq optionWhite anyNonWhiteChar$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   escape ::= eE sS cC aA pP eE\n\n   option ::= export_terminals$et optionWhite '='$eq optionWhite filename$fn optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($et), getRhsLastTokenIndex($et), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n            $EndJava\n          ./\n   option ::= export_terminals$et optionWhite '='$eq optionWhite '('$lp optionWhite filename$fn optionWhite ')'$rp optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($et), getRhsLastTokenIndex($et), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($lp), getRhsLastTokenIndex($lp), $_LEFT_PAREN);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($rp), getRhsLastTokenIndex($rp), $_RIGHT_PAREN);\n            $EndJava\n          ./\n   option ::= export_terminals$et optionWhite '='$eq optionWhite '('$lp optionWhite filename$fn optionWhite ','$comma optionWhite export_prefix$ep optionWhite ')'$rp optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($et), getRhsLastTokenIndex($et), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($lp), getRhsLastTokenIndex($lp), $_LEFT_PAREN);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma), getRhsLastTokenIndex($comma), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($ep), getRhsLastTokenIndex($ep), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($rp), getRhsLastTokenIndex($rp), $_RIGHT_PAREN);\n            $EndJava\n          ./\n   option ::= export_terminals$et optionWhite '='$eq optionWhite '('$lp optionWhite filename$fn optionWhite ','$comma1 optionWhite export_prefix$ep optionWhite ','$comma2 optionWhite export_suffix$es optionWhite ')'$rp optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($et), getRhsLastTokenIndex($et), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($lp), getRhsLastTokenIndex($lp), $_LEFT_PAREN);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma1), getRhsLastTokenIndex($comma1), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($ep), getRhsLastTokenIndex($ep), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma2), getRhsLastTokenIndex($comma2), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($es), getRhsLastTokenIndex($es), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($rp), getRhsLastTokenIndex($rp), $_RIGHT_PAREN);\n            $EndJava\n          ./\n   export_terminals ::= eE xX pP oO rR tT _opt tT eE rR mM iI nN aA lL sS\n                      | eE tT \n   export_prefix -> Value\n   export_suffix -> Value\n\n   option ::= extends_parsetable$e optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL); $EndJava./\n            | no extends_parsetable$e optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($e), getRhsLastTokenIndex($e), $_SYMBOL); $EndJava./\n   option ::= extends_parsetable$ep optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($ep), getRhsLastTokenIndex($ep), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   extends_parsetable ::= eE xX tT eE nN dD sS _opt pP aA rR sS eE tT aA bB lL eE\n                        | eE pP\n\n   --\n   -- factory\n   -- file_prefix\n   -- filter\n   -- first\n   -- follow\n   --\n   option ::= factory$f optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($f), getRhsLastTokenIndex($f), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   factory ::= fF aA cC tT oO rR yY\n\n   option ::= file_prefix$fp optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($fp), getRhsLastTokenIndex($fp), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   file_prefix ::= fF iI lL eE _opt pP rR eE fF iI xX\n                 | fF pP\n\n   option ::= filter$f optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($f), getRhsLastTokenIndex($f), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   filter ::= fF iI lL tT eE rR\n\n   option ::= first$f optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($f), getRhsLastTokenIndex($f), $_SYMBOL); $EndJava./\n            | no first$f optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($f), getRhsLastTokenIndex($f), $_SYMBOL); $EndJava./\n   first ::= fF iI rR sS tT\n\n   option ::= follow$f optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($f), getRhsLastTokenIndex($f), $_SYMBOL); $EndJava./\n            | no follow$f optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($f), getRhsLastTokenIndex($f), $_SYMBOL); $EndJava./\n   follow ::= fF oO lL lL oO wW\n\n   --\n   -- goto_default\n   --\n   option ::= goto_default$g optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($g), getRhsLastTokenIndex($g), $_SYMBOL); $EndJava./\n            | no goto_default$g optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($g), getRhsLastTokenIndex($g), $_SYMBOL); $EndJava./\n   goto_default ::= gG oO tT oO _opt dD eE fF aA uU lL tT\n                  | gG dD\n\n   --\n   -- Headers\n   --\n   option ::= headers$h optionWhite '='$eq optionWhite '('$lp optionWhite filename$fn optionWhite ','$comma1 optionWhite block_begin$bb optionWhite ','$comma2 optionWhite block_end$be optionWhite ')'$rp optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($h), getRhsLastTokenIndex($h), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($lp), getRhsLastTokenIndex($lp), $_LEFT_PAREN);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma1), getRhsLastTokenIndex($comma1), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($bb), getRhsLastTokenIndex($bb), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma2), getRhsLastTokenIndex($comma2), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($be), getRhsLastTokenIndex($be), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($rp), getRhsLastTokenIndex($rp), $_RIGHT_PAREN);\n            $EndJava\n          ./\n   headers ::= hH eE aA dD eE rR sS\n\n   --\n   -- imp_file\n   -- import_terminals\n   -- include_directory/include_directories\n   --\n   option ::= imp_file$if optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($if), getRhsLastTokenIndex($if), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   imp_file ::= iI mM pP _opt fF iI lL eE\n              | iI fF \n\n   option ::= import_terminals$it optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($it), getRhsLastTokenIndex($it), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   import_terminals ::= iI mM pP oO rR tT _opt tT eE rR mM iI nN aA lL sS\n                      | iI tT\n\n   option ::= include_directory$id optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($id), getRhsLastTokenIndex($id), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   include_directory ::= iI nN cC lL uU dD eE _opt dD iI rR eE cC tT oO rR yY\n                       | iI nN cC lL uU dD eE _opt dD iI rR eE cC tT oO rR iI eE sS \n                       | iI dD\n\n   --\n   -- lalr_level\n   -- list\n   --\n   option ::= lalr_level$l optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($l), getRhsLastTokenIndex($l), $_SYMBOL); $EndJava./\n            | no lalr_level$l optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($l), getRhsLastTokenIndex($l), $_SYMBOL); $EndJava./\n   option ::= lalr_level$l optionWhite '='$eq optionWhite number$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($l), getRhsLastTokenIndex($l), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   lalr_level ::= lL aA lL rR _opt lL eE vV eE lL\n                | lL aA lL rR\n                | lL aA\n                | lL lL\n\n   option ::= list$l optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($l), getRhsLastTokenIndex($l), $_SYMBOL); $EndJava./\n            | no list$l optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($l), getRhsLastTokenIndex($l), $_SYMBOL); $EndJava./\n   list ::= lL iI sS tT \n\n   --\n   -- margin\n   -- max_cases\n   --\n   option ::= margin$m optionWhite '='$eq optionWhite number$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($m), getRhsLastTokenIndex($m), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   margin ::= mM aA rR gG iI nN\n\n   option ::= max_cases$mc optionWhite '='$eq optionWhite number$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($mc), getRhsLastTokenIndex($mc), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   max_cases ::= mM aA xX _opt cC aA sS eE sS\n               | mM cC\n\n   --\n   -- names\n   -- nt_check\n   --\n   option ::= names$n optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($n), getRhsLastTokenIndex($n), $_SYMBOL); $EndJava./\n            | no names$n optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($n), getRhsLastTokenIndex($n), $_SYMBOL); $EndJava./\n   option ::= names$n optionWhite '='$eq optionWhite names_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($n), getRhsLastTokenIndex($n), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   names ::= nN aA mM eE sS\n\n   names_value ::= oO pP tT iI mM iI zZ eE dD\n                 | mM aA xX iI mM uU mM\n                 | mM iI nN iI mM uU mM\n   \n\n   option ::= nt_check$n optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($n), getRhsLastTokenIndex($n), $_SYMBOL); $EndJava./\n            | no nt_check$n optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($n), getRhsLastTokenIndex($n), $_SYMBOL); $EndJava./\n   nt_check ::= nN tT _opt cC hH eE cC kK\n              | nN cC\n\n   --\n   -- or_marker\n   -- out_directory\n   --\n   option ::= or_marker$om optionWhite '='$eq optionWhite anyNonWhiteChar$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($om), getRhsLastTokenIndex($om), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   or_marker ::= oO rR _opt mM aA rR kK eE rR\n               | oO mM \n\n   option ::= out_directory$dd optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($dd), getRhsLastTokenIndex($dd), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   out_directory ::= oO uU tT _opt dD iI rR eE cC tT oO rR yY \n                   | oO dD\n\n   --\n   -- package\n   -- parent_saved\n   -- parsetable_interfaces\n   -- prefix\n   -- priority\n   -- programming_language\n   -- prs_file\n   --\n   option ::= parent_saved$ps optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($ps), getRhsLastTokenIndex($ps), $_SYMBOL); $EndJava ./\n            | no parent_saved$ps optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($ps), getRhsLastTokenIndex($ps), $_SYMBOL); $EndJava ./\n   parent_saved ::= pP aA rR eE nN tT _opt sS aA vV eE dD\n                  | pP sS\n\n   option ::= package$p optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($p), getRhsLastTokenIndex($p), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   package ::= pP aA cC kK aA gG eE\n\n   option ::= parsetable_interfaces$pi optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($pi), getRhsLastTokenIndex($pi), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   parsetable_interfaces ::= pP aA rR sS eE tT aA bB lL eE _opt iI nN tT eE rR fF aA cC eE sS\n                           | pP aA rR sS eE tT aA bB lL eE\n                           | pP iI\n\n   option ::= prefix$p optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($p), getRhsLastTokenIndex($p), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   prefix ::= pP rR eE fF iI xX\n\n   option ::= priority$p optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($p), getRhsLastTokenIndex($p), $_SYMBOL); $EndJava./\n            | no priority$p optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($p), getRhsLastTokenIndex($p), $_SYMBOL); $EndJava./\n   priority ::= pP rR iI oO rR iI tT yY\n\n   option ::= programming_language$pl optionWhite '='$eq optionWhite programming_language_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($pl), getRhsLastTokenIndex($pl), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   programming_language ::= pP rR oO gG rR aA mM mM iI nN gG _opt lL aA nN gG uU aA gG eE\n                          | pP lL\n   programming_language_value ::= none\n                                | xX mM lL\n                                | cC\n                                | cC pP pP\n                                | jJ aA vV aA\n                                | pP lL xX\n                                | pP lL xX aA sS mM\n                                | mM lL\n   option ::= prs_file$pf optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($pf), getRhsLastTokenIndex($pf), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   prs_file ::= pP rR sS _opt fF iI lL eE\n              | pP fF\n   \n\n   --\n   -- quiet\n   --\n   option ::= quiet$q optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($q), getRhsLastTokenIndex($q), $_SYMBOL); $EndJava./\n            | no quiet$q optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($q), getRhsLastTokenIndex($q), $_SYMBOL); $EndJava./\n   quiet ::= qQ uU iI eE tT\n\n   --\n   -- read_reduce\n   -- remap_terminals\n   --\n   option ::= read_reduce$r optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($r), getRhsLastTokenIndex($r), $_SYMBOL); $EndJava./\n            | no read_reduce$r optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($r), getRhsLastTokenIndex($r), $_SYMBOL); $EndJava./\n   read_reduce ::= rR eE aA dD _opt rR eE dD uU cC eE\n                 | rR rR\n\n   option ::= remap_terminals$r optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($r), getRhsLastTokenIndex($r), $_SYMBOL); $EndJava./\n            | no remap_terminals$r optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($r), getRhsLastTokenIndex($r), $_SYMBOL); $EndJava./\n   remap_terminals ::= rR eE mM aA pP _opt tT eE rR mM iI nN aA lL sS\n                     | rR tT\n\n   --\n   -- scopes\n   -- serialize\n   -- shift_default\n   -- single_productions\n   -- slr\n   -- soft_keywords\n   -- states\n   -- suffix\n   -- sym_file\n   --\n   option ::= scopes$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no scopes$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   scopes ::= sS cC oO pP eE sS\n\n   option ::= serialize$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no serialize$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   serialize ::= sS eE rR iI aA lL iI zZ eE\n\n   option ::= shift_default$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no shift_default$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   shift_default ::= sS hH iI fF tT _opt dD eE fF aA uU lL tT\n                   | sS dD\n\n   option ::= single_productions$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no single_productions$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   single_productions ::= sS iI nN gG lL eE _opt pP rR oO dD uU cC tT iI oO nN sS\n                        | sS pP\n\n   option ::= slr$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no slr$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   slr ::= sS lL rR\n\n   option ::= soft_keywords$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no soft_keywords$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   soft_keywords ::= sS oO fF tT _opt kK eE yY wW oO rR dD sS \n                   | sS oO fF tT\n                   | sS kK\n\n   option ::= states$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n            | no states$s optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL); $EndJava ./\n   states ::= sS tT aA tT eE sS\n\n   option ::= suffix$s optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($s), getRhsLastTokenIndex($s), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   suffix ::= sS uU fF fF iI xX \n\n   option ::= sym_file$sf optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($sf), getRhsLastTokenIndex($sf), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   sym_file ::= sS yY mM _opt fF iI lL eE\n              | sS fF \n\n   --\n   -- tab_file\n   -- table\n   -- template\n   -- trace\n   --\n   option ::= tab_file$tf optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($tf), getRhsLastTokenIndex($tf), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   tab_file ::= tT aA bB _opt fF iI lL eE\n              | tT fF\n\n   option ::= template$t optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   template ::= tT eE mM pP lL aA tT eE\n   \n\n   option ::= trailers$t optionWhite '='$eq optionWhite '('$lp optionWhite filename$fn optionWhite ','$comma1 optionWhite block_begin$bb optionWhite ','$comma2 optionWhite block_end$be optionWhite ')'$rp optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($lp), getRhsLastTokenIndex($lp), $_LEFT_PAREN);\n                      makeToken(getRhsFirstTokenIndex($fn), getRhsLastTokenIndex($fn), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma1), getRhsLastTokenIndex($comma1), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($bb), getRhsLastTokenIndex($bb), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($comma2), getRhsLastTokenIndex($comma2), $_COMMA);\n                      makeToken(getRhsFirstTokenIndex($be), getRhsLastTokenIndex($be), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($rp), getRhsLastTokenIndex($rp), $_RIGHT_PAREN);\n            $EndJava\n          ./\n   trailers ::= tT rR aA iI lL eE rR sS\n\n   option ::= table$t optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL); $EndJava ./\n            | no table$t optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL); $EndJava ./\n   option ::= table$t optionWhite '='$eq optionWhite programming_language_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   table ::= tT aA bB lL eE \n\n   option ::= trace$t optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL); $EndJava ./\n            | no trace$t optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL); $EndJava ./\n   option ::= trace$t optionWhite '='$eq optionWhite trace_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($t), getRhsLastTokenIndex($t), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   trace ::= tT rR aA cC eE\n\n   trace_value ::= none\n                 | cC oO nN fF lL iI cC tT sS\n                 | fF uU lL lL\n\n   --\n   -- variables\n   -- verbose\n   -- visitor\n   -- visitor_type\n   --\n   option ::= variables$v optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL); $EndJava ./\n            | no variables$v optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL); $EndJava ./\n   option ::= variables$v optionWhite '='$eq optionWhite variables_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   variables ::= vV aA rR iI aA bB lL eE sS\n   variables_value ::= none\n                     | bB oO tT hH\n                     | tT eE rR mM iI nN aA lL sS\n                     | nN oO nN _opt tT eE rR mM iI nN aA lL sS\n                     | nN tT\n\n   option ::= verbose$v optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL); $EndJava ./\n            | no verbose$v optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL); $EndJava ./\n   verbose ::= vV eE rR bB oO sS eE\n\n   option ::= visitor$v optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL); $EndJava ./\n            | no visitor$v optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL); $EndJava ./\n   option ::= visitor$v optionWhite '='$eq optionWhite visitor_value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($v), getRhsLastTokenIndex($v), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   visitor ::= vV iI sS iI tT oO rR\n   visitor_value ::= none\n                   | dD eE fF aA uU lL tT\n                   | pP rR eE oO rR dD eE rR\n\n   option ::= visitor_type$vt optionWhite '='$eq optionWhite Value$val optionWhite\n          /.$BeginJava\n                      makeToken(getRhsFirstTokenIndex($vt), getRhsLastTokenIndex($vt), $_SYMBOL);\n                      makeToken(getRhsFirstTokenIndex($eq), getRhsLastTokenIndex($eq), $_EQUAL);\n                      makeToken(getRhsFirstTokenIndex($val), getRhsLastTokenIndex($val), $_SYMBOL);\n            $EndJava\n          ./\n   visitor_type ::= vV iI sS iI tT oO rR _opt tT yY pP eE\n                  | vV tT\n\n   --\n   -- warnings\n   --\n   option ::= warnings$w optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($w), getRhsLastTokenIndex($w), $_SYMBOL); $EndJava ./\n            | no warnings$w optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($w), getRhsLastTokenIndex($w), $_SYMBOL); $EndJava ./\n   warnings ::= wW aA rR nN iI nN gG sS\n\n   --\n   -- xref\n   --\n   option ::= xreference$x optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($x), getRhsLastTokenIndex($x), $_SYMBOL); $EndJava ./\n            | no xreference$x optionWhite /.$BeginJava  makeToken(getRhsFirstTokenIndex($x), getRhsLastTokenIndex($x), $_SYMBOL); $EndJava ./\n   xreference ::= xX rR eE fF\n                | xX rR eE fF eE rR eE nN cC eE\n%End\n", "meta": {"hexsha": "89dd81c7a8b19a9114a20b47eec9a49d5c096e77", "size": 56295, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/rt_cpp/LPGLexer.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "templates/templates/rt_cpp/LPGLexer.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/rt_cpp/LPGLexer.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 48.8671875, "max_line_length": 230, "alphanum_fraction": 0.5513633538, "num_tokens": 15997, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.17328818885147557, "lm_q2_score": 0.024053550926776208, "lm_q1q2_score": 0.004168196275547781}}
{"text": "--\n-- An LPG Parser Template Using lpg.jar\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     %additional_interfaces\n--     %super_stream_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   dtUnifiedTemplateF\n--\n%Options programming_Language=typescript\n%Options table\n%Options margin=4\n%Options prefix=Char_\n%Options action-block=(\"*.ts\", \"/.\", \"./\")\n%Options ParseTable=ParseTable\n\n--\n-- The EOF and ERROR symbols are assigned a default here as a\n-- convenience.\n--\n%EOF\n    EOF\n%End\n\n%Define\n    $Header\n    /.\n                //\n                // Rule %rule_number:  %rule_text\n                //\n                ./\n\n    $BeginAction\n    /.%Header%case %rule_number: {./\n\n    $EndAction\n    /.          break;\n                }./\n\n    $BeginJava\n    /.%BeginAction\n                    %symbol_declarations./\n\n    $EndJava /.%EndAction./\n\n    $NoAction\n    /.%Header%case %rule_number:\n                    break;./\n\n    $NullAction\n    /.%Header%case %rule_number:\n                    %setResult(null);\n                    break;./\n\n    $BeginActions\n    /.\n        public void ruleAction(ruleNumber : number )\n        {\n            switch (ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n\t            default:\n\t                ruleAction%rule_number(ruleNumber);\n\t                break;\n\t        }\n\t        return;\n\t    }\n\t\n\t    public void ruleAction%rule_number(ruleNumber : number )\n\t    {\n\t        switch (ruleNumber)\n\t        {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n\n    $additional_interfaces /../\n    $super_stream_class /.LpgLexStream./\n%End\n\n%Globals\n    /.\n    import {BadParseException, RuleAction, PrsStream, ParseTable, BacktrackingParser, IToken, ErrorToken, ILexStream, NullExportedSymbolsException, \nUnimplementedTerminalsException, Lpg, UndefinedEofSymbolException, NotBacktrackParseTableException, BadParseSymFileException, \nIPrsStream, Monitor, DiagnoseParser, IAst, IAstVisitor, IAbstractArrayList, NotDeterministicParseTableException,\n DeterministicParser, NullTerminalSymbolsException } from \"lpg2ts\";\n    ./\n%End\n\n%Headers\n    /.\n    export class %action_type extends %super_stream_class implements %sym_type, RuleAction%additional_interfaces\n    {\n        private static  prs : ParseTable = new %prs_type();\n        private  this.dtParser : DeterministicParser;\n\n        private void setResult(object1 : any ) { this.dtParser.setSym1(object1); }\n        public  getParser()  : DeterministicParser { return this.dtParser; }\n        public  getRhsSym(i : number) : any { return this.dtParser.getSym(i); }\n        public  getRhsTokenIndex(i : number) : number { return this.dtParser.getToken(i); }\n        public  getRhsFirstTokenIndex(i : number) : number { return this.dtParser.getFirstToken(i); }\n        public  getRhsLastTokenIndex(i : number) : number { return this.dtParser.getLastToken(i); }\n\n        public  getLeftSpan() : number{ return this.dtParser.getFirstToken(); }\n        public  getRightSpan() : number{ return this.dtParser.getLastToken(); }\n \n       constructor(filename : string, number tab)\n        {\n            super(filename,null, tab);\n        }\n\n        public  orderedExportedSymbols() : string[]{ return this.orderedTerminalSymbols; }\n        public  getEOFTokenKind() : number { return %prs_type.EOFT_SYMBOL; }\n\n        public  getILexStream() : ILexStream{ return <%super_stream_class> this; }\n        \n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public  getLexStream()  : ILexStream{ return <%super_stream_class> this; }\n\n    \n         public parser(error_repair_count : number = 0 ,  monitor? : Monitor) :  %ast_class | null\n        {\n            try\n            {\n                this.dtParser = new DeterministicParser(this, prs, this);\n            }\n            catch (e)\n            {\n                if( e instanceof NotDeterministicParseTableException){\n                    Lpg.Lang.System.Out.println(\"****Error: Regenerate %prs_type.ts with -NOBACKTRACK option\");\n                    process.exit(1);\n                }\n                if( e instanceof NotDeterministicParseTableException){\n                    Lpg.Lang.System.Out.println(\"****Error: Bad Parser Symbol File -- %sym_type.ts. Regenerate %prs_type.ts\");\n                    process.exit(1);\n                }\n            }\n\n            this.dtParser.setMonitor(monitor);\n\n            try\n            {\n                return <%ast_type> this.dtParser.parse();\n            }\n            catch (ex)\n            {\n              \n               if( ex instanceof BadParseException)\n               {\n                    let e = <BadParseException>(e);\n                    reset(e.error_token); // point to error token\n                    Lpg.Lang.System.Out.print(\"Error detected on character \" + e.error_token);\n                    if (e.error_token < getStreamLength())\n                        Lpg.Lang.System.Out.print(\" at line \" + getLine(e.error_token) + \", column \" + this.getColumn(e.error_token));\n                    else Lpg.Lang.System.Out.print(\" at end of file \");\n                    Lpg.Lang.System.Out.println(\" with kind \" + getKind(e.error_token));\n               }\n               else{\n                    throw ex;\n               }\n            }\n\n            return null;\n        }\n\n    ./\n\n%End\n\n%Rules\n    /.%BeginActions./\n%End\n\n%Trailers\n    /.\n        %EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "afb942099334d5b11617517630ee126af4b90e91", "size": 5542, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/dtUnifiedTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/dtUnifiedTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/dtUnifiedTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.5670103093, "max_line_length": 148, "alphanum_fraction": 0.5566582461, "num_tokens": 1270, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.07921032193536076, "lm_q2_score": 0.052618952233475, "lm_q1q2_score": 0.004167964146314925}}
{"text": "Class(AParMPI, AGenericTag, \n    rec(isParMPI := true)\n);\n\nClass(MPIProcGridND, AGenericTag, \n    rec(isParMPI := true)\n);\n", "meta": {"hexsha": "c62a3a880285a316cab2f3f7f62d46407dd7a2de", "size": 123, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "tags.gi", "max_stars_repo_name": "spiral-software/spiral-package-mpi", "max_stars_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tags.gi", "max_issues_repo_name": "spiral-software/spiral-package-mpi", "max_issues_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tags.gi", "max_forks_repo_name": "spiral-software/spiral-package-mpi", "max_forks_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-24T13:52:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-24T13:52:26.000Z", "avg_line_length": 15.375, "max_line_length": 34, "alphanum_fraction": 0.6666666667, "num_tokens": 39, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.1778108869057527, "lm_q2_score": 0.023330767620074855, "lm_q1q2_score": 0.004148464482717527}}
{"text": "MPICommunicator := grd -> AParMPI(grd);\n\nClass(TArrayND, TArrayBase, rec(\n    isArrayT := true,\n    toPtrType := self >> TPtr(self.t),\n    doHashValues := true,\n\n     __call__ := (self, t, sizes, linearization) >>\n        WithBases(self, rec(\n        t    := Checked(IsType(t), t),\n        sizes := sizes,\n        linearization := linearization,\n        operations := TypOps)),\n    print := self >> Print(self.__name__, \"(\", self.t, \", \", self.sizes, \", \", self.linearization, \")\"),\n    \n    rChildren := self >> [self.t, self.sizes, self.linearization],\n    rSetChild := rSetChildFields(\"t\", \"sizes\", \"linearization\"),\n    free := self >> []\n));\n\nClass(TGlobalArrayND, TArrayBase, rec(\n    isArrayT := true,\n    toPtrType := self >> TPtr(self.t),\n    doHashValues := true,\n\n     __call__ := (self, pgrid, localArray) >>\n        WithBases(self, rec(\n        t    := localArray.t,\n        pgrid := pgrid,\n        localArray := localArray,\n        operations := TypOps)),\n    print := self >> Print(self.__name__, \"(\", self.pgrid, \", \", self.localArray, \")\"),\n\n    rChildren := self >> [self.t, self.pgrid, self.localArray],\n    rSetChild := rSetChildFields(\"t\", \"pgrid\", \"localArray\"),\n    free := self >> []\n));\n\nClass(TPtrGlobalArrayND, TPtr, rec(\n    doHashValues := true,\n\n     __call__ := (self, pgrid, localArray) >>\n        WithBases(self, rec(\n        t    := localArray.t,\n        pgrid := pgrid,\n        localArray := localArray,\n        operations := TypOps)),\n    print := self >> Print(self.__name__, \"(\", self.pgrid, \", \", self.localArray, \")\"),\n\n    rChildren := self >> [self.t, self.pgrid, self.localArray],\n    rSetChild := rSetChildFields(\"t\", \"pgrid\", \"localArray\"),\n    free := self >> []\n));\n", "meta": {"hexsha": "5182dbe97007df8285461d327faa616ea8741a30", "size": 1713, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "types.gi", "max_stars_repo_name": "spiral-software/spiral-package-mpi", "max_stars_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "types.gi", "max_issues_repo_name": "spiral-software/spiral-package-mpi", "max_issues_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "types.gi", "max_forks_repo_name": "spiral-software/spiral-package-mpi", "max_forks_repo_head_hexsha": "f3d758c3448afbbfff933238fbafa8dfb90a99b1", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-24T13:52:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-24T13:52:26.000Z", "avg_line_length": 31.7222222222, "max_line_length": 104, "alphanum_fraction": 0.5697606538, "num_tokens": 472, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.19682621306573764, "lm_q2_score": 0.020645931002853023, "lm_q1q2_score": 0.004063660414508067}}
{"text": "#\n# SharedMemory: Shared Memory Parallelism in GAP\n#\n# Implementations\n#\n\n", "meta": {"hexsha": "5d3842fe749e97f6b97dada65b99ce25b707486c", "size": 74, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/SharedMemory.gi", "max_stars_repo_name": "markuspf/ShmIng", "max_stars_repo_head_hexsha": "6e5abb40d100069358f6bee3d35e16db732c04f8", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/SharedMemory.gi", "max_issues_repo_name": "markuspf/ShmIng", "max_issues_repo_head_hexsha": "6e5abb40d100069358f6bee3d35e16db732c04f8", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2019-03-24T09:42:14.000Z", "max_issues_repo_issues_event_max_datetime": "2019-03-24T09:42:14.000Z", "max_forks_repo_path": "gap/SharedMemory.gi", "max_forks_repo_name": "markuspf/SharedMemory", "max_forks_repo_head_hexsha": "6e5abb40d100069358f6bee3d35e16db732c04f8", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 10.5714285714, "max_line_length": 48, "alphanum_fraction": 0.7432432432, "num_tokens": 18, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.1460872321774425, "lm_q2_score": 0.027585283425931213, "lm_q1q2_score": 0.004029857704524569}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2010, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   See (or edit) Notice Declaration below\n-- *\n-- * </copyright>\n-- */\n--\n-- The EssentialOCL Parser\n--\n\n\n%Define\n    -- Redefinition of macros used in the parser template\n    --\n    $default_repair_count /.getDefaultRepairCount()./\n\t$super_parser_class /.AbstractOCLParser./\n    $prs_stream_class /.DerivedPrsStream./\n\n\t-- Definition of new macros used by the grammar file\n\t-- which may be redefined by extended files.\n    $copyright_contributions /.*./\n\n\t-- Definition of new macros used by the grammar file\n\t-- which are not intended to be extended.\n\t$lpg_ns /.lpg.runtime./ -- package namespace of the LPG Runtime API\n\n\n\t-- Some useful macros\n    $NewCase\n    /. $Header\n                case $rule_number:./\n\n\n\n    $EmptyListAction -- Deprecated, code inline with correct generic parameter type\n    /. $Header\n                case $rule_number:\n                    setResult(new BasicEList<Object>());\n                    break;./\n\n    -- BeginJava and EndJava need to be reworked in order to be able to properly use $NewCase macro\n\n    -- BeginJava does nothing\n\t-- block-actions should call BeginCode, instead\n    $BeginJava /../\n\n  \t-- EndJava does nothing\n\t-- block-actions should call EndCode, instead\n\t$EndJava /../\n\n\t$BeginCode\n\t/.$BeginAction\n\t\t\t\t\t$symbol_declarations./\n\n\t$EndCode /.$EndAction./\n\n%End\n\n%Notice\n    /./**\n * Essential OCL Grammar\n * <copyright>\n *\n * Copyright (c) 2010, 2010 IBM Corporation and others.\n * All rights reserved.   This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v2.0\n * which accompanies this distribution, and is available at\n * http://www.eclipse.org/legal/epl-v20.html\n *\n * Contributors:\n *   IBM - Initial API and implementation\n *   E.D.Willink - Elimination of some shift-reduce conflicts\n *   E.D.Willink - Remove unnecessary warning suppression\n *   E.D.Willink - Bugs 184048, 225493, 243976, 259818, 282882, 287993, 288040, 292112, 295166\n *   Borland - Bug 242880\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias):\n *        - 242153: LPG v 2.0.17 adoption.\n *        - 299396: Introducing new LPG templates\n *        - 300534: Removing the use of deprecated macros.\n *******************************************************************************/\n    ./\n%End\n\n%Globals\n    /.import org.eclipse.emf.common.util.BasicEList;\n\timport org.eclipse.emf.common.util.EList;\n\timport org.eclipse.ocl.cst.BooleanLiteralExpCS;\n\timport org.eclipse.ocl.cst.CSTNode;\n\timport org.eclipse.ocl.cst.CallExpCS;\n\timport org.eclipse.ocl.cst.CollectionLiteralExpCS;\n\timport org.eclipse.ocl.cst.CollectionLiteralPartCS;\n\timport org.eclipse.ocl.cst.CollectionTypeCS;\n\timport org.eclipse.ocl.cst.CollectionTypeIdentifierEnum;\n\timport org.eclipse.ocl.cst.FeatureCallExpCS;\n\timport org.eclipse.ocl.cst.IfExpCS;\n\timport org.eclipse.ocl.cst.IntegerLiteralExpCS;\n\timport org.eclipse.ocl.cst.InvalidLiteralExpCS;\n\timport org.eclipse.ocl.cst.IsMarkedPreCS;\n\timport org.eclipse.ocl.cst.IterateExpCS;\n\timport org.eclipse.ocl.cst.IteratorExpCS;\n\timport org.eclipse.ocl.cst.LetExpCS;\n\timport org.eclipse.ocl.cst.NullLiteralExpCS;\n\timport org.eclipse.ocl.cst.OCLExpressionCS;\n\timport org.eclipse.ocl.cst.OperationCallExpCS;\n\timport org.eclipse.ocl.cst.PathNameCS;\n\timport org.eclipse.ocl.cst.PrimitiveTypeCS;\n\timport org.eclipse.ocl.cst.RealLiteralExpCS;\n\timport org.eclipse.ocl.cst.SimpleNameCS;\n\timport org.eclipse.ocl.cst.SimpleTypeEnum;\n\timport org.eclipse.ocl.cst.StringLiteralExpCS;\n\timport org.eclipse.ocl.cst.TupleLiteralExpCS;\n\timport org.eclipse.ocl.cst.TupleTypeCS;\n\timport org.eclipse.ocl.cst.TypeCS;\n\timport org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS;\n\timport org.eclipse.ocl.cst.VariableCS;\n\timport org.eclipse.ocl.cst.VariableExpCS;\n\timport org.eclipse.ocl.lpg.DerivedPrsStream;\n\n\timport $lpg_ns.BadParseException;\n\timport $lpg_ns.BadParseSymFileException;\n\timport $lpg_ns.DiagnoseParser;\n\timport $lpg_ns.ErrorToken;\n\timport $lpg_ns.IToken;\n\timport $lpg_ns.ILexStream;\n\timport $lpg_ns.Monitor;\n\timport $lpg_ns.NullExportedSymbolsException;\n\timport $lpg_ns.NullTerminalSymbolsException;\n\timport $lpg_ns.ParseTable;\n\timport $lpg_ns.RuleAction;\n\timport $lpg_ns.UndefinedEofSymbolException;\n\timport $lpg_ns.UnimplementedTerminalsException;\n    ./\n%End\n\n%KeyWords\n-- Reserved keywords\n    and implies not or xor\n    if then else endif\n    let in\n    false true\n    null invalid\n    self\n\n-- Restricted keywords\n    Bag Collection OrderedSet Sequence Set\n    Tuple\n    Boolean Integer Real String UnlimitedNatural\n    OclAny OclInvalid OclVoid\n%End\n\n-- Terminals\n%Identifier\n    IDENTIFIER\n%End\n\n%Terminals\n\n    QUOTED_IDENTIFIER INTEGER_LITERAL REAL_LITERAL STRING_LITERAL\n\n    PLUS     ::= '+'\n    MINUS    ::= '-'\n    MULTIPLY ::= '*'\n    DIVIDE   ::= '/'\n\n    GREATER       ::= '>'\n    LESS          ::= '<'\n    EQUAL         ::= '='\n    GREATER_EQUAL ::= '>='\n    LESS_EQUAL    ::= '<='\n    NOT_EQUAL     ::= '<>'\n\n    LPAREN   ::= '('\n    RPAREN   ::= ')'\n    LBRACE   ::= '{'\n    RBRACE   ::= '}'\n    LBRACKET ::= '['\n    RBRACKET ::= ']'\n\n    ARROW      ::= '->'\n    BAR        ::= '|'\n    COMMA      ::= ','\n    COLON      ::= ':'\n    COLONCOLON ::= '::'\n    SEMICOLON  ::= ';'\n    DOT        ::= '.'\n    DOTDOT     ::= '..'\n%End\n\n%Headers\n\t/.\n\n\tpublic $environment_class getOCLEnvironment() {\n\t\treturn getLexer().getOCLEnvironment();\n\t}\n\n\t@Override\n\tpublic $super_lexer_class getLexer() {\n\t\treturn ($super_lexer_class) super.getLexer();\n\t}\n\n\n\n\t// Some methods for backwards compatibility\n\t/**\n\t* <p>\n\t* Before 3.0, this method was used with the now-deprecated  \"dollar\"getToken macro (which\n\t* provided token index in the prsStream) to obtain an IToken f a rule given the index of the\n\t* right hand side token in the said rule. In 3.0 a convenience method has been introduced\n\t* in order to directly return the IToken, given the index of the right hand side token in the rule.\n\t* </p>\n\t*\n\t* <p>\n\t* In an action-block of a rule, instead of doing <code>getIToken(\"dollar\"getToken(i))</code>\n\t* you should do <code>getRhsTokenText(i)</code>\n\t* </p>\n\t* @param i the right hand side token index\n\t* @return the correspondent IToken.\n\t*\n\t* @since 3.0\n\t*/\n\t@Deprecated\n\tprotected IToken getIToken(int i) {\n\t\treturn prsStream.getIToken(i);\n\t}\n\n\t/**\n\t* <p>\n\t* Before 3.0, this method was used with the now-deprecated \"dollar\"getToken macro (which\n\t* provided token index in the prsStream) to obtain an IToken f a rule given the index of the\n\t* right hand side token in the said rule. In 3.0 a convenience method has been introduced\n\t* in order to directly return the IToken, given the index of the right hand side token in the rule.\n\t* </p>\n\t*\n\t* <p>\n\t* In an action-block of a rule, instead of doing <code>getTokenText(\"dollar\"getToken(i))</code>\n\t* you should do <code>getRhsTokenText(i)</code>\n\t* </p>\n\t* @param i the right hand side token index\n\t* @result the text of the correspondent right hand side IToken.\n\t*/\n\t@Deprecated\n\tprotected String getTokenText(int i) {\n\t\treturn prsStream.getTokenText(i);\n\t}\n\n\t/**\n\t* A convenience method to obtain the text of a right hand side IToken.\n\t*\n\t* @param i the right hand side token index\n\t* @result the text of the correspondent right hand side IToken.\n\t*\n\t* @since 3.0\n\t*/\n\tprotected String getRhsTokenText(int i) {\n\t\treturn prsStream.getTokenText(getRhsTokenIndex(i));\n\t}\n\t./\n%End\n\n%Rules\n\n-----------------------------------------------------------------------\n--  Names\n-----------------------------------------------------------------------\n\n    reservedKeyword -> and\n    reservedKeyword -> else\n    reservedKeyword -> endif\n    reservedKeyword -> if\n    reservedKeyword -> implies\n    reservedKeyword -> in\n    reservedKeyword -> let\n    reservedKeyword -> not\n    reservedKeyword -> or\n    reservedKeyword -> then\n    reservedKeyword -> xor\n\n    tupleKeywordCS ::= Tuple\n    reservedKeywordCS ::= reservedKeyword\n    restrictedKeywordCS -> CollectionTypeIdentifier\n--  restrictedKeywordCS -> BooleanLiteralExpCS\n--  restrictedKeywordCS -> InvalidLiteralExpCS\n--  restrictedKeywordCS -> NullLiteralExpCS\n--  restrictedKeywordCS -> selfKeywordCS\n    restrictedKeywordCS -> PrimitiveTypeIdentifier\n    restrictedKeywordCS -> tupleKeywordCS\n\n    SimpleName ::= IDENTIFIER\n    SimpleName -> QuotedSimpleNameCS\n    QuotedSimpleNameCS ::= QUOTED_IDENTIFIER\n    QuotedSimpleNameCS ::= QuotedSimpleNameCS STRING_LITERAL\n\n    unreservedSimpleNameCS -> SimpleName\n    unreservedSimpleNameCS -> restrictedKeywordCS\n\n\tInfixOperator -> '*'\n\tInfixOperator -> '/'\n\tInfixOperator -> '+'\n\tInfixOperator -> '-'\n\tInfixOperator -> '>'\n\tInfixOperator -> '<'\n\tInfixOperator -> '>='\n\tInfixOperator -> '<='\n\tInfixOperator -> '='\n\tInfixOperator -> '<>'\n\tInfixOperator -> 'and'\n\tInfixOperator -> 'or'\n\tInfixOperator -> 'xor'\n\tInfixOperator -> 'implies'\n\tInfixOperator -> '.'\n\tInfixOperator -> '->'\n\n\tPrefixOperator -> '-'\n\tPrefixOperator -> 'not'\n\n-----------------------------------------------------------------------\n--  Types\n-----------------------------------------------------------------------\n    PrimitiveTypeIdentifier ::= Boolean\n    PrimitiveTypeIdentifier ::= Integer\n    PrimitiveTypeIdentifier ::= Real\n    PrimitiveTypeIdentifier ::= String\n    PrimitiveTypeIdentifier ::= UnlimitedNatural\n    PrimitiveTypeIdentifier ::= OclAny\n    PrimitiveTypeIdentifier ::= OclInvalid\n    PrimitiveTypeIdentifier ::= OclVoid\n\n    PrimitiveTypeCS ::= PrimitiveTypeIdentifier\n\n    CollectionTypeIdentifier ::= Set\n    CollectionTypeIdentifier ::= Bag\n    CollectionTypeIdentifier ::= Sequence\n    CollectionTypeIdentifier ::= Collection\n    CollectionTypeIdentifier ::= OrderedSet\n\n    CollectionTypeCS ::= CollectionTypeIdentifier\n    CollectionTypeCS ::= CollectionTypeIdentifier '(' TypeExpCS ')'\n\n    TupleTypeCS ::= Tuple\n    TupleTypeCS ::= Tuple '(' tupleTypePartCSlistopt ')'\n\n    tupleTypePartCSlistopt ::= %empty\n    tupleTypePartCSlistopt -> tupleTypePartCSlist\n\n    tupleTypePartCSlist ::= tuplePartCS\n    tupleTypePartCSlist ::= tupleTypePartCSlist ',' tuplePartCS\n\n    tuplePartCS ::= SimpleName ':' TypeExpCS\n\n-----------------------------------------------------------------------\n--  Declarations\n-----------------------------------------------------------------------\n    VariableDeclarationCS -> SimpleName\n    VariableDeclarationCS -> SimpleName '=' OCLExpressionCS\n    VariableDeclarationCS -> SimpleName ':' TypeExpCS\n    VariableDeclarationCS -> SimpleName ':' TypeExpCS '=' OCLExpressionCS\n\n-----------------------------------------------------------------------\n--  Literals\n-----------------------------------------------------------------------\n--    LiteralExpCS -> CollectionLiteralExpCS\n--    LiteralExpCS -> TupleLiteralExpCS\n--    LiteralExpCS -> PrimitiveLiteralExpCS\n--    LiteralExpCS -> TypeLiteralExpCS\n\n    CollectionLiteralExpCS ::= CollectionTypeCS '{' CollectionLiteralPartCSlistopt '}'\n\n    CollectionLiteralPartCSlistopt ::= %empty\n    CollectionLiteralPartCSlistopt -> CollectionLiteralPartCSlist\n\n    CollectionLiteralPartCSlist ::= CollectionLiteralPartCS\n    CollectionLiteralPartCSlist ::= CollectionLiteralPartCSlist ',' CollectionLiteralPartCS\n\n    CollectionLiteralPartCS ::= OCLExpressionCS\n    CollectionLiteralPartCS ::= OCLExpressionCS '..' OCLExpressionCS\n\n    PrimitiveLiteralExpCS -> NumberLiteralExpCS\n    PrimitiveLiteralExpCS -> StringLiteralExpCS\n    PrimitiveLiteralExpCS -> BooleanLiteralExpCS\n    PrimitiveLiteralExpCS -> UnlimitedNaturalLiteralExpCS\n    PrimitiveLiteralExpCS -> InvalidLiteralExpCS\n    PrimitiveLiteralExpCS -> NullLiteralExpCS\n\n    TupleLiteralExpCS ::= Tuple '{' TupleLiteralPartCSlist '}'\n\n    TupleLiteralPartCSlist ::= TupleLiteralPartCS\n    TupleLiteralPartCSlist ::= TupleLiteralPartCSlist ',' TupleLiteralPartCS\n\n    TupleLiteralPartCS -> SimpleName '=' OCLExpressionCS\n    TupleLiteralPartCS -> SimpleName ':' TypeExpCS '=' OCLExpressionCS\n\n    NumberLiteralExpCS ::= INTEGER_LITERAL\n    NumberLiteralExpCS ::= REAL_LITERAL\n\n    StringLiteralExpCS ::= STRING_LITERAL\n    StringLiteralExpCS ::= StringLiteralExpCS STRING_LITERAL\n\n    BooleanLiteralExpCS ::= true\n    BooleanLiteralExpCS ::= false\n\n    UnlimitedNaturalLiteralExpCS ::= '*'\n\n    InvalidLiteralExpCS ::= invalid\n\n    NullLiteralExpCS ::= null\n\n    TypeLiteralExpCS ::= PrimitiveTypeCS\n    TypeLiteralExpCS ::= CollectionTypeCS\n    TypeLiteralExpCS ::= TupleTypeCS\n\n    TypeNameExpCS -> SimpleName\n    TypeNameExpCS ::= SimpleName '(' ')'\n    TypeNameExpCS ::= SimpleName '(' UntypedExpressionCSlist ')'\n    TypeNameExpCS ::= TypeNameExpCS '::' unreservedSimpleNameCS\n\n    TypeExpCS -> TypeNameExpCS\n    TypeExpCS -> TypeLiteralExpCS\n\n-----------------------------------------------------------------------\n--  Expressions\n-----------------------------------------------------------------------\n    OCLExpressionCS -> InfixedExpCS\n    OCLExpressionCS -> InfixedLetExpCS\n\n\tInfixedExpCS -> PrefixedExpCS\n\tInfixedExpCS ::= InfixedExpCS InfixOperator PrefixedExpCS\n\n\tInfixedLetExpCS -> PrefixedLetExpCS\n\tInfixedLetExpCS ::= InfixedExpCS InfixOperator PrefixedLetExpCS\n\n\tPrefixedExpCS -> PrimaryExpCS\n\tPrefixedExpCS ::= PrefixOperator PrefixedExpCS\n\n\tPrefixedLetExpCS ::= LetExpCS\n\tPrefixedLetExpCS ::= PrefixOperator PrefixedLetExpCS\n\n\tPrimaryExpCS -> NavigatingExpCS\n\tPrimaryExpCS -> SelfExpCS\n\tPrimaryExpCS -> PrimitiveLiteralExpCS\n\tPrimaryExpCS -> TupleLiteralExpCS\n\tPrimaryExpCS -> CollectionLiteralExpCS\n--\tPrimaryExpCS -> TypeExpCS\n--    PrimaryExpCS -> NameExpCS\n    PrimaryExpCS -> TypeLiteralExpCS\n\tPrimaryExpCS -> IfExpCS\n\tPrimaryExpCS -> NestedExpCS\n\n    NameExpCS -> SimpleName\n    NameExpCS ::= NameExpCS '::' unreservedSimpleNameCS\n\n\tIndexExpCS -> NameExpCS\n\tIndexExpCS ::= NameExpCS '[' ExpCSlist ']'\n\tIndexExpCS ::= NameExpCS '[' ExpCSlist ']' '[' ExpCSlist ']'\n\n\tExpCSlist ::= OCLExpressionCS\n\tExpCSlist ::= ExpCSlist ',' OCLExpressionCS\n\n\tNavigatingExpCSbase -> IndexExpCS\n\n\tNavigatingExpCS -> NavigatingExpCSbase\n\tNavigatingExpCS ::= NavigatingExpCSbase '(' ')'\n\tNavigatingExpCS ::= NavigatingExpCSbase '(' TypedExpressionCS ')'\n\tNavigatingExpCS ::= NavigatingExpCSbase '(' TypedExpressionCS ',' UntypedExpressionCSlist ')'\n\tNavigatingExpCS ::= NavigatingExpCSbase '(' TypedExpressionCS '|' UntypedExpressionCSlist ')'\n\tNavigatingExpCS ::= NavigatingExpCSbase '(' TypedExpressionCS ',' TypedExpressionCS '|' UntypedExpressionCSlist ')'\n\tNavigatingExpCS ::= NavigatingExpCSbase '(' TypedExpressionCS ';' iteratorAccumulatorCS '|' UntypedExpressionCSlist ')'\n\n    UntypedExpressionCSlist ::= UntypedExpressionCS\n    UntypedExpressionCSlist ::= UntypedExpressionCSlist ',' UntypedExpressionCS\n\n\tUntypedExpressionCS -> OCLExpressionCS\n\n\tTypedExpressionCS ::= OCLExpressionCS\n\tTypedExpressionCS ::= OCLExpressionCS ':' TypeExpCS\n\n\titeratorAccumulatorCS ::= SimpleName ':' TypeExpCS '=' OCLExpressionCS\n\n    IfExpCS ::= if OCLExpressionCS then OCLExpressionCS else OCLExpressionCS endif\n\n    LetExpCS ::= let LetVariableCSlist in OCLExpressionCS\n\n    LetVariableCSlist ::= LetVariableCS\n    LetVariableCSlist ::= LetVariableCSlist ',' LetVariableCS\n\n    LetVariableCS ::= SimpleName '=' OCLExpressionCS\n    LetVariableCS ::= SimpleName ':' TypeExpCS '=' OCLExpressionCS\n\n\tNestedExpCS  ::= '(' OCLExpressionCS ')'\n\n    SelfExpCS ::= self\n%End\n", "meta": {"hexsha": "d1be7ba38de45f514e4d4a56b8b8aa85b3854166", "size": 15605, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/EssentialOCL.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/EssentialOCL.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/EssentialOCL.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.21, "max_line_length": 120, "alphanum_fraction": 0.6829221403, "num_tokens": 3851, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1968262036430985, "lm_q2_score": 0.020332353379760686, "lm_q1q2_score": 0.004001939926868219}}
{"text": "InstallGlobalFunction(MitM_OMRecToXML,\nfunction(r)\n    local str, rnam, attributes, content, item;\n    str := StringFormatted(\"<{}\", MitM_Tag(r));\n    attributes := MitM_Attributes(r);\n    if attributes <> fail then\n        for rnam in Set(RecNames(attributes)) do\n            Append(str, StringFormatted(\" {}=\\\"{}\\\"\",\n                                        rnam, attributes.(rnam)));\n        od;\n    fi;\n    if MitM_Content(r) <> fail then\n        Append(str, \">\");\n        content := MitM_Content(r);\n        if Length(content) = 1 and not MitM_OMRec(content[1]) then\n            Append(str, String(content[1]));\n        elif Length(content) > 0 then\n            Append(str, \"\\n\");\n            for item in content do\n                if MitM_OMRec(item) then\n                    Append(str, MitM_OMRecToXML(item));\n                else\n                    # This might not be possible with a proper OMRec, since a\n                    # string always appears inside a pair of tags, on its own.\n                    Append(str, String(item));\n                fi;\n                Append(str, \"\\n\");\n            od;\n        fi;\n        Append(str, StringFormatted(\"</{}>\", MitM_Tag(r)));\n    else\n        Append(str, \" />\");\n    fi;\n    return str;\nend);\n", "meta": {"hexsha": "7e0a39a3e98437b9fdbd26ad897a667598ff4dc5", "size": 1252, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/OMRecToXML.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/OMRecToXML.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/OMRecToXML.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 34.7777777778, "max_line_length": 78, "alphanum_fraction": 0.5055910543, "num_tokens": 284, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.14223190955366666, "lm_q2_score": 0.028007523648406734, "lm_q1q2_score": 0.003983563570382366}}
{"text": "CopyFile := function(src, dst)\n  local f, g, line;\n  f := InputTextFile(src);\n  g := OutputTextFile(dst, false);\n  while true do\n    line := ReadLine(f);\n    if line = fail then\n      break\n    else\n      WriteLine(g, Chomp(line));\n    fi;\n  od;\n  CloseStream(f);\n  CloseStream(g);\nend;\n", "meta": {"hexsha": "df5dcc4fb29c03d6050bbf440ca00a4aa2a3bc7d", "size": 287, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/File-input-output/GAP/file-input-output.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/File-input-output/GAP/file-input-output.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/File-input-output/GAP/file-input-output.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 17.9375, "max_line_length": 34, "alphanum_fraction": 0.5923344948, "num_tokens": 85, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09268777362681897, "lm_q2_score": 0.04272220028884896, "lm_q1q2_score": 0.003959825629212452}}
{"text": "--\n-- An LPG Lexer Template Using lpg.jar\n--\n-- An instance of this template must have a %Export section and the export_terminals option\n-- There must be only one non-terminal, the start symbol, for the keywords\n-- The action for each keyword should be a call to %setResult(terminal_symbol)\n--\n-- Macro that may be redefined in an instance of this template\n--\n--     %eof_char\n--\n-- B E G I N N I N G   O F   T E M P L A T E   KeywordTemplateF (Similar to KeywordTemplateD)\n--\n%Options programming_Language=typescript,margin=4\n%Options table\n%options action-block=(\"*.ts\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%Options prefix=Char_\n%Options single-productions\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- LexerTemplateD.\n--\n%Eof\n    EOF\n%End\n\n%Define\n    --\n    -- Macro that may be respecified in an instance of this template\n    --\n    $eof_char /.%sym_type%.%prefix%EOF%suffix%./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $setResult /.keywordKind[%rule_number] = ./\n\n    $Header\n    /.\n            //\n            // Rule %rule_number:  %rule_text\n            //\n            ./\n\n    $BeginAction /.%Header./\n\n    $EndAction /../\n\n    $BeginJava /.%BeginAction./\n\n    $EndJava /.%EndAction./\n%End\n\n%Globals\n    /.\n   \n    ./\n%End\n\n%Headers\n    /.\n    export class %action_type extends %prs_type\n    {\n        private  inputBytes : byte[];\n        private final number keywordKind[] = new number[%num_rules + 1];\n\n        public  getKeywordKinds() : number[] { return keywordKind; }\n\n        public  lexer(curtok : number, lasttok : number) : number\n        {\n            number current_kind = getKind(inputBytes[curtok]),\n                act;\n\n            for (act = tAction(START_STATE, current_kind);\n                 act > NUM_RULES && act < ACCEPT_ACTION;\n                 act = tAction(act, current_kind))\n            {\n                curtok++;\n                current_kind = (curtok > lasttok\n                                       ? %eof_char\n                                       : getKind(inputBytes[curtok]));\n            }\n\n            if (act > ERROR_ACTION)\n            {\n                curtok++;\n                act -= ERROR_ACTION;\n            }\n\n            return keywordKind[act == ERROR_ACTION  || curtok <= lasttok ? 0 : act];\n        }\n\n        public void setInputBytes(byte[] inputBytes) { this.inputBytes = inputBytes; }\n\n    ./\n%End\n\n%Rules\n    /.\n\n        public %action_type(byte[] inputBytes, number identifierKind)\n        {\n            this.inputBytes = inputBytes;\n            keywordKind[0] = identifierKind;\n    ./\n%End\n\n%Trailers\n    /.\n\n            for (i : number = 0; i < keywordKind.length; i++)\n            {\n                if (keywordKind[i] == 0)\n                    keywordKind[i] = identifierKind;\n            }\n        }\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "a1461ce0630505f3535b5e75262236f2e372982e", "size": 2944, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/Utf8KeywordTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/Utf8KeywordTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/Utf8KeywordTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.1811023622, "max_line_length": 93, "alphanum_fraction": 0.5458559783, "num_tokens": 723, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.15817436068510185, "lm_q2_score": 0.02442308854517005, "lm_q1q2_score": 0.003863106416587907}}
{"text": "#\n# JupyterMsg: Jupyter kernel using ZeroMQ\n#\n# Implementations\n#\n# TODO: Check signature\nInstallGlobalFunction( JupyterMsgDecode,\nfunction(kernel, raw)\n    local result, bindIfBound, sl, ids, tmp;\n\n    bindIfBound := function(name, pos)\n        if IsBound(raw[pos]) then\n            result.(name) := JsonStringToGap(raw[pos]);\n        fi;\n    end;\n\n    result := rec();\n\n    ids := [];\n    sl := 1;\n    while raw[sl] <> \"<IDS|MSG>\" do\n        Add(ids, raw[sl]);\n        sl := sl + 1;\n    od;\n    result.hmac := raw[sl + 1];\n    result.remainder := raw;\n\n    bindIfBound(\"header\", sl + 2);\n    bindIfBound(\"parent_header\", sl + 3);\n    bindIfBound(\"metadata\", sl + 4);\n    bindIfBound(\"content\", sl + 5);\n\n    tmp := CRYPTING_SHA256_HMAC( kernel!.SessionKey\n                               , Concatenation( raw[sl + 2]\n                                              , raw[sl + 3]\n                                              , raw[sl + 4]\n                                              , raw[sl + 5] ) );\n    tmp := List(tmp, CRYPTING_HexStringIntPad8);\n    tmp := LowercaseString(Concatenation(tmp));\n    result.hmac_verify := tmp;\n\n    if result.hmac <> result.hmac_verify then\n        PrintTo( \"*errout*\", \"HMAC verification for message failed: \"\n                 , result.hmac, \" <> \", result.hmac_verify, \"\\n\" );\n    fi;\n\n    return result;\nend);\n\nInstallGlobalFunction( JupyterMsgEncode,\nfunction(kernel, msg)\n    local raw, k, bindIfBound, tmp;\n\n    bindIfBound := function(pos, name)\n        if IsBound(msg.(name)) then\n            raw[pos] := GapToJsonString(msg.(name));\n        fi;\n    end;\n\n    raw := [];\n    # TODO: What is the correct behaviour here?\n    if IsBound(msg.uuid) then\n        raw[1] := msg.uuid;\n    else\n        raw[1] := \"\";\n    fi;\n    raw[2] := \"<IDS|MSG>\";\n    raw[3] := msg.hmac;\n    bindIfBound(4, \"header\");\n    bindIfBound(5, \"parent_header\");\n    bindIfBound(6, \"metadata\");\n    bindIfBound(7, \"content\");\n\n    # TODO: Ugly\n    if Length(raw) > 3 then\n        tmp := CRYPTING_SHA256_HMAC(msg.key,\n                                    Concatenation( raw[4]\n                                                 , raw[5]\n                                                 , raw[6]\n                                                 , raw[7]));\n        tmp := List(tmp, CRYPTING_HexStringIntPad8);\n        tmp := LowercaseString(Concatenation(tmp));\n        raw[3] := LowercaseString(tmp);\n    fi;\n    return raw;\nend);\n\nInstallGlobalFunction(JupyterMsgRecv,\nfunction(kernel, sock)\n    local raw;\n    raw := ZmqReceiveList(sock);\n    if IsBound(kernel!.ProtocolLog) then\n        AppendTo(kernel!.ProtocolLog, raw);\n        AppendTo(kernel!.ProtocolLog, \"\\n\");\n    fi;\n    return JupyterMsgDecode(kernel, raw);\nend);\n\nInstallGlobalFunction(JupyterMsgSend,\nfunction(kernel, sock, msg)\n    local msg2;\n    if IsBound(kernel!.ProtocolLog) then\n        msg2 := JupyterMsgEncode(kernel, msg);\n        AppendTo(kernel!.ProtocolLog, msg2);\n        AppendTo(kernel!.ProtocolLog, \"\\n\");\n    fi;\n    ZmqSend(sock, JupyterMsgEncode(kernel, msg));\nend);\n\n# Create a message template with the necessasry fields filled\nInstallGlobalFunction(JupyterMsg,\nfunction(kernel, msg_type, parent_header, content, metadata)\n    return rec( uuid := kernel!.ZmqIdentity\n              , sep := \"<IDS|MSG>\"                 # This could be in JupyterEncode\n              , hmac := \"\"\n              , header := rec( username := kernel!.Username\n                             , session := kernel!.SessionID\n                             , msg_type := msg_type\n                             , version := kernel!.ProtocolVersion\n                             , date := ISO8601Stamp()\n                             , msg_id := HexStringUUID(RandomUUID())\n                             )\n              , parent_header := parent_header\n              , metadata := metadata\n              , content := content\n              , key := kernel!.SessionKey\n                             # This shouldn't be here as all\n                             # messaging functions\n                             # should just be running in kernel context\n              );\nend);\n\n\n", "meta": {"hexsha": "7fc2f93463cd95638a966e5d6bbbf7b3518406a7", "size": 4139, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterMsg.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterMsg.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterMsg.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 30.8880597015, "max_line_length": 83, "alphanum_fraction": 0.5160666828, "num_tokens": 979, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.15002882434242512, "lm_q2_score": 0.025565212716829745, "lm_q1q2_score": 0.0038355188079699826}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    Percent ::= '%'\n    _\n    \n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n%End\n\n%Headers\n    /.\n        static   tokenKind : number[]=  new Array(128)  ; \n         static  __b_init : boolean = %action_type.init_block(%action_type.tokenKind);\n        static  init_block(tokenKind : number[]) : boolean\n        {\n            for (let i = 0; i < tokenKind.length; ++i) {\n                tokenKind[i] = 0;\n            }\n            tokenKind['$'.charCodeAt(0)] = %sym_type.%prefix%DollarSign%suffix%;\n            tokenKind['%'.charCodeAt(0)] = %sym_type.%prefix%Percent%suffix%;\n            tokenKind['_'.charCodeAt(0)] = %sym_type.%prefix%_%suffix%;\n            \n            tokenKind['a'.charCodeAt(0)] = %sym_type.%prefix%a%suffix%;\n            tokenKind['b'.charCodeAt(0)] = %sym_type.%prefix%b%suffix%;\n            tokenKind['c'.charCodeAt(0)] = %sym_type.%prefix%c%suffix%;\n            tokenKind['d'.charCodeAt(0)] = %sym_type.%prefix%d%suffix%;\n            tokenKind['e'.charCodeAt(0)] = %sym_type.%prefix%e%suffix%;\n            tokenKind['f'.charCodeAt(0)] = %sym_type.%prefix%f%suffix%;\n            tokenKind['g'.charCodeAt(0)] = %sym_type.%prefix%g%suffix%;\n            tokenKind['h'.charCodeAt(0)] = %sym_type.%prefix%h%suffix%;\n            tokenKind['i'.charCodeAt(0)] = %sym_type.%prefix%i%suffix%;\n            tokenKind['j'.charCodeAt(0)] = %sym_type.%prefix%j%suffix%;\n            tokenKind['k'.charCodeAt(0)] = %sym_type.%prefix%k%suffix%;\n            tokenKind['l'.charCodeAt(0)] = %sym_type.%prefix%l%suffix%;\n            tokenKind['m'.charCodeAt(0)] = %sym_type.%prefix%m%suffix%;\n            tokenKind['n'.charCodeAt(0)] = %sym_type.%prefix%n%suffix%;\n            tokenKind['o'.charCodeAt(0)] = %sym_type.%prefix%o%suffix%;\n            tokenKind['p'.charCodeAt(0)] = %sym_type.%prefix%p%suffix%;\n            tokenKind['q'.charCodeAt(0)] = %sym_type.%prefix%q%suffix%;\n            tokenKind['r'.charCodeAt(0)] = %sym_type.%prefix%r%suffix%;\n            tokenKind['s'.charCodeAt(0)] = %sym_type.%prefix%s%suffix%;\n            tokenKind['t'.charCodeAt(0)] = %sym_type.%prefix%t%suffix%;\n            tokenKind['u'.charCodeAt(0)] = %sym_type.%prefix%u%suffix%;\n            tokenKind['v'.charCodeAt(0)] = %sym_type.%prefix%v%suffix%;\n            tokenKind['w'.charCodeAt(0)] = %sym_type.%prefix%w%suffix%;\n            tokenKind['x'.charCodeAt(0)] = %sym_type.%prefix%x%suffix%;\n            tokenKind['y'.charCodeAt(0)] = %sym_type.%prefix%y%suffix%;\n            tokenKind['z'.charCodeAt(0)] = %sym_type.%prefix%z%suffix%;\n            return true;\n        }\n    \n        public  static    getKind(c :number ):number\n        {\n            return ((c & 0xFFFFFF80) == 0 /* 0 <= c < 128? */ ? %action_type.tokenKind[c] : 0);\n        }\n    ./\n%End\n\n", "meta": {"hexsha": "c9ceda68fbd5bbb6654ae78e5f5178e2aa4ce0b2", "size": 2877, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/include/typescript/KWLexerLowerCaseMapF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/include/typescript/KWLexerLowerCaseMapF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/include/typescript/KWLexerLowerCaseMapF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 48.7627118644, "max_line_length": 95, "alphanum_fraction": 0.5394508168, "num_tokens": 857, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.17328819739040088, "lm_q2_score": 0.021948253754852376, "lm_q1q2_score": 0.003803373329045466}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2005, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   See (or edit) Notice Declaration below\n-- *   \n-- * </copyright>\n-- */\n--\n-- The Essential OCL Lexer\n--\n\n%options escape=$\n%options la=2\n%options fp=EssentialOCLLexer,prefix=Char_\n%options single-productions\n%options noserialize\n%options package=org.eclipse.ocl.parser\n%options template=../lpg/LexerTemplateF.gi\n%options filter=EssentialOCLKWLexer.gi\n%options export_terminals=(\"EssentialOCLParsersym.java\", \"TK_\")\n%options include_directory=\"../lpg\"\n\n%Import\n\tLexerBasicMapF.gi\n%End\n\n%Define\n\n\t--\n\t-- Definition of macros used in the template\n\t--\n\t$action_class /.$file_prefix./  -- Deprecated.\n\t$eof_token /.$_EOF_TOKEN./\n    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./\n    $adapt_environment /.OCLUtil.getAdapter(environment, BasicEnvironment.class)./\n    $environment_import /.org.eclipse.ocl.Environment./\n \n \t--\n\t-- Redefinition of macros used in the template\n\t-- NB: They are also used in the included file LexerBasicMapF.g\n\t--\n \t$prs_stream_class /.DerivedPrsStream./\n \t$lex_stream_class /.DerivedLexStream./\n \t\n \t \t\n\t--\n\t-- Definition of macro used in the included file LexerBasicMapF.g\n\t--\n\t$kw_lexer_class /.EssentialOCLKWLexer./\n\t$copyright_contributions /.*./\n\n%End\n\n%Headers\n\t/.\n        \n    // Some OCL additions to make lexer work with an input reader\n\t/**\n\t * @since 3.0\n\t */\n\tpublic $action_type($environment_class environment, Reader reader, String filename) throws java.io.IOException {\n\t\tsuper($adapt_environment);\n\t\toclEnvironment = environment;\n\t\treset(reader, filename);\n\t}\n  \n   // OCL addition to reset the lexer stream from an input reader\n\t/**\n\t * @since 3.0\n\t */\n    @Override\n    public void reset(Reader reader, String filename) throws java.io.IOException {\n    \tchar[] input_chars = getInputChars(reader);\n        reset(input_chars, filename, ECLIPSE_TAB_VALUE);\n    }\n\t./\n%End\n%Notice\n\t/./**\n * Essential OCL Lexer\n * <copyright>\n *\n * Copyright (c) 2005, 2010 IBM Corporation and others.\n * All rights reserved.   This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v2.0\n * which accompanies this distribution, and is available at\n * http://www.eclipse.org/legal/epl-v20.html\n *\n * Contributors:\n *   IBM - Initial API and implementation\n *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling\n *   Borland - Bug 242880\n *   E.D.Willink - Bug 292112, 295166\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - Introducing new LPG templates (299396)\n $copyright_contributions\n *******************************************************************************/\n\t./\n%End\n\n%Globals\n    /.\n    import java.io.Reader;\n    \n    import $environment_import;\n    import org.eclipse.ocl.lpg.BasicEnvironment;\n    import org.eclipse.ocl.lpg.DerivedPrsStream;\n    import org.eclipse.ocl.lpg.DerivedLexStream;\n    import org.eclipse.ocl.util.OCLUtil;\n    ./\n%End\n\n%Export\n\n\tIDENTIFIER\n\tQUOTED_IDENTIFIER\n\tINTEGER_LITERAL\n\tREAL_LITERAL\n\tSTRING_LITERAL\n\t\n\tPLUS\n\tMINUS\n\tMULTIPLY\n\tDIVIDE\n\n\tGREATER\n\tLESS\n\tEQUAL\n\tGREATER_EQUAL\n\tLESS_EQUAL\n\tNOT_EQUAL\n\n\tLPAREN\n\tRPAREN\n\tLBRACE\n\tRBRACE\n\tLBRACKET\n\tRBRACKET\n\n\tARROW\n\tBAR\n\tCOMMA\n\tCOLON\n\tCOLONCOLON\n\tSEMICOLON\n\tDOT\n\tDOTDOT\n\t\n\tSINGLE_LINE_COMMENT\n\tMULTI_LINE_COMMENT\n\n%End\n\n%Terminals\n\tCtlCharNotWS\n\n\tLF   CR   HT   FF\n\n\ta b c d e f g h i j k l m n o p q r s t u v w x y z\n\t_\n\n\tA B C D E F G H I J K L M N O P Q R S T U V W X Y Z\n\n\t0 1 2 3 4 5 6 7 8 9\n\n\tAfterASCIINotAcute\n\tSpace        ::= ' '\n\tLF           ::= NewLine\n\tCR           ::= Return\n\tHT           ::= HorizontalTab\n\tFF           ::= FormFeed\n\tDoubleQuote  ::= '\"'\n\tSingleQuote  ::= \"'\"\n\tPercent      ::= '%'\n\tVerticalBar  ::= '|'\n\tExclamation  ::= '!'\n\tAtSign       ::= '@'\n\tBackQuote    ::= '`'\n\tAcute        ::= '\u00c3\u00af\u00c2\u00bf\u00c2\u00bd'\n\tTilde        ::= '~'\n\tSharp        ::= '#'\n\tDollarSign   ::= '$'\n\tAmpersand    ::= '&'\n\tCaret        ::= '^'\n\tColon        ::= ':'\n\tSemiColon    ::= ';'\n\tBackSlash    ::= '\\'\n\tLeftBrace    ::= '{'\n\tRightBrace   ::= '}'\n\tLeftBracket  ::= '['\n\tRightBracket ::= ']'\n\tQuestionMark ::= '?'\n\tComma        ::= ','\n\tDot          ::= '.'\n\tLessThan     ::= '<'\n\tGreaterThan  ::= '>'\n\tPlus         ::= '+'\n\tMinus        ::= '-'\n\tSlash        ::= '/'\n\tStar         ::= '*'\n\tLeftParen    ::= '('\n\tRightParen   ::= ')'\n\tEqual        ::= '='\n\n%End\n\n%Start\n\tToken\n%End\n\n%Rules\n\n\t---------------------  Rules for Scanned Tokens --------------------------------\n\t-- The lexer creates an array list of tokens which is defined in the PrsStream class.\n\t-- A token has three attributes: a start offset, an end offset and a kind.\n\t-- \n\t-- Only rules that produce complete tokens have actions to create token objects.\n\t-- When making a token, calls to the methods, $getToken(1) and $getRightSpan(), \n\t-- provide the offsets (i.e. the span) of a rule's right hand side (rhs) and thus of the token.\n\t-- For a rule of the form A ::= A1 A2 ... An, the start offset of the rhs of A is given by\n\t-- $getToken(1) or by $getLeftSpan() and the end offset by $getRightSpan().\n\t--  \n\t-- Regarding rules for parsing in general, note that for a rhs symbol Ai, the \n\t-- method $getToken(i) returns the location of the leftmost character derived from Ai.  \n\t-- The method $getLeftSpan(i) returns the same location unless Ai produces %empty in which case\n\t-- it returns the location of the last character derived before reducing Ai to %empty. \n\t-- The method $getRightSpan(i) returns the location of the rightmost character derived from Ai \n\t-- unless Ai produces %empty in which case it returns the location of the last character \n\t-- derived before reducing Ai to %empty.\n\t--------------------------------------------------------------------------------\n\tToken ::= Identifier\n\t\t/.$BeginAction\n\t\t\t\t\tcheckForKeyWord();\n\t\t  $EndAction\n\t\t./\n\n\t-- Deprecated\n\tToken ::= '\"' SLNotDQ '\"'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_IDENTIFIER);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '_' SingleQuote SLNotSQOpt SingleQuote\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_QUOTED_IDENTIFIER);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= SingleQuote SLNotSQOpt SingleQuote\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_STRING_LITERAL);\n\t\t  $EndAction\n\t\t./\n\n\t-- Deprecated\n\tToken ::= Acute SLNotSQOpt Acute\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_STRING_LITERAL);\n\t\t  $EndAction\n\t\t./\n\n\t-- Deprecated\n\tToken ::= BackQuote SLNotSQOpt Acute\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_STRING_LITERAL);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= IntegerLiteral\n\t\t/.$NoAction\n\t\t./\n\t\t\n\tToken ::= IntegerLiteral DotToken\n\t\t/.$NoAction\n\t\t./\n\n\tToken ::= IntegerLiteral DotDotToken\n\t\t/.$NoAction\n\t\t./\n\n\tToken ::= RealLiteral\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_REAL_LITERAL);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= SLC\n\t\t/.$BeginAction\n\t\t\t\t\tmakeComment($_SINGLE_LINE_COMMENT);\n\t\t  $EndAction\n\t\t./\n\n    Token ::= '/' '*' Inside Stars '/'\n        /.$BeginAction\n                    makeComment($_MULTI_LINE_COMMENT);\n          $EndAction\n        ./\n\n\tToken ::= WS -- White Space is scanned but not added to output vector\n\t\t/.$BeginAction\n\t\t\t\t\tskipToken();\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '+'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_PLUS);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '-'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_MINUS);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '*'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_MULTIPLY);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '/'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_DIVIDE);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '('\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_LPAREN);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= ')'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_RPAREN);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '>'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_GREATER);\n\t\t  $EndAction\n\t\t./\n\t\t\n\tToken ::= '<'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_LESS);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '='\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_EQUAL);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '>' '='\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_GREATER_EQUAL);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '<' '='\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_LESS_EQUAL);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '<' '>'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_NOT_EQUAL);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '['\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_LBRACKET);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= ']'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_RBRACKET);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '{'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_LBRACE);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '}'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_RBRACE);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '-' '>'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_ARROW);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= '|'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_BAR);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= ','\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_COMMA);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= ':'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_COLON);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= ':' ':'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_COLONCOLON);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= ';'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_SEMICOLON);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= DotToken\n\t\t/.$NoAction\n\t\t./\n\n\tDotToken ::= '.'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_DOT);\n\t\t  $EndAction\n\t\t./\n\n\tToken ::= DotDotToken\n\t\t/.$NoAction\n\t\t./\n\n\tDotDotToken ::= '.' '.'\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_DOTDOT);\n\t\t  $EndAction\n\t\t./\n\n\n    IntegerLiteral ::= Integer\n\t\t/.$BeginAction\n\t\t\t\t\tmakeToken($_INTEGER_LITERAL);\n\t\t  $EndAction\n\t\t./\n\n    RealLiteral -> Decimal\n                 | Decimal Exponent\n                 | Integer Exponent\n\n    Inside ::= Inside Stars NotSlashOrStar\n             | Inside '/'\n             | Inside NotSlashOrStar\n             | %empty\n\n    Stars -> '*'\n           | Stars '*'\n\n    SLC -> '-' '-'\n         | SLC NotEol\n\n    Integer -> Digit\n             | Integer Digit\n\n    Decimal -> Integer '.' Integer\n\n    Exponent -> LetterEe Integer\n              | LetterEe '-' Integer\n              | LetterEe '+' Integer\n\n    WSChar -> Space\n            | LF\n            | CR\n            | HT\n            | FF\n\n    Letter -> LowerCaseLetter\n            | UpperCaseLetter\n            | _\n            | AfterASCIINotAcute\n\n    LowerCaseLetter -> a | b | c | d | e | f | g | h | i | j | k | l | m |\n                       n | o | p | q | r | s | t | u | v | w | x | y | z\n\n    UpperCaseLetter -> A | B | C | D | E | F | G | H | I | J | K | L | M |\n                       N | O | P | Q | R | S | T | U | V | W | X | Y | Z\n\n    Digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n    LetterEe -> 'E'\n              | 'e'\n\n    WS -> WSChar\n        | WS WSChar\n\n    Identifier -> Letter\n                | Identifier Letter\n                | Identifier Digit\n                | Identifier DollarSign\n\n    SpecialNotStar -> '+' | '-' | '/' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n                      '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                      '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign\n\n    SpecialNotSlash -> '+' | '-' | -- exclude the star as well\n                       '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n                       '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                       '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign\n\n    SpecialNotSQNotDQ -> '+' | '-' | '/' | '(' | ')' | '*' | '!' | '@' | '`' | '~' |\n                         '%' | '&' | '^' | ':' | ';' | '|' | '{' | '}' |\n                         '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign\n\n    \n    SpecialNotDQ -> SpecialNotSQNotDQ | \"'\"\n    SpecialNotSQ -> SpecialNotSQNotDQ | '\"'\n\n    EscapedSymbols -> NotSQNotDQ | '\"' | \"'\" | '\\'\n    BackslashEscapedSymbol -> '\\' EscapedSymbols\n\n    NotSlashOrStar -> Letter\n                    | Digit\n                    | SpecialNotSlash\n                    | WSChar\n\n    NotEol -> Letter\n            | Digit\n            | Space\n            | '*'\n            | SpecialNotStar\n            | HT\n            | FF\n            | CtlCharNotWS\n\n    NotSQNotDQ -> Letter\n           | Digit\n           | SpecialNotSQNotDQ\n           | Space\n\n    NotDQ -> Letter\n           | Digit\n           | SpecialNotDQ\n           | Space\n           | BackslashEscapedSymbol\n\n    NotSQ -> Letter\n           | Digit\n           | SpecialNotSQ\n           | Space\n           | BackslashEscapedSymbol\n\n\tSLNotDQ -> NotDQ\n\t         | SLNotDQ NotDQ\n\n\tSLNotSQ -> NotSQ\n\t         | SLNotSQ NotSQ\n\n\tSLNotSQOpt -> %empty\n\t            | SLNotSQ\n\n%End\n", "meta": {"hexsha": "8f0b4d9e80d9299e9a5dcee82993454548f3cb51", "size": 12620, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/parser/EssentialOCLLexer.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/parser/EssentialOCLLexer.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/parser/EssentialOCLLexer.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.4991482112, "max_line_length": 113, "alphanum_fraction": 0.543977813, "num_tokens": 3660, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1441488420026069, "lm_q2_score": 0.025957354372137545, "lm_q1q2_score": 0.003741722574194932}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2010, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   See (or edit) Notice Declaration below\n-- *\n-- * </copyright>\n-- */\n--\n-- The Complete OCL KeyWord Lexer\n--\n\n%options slr\n%options fp=OCLKWLexer,prefix=Char_\n%options noserialize\n%options package=org.eclipse.ocl.xtext.essentialocl.parser\n%options template=../lpg/KeywordTemplateF.gi\n%options export_terminals=(\"OCLParsersym.java\", \"TK_\")\n%options include_directory=\"../lpg\"\n\n%Import\n\tEssentialOCLKWLexer.gi\n%End\n\n%Notice\n\t/./**\n * Complete OCL Keyword Lexer\n * <copyright>\n *\n * Copyright (c) 2010, 2009 IBM Corporation and others.\n * All rights reserved.   This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v2.0\n * which accompanies this distribution, and is available at\n * http://www.eclipse.org/legal/epl-v20.html\n *\n * Contributors:\n *   IBM - Initial API and implementation\n *   E.D.Willink - Bug 292112\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - Introducing new LPG templates (299396)\n$copyright_contributions\n *******************************************************************************/\n\t./\n%End\n\n%Export\n\tinv\n\tpre\n\tpost\n\tcontext\n\tpackage\n\tendpackage\n\tdef\n\tbody\n\tderive\n\tinit\n\t--\n\t-- the following were introduced in the OCL 2.1 RTF 09-05-02.\n\t--\n\tstatic\n\n\tOclMessage\n%End\n\n%Rules\n\n-- The Goal for the parser is a single Keyword\n\n\tKeyWord ::=\n\t\ti n v\n\t\t/.$BeginAction\n\t\t\t$setResult($_inv);\n\t\t  $EndAction\n\t\t./\n\n\t\t| p r e\n\t\t/.$BeginAction\n\t\t\t$setResult($_pre);\n\t\t  $EndAction\n\t\t./\n\n\t\t| p o s t\n\t\t/.$BeginAction\n\t\t\t$setResult($_post);\n\t\t  $EndAction\n\t\t./\n\n\t\t| b o d y\n\t\t/.$BeginAction\n\t\t\t$setResult($_body);\n\t\t  $EndAction\n\t\t./\n\n\t\t| c o n t e x t\n\t\t/.$BeginAction\n\t\t\t$setResult($_context);\n\t\t  $EndAction\n\t\t./\n\n\t\t| p a c k a g e\n\t\t/.$BeginAction\n\t\t\t$setResult($_package);\n\t\t  $EndAction\n\t\t./\n\n\t\t| e n d p a c k a g e\n\t\t/.$BeginAction\n\t\t\t$setResult($_endpackage);\n\t\t  $EndAction\n\t\t./\n\n\t\t| d e f\n\t\t/.$BeginAction\n\t\t\t$setResult($_def);\n\t\t  $EndAction\n\t\t./\n\n\t\t| d e r i v e\n\t\t/.$BeginAction\n\t\t\t$setResult($_derive);\n\t\t  $EndAction\n\t\t./\n\n\t\t| i n i t\n\t\t/.$BeginAction\n\t\t\t$setResult($_init);\n\t\t  $EndAction\n\t\t./\n\n\t\t| O c l M e s s a g e\n\t\t/.$BeginAction\n\t\t\t$setResult($_OclMessage);\n\t\t  $EndAction\n\t\t./\n\n\t\t| s t a t i c\n\t\t/.$BeginAction\n\t\t\t$setResult($_static);\n\t\t  $EndAction\n\t\t./\n%End\n", "meta": {"hexsha": "b1d4d4fb195ba0941e36aff9f0d308c4260221fd", "size": 2721, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/OCLKWLexer.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/OCLKWLexer.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/OCLKWLexer.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.3851351351, "max_line_length": 92, "alphanum_fraction": 0.6310180081, "num_tokens": 886, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.16238002450622283, "lm_q2_score": 0.021948254154697616, "lm_q1q2_score": 0.003563958047508606}}
{"text": "MitM_CookieCount := 0;\nMitM_CookieJar := rec();\n\nInstallGlobalFunction(MitM_CompleteProcedure,\nfunction(result, attr...)\n    if Length(attr) = 0 then\n        attr := rec();\n    elif Length(attr) = 1 then\n        attr := attr[1];\n    else\n        ErrorNoReturn(\"MitM_CompleteProcedure: takes 1 or 2 arguments (not \",\n                      Length(attr) + 1, \")\");\n    fi;\n    return MitM_OMRecToXML(MitM_OMRecToOMOBJRec(\n                 OMATTR( attr\n                       , OMA( OMS( \"scscp1\"\n                                 , \"procedure_completed\" )\n                            , result ) ) ) );\nend);\n\nInstallGlobalFunction(MitM_TerminateProcedure,\nfunction(message, attr...)\n    if Length(attr) = 0 then\n        attr := rec();\n    elif Length(attr) = 1 then\n        attr := attr[1];\n    else\n        ErrorNoReturn(\"MitM_TerminateProcedure: takes 1 or 2 arguments (not \",\n                      Length(attr) + 1, \")\");\n    fi;\n    return MitM_OMRecToXML(MitM_OMRecToOMOBJRec(\n                 OMATTR( attr\n                       , OMA( OMS( \"scscp1\"\n                                 , \"procedure_terminated\" )\n                            , OME( OMS( \"scscp1\"\n                                      , \"error_system_specific\" )\n                                 , [ OMSTR(message) ] ) ) ) ) );\nend);\n\nInstallValue(MitM_SCSCPHandlers, rec(\n    procedure_call := function(attr, oma)\n        local t, eval, rattr, res;\n\n        Info(InfoMitMServer, 15, \" Evaluating... \", oma);\n        Info(InfoMitMServer, 15, \" Attributes... \", attr);\n\n        t := NanosecondsSinceEpoch();\n        eval := MitM_OMRecToGAP(oma);\n        t := NanosecondsSinceEpoch() - t;\n\n        if eval.success then\n            rattr := rec( call_id := attr.call_id\n                        , info_runtime := t / 1000000. );\n            if IsBound(attr.option_return_cookie) then\n                MitM_CookieJar.(MitM_CookieCount) := eval.result;\n                res := MitM_GAPToOMRec(MitM_CookieCount);\n                MitM_CookieCount := MitM_CookieCount + 1;\n            elif IsBound(attr.option_return_object) then\n                res := MitM_GAPToOMRec(eval.result);\n            elif IsBound(attr.option_return_nothing) then\n                res := rec();\n            fi;\n\n            return MitM_CompleteProcedure(res, rattr);\n        else\n            Info(InfoMitMServer, 15, \" Error during evaluation: \", eval.error);\n            return MitM_TerminateProcedure(eval.error, rec(call_id := attr.call_id));\n        fi;\n    end\n) );\n\nInstallGlobalFunction(MitM_HandleSCSCP,\nfunction(node)\n    local attr, scscp_call, scscp_oma, content;\n\n    content := MitM_Content(node);\n    # Validate wrt SCSCP v1.3 spec - procedure call (4.1.1)\n    if not (Length(content) = 1 and MitM_Tag(content[1]) = \"OMATTR\") then\n        Info(InfoMitMServer, 15, \" Invalid procedure call: OMATTR expected\");\n        return MitM_TerminateProcedure(\"procedure call: OMOBJ should contain one OMATTR and nothing else\");\n    elif MitM_Tag(MitM_Content(content[1])[2]) <> \"OMA\" then\n        Info(InfoMitMServer, 15, \" Invalid procedure call: OMA expected\");\n        return MitM_TerminateProcedure(\"procedure call: OMOBJ: OMATTR's 2nd object should be an OMA\");\n    elif not (Length(MitM_Content(MitM_Content(content[1])[2])) = 2 and\n              MitM_Tag(MitM_Content(MitM_Content(content[1])[2])[1]) = \"OMS\") then\n        Info(InfoMitMServer, 15, \" Invalid procedure call: OMS expected\");\n        return MitM_TerminateProcedure(\"procedure call: OMOBJ: OMATTR: OMA's 1st object should be an OMS\");\n    elif MitM_Tag(MitM_Content(MitM_Content(content[1])[2])[2]) <> \"OMA\" then\n        Info(InfoMitMServer, 15, \" Invalid procedure call: OMA expected\");\n        return MitM_TerminateProcedure(\"procedure call: OMOBJ: OMATTR: OMA's 2nd object should be an OMA\");\n    fi;\n\n    attr := MitM_ATPToRec(MitM_Content(content[1])[1]);\n    scscp_call := MitM_Content(MitM_Content(content[1])[2])[1];\n    scscp_oma := MitM_Content(MitM_Content(content[1])[2])[2];\n\n    if MitM_CD(scscp_call) = \"scscp1\" then\n        if MitM_Name(scscp_call) = \"procedure_call\" then\n            return MitM_SCSCPHandlers.procedure_call(attr, scscp_oma);\n        elif MitM_Name(scscp_call) = \"terminate_procedure\" then\n            # TODO:\n        fi;\n    else\n        Info(InfoMitMServer, 15, \" Unsupported CD \", scscp_call.attributes.cd);\n        return fail;\n    fi;\nend);\n\nInstallGlobalFunction(MitM_SCSCPHandler,\nfunction(addr, stream)\n    local done, version, r, reply, obj;\n    done := false;\n\n    Info(InfoMitMServer, 5, \"Accepted MitM Connection on \", TCP_AddrToString(addr));\n    version := MitM_SCSCPServerHandshake(stream, stream);\n    Info(InfoMitMServer, 5, \" SCSCP Protocol Version \", version);\n    while not done do\n        r := MitM_ReadSCSCP(stream);\n        Info(InfoMitMServer, 15, \" Received: \", r);\n        if r.success <> true then\n            Info(InfoMitMServer, 15, \" Bad object received\");\n            Info(InfoMitMServer, 15, \"  error: \", r.error);\n            Info(InfoMitMServer, 15, \" closing connection.\");\n            CloseStream(stream);\n            done := true;\n            # WriteLine(stream, Concatenation(\"error: \", r.error));\n        else\n            reply := MitM_HandleSCSCP(r.result);\n            Info(InfoMitMServer, 15, \" Evaluated to \", reply);\n            WriteLine(stream, \"<?scscp start ?>\");\n            WriteLine(stream, reply);\n            WriteLine(stream, \"<?scscp end ?>\");\n        fi;\n    od;\n    Info(InfoMitMServer, 5, \"Leaving handler for \", TCP_AddrToString(addr));\nend);\n\nInstallGlobalFunction(StartMitMServer,\nfunction(args...)\n    local opt;\n\n    opt := ShallowCopy(MitM_DefaultServerOptions);\n    if IsBound(args[1]) and IsString(args[1]) then\n        opt.hostname := args[1];\n    fi;\n    if IsBound(args[2]) and IsPosInt(args[2]) then\n        opt.port := args[2];\n    fi;\n\n    Info(InfoMitMServer, 5, \"Starting MitM TCP Server on \", opt.hostname, \":\", opt.port);\n    StartTCPServer(opt.hostname, opt.port, MitM_SCSCPHandler);\nend);\n\nInstallGlobalFunction(StreamToMitMServer,\nfunction(hostname, port...)\n    local stream;\n    if Length(port) = 0 then\n        port := 26133; # SCSCP default\n    elif Length(port) = 1 then\n        port := port[1];\n    else\n        Error(\"MitM_ConnectionToServer: 1 or 2 arguments expected, but \",\n              Length(port) + 1, \" found\");\n    fi;\n    stream := ConnectInputOutputTCPStream(hostname, port);\n    MitM_SCSCPClientHandshake(stream, stream);\n    return stream;\nend);\n\nInstallGlobalFunction(SendObjToMitMServer,\nfunction(stream, obj)\n    local xml;\n    xml := MitM_OMRecToXML(obj);\n    WriteLine(stream, \"<?scscp start ?>\");\n    WriteLine(stream, xml);\n    WriteLine(stream, \"<?scscp end ?>\");\n    return MitM_ReadSCSCP(stream);\nend);\n\nInstallGlobalFunction(MitM_ProcedureCall,\nfunction(obj)\n    local base64, call_id, opts, call, attr;\n    # obj should be an OMA to be run\n    base64 := Concatenation(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n                            \"abcdefghijklmnopqrstuvwxyz\",\n                            \"0123456789+/\");\n    call_id := Concatenation(MitM_cdbase, \":\",\n                             List([1..16], i -> Random(base64)));\n    # TODO: support option_return_cookie and option_return_nothing\n    opts := rec(call_id := OMSTR(call_id), option_return_object := OMSTR(\"\"));\n    call := OMA(OMS(\"scscp1\", \"procedure_call\"), obj);\n    attr := OMATTR(opts, call);\n    return OMOBJ(attr);\nend);\n\nInstallGlobalFunction(GetAllowedHeads,\nfunction(stream)\n    local call, out, obj, attr, oma_outer, oma_inner, list;\n    call := MitM_ProcedureCall(OMA(OMS(\"scscp2\", \"get_allowed_heads\")));\n    out := SendObjToMitMServer(stream, call);\n    if not out.success then\n        return fail;\n    fi;\n    obj := out.result;\n    # TODO: check that the server successfully sent a list of heads\n    attr := MitM_Content(obj)[1];\n    oma_outer := MitM_Content(attr)[2];\n    oma_inner := MitM_Content(oma_outer)[2];\n    list := MitM_Content(oma_inner);\n    return list{[2..Length(list)]};\nend);\n", "meta": {"hexsha": "670346ba96039cf2fb4cf71d17b4c06c74f83d16", "size": 8006, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/MathInTheMiddle.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/MathInTheMiddle.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/MathInTheMiddle.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 37.7641509434, "max_line_length": 107, "alphanum_fraction": 0.6112915314, "num_tokens": 2101, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1824255326961778, "lm_q2_score": 0.019419346054312885, "lm_q1q2_score": 0.003542584548569447}}
{"text": "InstallGlobalFunction(TCP_AddrToString,\naddr -> JoinStringsWithSeparator(List(addr{[5..8]},\n                                      x -> String(INT_CHAR(x))), \".\"));\n\nInstallGlobalFunction( StartTCPServer,\nfunction(hostname, port, handlerCallback)\n    local socket, addr, client, stream;\n    socket := ListeningTCPSocket(hostname, port);\n    while true do\n        # Currently we accept connections from anyone.\n        addr := IO_MakeIPAddressPort( \"0.0.0.0\", 0 );\n\n        # Accept connection, and open stream.\n        client := IO_accept(socket, addr);\n\n        # TODO: prettier\n        Info(InfoTCPSockets, 5, \"Accepted connection from: \",\n             TCP_AddrToString(addr));\n        stream := AcceptInputOutputTCPStream(client);\n\n        # Handle connection\n        handlerCallback(addr, stream);\n    od;\nend);\n\nInstallGlobalFunction( ListeningTCPSocket,\nfunction(hostname, port)\n    local socket, client, desc, stream, res, bindaddr, listenname;\n\n    res := IO_gethostbyname(hostname);\n    if res = fail then\n        ErrorNoReturn(\"ListeningTCPSocket: lookup failed on address \",\n                      hostname);\n    fi;\n    bindaddr := res.addr[1];\n    listenname := res.name;\n\n    if not IsPosInt(port) or (port > 65535) then\n        ErrorNoReturn(\"ListeningTCPSocket:\\n<port> must be \",\n                      \"a positive integer no greater than 65535\");\n    fi;\n\n    # Create TCP socket\n    Info(InfoTCPSockets, 5, \"MitM server listening for connections...\");\n    socket := IO_socket( IO.PF_INET, IO.SOCK_STREAM, \"tcp\" );\n    if socket = fail then\n        ErrorNoReturn(\"ListeningTCPSocket: failed to open socket:\\n\", \n                      LastSystemError().message);\n    fi;\n\n    res := IO_bind(socket, IO_make_sockaddr_in(bindaddr, port));\n    if res = fail then\n        ErrorNoReturn(\"ListeningTCPSocket: failed to bind:\\n\", \n                      LastSystemError().message);\n    fi;\n\n    Info(InfoTCPSockets, 5, \"MitM server listening on \", listenname, \" \", port);\n    # TODO: make the queue length a parameter\n    IO_listen(socket, 5);\n    return socket;\nend);\n\nInstallGlobalFunction( ConnectInputOutputTCPStream,\nfunction( hostname, port )\n    local lookup, sock, res, err, fio;\n\n    if not IsString( hostname ) then\n        Error(\"ConnectInputOutputTCPStream: <hostname> must be a string\");\n    fi;\n    if not (IsInt(port) and port >= 0) then\n        Error(\"ConnectInputOutputTCPStream: <port> must be a non-negative integer\");\n    fi;\n    lookup := IO_gethostbyname( hostname );\n    if lookup = fail then\n        Error(\"ConnectInputOutputTCPStream: cannot find hostname \", hostname);\n    fi;\n    sock := IO_socket( IO.PF_INET, IO.SOCK_STREAM, \"tcp\" );\n    res := IO_connect( sock, IO_make_sockaddr_in( lookup.addr[1], port ) );\n    if res = fail then\n        err := LastSystemError();\n        IO_close(sock);\n        Error(\"ConnectInputOutputTCPStream: \", err.message);\n    else\n        fio := IO_WrapFD( sock, IO.DefaultBufSize, IO.DefaultBufSize );\n        return Objectify( InputOutputTCPStreamDefaultType,\n                          [ fio, hostname, [ port ], false ] );\n    fi;\nend);\n\nInstallGlobalFunction( AcceptInputOutputTCPStream,\nfunction(socket_descriptor)\n    local fio;\n    if not (IsInt(socket_descriptor) and socket_descriptor >= 0) then\n        Error(\"AcceptInputOutputTCPStream: argument must be a non-negative integer\");\n    fi;\n    fio := IO_WrapFD(socket_descriptor, IO.DefaultBufSize, IO.DefaultBufSize);\n    return Objectify( InputOutputTCPStreamDefaultType,\n                      [ fio, \"socket descriptor\", [ socket_descriptor ], false ] );\nend);\n\nInstallMethod( ViewObj, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\nfunction(stream)\n    Print(\"<\");\n    if IsClosedStream(stream) then\n        Print(\"closed \");\n    fi;\n    Print(\"input/output TCP stream to \",stream![2],\":\", stream![3][1], \">\");\nend);\n\nInstallMethod( PrintObj, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\n               ViewObj);\n\nInstallMethod( ReadByte, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\nfunction(stream)\n    local buf;\n    buf := IO_Read( stream![1], 1 );\n    if buf = fail or Length(buf) = 0 then\n        stream![4] := true;\n        return fail;\n    else\n        stream![4] := true;\n        return INT_CHAR(buf[1]);\n    fi;\nend);\n\nInstallMethod( ReadLine, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\nfunction( stream )\n    local sofar, chunk;\n    sofar := IO_Read( stream![1], 1 );\n    if sofar = fail or Length(sofar) = 0 then\n        stream![4] := true;\n        return fail;\n    fi;\n    while sofar[ Length(sofar) ] <> '\\n' do\n        chunk := IO_Read( stream![1], 1);\n        if chunk = fail or Length(chunk) = 0 then\n            stream![4] := true;\n            return sofar;\n        fi;\n        Append( sofar, chunk );\n    od;\n    return sofar;\nend);\n\nBindGlobal( \"ReadAllIoTCPStream\",\nfunction(stream, limit)\n    local sofar, chunk, csize;\n    if limit = -1 then\n        csize := 20000;\n    else\n        csize := Minimum(20000,limit);\n        limit := limit - csize;\n    fi;\n    sofar := IO_Read(stream![1], csize);\n    if sofar = fail or Length(sofar) = 0 then\n        stream![4] := true;\n        return fail;\n    fi;\n    while limit <> 0  do\n        if limit = -1 then\n            csize := 20000;\n        else\n            csize := Minimum(20000,limit);\n            limit := limit - csize;\n        fi;\n        chunk := IO_Read( stream![1], csize);\n        if chunk = fail or Length(chunk) = 0 then\n            stream![4] := true;\n            return sofar;\n        fi;\n        Append(sofar,chunk);\n    od;\n    return sofar;\nend);\n\n\nInstallMethod( ReadAll, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\n               stream ->  ReadAllIoTCPStream(stream, -1) );\n\nInstallMethod( ReadAll, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream, IsInt ],\nfunction( stream, limit )\n    if limit < 0 then\n        Error(\"ReadAll: negative limit not allowed\");\n    fi;\n    return  ReadAllIoTCPStream(stream, limit);\nend);\n\nInstallMethod( WriteByte, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream, IsInt ],\nfunction(stream, byte)\n    local ret,s;\n    if byte < 0 or 255 < byte  then\n        Error( \"<byte> must an integer between 0 and 255\" );\n    fi;\n    s := [CHAR_INT(byte)];\n    ConvertToStringRep( s );\n    ret := IO_Write( stream![1], s );\n    if ret <> 1 then\n        return fail;\n    else\n        return true;\n    fi;\nend);\n\nInstallMethod( WriteLine, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream, IsString ],\nfunction( stream, string )\n    return IO_WriteLine( stream![1], string );\nend);\n\nInstallMethod( WriteAll, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream, IsString ],\nfunction( stream, string )\n    local byte;\n    for byte in string  do\n        if WriteByte( stream, INT_CHAR(byte) ) <> true  then\n            return fail;\n        fi;\n    od;\n    return true;\nend);\n\nInstallMethod( IsEndOfStream, \"iostream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\nstream -> not IO_HasData( stream![1] ) );\n# TODO: when does this return true? -MT\n\nInstallMethod( CloseStream, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\nfunction(stream)\n    IO_Close( stream![1] );\n    SetFilterObj( stream, IsClosedStream );\nend);\n\nInstallMethod( FileDescriptorOfStream, \"for ioTCPstream\",\n               [ IsInputOutputTCPStreamRep and IsInputOutputStream ],\n               stream -> IO_GetFD( stream![1] ) );\n", "meta": {"hexsha": "49041f17a1fe28daf7f7bf03ff3181a210b3ddf7", "size": 7761, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/TCPStream.gi", "max_stars_repo_name": "markuspf/MathsInTheMiddle", "max_stars_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-04-23T00:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T00:34:49.000Z", "max_issues_repo_path": "gap/TCPStream.gi", "max_issues_repo_name": "markuspf/MathsInTheMiddle", "max_issues_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 18, "max_issues_repo_issues_event_min_datetime": "2018-09-10T10:03:23.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-06T15:16:30.000Z", "max_forks_repo_path": "gap/TCPStream.gi", "max_forks_repo_name": "markuspf/MathsInTheMiddle", "max_forks_repo_head_hexsha": "3a4a3c74ee4611233186bdb76f721458584d8611", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2018-08-20T16:32:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-08T10:18:20.000Z", "avg_line_length": 31.8073770492, "max_line_length": 85, "alphanum_fraction": 0.6209251385, "num_tokens": 1939, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.18476749269168688, "lm_q2_score": 0.019124034899065213, "lm_q1q2_score": 0.0035334999784485967}}
{"text": "--\n-- An LPG Lexer Template Using lpg.jar\n--\n-- An instance of this template must have a %Export section and the export_terminals option\n-- There must be only one non-terminal, the start symbol, for the keywords\n-- The action for each keyword should be a call to %setResult(terminal_symbol)\n--\n-- Macro that may be redefined in an instance of this template\n--\n--     %eof_char\n--\n-- B E G I N N I N G   O F   T E M P L A T E   KeywordTemplateF (Similar to KeywordTemplateD)\n--\n%Options programming_Language=typescript,margin=4\n%Options table\n%options action-block=(\"*.ts\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%Options prefix=Char_\n%Options single-productions\n\n\n\n%Globals\n    /.\n    import { %prs_type } from \".\\/%prs_type\";\n    import { %sym_type } from \".\\/%sym_type\";\n    import { %exp_type } from \".\\/%exp_type\";\n    ./\n%End\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- LexerTemplateD.\n--\n%Eof\n    EOF\n%End\n\n%Define\n    --\n    -- Macro that may be respecified in an instance of this template\n    --\n    $eof_char /.%sym_type%.%prefix%EOF%suffix%./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $setResult /.this.keywordKind[%rule_number] = ./\n\n    $Header\n    /.\n            //\n            // Rule %rule_number:  %rule_text\n            //\n    ./\n\n    $BeginAction /.%Header./\n\n    $EndAction /../\n\n    $BeginJava /.%BeginAction./\n\n    $EndJava /.%EndAction./\n%End\n\n\n%Headers\n    /.\n    export class %action_type extends %prs_type\n    {\n        private inputChars : string;\n        private   keywordKind  : number[] = new Array(%num_rules + 1);\n\n        public  getKeywordKinds() : number[] { return this.keywordKind; }\n\n        public  lexer(curtok : number, lasttok : number) : number\n        {\n            let current_kind = %action_type.getKind(this.inputChars.charCodeAt(curtok)),\n                act;\n\n            for (act = this.tAction(this.START_STATE, current_kind);\n                 act > this.NUM_RULES && act < this.ACCEPT_ACTION;\n                 act = this.tAction(act, current_kind))\n            {\n                curtok++;\n                current_kind = (curtok > lasttok\n                                       ? %eof_char\n                                       : %action_type.getKind(this.inputChars.charCodeAt(curtok)));\n            }\n\n            if (act > this.ERROR_ACTION)\n            {\n                curtok++;\n                act -= this.ERROR_ACTION;\n            }\n\n            return this.keywordKind[act == this.ERROR_ACTION  || curtok <= lasttok ? 0 : act];\n        }\n\n        public setInputChars(inputChars : string ) : void  { this.inputChars = inputChars; }\n\n    ./\n%End\n\n%Rules\n    /.\n\n        constructor( inputChars : string,  identifierKind : number)\n        {\n            super();\n            this.inputChars = inputChars;\n            this.keywordKind[0] = identifierKind;\n    ./\n%End\n\n%Trailers\n    /.\n            for (let i : number = 0; i < this.keywordKind.length; i++)\n            {\n                if (this.keywordKind[i] == 0)\n                    this.keywordKind[i] = identifierKind;\n            }\n        }\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "885e880966f8dfbc5ec36713bd858f10570dfe05", "size": 3228, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/KeywordTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/KeywordTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/KeywordTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.4545454545, "max_line_length": 99, "alphanum_fraction": 0.5557620818, "num_tokens": 798, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.12085324198975819, "lm_q2_score": 0.028436035514937053, "lm_q1q2_score": 0.003436587081316046}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2010, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   See (or edit) Notice Declaration below\n-- *\n-- * </copyright>\n-- */\n--\n-- The Essential OCL KeyWord Lexer\n--\n\n%options slr\n%options fp=EssentialOCLKWLexer,prefix=Char_\n%options noserialize\n%options package=org.eclipse.ocl.xtext.essentialocl.parser\n%options template=../lpg/KeywordTemplateF.gi\n%options export_terminals=(\"EssentialOCLParsersym.java\", \"TK_\")\n%options include_directory=\"../lpg\"\n\n%Import\n\tKWLexerMapF.gi\n%End\n\n%Define\n\n\t--\n\t-- Definition of macros used in the template\n\t--\n\t$action_class /.$file_prefix./\n\t$eof_char /.Char_EOF./\n\t$copyright_contributions /.*./\n\n%End\n\n%Notice\n\t/./**\n * Essential OCL Keyword Lexer\n * <copyright>\n *\n * Copyright (c) 2010, 2009 IBM Corporation and others.\n * All rights reserved.   This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v2.0\n * which accompanies this distribution, and is available at\n * http://www.eclipse.org/legal/epl-v20.html\n *\n * Contributors:\n *   IBM - Initial API and implementation\n *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling\n *   E.D.Willink - Bug 285633, 292112\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - Introducing new LPG templates (299396)\n$copyright_contributions\n * </copyright>\n *\n *\n */\n\t./\n%End\n\n%Globals\n\t/../\n%End\n\n%Export\n\tself\n\tif\n\tthen\n\telse\n\tendif\n\tand\n\tor\n\txor\n\tnot\n\timplies\n\tlet\n\tin\n\ttrue\n\tfalse\n\n\tnull\n\tinvalid\n\n\t--\n\t-- the remainder of the LPG keywords are defined as such for the\n\t-- purpose of constructing the CST grammar.  They are not OCL\n\t-- reserved words\n\t--\n\tSet\n\tBag\n\tSequence\n\tCollection\n\tOrderedSet\n\n\tString\n\tInteger\n\tUnlimitedNatural\n\tReal\n\tBoolean\n\tTuple\n\tOclAny\n\tOclVoid\n\tOclInvalid\n%End\n\n%Start\n\tKeyWord\n%End\n\n%Rules\n\n-- The Goal for the parser is a single Keyword\n\n\tKeyWord ::=\n\t\ts e l f\n\t\t/.$BeginAction\n\t\t\t$setResult($_self);\n\t\t  $EndAction\n\t\t./\n\n\t\t| i f\n\t\t/.$BeginAction\n\t\t\t$setResult($_if);\n\t\t  $EndAction\n\t\t./\n\n\t\t| t h e n\n\t\t/.$BeginAction\n\t\t\t$setResult($_then);\n\t\t  $EndAction\n\t\t./\n\n\t\t| e l s e\n\t\t/.$BeginAction\n\t\t\t$setResult($_else);\n\t\t  $EndAction\n\t\t./\n\n\t\t| e n d i f\n\t\t/.$BeginAction\n\t\t\t$setResult($_endif);\n\t\t  $EndAction\n\t\t./\n\n\t\t| a n d\n\t\t/.$BeginAction\n\t\t\t$setResult($_and);\n\t\t  $EndAction\n\t\t./\n\n\t\t| o r\n\t\t/.$BeginAction\n\t\t\t$setResult($_or);\n\t\t  $EndAction\n\t\t./\n\n\t\t| x o r\n\t\t/.$BeginAction\n\t\t\t$setResult($_xor);\n\t\t  $EndAction\n\t\t./\n\n\t\t| n o t\n\t\t/.$BeginAction\n\t\t\t$setResult($_not);\n\t\t  $EndAction\n\t\t./\n\n\t\t| i m p l i e s\n\t\t/.$BeginAction\n\t\t\t$setResult($_implies);\n\t\t  $EndAction\n\t\t./\n\n\t\t| l e t\n\t\t/.$BeginAction\n\t\t\t$setResult($_let);\n\t\t  $EndAction\n\t\t./\n\n\t\t| i n\n\t\t/.$BeginAction\n\t\t\t$setResult($_in);\n\t\t  $EndAction\n\t\t./\n\n\t\t| t r u e\n\t\t/.$BeginAction\n\t\t\t$setResult($_true);\n\t\t  $EndAction\n\t\t./\n\n\t\t| f a l s e\n\t\t/.$BeginAction\n\t\t\t$setResult($_false);\n\t\t  $EndAction\n\t\t./\n\n\t\t| S e t\n\t\t/.$BeginAction\n\t\t\t$setResult($_Set);\n\t\t  $EndAction\n\t\t./\n\n\t\t| B a g\n\t\t/.$BeginAction\n\t\t\t$setResult($_Bag);\n\t\t  $EndAction\n\t\t./\n\n\t\t| S e q u e n c e\n\t\t/.$BeginAction\n\t\t\t$setResult($_Sequence);\n\t\t  $EndAction\n\t\t./\n\n\t\t| C o l l e c t i o n\n\t\t/.$BeginAction\n\t\t\t$setResult($_Collection);\n\t\t  $EndAction\n\t\t./\n\n\t\t| O r d e r e d S e t\n\t\t/.$BeginAction\n\t\t\t$setResult($_OrderedSet);\n\t\t  $EndAction\n\t\t./\n\n\t\t| S t r i n g\n\t\t/.$BeginAction\n\t\t\t$setResult($_String);\n\t\t  $EndAction\n\t\t./\n\n\t\t| I n t e g e r\n\t\t/.$BeginAction\n\t\t\t$setResult($_Integer);\n\t\t  $EndAction\n\t\t./\n\n\t\t| U n l i m i t e d N a t u r a l\n\t\t/.$BeginAction\n\t\t\t$setResult($_UnlimitedNatural);\n\t\t  $EndAction\n\t\t./\n\n\t\t| R e a l\n\t\t/.$BeginAction\n\t\t\t$setResult($_Real);\n\t\t  $EndAction\n\t\t./\n\n\t\t| B o o l e a n\n\t\t/.$BeginAction\n\t\t\t$setResult($_Boolean);\n\t\t  $EndAction\n\t\t./\n\n\t\t| T u p l e\n\t\t/.$BeginAction\n\t\t\t$setResult($_Tuple);\n\t\t  $EndAction\n\t\t./\n\n\t\t| O c l A n y\n\t\t/.$BeginAction\n\t\t\t$setResult($_OclAny);\n\t\t  $EndAction\n\t\t./\n\n\t\t| O c l V o i d\n\t\t/.$BeginAction\n\t\t\t$setResult($_OclVoid);\n\t\t  $EndAction\n\t\t./\n\n\t\t| O c l I n v a l i d\n\t\t/.$BeginAction\n\t\t\t$setResult($_OclInvalid);\n\t\t  $EndAction\n\t\t./\n\n\t\t| n u l l\n\t\t/.$BeginAction\n\t\t\t$setResult($_null);\n\t\t  $EndAction\n\t\t./\n\n\t\t| i n v a l i d\n\t\t/.$BeginAction\n\t\t\t$setResult($_invalid);\n\t\t  $EndAction\n\t\t./\n%End\n", "meta": {"hexsha": "0d26be51a7ecdce9f73b0c941e786c94e89dc32c", "size": 4596, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/EssentialOCLKWLexer.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/EssentialOCLKWLexer.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/xtext/essentialocl/parser/EssentialOCLKWLexer.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 15.26910299, "max_line_length": 100, "alphanum_fraction": 0.6203220191, "num_tokens": 1656, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.13846179767920994, "lm_q2_score": 0.024798160015406693, "lm_q1q2_score": 0.003433597814869915}}
{"text": "package main\n\nimport (\n\t\"github.com/containous/yaegi/interp\"\n)\n\nfunc main() {\n\ti := interp.New(interp.Opt{})\n\ti.Use(interp.ExportValue, interp.ExportType)\n\ti.Eval(`import \"github.com/containous/yaegi/interp\"`)\n\ti.Eval(`i := interp.New(interp.Opt{})`)\n\ti.Eval(`i.Eval(\"println(42)\")`)\n}\n\n// Output:\n// 42\n", "meta": {"hexsha": "53075f3cdd2ed7f1e87c29c71c5f5e822fe6cfeb", "size": 304, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "_test/interp2.gi", "max_stars_repo_name": "blasrodri/yaegi", "max_stars_repo_head_hexsha": "f60bc4bae6bef6308de4c409491a409e896f7677", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-07-27T12:20:42.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-28T17:59:54.000Z", "max_issues_repo_path": "_test/interp2.gi", "max_issues_repo_name": "blasrodri/yaegi", "max_issues_repo_head_hexsha": "f60bc4bae6bef6308de4c409491a409e896f7677", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "_test/interp2.gi", "max_forks_repo_name": "blasrodri/yaegi", "max_forks_repo_head_hexsha": "f60bc4bae6bef6308de4c409491a409e896f7677", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2019-10-23T17:20:59.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-05T02:04:10.000Z", "avg_line_length": 17.8823529412, "max_line_length": 54, "alphanum_fraction": 0.6677631579, "num_tokens": 94, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08389039557214682, "lm_q2_score": 0.040845715326161415, "lm_q1q2_score": 0.0034265632161389814}}
{"text": "%Headers\n/.\n        //\n        // These functions are only needed in order to use a lexer as\n        // a special purpose \"diff\" program. To do so, one can invoke\n        // the main program below directly from the command line.\n        //\n        private static int LINES = 0,\n                           TOKENS = 1;\n        private static int differ_mode = LINES; // default\n        private static String extension = \"\";\n        private static int changeCount = 0,\n                           insertCount = 0,\n                           deleteCount = 0,\n                           moveCount = 0;\n\n        private static void compareFiles(String old_file, String new_file)\n        {\n            try\n            {\n                $action_type old_lexer, new_lexer;\n                if (old_file.equals(\"\"))\n                {\n                    char [] input_chars = new char[0];\n                    old_lexer = new $action_type(input_chars, \"null_file\");\n                }\n                else old_lexer = new $action_type(old_file);\n\n                if (new_file.equals(\"\"))\n                {\n                    char [] input_chars = new char[0];\n                    new_lexer = new $action_type(input_chars, \"null_file\");\n                }\n                else new_lexer = new $action_type(new_file);\n    \n                PrsStream old_stream = new PrsStream(old_lexer.getILexStream());\n                old_lexer.lexer(old_stream);\n    \n                PrsStream new_stream = new PrsStream(new_lexer.getILexStream());\n                new_lexer.lexer(new_stream);\n\n                Differ diff = (differ_mode == TOKENS ? (Differ) new DifferTokens(old_stream, new_stream)\n                                                     : (Differ) new DifferLines(old_stream, new_stream));\n                diff.compare();\n\n                if (diff.getChangeCount() > 0)\n                {\n                    diff.outputChanges();\n\n                    changeCount += diff.getChangeCount();\n                    insertCount += (diff.getInsertCount() + diff.getReplaceInsertCount());\n                    deleteCount += (diff.getDeleteCount() + diff.getReplaceDeleteCount());\n                    moveCount += diff.getMoveCount();\n                }\n            }\n            catch (Exception e)\n            {\n                System.err.println(e.getMessage());\n                e.printStackTrace();\n            }\n        }\n\n        private static void compareDirectories(java.io.File old_dir, java.io.File new_dir)\n        {\n            try\n            {\n                java.io.File old_file[] = old_dir.listFiles(),\n                             new_file[] = new_dir.listFiles();\n                java.util.HashMap old_map = new java.util.HashMap();\n                for (int i = 0; i < old_file.length; i++)\n                {\n                    String name = old_file[i].getName();\n                    if (old_file[i].isDirectory() || name.endsWith(extension))\n                        old_map.put(name, old_file[i]);\n                }\n\n                for (int i = 0; i < new_file.length; i++)\n                {\n                    java.io.File file = (java.io.File) old_map.get(new_file[i].getName());\n                    if (file != null)\n                    {\n                        old_map.remove(new_file[i].getName());\n\n                        if (file.isDirectory() && new_file[i].isDirectory())\n                             compareDirectories(file, new_file[i]);\n                        else compareFiles(file.getPath(), new_file[i].getPath());\n                    }\n                    else if (new_file[i].isDirectory() ||\n                             new_file[i].getName().endsWith(extension))\n                    {\n                        String s = new_file[i].getName() +\n                                   \" found in directory \" + \n                                   new_dir.getPath() +\n                                   \" does not exist in directory \" +\n                                   old_dir.getPath();\n                        System.err.println(\"*Warning: \" + s);\n                        \n                        if (! new_file[i].isDirectory())\n                            compareFiles(\"\", new_file[i].getPath());\n                    }\n                }\n\n                for (java.util.Iterator i = old_map.entrySet().iterator(); i.hasNext(); )\n                {\n                    java.util.Map.Entry e = (java.util.Map.Entry) i.next();\n                    java.io.File file = (java.io.File) e.getValue();\n                    \n                    String s = file.getName() +\n                               \" not found in directory \" +\n                               new_dir.getPath();\n                    System.err.println(\"*Warning: \" + s);\n                    \n                    if (! file.isDirectory())\n                        compareFiles(file.getPath(), \"\");\n                }\n            }\n            catch (Exception e)\n            {\n                System.err.println(e.getMessage());\n                e.printStackTrace();\n            }\n        }\n\n        public static void main(String[] args)\n        {\n            String new_file = null,\n                   old_file = null;\n            boolean help = false;\n\n            int i;\n            for (i = 0; i < args.length; i++)\n            {\n                if (args[i].charAt(0) == '-')\n                {\n                    if (args[i].equals(\"-ext\"))\n                         extension = (i + 1 < args.length ? args[++i] : \"\");\n                    else if (args[i].equals(\"-h\"))\n                         help = true;\n                    else if (args[i].equals(\"-l\"))\n                         differ_mode = LINES;\n                    else if (args[i].equals(\"-t\"))\n                         differ_mode = TOKENS;\n                }\n                else break;\n            }\n            if (i < args.length) \n            {\n                new_file = args[i++];\n                old_file = new_file; // assume only one file is specified\n            }\n            if (i < args.length) \n                old_file = args[i++];\n            for (; i < args.length; i++)\n                System.err.println(\"Invalid argument: \" + args[i]);\n\n            if (help || (new_file == null &&  old_file == null))\n            {\n                System.out.println();\n                System.out.println(\"Usage: diff [OPTION]... file1 [file2]\");\n                System.out.println(\"Compute stats for file1 or compare file1 to file2 statement by statement.\");\n                System.out.println();\n                System.out.println(\"  -ext s -- if file1 and file2 are directories, compare only files that end\\n\" +\n                                   \"            with the extension (suffix) s.\");\n                System.out.println(\"  -h     -- print this help message\");\n                System.out.println(\"  -l     -- compare line by line instead of statement by statement\");\n                System.out.println(\"  -t     -- compare token by token instead of statement by statement\");\n            }\n            else if (old_file.equals(new_file))\n            {\n                java.io.File old_dir = new java.io.File(old_file);\n                // if (old_dir.isDirectory())\n                //     computeStats(old_dir);\n                // else computeStats(old_file);\n\n                System.out.println(\"*** No difference ***\");\n                // System.out.println(\"    Number of files: \" + fileCount);\n                // System.out.println(\"    Number of lines: \" + lineCount);\n                // System.out.println(\"    Number of types (classes/interfaces): \" + (classCount + interfaceCount) + \" (\" + classCount + \"/\" + interfaceCount + \")\");\n                // System.out.println(\"    Number of statements: \" + statementCount);\n                // System.out.println(\"    Number of braces (left/right): (\" + leftBraceCount + \"/\" + rightBraceCount + \")\");\n            }\n            else\n            {\n                java.io.File old_dir = new java.io.File(old_file),\n                     new_dir = new java.io.File(new_file);\n                if (old_dir.isDirectory() && new_dir.isDirectory())\n                     compareDirectories(old_dir, new_dir);\n                else compareFiles(old_file, new_file);\n\n                if (changeCount == 0)\n                    System.out.println(\"***** No difference *****\");\n                else\n                {\n                    System.out.println(\"***** \" +\n                                       changeCount +\n                                       \" different \" +\n                                       (changeCount == 1 ? \"section\" : \"sections\") + \" *****\");\n                    System.out.println(\"    \" + moveCount    + \" statements moved\");\n                    System.out.println(\"    \" + insertCount  + \" statements inserted\");\n                    System.out.println(\"    \" + deleteCount  + \" statements deleted\");\n                }\n            }\n\n            return;\n        }\n./\n%End", "meta": {"hexsha": "77f15c42a643661dabf2074e6ac4a31cae446fc2", "size": 8991, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/include/java/DifferF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/include/java/DifferF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/include/java/DifferF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 43.4347826087, "max_line_length": 165, "alphanum_fraction": 0.4326548771, "num_tokens": 1638, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1732881888514755, "lm_q2_score": 0.01971912961957596, "lm_q1q2_score": 0.003417092257503803}}
{"text": "# Several ways to do it\n\"Goodbye, World!\";\n\nPrint(\"Goodbye, World!\\n\"); # No EOL appended\n\nDisplay(\"Goodbye, World!\");\n\nf := OutputTextUser();\nWriteLine(f, \"Goodbye, World!\\n\");\nCloseStream(f);\n", "meta": {"hexsha": "be47f9bad2544f14d21f674ad1c2a70f08c96680", "size": 194, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Hello-world-Text/GAP/hello-world-text.gap", "max_stars_repo_name": "djgoku/RosettaCodeData", "max_stars_repo_head_hexsha": "91df62d46142e921b3eacdb52b0316c39ee236bc", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Task/Hello-world-Text/GAP/hello-world-text.gap", "max_issues_repo_name": "djgoku/RosettaCodeData", "max_issues_repo_head_hexsha": "91df62d46142e921b3eacdb52b0316c39ee236bc", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Hello-world-Text/GAP/hello-world-text.gap", "max_forks_repo_name": "djgoku/RosettaCodeData", "max_forks_repo_head_hexsha": "91df62d46142e921b3eacdb52b0316c39ee236bc", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 17.6363636364, "max_line_length": 45, "alphanum_fraction": 0.6649484536, "num_tokens": 58, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08756383476086144, "lm_q2_score": 0.036220052483855784, "lm_q1q2_score": 0.003171566690726077}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\n\nImport(platforms, profiler, code);\nImport(platforms.sse, platforms.avx, platforms.intel);\n\nClass(OSInfo, rec(osname := \"\",\n    is8Bit := False,\n    is16bit := False,\n    is32bit := False,\n    is64bit := False,\n    isWindows := False,\n    isLinux := False,\n    isCygwin := False,\n    isDarwin := False,\n    info := self >> Cond(IsBound(self.vendor), Print(self.vendor, \" \", self.osname), Print(self.osname)),\n    useColor := True\n));\n\nClass(OSWindows, OSInfo, rec(\n    setTitle := meth(self, title)\n        Exec(Concat(\"title \", title));\n    end,\n    vendor := \"Microsoft\",\n    isWindows := True,\n    useColor := False\n));\n\nClass(OSWindows32, OSWindows, rec(is16bit := True, is32bit := True));\nClass(OSWindows64, OSWindows, rec(is16bit := True, is32bit := True, is64bit :=True));\nClass(OSLinux32, OSInfo, rec(osname := \"Linux32\", is32bit := True, isLinux := True));\nClass(OSLinux64, OSInfo, rec(osname := \"Linux64\", is32bit := True, is64bit := True, isLinux := True));\nClass(OSArmLinux, OSInfo, rec(osname := \"GNU/Linux\", is16bit := True, is32bit := True, isLinux := True));\nClass(OSCygwin32, OSInfo, rec(osname := \"Cygwin32\", is32bit := True, isCygwin := True));\nClass(OSDarwin, OSInfo, rec(osname := \"OSX/Darwin\", is32bit := True, is64bit := True, isDarwin := True));\n\nSupportedOSs := rec(\n    WindowsNT4 := CopyFields(OSWindows32, rec(osname := \"Windows NT 4.0\")),\n    Windows2000 := CopyFields(OSWindows32, rec(osname := \"Windows 2000\")),\n    WindowsXP32 := CopyFields(OSWindows32, rec(osname := \"WindowsXP 32-bit\")),\n    WindowsXP64 := CopyFields(OSWindows64, rec(osname := \"WindowsXP 64-bit\")),\n    WindowsVista := CopyFields(OSWindows64, rec(osname := \"Windows Vista\")),\n    Windows7 := CopyFields(OSWindows64, rec(osname := \"Windows 7\")),\n    Windows8 := CopyFields(OSWindows64, rec(osname := \"Windows 8\")),\n    Linux32 := OSLinux32,\n    Linux64 := OSLinux64,\n    Cygwin32 := OSCygwin32,\n    Darwin := OSDarwin,\n    ArmLinux := OSArmLinux,\n);\n\nClass(CPUInfo, rec(\n    hasDouble := True,\n    hasFloat := True,\n    intSize := 32,\n    cores := 1,\n    cpuname := \"\",\n    vendor := \"\",\n    info := self >> Chain(\n        Print(Cond(IsBound(self.vendor), Print(self.vendor, \" \", self.cpuname), Print(self.osname))),\n        When(IsBound(self.freq) and self.freq > 0, Print(\" at \", self.freq, \" MHz\")),\n        When(self.cores > 1, Print(\", \", self.cores, \" cores\")),\n        When(IsBound(self.SIMDname), Print(\", \", self.SIMDname))\n    )\n));\n\nClass(IntelCPU, CPUInfo, rec(\n    vendor := \"Intel\",\n    getSimdIsa := (self, dt) >> When(self.SIMD().hasAVX(), \n        Cond(\n            dt = T_Real(32), AVX_8x32f,\n            dt = T_Real(64), AVX_4x64f,\n            dt),\n        Cond(\n            dt = T_Real(32), SSE_4x32f,\n            dt = T_Real(64), SSE_2x64f,\n            dt)\n    ),\n    getOpts := arg >> IAGlobals.getOpts(Drop(arg, 1))\n));\n\nClass(AMDCPU, CPUInfo, rec(\n    vendor := \"AMD\"\n));\n\n\nClass(STICPU, CPUInfo, rec(\n    vendor := \"STI\"\n));\n\nClass(PowerPC, CPUInfo, rec(\n    vendor := \"IBM\"\n));\n\nClass(DPA, CPUInfo, rec(\n       vendor := \"CMU\"\n));\n\nClass(ARM, CPUInfo, rec(\n       vendor := \"Raspberry Pi Foundation\"\n));\n\n\nSupportedCPUs := rec(\n    Pentium := rec(),\n    PentiumPro := rec(),\n    PentiumII := rec(),\n    PentiumIII := rec(),\n    Pentium4 := Class(Pentium4, IntelCPU, rec(\n        cpuname := \"Pentium4\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=False)),\n        SIMDname := \"SSE2\",\n        cores := 1,\n        default_lang := \"c.icl.opt.pentium4\"\n    )),\n    Pentium4Extreme := Class(Pentium4Extreme, IntelCPU, rec(\n        cpuname := \"Pentium4Extreme\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True)),\n        SIMDname := \"SSE3\",\n        cores := 1,\n        default_lang := \"c.icl.opt.pentium4extreme\"\n    )),\n    PentiumD := rec(),\n    Xeon := Class(Xeon, IntelCPU, rec(\n        cpuname := \"Xeon\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True)),\n        SIMDname := \"SSE4.2\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.corei7\",\n        smp_lang := \"c.icl.smp_corei7\",\n        OpenMP_lang := \"c.icl.openmp_corei7\"\n    )),\n    XeonMP := rec(),\n    PentiumM := Class(PentiumM, IntelCPU, rec(\n        cpuname := \"PentiumM\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=False)),\n        SIMDname := \"SSE2\",\n        cores := 1,\n        default_lang := \"c.icl.opt.pentiumM\"\n    )),\n    CoreDuo := Class(CoreDuo, IntelCPU, rec(\n        cpuname := \"CoreDuo\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True)),\n        SIMDname := \"SSE3\",\n        cores := 2,\n        profile := rec(\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\")),\n            threads := (arg) -> When(LocalConfig.osinfo.isWindows(),\n        CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\")),\n        CopyFields(default_profiles.linux_x86_threads, rec(CFLAGS := arg -> \"-msse3\"))\n)\n        ),\n        default_lang := \"c.icl.opt.core\",\n        smp_lang := \"c.icl.smp_core\",\n        OpenMP_lang := \"c.icl.openmp_core\"\n    )),\n    Core2Duo := Class(Core2Duo, IntelCPU, rec(\n        cpuname := \"Core2Duo\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True)),\n        SIMDname := \"SSSE3\",\n        cores := 2,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxSSSE3\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\"))\n        ),\n        default_lang := \"c.icl.opt.core2\",\n        smp_lang := \"c.icl.smp_core2\",\n        OpenMP_lang := \"c.icl.openmp_core2\"\n    )),\n    Core2Quad := Class(Core2Quad, IntelCPU, rec(\n        cpuname := \"Core2 Extreme\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True)),\n        SIMDname := \"SSSE3\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxSSSE3\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\"))\n        ),\n        default_lang := \"c.icl.opt.core2\",\n        smp_lang := \"c.icl.smp_core2\",\n        OpenMP_lang := \"c.icl.openmp_core2\"\n    )),\n\n\n    DPABasic := Class(DPABasic, DPA, rec(\n\t    cpuname := \"DPABasic\",\n\t    cores := 1,\n\t    SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec( numregs := 32)),\n\t    )),\n\n    Core2Penryn := Class(Core2Penryn, IntelCPU, rec(\n        cpuname := \"Core2 Penryn\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True)),\n        SIMDname := \"SSE4.1\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.core2p\",\n        smp_lang := \"c.icl.smp_core2p\",\n        OpenMP_lang := \"c.icl.openmp_core2p\"\n    )),\n    Core_i7 := Class(Core_i7, IntelCPU, rec(\n        cpuname := \"Core i7\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True)),\n        SIMDname := \"SSE4.2\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.corei7\",\n        smp_lang := \"c.icl.smp_corei7\",\n        OpenMP_lang := \"c.icl.openmp_corei7\"\n    )),\n\t# specifically for Spiral FFT GPL 1.0\n    Core_AVX := Class(Core_AVX, IntelCPU, rec(\n        cpuname := \"Intel Core with AVX\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True, hasAVX := True)),\n        SIMDname := \"AVX\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.corei7\",\n        smp_lang := \"c.icl.smp_corei7\",\n        OpenMP_lang := \"c.icl.openmp_corei7\"\n    )),\n\t# specifically for Spiral FFT GPL 1.0\n    Core_no_AVX := Class(Core_no_AVX, IntelCPU, rec(\n        cpuname := \"Intel Core without AVX\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True, hasAVX := False)),\n        SIMDname := \"SSE4.2\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.corei7\",\n        smp_lang := \"c.icl.smp_corei7\",\n        OpenMP_lang := \"c.icl.openmp_corei7\"\n    )),\n    Core_i7U := Class(Core_i7U, IntelCPU, rec(\n        cpuname := \"Core i7 Ultrabook\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True, hasAVX := True)),\n        SIMDname := \"AVX\",\n        cores := 2,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.corei7\",\n        smp_lang := \"c.icl.smp_corei7\",\n        OpenMP_lang := \"c.icl.openmp_corei7\"\n    )),\n    Core_i5U := Class(Core_i5U, IntelCPU, rec(\n        cpuname := \"Core i5U\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True)),\n        SIMDname := \"SSE4.2\",\n        cores := 2,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n        default_lang := \"c.icl.opt.corei7\",\n        smp_lang := \"c.icl.smp_corei7\",\n        OpenMP_lang := \"c.icl.openmp_corei7\"\n    )),\n    Core_i5_SandyBridge := Class(Core_i5_SandyBridge, IntelCPU, rec(\n        cpuname := \"Core i5 SandyBridge\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True, hasSSSE3:=True, hasSSE4_1 := True, hasSSE4_2 := True, hasAVX := True)),\n        SIMDname := \"AVX\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxS\"))\n        ),\n    )),\n\n    Itanium := rec(),\n    Itanium2 := rec(),\n    Itanium3 := rec(),\n    MPC_G4 := rec(),\n    PPC905_G5 := rec(),\n    XScale := rec(),\n    PowerPC405 := rec(),\n    Athlon := rec(),\n    AthlonXP := rec(),\n    Opteron := rec(),\n    OpteronDual := rec(),\n    OpteronQuad := Class(OpteronQuad, AMDCPU, rec(\n        cpuname := \"Dual Opteron 2220\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasMMX := True, hasSSE:=True, hasSSE2:=True, hasSSE3:=True)),\n        SIMDname := \"SSE3\",\n        cores := 4,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxSSSE3\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"/O3 /G7 /QxKWP\"))\n        ),\n        default_lang := \"c.icl.opt.opteron2220\"\n    )),\n    CellBE := Class(CellBE, STICPU, rec(\n        cpuname := \"Cell BE\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasSPU := True)),\n        SIMDname := \"SIMD-SPU\",\n        cores := 9,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"\"))\n        ),\n        default_lang := \"\"\n   )),\n   CellBEPS3 := Class(CellBEPS3, STICPU, rec(\n        cpuname := \"Cell BE (PS3)\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasSPU := True)),\n        SIMDname := \"SIMD-SPU\",\n        cores := 6,\n        profile := rec(\n            EM64T := (arg) -> CopyFields(default_profiles.win_x64_icc, rec(CFLAGS := arg -> \"\")),\n            IA32 := (arg) -> CopyFields(default_profiles.win_x86_icc, rec(CFLAGS := arg -> \"\")),\n            threads := (arg) -> CopyFields(default_profiles.win_x86_icc_threads, rec(CFLAGS := arg -> \"\"))\n        ),\n        default_lang := \"\",\n        getSimdIsa := dt -> Cond(\n            dt = T_Real(32), platforms.cellSPU.spu_4x32f,\n            dt = T_Real(64), platforms.cellSPU.spu_2x64f,\n            dt),\n   )),\n   PowerPC970 := Class(PowerPC970, PowerPC, rec(\n        cpuname := \"PowerPC 970 (G5)\",\n        SIMD := () -> CopyFields(platforms.SIMDArchitectures, rec(hasAltiVec := true)),\n        SIMDname := \"AltiVec\",\n        cores := 1,\n        profile := rec(\n        ),\n        default_lang := \"\"\n   )),\n                     \n   ARMV7L := Class(ARMV7L, ARM, rec(\n       cpuname := \"ARMV7L\",\n       cores := 4,\n   )),\n\n   BlueGeneL := rec()\n);\n", "meta": {"hexsha": "5fc8dbc733432bda0ce33f68e4d27f7af362efae", "size": 16211, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/cpus.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/cpus.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/cpus.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 44.2923497268, "max_line_length": 198, "alphanum_fraction": 0.5799148726, "num_tokens": 5037, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1008786227300565, "lm_q2_score": 0.030675798387551766, "lm_q1q2_score": 0.00309453229248111}}
{"text": "\n# Copyright (c) 2018-2021, Carnegie Mellon University\n# See LICENSE for details\n\nTestFailExit := function()\n    Print(\"TEST FAILED\\n\");\n    Exit(-1);\nend;\n\n\nTestSkipExit := function()\n    Print(\"Skipping test\\n\");\n    Exit(86);\nend;\n\n\n#F  GetBasicProfilerTestFName (<pf>)\n#F      Get the filename associated with Basic Profiler Test\n#F      if <pf> return Success file name\n#F      otherwise return Failure file name\n\nGetBasicProfilerTestFName := function(pf)\n    local path, sep;\n    sep  := Conf(\"path_sep\");\n    path := Conf(\"spiral_dir\");\n    path := Concat(path, sep, \"build\");\n    if pf then\n        path := Concat(path, sep, \"PROFILER_RUN_SUCCESS\");\n    else\n        path := Concat(path, sep, \"PROFILER_RUN_FAILED\");\n    fi;\n    return path;\nend;\n\n#F  ClearBasicProfilerTestResults () -- remove results of prior run(s) of basic profiler test\n\nClearBasicProfilerTestResults := function()\n    SysRemove(GetBasicProfilerTestFName(true));\n    SysRemove(GetBasicProfilerTestFName(false));\n    return;\nend;\n\n\n#F  MarkBasicProfilerTest (<pf>)\n#F      Mark (create the filename) associated with Basic Profiler Test\n#F      if <pf> ==> test successed, use success file name\n#F      otherwise ==> test failed, use Failure file name\n\nMarkBasicProfilerTest := function(pf)\n    local path;\n    path := GetBasicProfilerTestFName(pf);\n    PrintTo(path, \"\");\n    return;\nend;\n\n\n#F  CheckBasicProfilerTest () -- Return True if basic profiler test passed, otherwise, False\n\nCheckBasicProfilerTest := function()\n    local res, file;\n    file := GetBasicProfilerTestFName(true);\n    res  := CheckFileExists(file, \"\");\n    \n    if SysVerbose() > 0 then\n        Print(\"Marker file: \", file);\n        if res then PrintLine(\" Found, return true\"); else PrintLine(\" NOT Found\"); fi;\n    fi;\n    if res then return res; fi;\n    \n    file := GetBasicProfilerTestFName(false);\n    res := CheckFileExists(file, \"\");\n    if SysVerbose() > 0 then\n        Print(\"Marker file: \", file);\n        if res then PrintLine(\" Found, return false\"); else PrintLine(\" NOT Found\"); fi;\n    fi;\n    return false;\nend;\n", "meta": {"hexsha": "e039828fd8c8e2cc33faf1d864878721482d2d0c", "size": 2082, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "namespaces/spiral/test.gi", "max_stars_repo_name": "sr7cb/spiral-software", "max_stars_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": 42, "max_stars_repo_stars_event_min_datetime": "2019-09-01T19:29:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-17T12:26:12.000Z", "max_issues_repo_path": "namespaces/spiral/test.gi", "max_issues_repo_name": "sr7cb/spiral-software", "max_issues_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2020-11-20T16:15:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-07T21:17:28.000Z", "max_forks_repo_path": "namespaces/spiral/test.gi", "max_forks_repo_name": "sr7cb/spiral-software", "max_forks_repo_head_hexsha": "349d9e0abe75bf4b9a4690f2dbee631700f8361a", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": 21, "max_forks_repo_forks_event_min_datetime": "2019-08-20T19:27:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-01T22:11:18.000Z", "avg_line_length": 26.6923076923, "max_line_length": 93, "alphanum_fraction": 0.6589817483, "num_tokens": 526, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.11757212736159105, "lm_q2_score": 0.025957355455306908, "lm_q1q2_score": 0.0030518615015614338}}
{"text": "# This is another ugly hack to make the GAP Help System\n# play ball. Let us please fix this soon.\n# TODO: This is now broken because we got rid of parsing\n#       on the python side. HELP now should result\n#       in a record that can be sent back to jupyter\n#       as a JSON string\nHELP_VIEWER_INFO.jupyter_online :=\n    rec(\n         type := \"url\",\n         show := function( data )\n             # data[1] is the text preceding the hyperlink (name of the help book),\n             # data[2] is the text to be linked, and data[3] is the URL\n             local p,r;\n\n             p := data[3];\n\n             for r in GAPInfo.RootPaths do\n                 p := ReplacedString(data[3], r, \"https://www.gap-system.org/Manuals/\");\n             od;\n             return JupyterRenderable( rec( (\"text/html\") := Concatenation( data[1], \": <a target=\\\"_blank\\\" href=\\\"\", p, \"\\\">\", data[2], \"</a>\") )\n                                     , rec( ) );\n         end\n        );\n\nHELP_VIEWER_INFO.jupyter_local :=\n    rec( type := \"url\",\n         show := function( data )\n             # data[1] is the text preceding the hyperlink (name of the help book),\n             # data[2] is the text to be linked, and data[3] is the URL\n             local p,r;\n\n             p := data[3];\n\n             for r in GAPInfo.RootPaths do\n                 p := ReplacedString(data[3], r, \"/\");\n             od;\n             return JupyterRenderable( rec( (\"text/html\") := Concatenation( data[1], \": <a target=\\\"_blank\\\" href=\\\"files\", p, \"\\\">\", data[2], \"</a>\") )\n                                     , rec( ) );\n         end);\n\n#############################################################################\n##\n#F  GET_HELP_URL( <match> ) . . . . . .  print the url for the help section\n##\n##  Based on HELP_PRINT_MATCH\n##\n##  <match> is [book, entrynr]\n##\nInstallGlobalFunction(GET_HELP_URL, function(match)\nlocal book, entrynr, viewer, hv, pos, type, data;\n  book := HELP_BOOK_INFO(match[1]);\n  entrynr := match[2];\n  viewer:= UserPreference(\"HelpViewers\");\n  if HELP_LAST.NEXT_VIEWER = false then\n    hv := viewer;\n  else\n    pos := Position( viewer, HELP_LAST.VIEWER );\n    if pos = fail then\n      hv := viewer;\n    else\n      hv := viewer{Concatenation([pos+1..Length(viewer)],[1..pos])};\n    fi;\n    HELP_LAST.NEXT_VIEWER := false;\n  fi;\n  for viewer in hv do\n    # type of data we need now depends on help viewer\n    type := HELP_VIEWER_INFO.(viewer).type;\n    # get the data via appropriate handler\n    data := HELP_BOOK_HANDLER.(book.handler).HelpData(book, entrynr, type);\n    if data <> fail then\n      # show the data\n      return HELP_VIEWER_INFO.(viewer).show(\n        [ book.bookname, StripEscapeSequences(book.entries[entrynr][1]), data]);\n          # name of the help book, the text to be linked, and the URL\n    else\n        return JupyterRenderable( rec( (\"text/html\") := Concatenation( book.bookname, \": \"\n                                                                       , StripEscapeSequences(book.entries[entrynr][1])\n                                                                       , \" - no html help available. Please check other formats!\" ) )\n                                , rec( ) );\n    fi;\n    HELP_LAST.VIEWER := viewer;\n  od;\n  HELP_LAST.BOOK := book;\n  HELP_LAST.MATCH := entrynr;\n  HELP_LAST.VIEWER := viewer;\n  return true;\nend);\n\nInstallGlobalFunction(JUPYTER_HELP_SHOW_MATCHES, function( books, topic, frombegin )\nlocal   exact,  match,  x,  lines,  cnt,  i,  str,  n, res;\n\n  # first get lists of exact and other matches\n  x := HELP_GET_MATCHES( books, topic, frombegin );\n  exact := x[1];\n  match := x[2];\n\n  # no topic found\n  if 0 = Length(match) and 0 = Length(exact)  then\n    Print( \"Help: no matching entry found\\n\" );\n    return false;\n\n  # one exact or together one topic found\n  elif 1 = Length(exact) or (0 = Length(exact) and 1 = Length(match)) then\n    if Length(exact) = 0 then exact := match; fi;\n    i := exact[1];\n    return GET_HELP_URL(i);\n\n  # more than one topic found, show overview in pager\n  else\n    lines :=\n        [\"\",\"Help: several entries match this topic - type ?2 to get match [2]\\n\"];\n        # there is an empty line in the beginning since `tail' will start from line 2\n    HELP_LAST.TOPICS:=[];\n    cnt := 0;\n    # show exact matches first\n    match := Concatenation(exact, match);\n    res:=\"\";\n    for i  in match  do\n      cnt := cnt+1;\n      topic := Concatenation(i[1].bookname,\": \",i[1].entries[i[2]][1]);\n      Add(HELP_LAST.TOPICS, i);\n      Append(res, GET_HELP_URL(i)!.data.(\"text/html\"));\n      Append(res, \"<br/>\");\n    od;\n    return JupyterRenderable( rec( (\"text/html\") := res )\n                            , rec( ) );\n  fi;\nend);\n\nInstallGlobalFunction(JUPYTER_HELP, function( str )\n  local origstr, nwostr, p, book, books, move, add;\n\n  origstr := ShallowCopy(str);\n  nwostr := NormalizedWhitespace(origstr);\n\n  # extract the book\n  p := Position( str, ':' );\n  if p <> fail  then\n      book := str{[1..p-1]};\n      str  := str{[p+1..Length(str)]};\n  else\n      book := \"\";\n  fi;\n\n  # normalizing for search\n  book := SIMPLE_STRING(book);\n  str := SIMPLE_STRING(str);\n\n  # we check if `book' MATCH_BEGINs some of the available books\n  books := Filtered(HELP_KNOWN_BOOKS[1], bn-> MATCH_BEGIN(bn, book));\n  if Length(book) > 0 and Length(books) = 0 then\n    Print(\"Help: None of the available books matches (try: '?books').\\n\");\n    return;\n  fi;\n\n  # function to add a topic to the ring\n  move := false;\n  add  := function( books, topic )\n      if not move  then\n          HELP_RING_IDX := (HELP_RING_IDX+1) mod HELP_RING_SIZE;\n          HELP_BOOK_RING[HELP_RING_IDX+1]  := books;\n          HELP_TOPIC_RING[HELP_RING_IDX+1] := topic;\n      fi;\n  end;\n\n  # if the topic is empty show the last shown one again\n  if  book = \"\" and str = \"\"  then\n       if HELP_LAST.BOOK = 0 then\n         HELP(\"Tutorial: Help\");\n       else\n         return GET_HELP_URL( [HELP_LAST.BOOK, HELP_LAST.MATCH] );\n       fi;\n       return;\n\n  # if topic is \"&\" shobn;w last topic again, but with next viewer in viewer\n  # list, or with last viewer again if there is no next one\n  elif book = \"\" and str = \"&\" and Length(nwostr) = 1 then\n       if HELP_LAST.BOOK = 0 then\n         HELP(\"Tutorial: Help\");\n       else\n         HELP_LAST.NEXT_VIEWER := true;\n         return GET_HELP_URL( [HELP_LAST.BOOK, HELP_LAST.MATCH] );\n       fi;\n       return;\n\n  # if the topic is '-' we are interested in the previous search again\n  elif book = \"\" and str = \"-\" and Length(nwostr) = 1  then\n      HELP_RING_IDX := (HELP_RING_IDX-1) mod HELP_RING_SIZE;\n      books := HELP_BOOK_RING[HELP_RING_IDX+1];\n      str  := HELP_TOPIC_RING[HELP_RING_IDX+1];\n      move := true;\n\n  # if the topic is '+' we are interested in the last section again\n  elif book = \"\" and str = \"+\" and Length(nwostr) = 1  then\n      HELP_RING_IDX := (HELP_RING_IDX+1) mod HELP_RING_SIZE;\n      books := HELP_BOOK_RING[HELP_RING_IDX+1];\n      str  := HELP_TOPIC_RING[HELP_RING_IDX+1];\n      move := true;\n  fi;\n\n  # number means topic from HELP_LAST.TOPICS list\n  if book = \"\" and ForAll(str, a-> a in \"0123456789\") then\n      HELP_SHOW_FROM_LAST_TOPICS(Int(str));\n\n  # if the topic is '<' we are interested in the one before 'LastTopic'\n  elif book = \"\" and str = \"<\" and Length(nwostr) = 1  then\n      HELP_SHOW_PREV();\n\n  # if the topic is '>' we are interested in the one after 'LastTopic'\n  elif book = \"\" and str = \">\" and Length(nwostr) = 1  then\n      HELP_SHOW_NEXT();\n\n  # if the topic is '<<' we are interested in the previous chapter intro\n  elif book = \"\" and str = \"<<\"  then\n      HELP_SHOW_PREV_CHAPTER();\n\n  # if the topic is '>>' we are interested in the next chapter intro\n  elif book = \"\" and str = \">>\"  then\n      HELP_SHOW_NEXT_CHAPTER();\n\n  # if the subject is 'Welcome to GAP' display a welcome message\n  elif book = \"\" and str = \"welcome to gap\"  then\n      if HELP_SHOW_WELCOME(book)  then\n          add( books, \"Welcome to GAP\" );\n      fi;\n\n  # if the topic is 'books' display the table of books\n  elif book = \"\" and str = \"books\"  then\n      if HELP_SHOW_BOOKS()  then\n          add( books, \"books\" );\n      fi;\n\n  # if the topic is 'chapters' display the table of chapters\n  elif str = \"chapters\"  or str = \"contents\" or book <> \"\" and str = \"\" then\n      if ForAll(books, b->  HELP_SHOW_CHAPTERS(b)) then\n        add( books, \"chapters\" );\n      fi;\n\n  # if the topic is 'sections' display the table of sections\n  elif str = \"sections\"  then\n      if ForAll(books, b-> HELP_SHOW_SECTIONS(b)) then\n        add(books, \"sections\");\n      fi;\n\n  # if the topic is '?<string>' search the index for any entries for\n  # which <string> is a substring (as opposed to an abbreviation)\n  elif Length(str) > 0 and str[1] = '?'  then\n      str := str{[2..Length(str)]};\n      NormalizeWhitespace(str);\n      return HELP_SHOW_MATCHES( books, str, false);\n\n  # search for this topic\n  elif IsJupyterRenderable( HELP_SHOW_MATCHES( books, str, true ) ) then\n      return HELP_SHOW_MATCHES( books, str, true );\n  elif origstr in NAMES_SYSTEM_GVARS then\n      Print( \"Help: '\", origstr, \"' is currently undocumented.\\n\",\n             \"      For details, try ?Undocumented Variables\\n\" );\n  elif book = \"\" and\n                 ForAny(HELP_KNOWN_BOOKS[1], bk -> MATCH_BEGIN(bk, str)) then\n      Print( \"Help: Are you looking for a certain book? (Trying '?\", origstr,\n             \":' ...\\n\");\n      return HELP( Concatenation(origstr, \":\") );\n  else\n     # seems unnecessary, since some message is already printed in all\n     # cases above (?):\n     # Print( \"Help: Sorry, could not find a match for '\", origstr, \"'.\\n\");\n  fi;\nend);\n\n# Load some help stuff (Experimental)\nInstallGlobalFunction(JUPYTER_FindManSection,\nfunction(file, name)\n    local xml, sections, p, s, res;\n    xml := ParseTreeXMLFile(file);\n    CheckAndCleanGapDocTree(xml);\n    sections := XMLElements(xml, \"ManSection\");;\n    res := [];\n    for s in sections do\n        if IsBound(s.content) then\n            p := PositionProperty(s.content, x ->\n                                               IsBound(x.attributes) and\n                                             IsBound(x.attributes.Name) and\n                                             x.attributes.Name = name);\n            if p <> fail then\n                Add(res, s);\n            fi;\n        fi;\n    od;\n    return res;\nend);\n\n", "meta": {"hexsha": "4373ca54b339fe4a7d2c7fce6de045063dbf3732", "size": 10373, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterHelp.gi", "max_stars_repo_name": "ZachNewbery/JupyterKernel", "max_stars_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 16, "max_stars_repo_stars_event_min_datetime": "2017-10-06T06:11:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T18:28:56.000Z", "max_issues_repo_path": "gap/JupyterHelp.gi", "max_issues_repo_name": "ZachNewbery/JupyterKernel", "max_issues_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 111, "max_issues_repo_issues_event_min_datetime": "2017-10-03T15:30:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-28T12:55:13.000Z", "max_forks_repo_path": "gap/JupyterHelp.gi", "max_forks_repo_name": "ZachNewbery/JupyterKernel", "max_forks_repo_head_hexsha": "5bf0e17031271bc641c4e604c9562eb48dd33633", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 16, "max_forks_repo_forks_event_min_datetime": "2017-10-18T14:48:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-30T09:46:37.000Z", "avg_line_length": 35.5239726027, "max_line_length": 152, "alphanum_fraction": 0.581027668, "num_tokens": 2769, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09534945975773548, "lm_q2_score": 0.031618769435875646, "lm_q1q2_score": 0.0030148325839151418}}
{"text": "#\n# francy: Interactive Discrete Mathematics in GAP\n#\n\n#############################################################################\n##\n#M  FrancyMessage( <messageType>, <string>, <string> )  . .  create a Label\n##\nInstallMethod(FrancyMessage,\n  \"message type, a title, a value\",\n  true,\n  [IsFrancyMessageType,\n   IsString,\n   IsString],\n  0,\nfunction(messageType, title, value)\nlocal id;\nid := GenerateID();\n  return Objectify(FrancyMessageObjectType, rec(\n    id    := id,\n    type  := messageType!.value,\n    title := title,\n    text  := value\n  ));\nend);\n\nInstallOtherMethod(FrancyMessage,\n  \"a title, a value\",\n  true,\n  [IsString,\n   IsString],\n  0,\nfunction(title, value)\n  return FrancyMessage(FrancyMessageType.DEFAULT, title, value);\nend);\n\nInstallOtherMethod(FrancyMessage,\n  \"message type, a value\",\n  true,\n  [IsFrancyMessageType,\n   IsString],\n  0,\nfunction(messageType, value)\n  return FrancyMessage(messageType, \"\", value);\nend);\n\nInstallOtherMethod(FrancyMessage,\n  \"a value\",\n  true,\n  [IsString],\n  0,\nfunction(value)\n  return FrancyMessage(FrancyMessageType.DEFAULT, \"\", value);\nend);\n", "meta": {"hexsha": "403d69cc43679d321f8c8b5aedcd34ac11106a5c", "size": 1106, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/message.gi", "max_stars_repo_name": "LaGuer/francy", "max_stars_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2016-12-15T12:04:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-14T19:19:24.000Z", "max_issues_repo_path": "gap/message.gi", "max_issues_repo_name": "LaGuer/francy", "max_issues_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 29, "max_issues_repo_issues_event_min_datetime": "2018-10-09T22:37:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:44:50.000Z", "max_forks_repo_path": "gap/message.gi", "max_forks_repo_name": "LaGuer/francy", "max_forks_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-12-15T12:04:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-28T10:51:50.000Z", "avg_line_length": 20.1090909091, "max_line_length": 77, "alphanum_fraction": 0.6401446655, "num_tokens": 291, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.12421302132013363, "lm_q2_score": 0.023330768214277667, "lm_q1q2_score": 0.002897985209615168}}
{"text": "--\n-- The Java KeyWord Lexer\n--\n%Options fp=CncKWLexer\n%options package=CnCParser\n%options template=KeywordTemplateF.gi\n\n%Notice\n/.\n//\n// This file is part of the CNC-C implementation and\n// distributed under the Modified BSD License. \n// See LICENSE for details.\n// \n// I AM A GENERATED FILE. PLEASE DO NOT CHANGE ME!!!\n//\n./\n%End\n\n%Include\n    KWLexerFoldedCaseMapF.gi\n%End\n\n%Export\n\n    T_ENV  \n    T_UNSIGNED\n    T_STRUCT\n\n%End\n\n%Terminals\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n%End\n\n%Start\n    KeyWord\n%End\n\n%Rules\n\n    KeyWord ::= e n v /.$setResult($_T_ENV);./ \n    KeyWord ::= s t r u c t /.$setResult($_T_STRUCT);./\n    KeyWord ::= u n s i g n e d /.$setResult($_T_UNSIGNED);./\n\n%End\n", "meta": {"hexsha": "27898ebc00ac3fb1ad9de21a0592d6c91f7f3486", "size": 787, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "CnCLPGParser/src/CnCParser/cncKWLexer.gi", "max_stars_repo_name": "pelmers/cnc-ocr", "max_stars_repo_head_hexsha": "1ee9690d9856bdf6bba1a468bfc21f28aed958ab", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "CnCLPGParser/src/CnCParser/cncKWLexer.gi", "max_issues_repo_name": "pelmers/cnc-ocr", "max_issues_repo_head_hexsha": "1ee9690d9856bdf6bba1a468bfc21f28aed958ab", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "CnCLPGParser/src/CnCParser/cncKWLexer.gi", "max_forks_repo_name": "pelmers/cnc-ocr", "max_forks_repo_head_hexsha": "1ee9690d9856bdf6bba1a468bfc21f28aed958ab", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.3958333333, "max_line_length": 65, "alphanum_fraction": 0.5756035578, "num_tokens": 259, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09947021922124634, "lm_q2_score": 0.028870907155182642, "lm_q1q2_score": 0.002871795463842267}}
{"text": "%Define\n    $kw_lexer_class /.NoKWLexer./\n    $_IDENTIFIER /.0./\n%End\n%Headers\n    --\n    -- Additional methods for the action class not provided in the template\n    --\n    /.\n          export   class NoKWLexer\n        {\n            public  getKeywordKinds() :number[]{ return null; }\n\n            public  lexer(curtok : number, lasttok : number): number { return 0; }\n\n            public  setInputChars(inputChars : string) : void{ }\n\n            public  getKind(c : number) : number{ return 0; }\n\n            public NoKWLexer(inputChars : string,  identifierKind : number) { }\n        }\n    ./\n%End\n\n%Import\n    LexerBasicMapF.gi\n%End\n", "meta": {"hexsha": "b8f415d6d4f09fa78cd789a8428a30fe3ffbb024", "size": 637, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerVeryBasicMapF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerVeryBasicMapF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerVeryBasicMapF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.75, "max_line_length": 82, "alphanum_fraction": 0.5745682889, "num_tokens": 168, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.11124121240045179, "lm_q2_score": 0.025565216753763307, "lm_q1q2_score": 0.002843905706968973}}
{"text": "#\n# francy: Interactive Discrete Mathematics in GAP\n#\n\n#############################################################################\n##\n#M  PrintObj( <obj> ) . . . . . . . . . . . . .  override for IsFrancyObjects\n##\nInstallOtherMethod(PrintObj,\n  \"a francy object\",\n  true,\n  [IsFrancyObject],\n  0,\nfunction(object)\n  Print(Sanitize(object));\nend);\n\n#############################################################################\n##\n#M  ViewString( <obj> )  . . . . . . . . . . . . override for IsFrancyObjects\n##\nInstallOtherMethod(ViewString,\n  \"a francy object\",\n  true,\n  [IsFrancyObject],\n  0,\nfunction(object)\n  return (Concatenation( \"<\",\n      CategoriesOfObject( object )[1],\n      \"/\", CategoriesOfObject( object )[2], \">\"));\nend);\n\n#############################################################################\n##\n#M  JUPYTER_ViewString( <obj> )  . . . . . . . . override for IsFrancyObjects\n##\nInstallOtherMethod(JUPYTER_ViewString,\n  \"a francy object\",\n  true,\n  [IsFrancyObject],\n  0,\n  ViewString\n);\n\n#############################################################################\n##\n#M  Sanitize( <obj> )  . . . . . . . . simple properties clone for FrancyObjects\n##\n## This method will clone a FrancyObject and return a record, traversing all the\n## components and converting when appropriate.\n##\n## This method removes components of type IsFunction, as they can't be\n## converted to JSON string, converts lists of objects into lists of strings\n## and everything else that is not a FrancyObject and therefore unknown!\n##\nInstallMethod(Sanitize,\n  \"an object\",\n  true,\n  [IsObject],\n  0,\nfunction(object)\n  return Sanitize(object, rec());\nend);\n\n#############################################################################\n##\n#M  Sanitize( <obj> )  . . . . . . . . simple properties clone for Records\n##\n## This method will clone a FrancyObject into the given record\n##\nInstallOtherMethod(Sanitize,\n  \"an object, a record\",\n  true,\n  [IsObject,\n   IsRecord],\n  0,\nfunction(object, record)\n  local component, copy, tmp;\n  copy := StructuralCopy(object);\n  for component in NamesOfComponents(copy) do\n    if IsRecord(copy!.(component)) or IsFrancyObject(copy!.(component)) then\n      record!.(component) := rec();\n      Sanitize(copy!.(component), record!.(component));\n    elif IsList(copy!.(component)) and not IsString(copy!.(component)) then\n      record!.(component) := [];\n      Sanitize(copy!.(component), record!.(component));\n    elif IsFunction(copy!.(component)) then\n      record!.(component) := NameFunction(copy!.(component));\n    else\n      record!.(component) := copy!.(component);\n    fi;\n  od;\n  return record;\nend);\n\n#############################################################################\n##\n#M  Sanitize( <obj> )  . . . . . . . . simple properties clone for Records\n##\n## This method will return a sanitized list from another list\n##\nInstallOtherMethod(Sanitize,\n  \"a list, another list\",\n  true,\n  [IsList,\n   IsList],\n  0,\nfunction(list, result)\n  local item;\n  for item in list do\n    # well, everything that is important for the client is in records\n    # everything inside arrays we just convert to string...\n    # ...if you wonder, these are most likely known arguments that are stored\n    # in order to execute callbacks, so the client does nothing with them\n    Add(result, String(item));\n  od;\n  return result;\nend);\n\n#############################################################################\n##\n#O  MergeRecord( <obj>, <obj> )  . . . . . . . . simple properties merge\n##\nInstallMethod(MergeObjects,\n  \"an object, another object\",\n  true,\n  [IsFrancyObject, IsFrancyObject],\n  0,\nfunction(dst, src)\n  local name;\n  for name in NamesOfComponents(src) do\n    dst!.(name) := src!.(name);\n  od;\n  return dst;\nend);\n\n#############################################################################\n##\n#O  GenerateID( ) . . . . . . . . . . . Generates sequential ids for objects\n##\nInstallMethod(GenerateID,\n  \"\",\n  true,\n  [],\n  0,\nfunction()\n  FrancyGeneratedID := FrancyGeneratedID + 1;\n  return Concatenation(\"F\", String(FrancyGeneratedID));\nend);\n", "meta": {"hexsha": "3ea1e72054025d472b3be9a63c186d9b05a9447d", "size": 4092, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/util.gi", "max_stars_repo_name": "LaGuer/francy", "max_stars_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2016-12-15T12:04:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-14T19:19:24.000Z", "max_issues_repo_path": "gap/util.gi", "max_issues_repo_name": "LaGuer/francy", "max_issues_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 29, "max_issues_repo_issues_event_min_datetime": "2018-10-09T22:37:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:44:50.000Z", "max_forks_repo_path": "gap/util.gi", "max_forks_repo_name": "LaGuer/francy", "max_forks_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-12-15T12:04:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-28T10:51:50.000Z", "avg_line_length": 27.28, "max_line_length": 80, "alphanum_fraction": 0.55742913, "num_tokens": 978, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.10818894306026933, "lm_q2_score": 0.025957357951306048, "lm_q1q2_score": 0.002808299121388879}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2008, 2009 Eclipse.org and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   E.D.Willink - Initial API and implementation\n-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias):\n-- *        - 242153: LPG v 2.0.17 adoption.\n-- *        - 299396: Introducing new LPG templates.\n-- *        - 300534: Removing the use of deprecated macros.\n-- *\n-- * </copyright>\n-- */\n--\n-- Additional ERROR_TOKEN rules for The EssentialOCL Backtracking Parser\n--\n\n%Headers\n\t/.\n\t// Some methods for backwards compatibility\n\t\n\t/**\n\t * Report error message for given error_token.\n\t * \n\t * @param error_token\n\t *            the error taken index\n\t * @param msg\n\t *            the message to report\n\t * \n\t * @since 1.3\n\t */\n\tprotected final void reportErrorTokenMessage(int error_token, String msg) {\n\t\tgetIPrsStream().reportErrorTokenMessage(error_token, msg); \n\t}\n\t./\n%End\n\n%Rules\n\tERROR_Colon ::= ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(1), OCLParserErrors.MISSING_COLON);\n\t\t  $EndCode\n\t\t./\n\tERROR_Empty ::= ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(1), OCLParserErrors.EXTRA_TOKENS);\n\t\t  $EndCode\n\t\t./\n\n-----------------------------------------------------------------------\n--\tNames\n-----------------------------------------------------------------------\n\t\t\n\tERROR_SimpleNameCS ::= ERROR_TOKEN\n\t\t/.$BeginCode\t\t\t\t\t\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(1), OCLParserErrors.MISSING_SIMPLE_NAME);\n                    IToken iToken = getRhsIToken(1);\n\t\t\t\t\tSimpleNameCS result = createSimpleNameCS(\n\t\t\t\t\t\t\tSimpleTypeEnum.IDENTIFIER_LITERAL,\n\t\t\t\t\t\t\tiToken\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, iToken);\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n\tsimpleNameCS -> ERROR_SimpleNameCS\n--\tsimpleNameCS -> reservedKeyword ERROR_SimpleNameCS\n\n-----------------------------------------------------------------------\n--\tTypes\n-----------------------------------------------------------------------\t\t\n\tcollectionTypeCS ::= CollectionTypeIdentifierCS '(' typeCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(4), OCLParserErrors.MISSING_RPAREN);\n\t\t\t\t\tCollectionTypeCS result = (CollectionTypeCS)getRhsSym(1); \n\t\t\t\t\tresult.setTypeCS((TypeCS)getRhsSym(3));\n\t\t\t\t\tsetOffsets(result, result, getRhsIToken(4));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n-----------------------------------------------------------------------\n--\tDeclarations\n-----------------------------------------------------------------------\n--\tVariableDeclarationCS ::= notLiteralNorReservedSimpleNameCS ERROR_TOKEN\n--\t\t/.$BeginCode\n--\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(2), OCLParserErrors.MISSING_VARIABLE_TYPE);\n--\t\t\t\t\tSimpleNameCS name = (SimpleNameCS)getRhsSym(1);\n--\t\t\t\t\tVariableCS result = createVariableCS(name, null, null);\n--\t\t\t\t\tsetOffsets(result, name, getRhsIToken(2));\n--\t\t\t\t\tsetResult(result);\n--\t\t  $EndCode\n--\t\t./\n\n--\tvariableDeclarationListCS ::= ERROR_TOKEN\n--\t\t/.$BeginCode\n--\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(1), OCLParserErrors.MISSING_VARIABLES);\n--\t\t\t\t\tEList result = new BasicEList();\n--\t\t\t\t\tsetResult(result);\n--\t\t  $EndCode\n--\t\t./\n\n-----------------------------------------------------------------------\n--\tLiterals\n-----------------------------------------------------------------------\n\tTupleLiteralExpCS ::= Tuple ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(2), OCLParserErrors.MISSING_LBRACE);\n\t\t\t\t\tTupleLiteralExpCS result = createTupleLiteralExpCS((EList<VariableCS>)getRhsSym(3));\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(4));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n\tTupleLiteralPartsCS ::= ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(1), OCLParserErrors.MISSING_VARIABLES);\n\t\t\t\t\tEList<VariableCS> result = new BasicEList<VariableCS>();\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n-----------------------------------------------------------------------\n--\tCalls\n-----------------------------------------------------------------------\t\t\n\tAssociationClassCallExpCS ::= simpleNameCS '[' argumentsCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(4), OCLParserErrors.MISSING_RBRACK);\n\t\t\t\t\tVariableExpCS result = createVariableExpCS(\n\t\t\t\t\t\t\t(SimpleNameCS)getRhsSym(1),\n\t\t\t\t\t\t\t(EList<OCLExpressionCS>)getRhsSym(3),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, (CSTNode)getRhsSym(1), getRhsIToken(4));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n-----------------------------------------------------------------------\n--\tExpressions\n-----------------------------------------------------------------------\n\tIfExpCS ::= if OclExpressionCS then OclExpressionCS else OclExpressionCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(7), OCLParserErrors.MISSING_ENDIF);\n\t\t\t\t\tIfExpCS result = createIfExpCS(\n\t\t\t\t\t\t\t(OCLExpressionCS)getRhsSym(2),\n\t\t\t\t\t\t\t(OCLExpressionCS)getRhsSym(4),\n\t\t\t\t\t\t\t(OCLExpressionCS)getRhsSym(6)\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(7));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tIfExpCS ::= if OclExpressionCS then OclExpressionCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(5), OCLParserErrors.MISSING_ELSE_ENDIF);\n\t\t\t\t\tIfExpCS result = createIfExpCS(\n\t\t\t\t\t\t\t(OCLExpressionCS)getRhsSym(2),\n\t\t\t\t\t\t\t(OCLExpressionCS)getRhsSym(4),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(5))\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(5));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tIfExpCS ::= if OclExpressionCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(3), OCLParserErrors.MISSING_THEN_ELSE_ENDIF);\n\t\t\t\t\tIfExpCS result = createIfExpCS(\n\t\t\t\t\t\t\t(OCLExpressionCS)getRhsSym(2),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(3)),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(3))\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tIfExpCS ::= if ERROR_TOKEN endif\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(3), OCLParserErrors.MISSING_THEN_ELSE);\n\t\t\t\t\tIfExpCS result = createIfExpCS(\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(2)),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(2)),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(2))\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n\tprimaryExpCS ::= '(' OclExpressionCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(3), OCLParserErrors.MISSING_RPAREN);\n\t\t\t\t\tOCLExpressionCS result = (OCLExpressionCS)getRhsSym(2);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n%End\n", "meta": {"hexsha": "ede3a0f99be9f13c1861bb61cf69c4f14f354682", "size": 6958, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/parser/backtracking/EssentialOCLErrors.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/parser/backtracking/EssentialOCLErrors.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/parser/backtracking/EssentialOCLErrors.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.7766990291, "max_line_length": 91, "alphanum_fraction": 0.6162690428, "num_tokens": 1816, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.10970578261038684, "lm_q2_score": 0.02517884293499811, "lm_q1q2_score": 0.0027622646694079774}}
{"text": "%Terminals\n    u0000\n    u0001\n    u0002\n    u0003\n    u0004\n    u0005\n    u0006\n    u0007\n    u0008\n    u0009 -- HT\n    u000A -- LF\n    u000B\n    u000C -- FF\n    u000D -- CR\n    u000E\n    u000F\n    u0010\n    u0011\n    u0012\n    u0013\n    u0014\n    u0015\n    u0016\n    u0017\n    u0018\n    u0019\n    u001A\n    u001B\n    u001C\n    u001D\n    u001E\n    u001F\n    u0020 ::= ' '\n    u0021 ::= '!'\n    u0022 ::= '\"'\n    u0023 ::= '%'\n    u0024 ::= '%'\n    u0025 ::= '%'\n    u0026 ::= '&'\n    u0027 ::= \"'\"\n    u0028 ::= '('\n    u0029 ::= ')'\n    u002A ::= '*'\n    u002B ::= '+'\n    u002C ::= ','\n    u002D ::= '-'\n    u002E ::= '.'\n    u002F ::= '/'\n    u0030 ::= '0'\n    u0031 ::= '1'\n    u0032 ::= '2'\n    u0033 ::= '3'\n    u0034 ::= '4'\n    u0035 ::= '5'\n    u0036 ::= '6'\n    u0037 ::= '7'\n    u0038 ::= '8'\n    u0039 ::= '9'\n    u003A ::= ':'\n    u003B ::= ';'\n    u003C ::= '<'\n    u003D ::= '='\n    u003E ::= '>'\n    u003F ::= '?'\n    u0040 ::= '@'\n    u0041 ::= 'A'\n    u0042 ::= 'B'\n    u0043 ::= 'C'\n    u0044 ::= 'D'\n    u0045 ::= 'E'\n    u0046 ::= 'F'\n    u0047 ::= 'G'\n    u0048 ::= 'H'\n    u0049 ::= 'I'\n    u004A ::= 'J'\n    u004B ::= 'K'\n    u004C ::= 'L'\n    u004D ::= 'M'\n    u004E ::= 'N'\n    u004F ::= 'O'\n    u0050 ::= 'P'\n    u0051 ::= 'Q'\n    u0052 ::= 'R'\n    u0053 ::= 'S'\n    u0054 ::= 'T'\n    u0055 ::= 'U'\n    u0056 ::= 'V'\n    u0057 ::= 'W'\n    u0058 ::= 'X'\n    u0059 ::= 'Y'\n    u005A ::= 'Z'\n    u005B ::= '['\n    u005C ::= '\\'\n    u005D ::= ']'\n    u005E ::= '^'\n    u005F ::= '_'\n    u0060 ::= '`'\n    u0061 ::= 'a'\n    u0062 ::= 'b'\n    u0063 ::= 'c'\n    u0064 ::= 'd'\n    u0065 ::= 'e'\n    u0066 ::= 'f'\n    u0067 ::= 'g'\n    u0068 ::= 'h'\n    u0069 ::= 'i'\n    u006A ::= 'j'\n    u006B ::= 'k'\n    u006C ::= 'l'\n    u006D ::= 'm'\n    u006E ::= 'n'\n    u006F ::= 'o'\n    u0070 ::= 'p'\n    u0071 ::= 'q'\n    u0072 ::= 'r'\n    u0073 ::= 's'\n    u0074 ::= 't'\n    u0075 ::= 'u'\n    u0076 ::= 'v'\n    u0077 ::= 'w'\n    u0078 ::= 'x'\n    u0079 ::= 'y'\n    u007A ::= 'z'\n    u007B ::= '{'\n    u007C ::= '|'\n    u007D ::= '}'\n    u007E ::= '~'\n    u007F\n    \n    UNUSED\n%End\n%Trailers \n/. \n        //\n        //\n        //\n       export   class %super_stream_class extends LpgLexStream\n        {\n        \n         //\n        //\n        //\n        static   tokenKind : number[]=  new Array(0x10000)  ; // 0x10000 == 65536\n        static  __b_init : boolean = %super_stream_class.init_block(%super_stream_class.tokenKind);\n        static  init_block(tokenKind : number[]) : boolean\n        {\n            for (let i = 0; i < tokenKind.length; ++i) {\n                tokenKind[i] = 0;\n            }\n            tokenKind[0x0000] = %sym_type.%prefix%u0000%suffix%;           // 000    0x00\n            tokenKind[0x0001] = %sym_type.%prefix%u0001%suffix%;           // 001    0x01\n            tokenKind[0x0002] = %sym_type.%prefix%u0002%suffix%;           // 002    0x02\n            tokenKind[0x0003] = %sym_type.%prefix%u0003%suffix%;           // 003    0x03\n            tokenKind[0x0004] = %sym_type.%prefix%u0004%suffix%;           // 004    0x04\n            tokenKind[0x0005] = %sym_type.%prefix%u0005%suffix%;           // 005    0x05\n            tokenKind[0x0006] = %sym_type.%prefix%u0006%suffix%;           // 006    0x06\n            tokenKind[0x0007] = %sym_type.%prefix%u0007%suffix%;           // 007    0x07\n            tokenKind[0x0008] = %sym_type.%prefix%u0008%suffix%;           // 008    0x08\n            tokenKind[0x0009] = %sym_type.%prefix%HT%suffix%;              // 009    0x09\n            tokenKind[0x000A] = %sym_type.%prefix%LF%suffix%;              // 010    0x0A\n            tokenKind[0x000B] = %sym_type.%prefix%u000B%suffix%;           // 011    0x0B\n            tokenKind[0x000C] = %sym_type.%prefix%FF%suffix%;              // 012    0x0C\n            tokenKind[0x000D] = %sym_type.%prefix%CR%suffix%;              // 013    0x0D\n            tokenKind[0x000E] = %sym_type.%prefix%u000E%suffix%;           // 014    0x0E\n            tokenKind[0x000F] = %sym_type.%prefix%u000F%suffix%;           // 015    0x0F\n            tokenKind[0x0010] = %sym_type.%prefix%u0010%suffix%;           // 016    0x10\n            tokenKind[0x0011] = %sym_type.%prefix%u0011%suffix%;           // 017    0x11\n            tokenKind[0x0012] = %sym_type.%prefix%u0012%suffix%;           // 018    0x12\n            tokenKind[0x0013] = %sym_type.%prefix%u0013%suffix%;           // 019    0x13\n            tokenKind[0x0014] = %sym_type.%prefix%u0014%suffix%;           // 020    0x14\n            tokenKind[0x0015] = %sym_type.%prefix%u0015%suffix%;           // 021    0x15\n            tokenKind[0x0016] = %sym_type.%prefix%u0016%suffix%;           // 022    0x16\n            tokenKind[0x0017] = %sym_type.%prefix%u0017%suffix%;           // 023    0x17\n            tokenKind[0x0018] = %sym_type.%prefix%u0018%suffix%;           // 024    0x18\n            tokenKind[0x0019] = %sym_type.%prefix%u0019%suffix%;           // 025    0x19\n            tokenKind[0x001A] = %sym_type.%prefix%u001A%suffix%;           // 026    0x1A\n            tokenKind[0x001B] = %sym_type.%prefix%u001B%suffix%;           // 027    0x1B\n            tokenKind[0x001C] = %sym_type.%prefix%u001C%suffix%;           // 028    0x1C\n            tokenKind[0x001D] = %sym_type.%prefix%u001D%suffix%;           // 029    0x1D\n            tokenKind[0x001E] = %sym_type.%prefix%u001E%suffix%;           // 030    0x1E\n            tokenKind[0x001F] = %sym_type.%prefix%u001F%suffix%;           // 031    0x1F\n            tokenKind[0x0020] = %sym_type.%prefix%u0020%suffix%;           // 032    0x20\n            tokenKind[0x0021] = %sym_type.%prefix%u0021%suffix%;           // 033    0x21\n            tokenKind[0x0022] = %sym_type.%prefix%u0022%suffix%;           // 034    0x22\n            tokenKind[0x0023] = %sym_type.%prefix%u0023%suffix%;           // 035    0x23\n            tokenKind[0x0024] = %sym_type.%prefix%u0024%suffix%;           // 036    0x24\n            tokenKind[0x0025] = %sym_type.%prefix%u0025%suffix%;           // 037    0x25\n            tokenKind[0x0026] = %sym_type.%prefix%u0026%suffix%;           // 038    0x26\n            tokenKind[0x0027] = %sym_type.%prefix%u0027%suffix%;           // 039    0x27\n            tokenKind[0x0028] = %sym_type.%prefix%u0028%suffix%;           // 040    0x28\n            tokenKind[0x0029] = %sym_type.%prefix%u0029%suffix%;           // 041    0x29\n            tokenKind[0x002A] = %sym_type.%prefix%u002A%suffix%;           // 042    0x2A\n            tokenKind[0x002B] = %sym_type.%prefix%u002B%suffix%;           // 043    0x2B\n            tokenKind[0x002C] = %sym_type.%prefix%u002C%suffix%;           // 044    0x2C\n            tokenKind[0x002D] = %sym_type.%prefix%u002D%suffix%;           // 045    0x2D\n            tokenKind[0x002E] = %sym_type.%prefix%u002E%suffix%;           // 046    0x2E\n            tokenKind[0x002F] = %sym_type.%prefix%u002F%suffix%;           // 047    0x2F\n            tokenKind[0x0030] = %sym_type.%prefix%u0030%suffix%;           // 048    0x30\n            tokenKind[0x0031] = %sym_type.%prefix%u0031%suffix%;           // 049    0x31\n            tokenKind[0x0032] = %sym_type.%prefix%u0032%suffix%;           // 050    0x32\n            tokenKind[0x0033] = %sym_type.%prefix%u0033%suffix%;           // 051    0x33\n            tokenKind[0x0034] = %sym_type.%prefix%u0034%suffix%;           // 052    0x34\n            tokenKind[0x0035] = %sym_type.%prefix%u0035%suffix%;           // 053    0x35\n            tokenKind[0x0036] = %sym_type.%prefix%u0036%suffix%;           // 054    0x36\n            tokenKind[0x0037] = %sym_type.%prefix%u0037%suffix%;           // 055    0x37\n            tokenKind[0x0038] = %sym_type.%prefix%u0038%suffix%;           // 056    0x38\n            tokenKind[0x0039] = %sym_type.%prefix%u0039%suffix%;           // 057    0x39\n            tokenKind[0x003A] = %sym_type.%prefix%u003A%suffix%;           // 058    0x3A\n            tokenKind[0x003B] = %sym_type.%prefix%u003B%suffix%;           // 059    0x3B\n            tokenKind[0x003C] = %sym_type.%prefix%u003C%suffix%;           // 060    0x3C\n            tokenKind[0x003D] = %sym_type.%prefix%u003D%suffix%;           // 061    0x3D\n            tokenKind[0x003E] = %sym_type.%prefix%u003E%suffix%;           // 062    0x3E\n            tokenKind[0x003F] = %sym_type.%prefix%u003F%suffix%;           // 063    0x3F\n            tokenKind[0x0040] = %sym_type.%prefix%u0040%suffix%;           // 064    0x40\n            tokenKind[0x0041] = %sym_type.%prefix%u0041%suffix%;           // 065    0x41\n            tokenKind[0x0042] = %sym_type.%prefix%u0042%suffix%;           // 066    0x42\n            tokenKind[0x0043] = %sym_type.%prefix%u0043%suffix%;           // 067    0x43\n            tokenKind[0x0044] = %sym_type.%prefix%u0044%suffix%;           // 068    0x44\n            tokenKind[0x0045] = %sym_type.%prefix%u0045%suffix%;           // 069    0x45\n            tokenKind[0x0046] = %sym_type.%prefix%u0046%suffix%;           // 070    0x46\n            tokenKind[0x0047] = %sym_type.%prefix%u0047%suffix%;           // 071    0x47\n            tokenKind[0x0048] = %sym_type.%prefix%u0048%suffix%;           // 072    0x48\n            tokenKind[0x0049] = %sym_type.%prefix%u0049%suffix%;           // 073    0x49\n            tokenKind[0x004A] = %sym_type.%prefix%u004A%suffix%;           // 074    0x4A\n            tokenKind[0x004B] = %sym_type.%prefix%u004B%suffix%;           // 075    0x4B\n            tokenKind[0x004C] = %sym_type.%prefix%u004C%suffix%;           // 076    0x4C\n            tokenKind[0x004D] = %sym_type.%prefix%u004D%suffix%;           // 077    0x4D\n            tokenKind[0x004E] = %sym_type.%prefix%u004E%suffix%;           // 078    0x4E\n            tokenKind[0x004F] = %sym_type.%prefix%u004F%suffix%;           // 079    0x4F\n            tokenKind[0x0050] = %sym_type.%prefix%u0050%suffix%;           // 080    0x50\n            tokenKind[0x0051] = %sym_type.%prefix%u0051%suffix%;           // 081    0x51\n            tokenKind[0x0052] = %sym_type.%prefix%u0052%suffix%;           // 082    0x52\n            tokenKind[0x0053] = %sym_type.%prefix%u0053%suffix%;           // 083    0x53\n            tokenKind[0x0054] = %sym_type.%prefix%u0054%suffix%;           // 084    0x54\n            tokenKind[0x0055] = %sym_type.%prefix%u0055%suffix%;           // 085    0x55\n            tokenKind[0x0056] = %sym_type.%prefix%u0056%suffix%;           // 086    0x56\n            tokenKind[0x0057] = %sym_type.%prefix%u0057%suffix%;           // 087    0x57\n            tokenKind[0x0058] = %sym_type.%prefix%u0058%suffix%;           // 088    0x58\n            tokenKind[0x0059] = %sym_type.%prefix%u0059%suffix%;           // 089    0x59\n            tokenKind[0x005A] = %sym_type.%prefix%u005A%suffix%;           // 090    0x5A\n            tokenKind[0x005B] = %sym_type.%prefix%u005B%suffix%;           // 091    0x5B\n            tokenKind[0x005C] = %sym_type.%prefix%u005C%suffix%;           // 092    0x5C\n            tokenKind[0x005D] = %sym_type.%prefix%u005D%suffix%;           // 093    0x5D\n            tokenKind[0x005E] = %sym_type.%prefix%u005E%suffix%;           // 094    0x5E\n            tokenKind[0x005F] = %sym_type.%prefix%u005F%suffix%;           // 095    0x5F\n            tokenKind[0x0060] = %sym_type.%prefix%u0060%suffix%;           // 096    0x60\n            tokenKind[0x0061] = %sym_type.%prefix%u0061%suffix%;           // 097    0x61\n            tokenKind[0x0062] = %sym_type.%prefix%u0062%suffix%;           // 098    0x62\n            tokenKind[0x0063] = %sym_type.%prefix%u0063%suffix%;           // 099    0x63\n            tokenKind[0x0064] = %sym_type.%prefix%u0064%suffix%;           // 100    0x64\n            tokenKind[0x0065] = %sym_type.%prefix%u0065%suffix%;           // 101    0x65\n            tokenKind[0x0066] = %sym_type.%prefix%u0066%suffix%;           // 102    0x66\n            tokenKind[0x0067] = %sym_type.%prefix%u0067%suffix%;           // 103    0x67\n            tokenKind[0x0068] = %sym_type.%prefix%u0068%suffix%;           // 104    0x68\n            tokenKind[0x0069] = %sym_type.%prefix%u0069%suffix%;           // 105    0x69\n            tokenKind[0x006A] = %sym_type.%prefix%u006A%suffix%;           // 106    0x6A\n            tokenKind[0x006B] = %sym_type.%prefix%u006B%suffix%;           // 107    0x6B\n            tokenKind[0x006C] = %sym_type.%prefix%u006C%suffix%;           // 108    0x6C\n            tokenKind[0x006D] = %sym_type.%prefix%u006D%suffix%;           // 109    0x6D\n            tokenKind[0x006E] = %sym_type.%prefix%u006E%suffix%;           // 110    0x6E\n            tokenKind[0x006F] = %sym_type.%prefix%u006F%suffix%;           // 111    0x6F\n            tokenKind[0x0070] = %sym_type.%prefix%u0070%suffix%;           // 112    0x70\n            tokenKind[0x0071] = %sym_type.%prefix%u0071%suffix%;           // 113    0x71\n            tokenKind[0x0072] = %sym_type.%prefix%u0072%suffix%;           // 114    0x72\n            tokenKind[0x0073] = %sym_type.%prefix%u0073%suffix%;           // 115    0x73\n            tokenKind[0x0074] = %sym_type.%prefix%u0074%suffix%;           // 116    0x74\n            tokenKind[0x0075] = %sym_type.%prefix%u0075%suffix%;           // 117    0x75\n            tokenKind[0x0076] = %sym_type.%prefix%u0076%suffix%;           // 118    0x76\n            tokenKind[0x0077] = %sym_type.%prefix%u0077%suffix%;           // 119    0x77\n            tokenKind[0x0078] = %sym_type.%prefix%u0078%suffix%;           // 120    0x78\n            tokenKind[0x0079] = %sym_type.%prefix%u0079%suffix%;           // 121    0x79\n            tokenKind[0x007A] = %sym_type.%prefix%u007A%suffix%;           // 122    0x7A\n            tokenKind[0x007B] = %sym_type.%prefix%u007B%suffix%;           // 123    0x7B\n            tokenKind[0x007C] = %sym_type.%prefix%u007C%suffix%;           // 124    0x7C\n            tokenKind[0x007D] = %sym_type.%prefix%u007D%suffix%;           // 125    0x7D\n            tokenKind[0x007E] = %sym_type.%prefix%u007E%suffix%;           // 126    0x7E\n            tokenKind[0x007F] = %sym_type.%prefix%u007F%suffix%;           // 127    0x7F\n\n            tokenKind[0xFFFF] = %sym_type.%prefix%EOF%suffix%;\n\n            //\n            // Every other character not yet assigned is treated initially as unused\n            //\n            for (let i = 0x007F; i < 0xFFFF; i++)\n                if (tokenKind[i] == 0) tokenKind[i] = %sym_type.%prefix%UNUSED%suffix%;\n            return true;\n        }\n                \n        public    getKind(number i) : number // Classify character at ith location\n        {\n            return (i >= this.getStreamLength()\n                       ? 0xffff\n                       : %super_stream_class.tokenKind[getIntValue(i)]);\n        }\n\n        public  orderedExportedSymbols() : string[] { return %exp_type.orderedTerminalSymbols; }\n\n        constructor(fileName: string, inputChars?: string, tab: number=4) {\n             super(fileName, inputChars, tab);\n         }\n        }\n./\n%End\n%Headers\n    --\n    -- Additional methods for the action class not provided in the template\n    --\n    /.\n        //\n        // The Lexer contains an array of characters as the input stream to be parsed.\n        // There are methods to retrieve and classify characters.\n        // The lexparser \"token\" is implemented simply as the index of the next character in the array.\n        // The Lexer : the abstract class LpgLexStream with an implementation of the abstract\n        // method getKind.  The template defines the Lexer class and the lexer() method.\n        // A driver creates the action class, \"Lexer\", passing an Option object to the constructor.\n        //\n       kwLexer :  %kw_lexer_class;\n       public   printTokens : boolean =false;\n   \n       private static  readonly   ECLIPSE_TAB_VALUE: number = 4;\n\n        public  getKeywordKinds() : number[] { return this.kwLexer.getKeywordKinds(); }\n\n        constructor(filename : string) : this(filename, ECLIPSE_TAB_VALUE)\n        {\n           \n            this.kwLexer = new %kw_lexer_class(this.getInputChars(), %_IDENTIFIER);\n        }\n\n        public  initialize(filename : string,content? : string) : void\n        {\n            super.initialize(filename,content);\n            if (this.kwLexer == null)\n                 this.kwLexer = new %kw_lexer_class(this.getInputChars(), %_IDENTIFIER);\n            else this.kwLexer.setInputChars(this.getInputChars());\n        }\n        \n         void makeToken(kind : number)\n        {\n            let startOffset = this.getLeftSpan(),\n                endOffset = this.getRightSpan();\n            this.makeToken(startOffset, endOffset, kind);\n            if (this.printTokens) this.printValue(startOffset, endOffset);\n        }\n\n         void makeComment(kind : number)\n        {\n            let startOffset = this.getLeftSpan(),\n                endOffset = this.getRightSpan();\n            super.getPrsStream().makeAdjunct(startOffset, endOffset, kind);\n        }\n\n         skipToken() : void \n        {\n            if (this.printTokens) this.printValue(this.getLeftSpan(), this.getRightSpan());\n        }\n        \n         checkForKeyWord() : void \n        {\n            let startOffset = this.getLeftSpan(),\n                endOffset = this.getRightSpan();\n            let kwKind = this.kwLexer.lexer(startOffset, endOffset);\n            this.makeToken(startOffset, endOffset, kwKind);\n            if (this.printTokens) this.printValue(startOffset, endOffset);\n        }\n        \n        \n         printValue(startOffset : number, endOffset : number) : void \n        {\n             let s = lexStream.getInputChars().substr(startOffset, endOffset - startOffset + 1);\n             console.Out.Write(s);\n        }\n\n\n    ./\n%End\n", "meta": {"hexsha": "ceee8705f7a27c68c14925ad7c8a3b88cc5c8571", "size": 17746, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerUnicodeMapF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerUnicodeMapF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerUnicodeMapF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 46.9470899471, "max_line_length": 103, "alphanum_fraction": 0.5101994816, "num_tokens": 5951, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.14223188046612723, "lm_q2_score": 0.019419347437601077, "lm_q1q2_score": 0.0027620503034750704}}
{"text": "%Terminals\n    DollarSign ::= '$'\n    Percent ::= '%'\n    _\n    a b c d e f g h i j k l m n o p q r s t u v w x y z\n%End\n\n%Headers\n    /.\n        //\n        // Each upper case letter is mapped into its corresponding\n        // lower case counterpart. For example, if an 'A' appears\n        // in the input, it is mapped into %sym_type.%prefix%a%suffix% just\n        // like 'a'.\n        //\n       public  static   tokenKind : number[]=  new Array(128)  ; \n         static  __b_init : boolean = %action_type.init_block(%action_type.tokenKind);\n        static  init_block(tokenKind : number[]) : boolean\n        {\n            for (let i = 0; i < tokenKind.length; ++i) {\n                tokenKind[i] = 0;\n            }\n            tokenKind['$'.charCodeAt(0)] = %sym_type.%prefix%DollarSign%suffix%;\n            tokenKind['%'.charCodeAt(0)] = %sym_type.%prefix%Percent%suffix%;\n            tokenKind['_'.charCodeAt(0)] = %sym_type.%prefix%_%suffix%;\n\n            tokenKind['a'.charCodeAt(0)] = %sym_type.%prefix%a%suffix%;\n            tokenKind['b'.charCodeAt(0)] = %sym_type.%prefix%b%suffix%;\n            tokenKind['c'.charCodeAt(0)] = %sym_type.%prefix%c%suffix%;\n            tokenKind['d'.charCodeAt(0)] = %sym_type.%prefix%d%suffix%;\n            tokenKind['e'.charCodeAt(0)] = %sym_type.%prefix%e%suffix%;\n            tokenKind['f'.charCodeAt(0)] = %sym_type.%prefix%f%suffix%;\n            tokenKind['g'.charCodeAt(0)] = %sym_type.%prefix%g%suffix%;\n            tokenKind['h'.charCodeAt(0)] = %sym_type.%prefix%h%suffix%;\n            tokenKind['i'.charCodeAt(0)] = %sym_type.%prefix%i%suffix%;\n            tokenKind['j'.charCodeAt(0)] = %sym_type.%prefix%j%suffix%;\n            tokenKind['k'.charCodeAt(0)] = %sym_type.%prefix%k%suffix%;\n            tokenKind['l'.charCodeAt(0)] = %sym_type.%prefix%l%suffix%;\n            tokenKind['m'.charCodeAt(0)] = %sym_type.%prefix%m%suffix%;\n            tokenKind['n'.charCodeAt(0)] = %sym_type.%prefix%n%suffix%;\n            tokenKind['o'.charCodeAt(0)] = %sym_type.%prefix%o%suffix%;\n            tokenKind['p'.charCodeAt(0)] = %sym_type.%prefix%p%suffix%;\n            tokenKind['q'.charCodeAt(0)] = %sym_type.%prefix%q%suffix%;\n            tokenKind['r'.charCodeAt(0)] = %sym_type.%prefix%r%suffix%;\n            tokenKind['s'.charCodeAt(0)] = %sym_type.%prefix%s%suffix%;\n            tokenKind['t'.charCodeAt(0)] = %sym_type.%prefix%t%suffix%;\n            tokenKind['u'.charCodeAt(0)] = %sym_type.%prefix%u%suffix%;\n            tokenKind['v'.charCodeAt(0)] = %sym_type.%prefix%v%suffix%;\n            tokenKind['w'.charCodeAt(0)] = %sym_type.%prefix%w%suffix%;\n            tokenKind['x'.charCodeAt(0)] = %sym_type.%prefix%x%suffix%;\n            tokenKind['y'.charCodeAt(0)] = %sym_type.%prefix%y%suffix%;\n            tokenKind['z'.charCodeAt(0)] = %sym_type.%prefix%z%suffix%;\n\n            tokenKind['A'.charCodeAt(0)] = %sym_type.%prefix%a%suffix%;\n            tokenKind['B'.charCodeAt(0)] = %sym_type.%prefix%b%suffix%;\n            tokenKind['C'.charCodeAt(0)] = %sym_type.%prefix%c%suffix%;\n            tokenKind['D'.charCodeAt(0)] = %sym_type.%prefix%d%suffix%;\n            tokenKind['E'.charCodeAt(0)] = %sym_type.%prefix%e%suffix%;\n            tokenKind['F'.charCodeAt(0)] = %sym_type.%prefix%f%suffix%;\n            tokenKind['G'.charCodeAt(0)] = %sym_type.%prefix%g%suffix%;\n            tokenKind['H'.charCodeAt(0)] = %sym_type.%prefix%h%suffix%;\n            tokenKind['I'.charCodeAt(0)] = %sym_type.%prefix%i%suffix%;\n            tokenKind['J'.charCodeAt(0)] = %sym_type.%prefix%j%suffix%;\n            tokenKind['K'.charCodeAt(0)] = %sym_type.%prefix%k%suffix%;\n            tokenKind['L'.charCodeAt(0)] = %sym_type.%prefix%l%suffix%;\n            tokenKind['M'.charCodeAt(0)] = %sym_type.%prefix%m%suffix%;\n            tokenKind['N'.charCodeAt(0)] = %sym_type.%prefix%n%suffix%;\n            tokenKind['O'.charCodeAt(0)] = %sym_type.%prefix%o%suffix%;\n            tokenKind['P'.charCodeAt(0)] = %sym_type.%prefix%p%suffix%;\n            tokenKind['Q'.charCodeAt(0)] = %sym_type.%prefix%q%suffix%;\n            tokenKind['R'.charCodeAt(0)] = %sym_type.%prefix%r%suffix%;\n            tokenKind['S'.charCodeAt(0)] = %sym_type.%prefix%s%suffix%;\n            tokenKind['T'.charCodeAt(0)] = %sym_type.%prefix%t%suffix%;\n            tokenKind['U'.charCodeAt(0)] = %sym_type.%prefix%u%suffix%;\n            tokenKind['V'.charCodeAt(0)] = %sym_type.%prefix%v%suffix%;\n            tokenKind['W'.charCodeAt(0)] = %sym_type.%prefix%w%suffix%;\n            tokenKind['X'.charCodeAt(0)] = %sym_type.%prefix%x%suffix%;\n            tokenKind['Y'.charCodeAt(0)] = %sym_type.%prefix%y%suffix%;\n            tokenKind['Z'.charCodeAt(0)] = %sym_type.%prefix%z%suffix%;\n            return true;\n        }\n    \n       public  static    getKind(c :number ):number\n        {\n            return (c < 128 ? %action_type.tokenKind[c] : 0);\n        }\n    ./\n%End\n\n", "meta": {"hexsha": "55fe54e829d59d5455a7d28632f79b239dbdd974", "size": 4881, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/include/typescript/KWLexerFoldedCaseMapF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/include/typescript/KWLexerFoldedCaseMapF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/include/typescript/KWLexerFoldedCaseMapF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 54.2333333333, "max_line_length": 86, "alphanum_fraction": 0.569555419, "num_tokens": 1440, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.11436853825632724, "lm_q2_score": 0.024053554993252988, "lm_q1q2_score": 0.0027509699244465257}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2005, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   See (or edit) Notice Declaration below\n-- *\n-- * </copyright>\n-- */\n--\n-- The EssentialOCL Parser\n--\n\n\n%Define\n    -- Redefinition of macros used in the parser template\n    --\n    $default_repair_count /.getDefaultRepairCount()./\n\t$super_parser_class /.AbstractOCLParser./\n    $prs_stream_class /.DerivedPrsStream./\n\n\t-- Definition of new macros used by the grammar file\n\t-- which may be redefined by extended files.\n    $copyright_contributions /.*./\n\n\t-- Definition of new macros used by the grammar file\n\t-- which are not intended to be extended.\n\t$lpg_ns /.lpg.runtime./ -- package namespace of the LPG Runtime API\n\t\n\n\t-- Some useful macros\t\n    $NewCase\n    /. $Header\n                case $rule_number:./\n\n\n\t\n    $EmptyListAction -- Deprecated, code inline with correct generic parameter type\n    /. $Header\n                case $rule_number:\n                    setResult(new BasicEList<Object>());\n                    break;./\n                    \n    -- BeginJava and EndJava need to be reworked in order to be able to properly use $NewCase macro\n    \n    -- BeginJava does nothing\n\t-- block-actions should call BeginCode, instead\n    $BeginJava /../\n    \n  \t-- EndJava does nothing\n\t-- block-actions should call EndCode, instead\n\t$EndJava /../\n\t\n\t$BeginCode\n\t/.$BeginAction\n\t\t\t\t\t$symbol_declarations./\n\n\t$EndCode /.$EndAction./\n\n%End\n\n%Notice\n    /./**\n * Essential OCL Grammar\n * <copyright>\n *\n * Copyright (c) 2005, 2010 IBM Corporation and others.\n * All rights reserved.   This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v2.0\n * which accompanies this distribution, and is available at\n * http://www.eclipse.org/legal/epl-v20.html\n *\n * Contributors:\n *   IBM - Initial API and implementation\n *   E.D.Willink - Elimination of some shift-reduce conflicts\n *   E.D.Willink - Remove unnecessary warning suppression\n *   E.D.Willink - Bugs 184048, 225493, 243976, 259818, 282882, 287993, 288040, 292112, 295166\n *   Borland - Bug 242880\n *   Adolfo Sanchez-Barbudo Herrera (Open Canarias):\n *        - 242153: LPG v 2.0.17 adoption.\n *        - 299396: Introducing new LPG templates\n *        - 300534: Removing the use of deprecated macros.\n *******************************************************************************/\n    ./\n%End\n\n%Globals\n    /.import org.eclipse.emf.common.util.BasicEList;\n\timport org.eclipse.emf.common.util.EList;\n\timport org.eclipse.ocl.cst.BooleanLiteralExpCS;\n\timport org.eclipse.ocl.cst.CSTNode;\n\timport org.eclipse.ocl.cst.CallExpCS;\n\timport org.eclipse.ocl.cst.CollectionLiteralExpCS;\n\timport org.eclipse.ocl.cst.CollectionLiteralPartCS;\n\timport org.eclipse.ocl.cst.CollectionTypeCS;\n\timport org.eclipse.ocl.cst.CollectionTypeIdentifierEnum;\n\timport org.eclipse.ocl.cst.FeatureCallExpCS;\n\timport org.eclipse.ocl.cst.IfExpCS;\n\timport org.eclipse.ocl.cst.IntegerLiteralExpCS;\n\timport org.eclipse.ocl.cst.InvalidLiteralExpCS;\n\timport org.eclipse.ocl.cst.IsMarkedPreCS;\n\timport org.eclipse.ocl.cst.IterateExpCS;\n\timport org.eclipse.ocl.cst.IteratorExpCS;\n\timport org.eclipse.ocl.cst.LetExpCS;\n\timport org.eclipse.ocl.cst.NullLiteralExpCS;\n\timport org.eclipse.ocl.cst.OCLExpressionCS;\n\timport org.eclipse.ocl.cst.OperationCallExpCS;\n\timport org.eclipse.ocl.cst.PathNameCS;\n\timport org.eclipse.ocl.cst.PrimitiveTypeCS;\n\timport org.eclipse.ocl.cst.RealLiteralExpCS;\n\timport org.eclipse.ocl.cst.SimpleNameCS;\n\timport org.eclipse.ocl.cst.SimpleTypeEnum;\n\timport org.eclipse.ocl.cst.StringLiteralExpCS;\n\timport org.eclipse.ocl.cst.TupleLiteralExpCS;\n\timport org.eclipse.ocl.cst.TupleTypeCS;\n\timport org.eclipse.ocl.cst.TypeCS;\n\timport org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS;\n\timport org.eclipse.ocl.cst.VariableCS;\n\timport org.eclipse.ocl.cst.VariableExpCS;\t\n\timport org.eclipse.ocl.lpg.DerivedPrsStream;\n\t\n\timport $lpg_ns.BadParseException;\n\timport $lpg_ns.BadParseSymFileException;\n\timport $lpg_ns.DiagnoseParser;\n\timport $lpg_ns.ErrorToken;\n\timport $lpg_ns.IToken;\n\timport $lpg_ns.ILexStream;\n\timport $lpg_ns.Monitor;\n\timport $lpg_ns.NullExportedSymbolsException;\n\timport $lpg_ns.NullTerminalSymbolsException;\n\timport $lpg_ns.ParseTable;\n\timport $lpg_ns.RuleAction;\n\timport $lpg_ns.UndefinedEofSymbolException;\n\timport $lpg_ns.UnimplementedTerminalsException;\t\n    ./\n%End\n\n%KeyWords\n-- Reserved keywords\n    and implies not or xor  \n    if then else endif  \n    let in  \n    false true\n    null invalid\n    self    \n\n-- Restricted keywords\n    Bag Collection OrderedSet Sequence Set  \n    Tuple\n    Boolean Integer Real String UnlimitedNatural\n    OclAny OclInvalid OclVoid\n%End\n\n-- Terminals\n%Identifier\n    IDENTIFIER\n%End\n\n%Terminals\n    \n    QUOTED_IDENTIFIER INTEGER_LITERAL REAL_LITERAL STRING_LITERAL\n    \n    PLUS     ::= '+'\n    MINUS    ::= '-'\n    MULTIPLY ::= '*'\n    DIVIDE   ::= '/'\n\n    GREATER       ::= '>'\n    LESS          ::= '<'\n    EQUAL         ::= '='\n    GREATER_EQUAL ::= '>='\n    LESS_EQUAL    ::= '<='\n    NOT_EQUAL     ::= '<>'\n\n    LPAREN   ::= '('\n    RPAREN   ::= ')'\n    LBRACE   ::= '{'\n    RBRACE   ::= '}'\n    LBRACKET ::= '['\n    RBRACKET ::= ']'\n\n    ARROW      ::= '->'\n    BAR        ::= '|'\n    COMMA      ::= ','\n    COLON      ::= ':'\n    COLONCOLON ::= '::'\n    SEMICOLON  ::= ';'\n    DOT        ::= '.'\n    DOTDOT     ::= '..'\n%End\n\n%Headers\n\t/.\n\t\n\tpublic $environment_class getOCLEnvironment() {\n\t\treturn getLexer().getOCLEnvironment();\n\t}\n\t\t\n\t@Override\n\tpublic $super_lexer_class getLexer() {\n\t\treturn ($super_lexer_class) super.getLexer();\n\t}\n\t\n\t\n\t\n\t// Some methods for backwards compatibility \n\t/**\n\t* <p>\n\t* Before 3.0, this method was used with the now-deprecated  \"dollar\"getToken macro (which\n\t* provided token index in the prsStream) to obtain an IToken f a rule given the index of the\n\t* right hand side token in the said rule. In 3.0 a convenience method has been introduced\n\t* in order to directly return the IToken, given the index of the right hand side token in the rule.\n\t* </p> \n\t*\n\t* <p>\n\t* In an action-block of a rule, instead of doing <code>getIToken(\"dollar\"getToken(i))</code> \n\t* you should do <code>getRhsTokenText(i)</code>\n\t* </p>\n\t* @param i the right hand side token index\n\t* @return the correspondent IToken.\n\t*\n\t* @since 3.0\t\n\t*/\n\t@Deprecated\n\tprotected IToken getIToken(int i) {\n\t\treturn prsStream.getIToken(i);\n\t}\n\t\n\t/**\n\t* <p>\n\t* Before 3.0, this method was used with the now-deprecated \"dollar\"getToken macro (which\n\t* provided token index in the prsStream) to obtain an IToken f a rule given the index of the\n\t* right hand side token in the said rule. In 3.0 a convenience method has been introduced\n\t* in order to directly return the IToken, given the index of the right hand side token in the rule.\n\t* </p> \n\t* \n\t* <p>\n\t* In an action-block of a rule, instead of doing <code>getTokenText(\"dollar\"getToken(i))</code> \n\t* you should do <code>getRhsTokenText(i)</code>\n\t* </p>\n\t* @param i the right hand side token index\n\t* @result the text of the correspondent right hand side IToken.\n\t*/\n\t@Deprecated\n\tprotected String getTokenText(int i) {\n\t\treturn prsStream.getTokenText(i);\n\t}\n\t\n\t/**\n\t* A convenience method to obtain the text of a right hand side IToken.\n\t*  \n\t* @param i the right hand side token index\n\t* @result the text of the correspondent right hand side IToken.\n\t*\n\t* @since 3.0\n\t*/\n\tprotected String getRhsTokenText(int i) { \n\t\treturn prsStream.getTokenText(getRhsTokenIndex(i));\n\t}\n\t./\n%End\n\n%Rules\n\n-----------------------------------------------------------------------\n--  Names\n-----------------------------------------------------------------------\n--  Temporary backward compatibility support for 7.4.8 conceptual usage \n    conceptualOperationName -> and\n    conceptualOperationName -> implies\n    conceptualOperationName -> not\n    conceptualOperationName -> or\n    conceptualOperationName -> xor\n    conceptualOperationName -> '<'\n    conceptualOperationName -> '<='\n    conceptualOperationName -> '>='\n    conceptualOperationName -> '>'\n    conceptualOperationName -> '='\n    conceptualOperationName -> '<>'\n    conceptualOperationName -> '+'\n    conceptualOperationName -> '-'\n    conceptualOperationName -> '*'\n    conceptualOperationName -> '/'\n    conceptualOperationNameCS ::= conceptualOperationName\n        /.$BeginCode\n                    IToken iToken = getRhsIToken(1);\n                    SimpleNameCS result = createConceptualOperationNameCS(iToken);\n                    setOffsets(result, iToken);\n                    setResult(result);\n          $EndCode\n        ./\n    \n    reservedKeyword -> and\n    reservedKeyword -> else\n    reservedKeyword -> endif\n    reservedKeyword -> if\n    reservedKeyword -> implies\n    reservedKeyword -> in\n    reservedKeyword -> let\n    reservedKeyword -> not\n    reservedKeyword -> or\n    reservedKeyword -> then\n    reservedKeyword -> xor\n\n    tupleKeywordCS ::= Tuple\n        /.$NewCase./\n    reservedKeywordCS ::= reservedKeyword\n        /.$BeginCode\n                    IToken iToken = getRhsIToken(1);\n                    SimpleNameCS result = createSimpleNameCS(\n                                SimpleTypeEnum.KEYWORD_LITERAL,\n                                iToken\n                            );\n                    setOffsets(result, iToken);\n                    setResult(result);\n          $EndCode\n        ./\n    restrictedKeywordCS -> CollectionTypeIdentifierCS\n--  restrictedKeywordCS -> BooleanLiteralExpCS\n--  restrictedKeywordCS -> InvalidLiteralExpCS\n--  restrictedKeywordCS -> NullLiteralExpCS\n--  restrictedKeywordCS -> selfKeywordCS\n    restrictedKeywordCS -> primitiveTypeCS\n    restrictedKeywordCS -> tupleKeywordCS\n        \n    selfKeywordCS ::= self\n        /.$BeginCode\n                    IToken iToken = getRhsIToken(1);\n                    SimpleNameCS result = createSimpleNameCS(\n                            SimpleTypeEnum.SELF_LITERAL,\n                            iToken\n                        );\n                    setOffsets(result, iToken);\n                    setResult(result);\n          $EndCode\n        ./\n        \n    simpleNameCS ::= IDENTIFIER\n        /.$BeginCode\n                    IToken iToken = getRhsIToken(1);\n                    SimpleNameCS result = createSimpleNameCS(\n                            SimpleTypeEnum.IDENTIFIER_LITERAL,\n                            iToken\n                        );\n                    setOffsets(result, iToken);\n                    setResult(result);\n          $EndCode\n        ./\n    simpleNameCS -> QuotedSimpleNameCS\n    QuotedSimpleNameCS ::= QUOTED_IDENTIFIER\n        /.$BeginCode\n                    IToken iToken = getRhsIToken(1);\n                    SimpleNameCS result = createQuotedSimpleNameCS(\n                            SimpleTypeEnum.IDENTIFIER_LITERAL,\n                            iToken\n                        );\n                    setOffsets(result, iToken);\n                    setResult(result);\n          $EndCode\n        ./\n    QuotedSimpleNameCS ::= QuotedSimpleNameCS STRING_LITERAL\n        /.$BeginCode\n                    SimpleNameCS string = (SimpleNameCS)getRhsSym(1);\n                    IToken literalToken = getRhsIToken(2);\n                    SimpleNameCS result = extendQuotedSimpleNameCS(string, literalToken);\n                    setOffsets(result, string, literalToken);\n                    setResult(result);\n          $EndCode\n        ./\n\n    unreservedSimpleNameCS -> simpleNameCS\n    unreservedSimpleNameCS -> restrictedKeywordCS\n\n    pathNameCS ::= simpleNameCS\n        /.$BeginCode\n                    SimpleNameCS simpleName = (SimpleNameCS)getRhsSym(1);\n                    PathNameCS result = createPathNameCS(simpleName);\n                    setOffsets(result, simpleName);\n                    setResult(result);\n          $EndCode\n        ./\n    pathNameCS ::= pathNameCS '::' unreservedSimpleNameCS\n        /.$BeginCode\n                    PathNameCS result = (PathNameCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    result = extendPathNameCS(result, simpleNameCS);\n                    setOffsets(result, result, simpleNameCS);\n                    setResult(result);\n          $EndCode\n        ./\n        \n-----------------------------------------------------------------------\n--  Types\n-----------------------------------------------------------------------\n    primitiveTypeCS ::= Boolean\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.BOOLEAN_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    primitiveTypeCS ::= Integer\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.INTEGER_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    primitiveTypeCS ::= Real\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.REAL_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    primitiveTypeCS ::= String\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.STRING_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    primitiveTypeCS ::= UnlimitedNatural\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.UNLIMITED_NATURAL_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    primitiveTypeCS ::= OclAny\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.OCL_ANY_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    primitiveTypeCS ::= OclInvalid\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.OCL_INVALID_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    primitiveTypeCS ::= OclVoid\n        /.$BeginCode\n                    PrimitiveTypeCS result = createPrimitiveTypeCS(\n                            SimpleTypeEnum.OCL_VOID_LITERAL,\n                            getRhsTokenText(1)\n                        );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n        \n    CollectionTypeIdentifierCS ::= Set\n        /.$BeginCode\n                    SimpleNameCS result = createCollectionTypeCS(\n                                CollectionTypeIdentifierEnum.SET_LITERAL,\n                                getRhsTokenText(1)\n                            );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    CollectionTypeIdentifierCS ::= Bag\n        /.$BeginCode\n                    SimpleNameCS result = createCollectionTypeCS(\n                                CollectionTypeIdentifierEnum.BAG_LITERAL,\n                                getRhsTokenText(1)\n                            );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    CollectionTypeIdentifierCS ::= Sequence\n        /.$BeginCode\n                    SimpleNameCS result = createCollectionTypeCS(\n                                CollectionTypeIdentifierEnum.SEQUENCE_LITERAL,\n                                getRhsTokenText(1)\n                            );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    CollectionTypeIdentifierCS ::= Collection\n        /.$BeginCode\n                    SimpleNameCS result = createCollectionTypeCS(\n                                CollectionTypeIdentifierEnum.COLLECTION_LITERAL,\n                                getRhsTokenText(1)\n                            );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    CollectionTypeIdentifierCS ::= OrderedSet\n        /.$BeginCode\n                    SimpleNameCS result = createCollectionTypeCS(\n                                CollectionTypeIdentifierEnum.ORDERED_SET_LITERAL,\n                                getRhsTokenText(1)\n                            );\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    typeCS -> primitiveTypeCS\n    typeCS -> pathNameCS\n    typeCS -> collectionTypeCS\n    typeCS -> tupleTypeCS\n\n    collectionTypeCS ::= CollectionTypeIdentifierCS '(' typeCS ')'\n        /.$BeginCode\n                    CollectionTypeCS result = (CollectionTypeCS)getRhsSym(1);\n                    result.setTypeCS((TypeCS)getRhsSym(3));\n                    setOffsets(result, result, getRhsIToken(4));\n                    setResult(result);\n          $EndCode\n        ./\n\n    tupleTypeCS ::= Tuple '(' tupleTypePartsCSopt ')'\n        /.$BeginCode\n                     TupleTypeCS result = createTupleTypeCS((EList<VariableCS>)getRhsSym(3));\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(4));\n                    setResult(result);\n          $EndCode\n        ./\n\n    tupleTypePartsCSopt ::= %empty\n        /.$BeginCode\n                    setResult(new BasicEList<VariableCS>());\n          $EndCode\n        ./\n    tupleTypePartsCSopt -> tupleTypePartsCS\n\n    tupleTypePartsCS ::= typedUninitializedVariableCS\n        /.$BeginCode\n                    EList<VariableCS> result = new BasicEList<VariableCS>();\n                    result.add((VariableCS)getRhsSym(1));\n                    setResult(result);\n          $EndCode\n        ./\n    tupleTypePartsCS ::= tupleTypePartsCS ',' typedUninitializedVariableCS\n        /.$BeginCode\n                    EList<VariableCS> result = (EList<VariableCS>)getRhsSym(1);\n                    result.add((VariableCS)getRhsSym(3));\n                    setResult(result);\n          $EndCode\n        ./\n\n-----------------------------------------------------------------------\n--  Declarations\n-----------------------------------------------------------------------     \n    untypedUninitializedVariableCS ::= simpleNameCS\n        /.$BeginCode\n                    SimpleNameCS name = (SimpleNameCS)getRhsSym(1);\n                    VariableCS result = createVariableCS(name, null, null);\n                    setOffsets(result, name);\n                    setResult(result);\n          $EndCode\n        ./\n\n    typedUninitializedVariableCS ::= simpleNameCS ':' typeCS\n        /.$BeginCode\n                    SimpleNameCS name = (SimpleNameCS)getRhsSym(1);\n                    TypeCS type = (TypeCS)getRhsSym(3);\n                    VariableCS result = createVariableCS(name, type, null);\n                    setOffsets(result, name, type);\n                    setResult(result);\n          $EndCode\n        ./\n        \n    untypedInitializedVariableCS ::= simpleNameCS '=' OclExpressionCS\n        /.$BeginCode\n                    SimpleNameCS name = (SimpleNameCS)getRhsSym(1);\n                    OCLExpressionCS initExpression = (OCLExpressionCS)getRhsSym(3);\n                    VariableCS result = createVariableCS(name, null, initExpression);\n                    setOffsets(result, name, initExpression);\n                    setResult(result);\n          $EndCode\n        ./\n        \n    typedInitializedVariableCS ::= simpleNameCS ':' typeCS '=' OclExpressionCS\n        /.$BeginCode\n                    SimpleNameCS name = (SimpleNameCS)getRhsSym(1);\n                    TypeCS type = (TypeCS)getRhsSym(3);\n                    OCLExpressionCS initExpression = (OCLExpressionCS)getRhsSym(5);\n                    VariableCS result = createVariableCS(name, type, initExpression);\n                    setOffsets(result, name, initExpression);\n                    setResult(result);\n          $EndCode\n        ./\n\n    initializedVariableCS -> untypedInitializedVariableCS\n    initializedVariableCS -> typedInitializedVariableCS\n\n    uninitializedVariableCS -> untypedUninitializedVariableCS\n    uninitializedVariableCS -> typedUninitializedVariableCS\n\n    VariableDeclarationCS -> untypedUninitializedVariableCS\n    VariableDeclarationCS -> untypedInitializedVariableCS\n    VariableDeclarationCS -> typedUninitializedVariableCS\n    VariableDeclarationCS -> typedInitializedVariableCS\n\n-----------------------------------------------------------------------\n--  Literals\n-----------------------------------------------------------------------\n-- EnumLiteralExpCS is parsed as a PropertyCallExpCS[C]\n--  LiteralExpCS -> EnumLiteralExpCS\n    LiteralExpCS -> CollectionLiteralExpCS\n    LiteralExpCS -> TupleLiteralExpCS\n    LiteralExpCS -> PrimitiveLiteralExpCS\n    LiteralExpCS -> TypeLiteralExpCS\n\n    CollectionLiteralExpCS ::= CollectionTypeIdentifierCS\n       '{' CollectionLiteralPartsCSopt '}'\n        /.$BeginCode\n                    CollectionTypeCS typeCS = (CollectionTypeCS)getRhsSym(1);\n                    CollectionLiteralExpCS result = createCollectionLiteralExpCS(\n                            typeCS,\n                            (EList<CollectionLiteralPartCS>)getRhsSym(3)\n                        );\n                    setOffsets(result, typeCS, getRhsIToken(4));\n                    setResult(result);\n          $EndCode\n        ./\n    CollectionLiteralExpCS ::= collectionTypeCS '{' CollectionLiteralPartsCSopt '}'\n        /.$BeginCode\n                    CollectionTypeCS typeCS = (CollectionTypeCS)getRhsSym(1);\n                    CollectionLiteralExpCS result = createCollectionLiteralExpCS(\n                            typeCS,\n                            (EList<CollectionLiteralPartCS>)getRhsSym(3)\n                        );\n                    setOffsets(result, typeCS, getRhsIToken(4));\n                    setResult(result);\n          $EndCode\n        ./\n\n    CollectionLiteralPartsCSopt ::= %empty\n        /.$BeginCode\n                    setResult(new BasicEList<CollectionLiteralPartCS>());\n          $EndCode\n        ./\n    CollectionLiteralPartsCSopt -> CollectionLiteralPartsCS\n\n    CollectionLiteralPartsCS ::= CollectionLiteralPartCS\n        /.$BeginCode\n                    EList<CollectionLiteralPartCS> result = new BasicEList<CollectionLiteralPartCS>();\n                    result.add((CollectionLiteralPartCS)getRhsSym(1));\n                    setResult(result);\n          $EndCode\n        ./\n    CollectionLiteralPartsCS ::= CollectionLiteralPartsCS ',' CollectionLiteralPartCS\n        /.$BeginCode\n                    EList<CollectionLiteralPartCS> result = (EList<CollectionLiteralPartCS>)getRhsSym(1);\n                    result.add((CollectionLiteralPartCS)getRhsSym(3));\n                    setResult(result);\n          $EndCode\n        ./\n\n    CollectionLiteralPartCS -> CollectionRangeCS\n    CollectionLiteralPartCS ::= OclExpressionCS\n        /.$BeginCode\n                    CollectionLiteralPartCS result = createCollectionLiteralPartCS(\n                            (OCLExpressionCS)getRhsSym(1)\n                        );\n                    setOffsets(result, (CSTNode)getRhsSym(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    CollectionRangeCS ::= OclExpressionCS '..' OclExpressionCS\n        /.$BeginCode\n                    CollectionLiteralPartCS result = createCollectionRangeCS(\n                            (OCLExpressionCS)getRhsSym(1),\n                            (OCLExpressionCS)getRhsSym(3)\n                        );\n                    setOffsets(result, (CSTNode)getRhsSym(1), (CSTNode)getRhsSym(3));\n                    setResult(result);\n          $EndCode\n        ./\n\n    PrimitiveLiteralExpCS -> IntegerLiteralExpCS\n    PrimitiveLiteralExpCS -> RealLiteralExpCS\n    PrimitiveLiteralExpCS -> StringLiteralExpCS\n    PrimitiveLiteralExpCS -> BooleanLiteralExpCS\n    PrimitiveLiteralExpCS -> UnlimitedNaturalLiteralExpCS\n    PrimitiveLiteralExpCS -> InvalidLiteralExpCS\n    PrimitiveLiteralExpCS -> NullLiteralExpCS\n\n    TupleLiteralExpCS ::= Tuple '{' TupleLiteralPartsCS '}'\n        /.$BeginCode\n                    TupleLiteralExpCS result = createTupleLiteralExpCS((EList<VariableCS>)getRhsSym(3));\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(4));\n                    setResult(result);\n          $EndCode\n        ./\n\n    TupleLiteralPartsCS ::= initializedVariableCS\n        /.$BeginCode\n                    EList<VariableCS> result = new BasicEList<VariableCS>();\n                    result.add((VariableCS)getRhsSym(1));\n                    setResult(result);\n          $EndCode\n        ./\n    TupleLiteralPartsCS ::= TupleLiteralPartsCS ',' initializedVariableCS\n        /.$BeginCode\n                    EList<VariableCS> result = (EList<VariableCS>)getRhsSym(1);\n                    result.add((VariableCS)getRhsSym(3));\n                    setResult(result);\n          $EndCode\n        ./\n\n    IntegerLiteralExpCS ::= INTEGER_LITERAL\n        /.$BeginCode\n                    IntegerLiteralExpCS result = createIntegerLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    RealLiteralExpCS ::= REAL_LITERAL\n        /.$BeginCode\n                    RealLiteralExpCS result = createRealLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    StringLiteralExpCS ::= STRING_LITERAL\n        /.$BeginCode\n                    IToken literalToken = getRhsIToken(1);\n                    StringLiteralExpCS result = createStringLiteralExpCS(literalToken);\n                    setOffsets(result, literalToken);\n                    setResult(result);\n          $EndCode\n        ./\n    StringLiteralExpCS ::= StringLiteralExpCS STRING_LITERAL\n        /.$BeginCode\n                    StringLiteralExpCS string = (StringLiteralExpCS)getRhsSym(1);\n                    IToken literalToken = getRhsIToken(2);\n                    StringLiteralExpCS result = extendStringLiteralExpCS(string, literalToken);\n                    setOffsets(result, string, literalToken);\n                    setResult(result);\n          $EndCode\n        ./\n\n    BooleanLiteralExpCS ::= true\n        /.$BeginCode\n                    BooleanLiteralExpCS result = createBooleanLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n    BooleanLiteralExpCS ::= false\n        /.$BeginCode\n                    BooleanLiteralExpCS result = createBooleanLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    UnlimitedNaturalLiteralExpCS ::= '*'\n        /.$BeginCode\n                    UnlimitedNaturalLiteralExpCS result = createUnlimitedNaturalLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    InvalidLiteralExpCS ::= invalid\n        /.$BeginCode\n                    InvalidLiteralExpCS result = createInvalidLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n\n    NullLiteralExpCS ::= null\n        /.$BeginCode\n                    NullLiteralExpCS result = createNullLiteralExpCS(getRhsTokenText(1));\n                    setOffsets(result, getRhsIToken(1));\n                    setResult(result);\n          $EndCode\n        ./\n        \n    -- unqualified pathNameCS is parsed as SimpleNameExpCS\n    -- qualified pathNameCS is parsed as PropertyCallExpCS[C]\n    TypeLiteralExpCS ::= primitiveTypeCS\n        /.$NewCase./\n    TypeLiteralExpCS ::= collectionTypeCS\n        /.$NewCase./\n    TypeLiteralExpCS ::= tupleTypeCS\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(1);\n                    VariableExpCS result = createVariableExpCS(\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            null\n                        );\n                    setOffsets(result, simpleNameCS);\n                    setResult(result);\n          $EndCode\n        ./\n\n-----------------------------------------------------------------------\n--  Calls\n-----------------------------------------------------------------------         \n    CallExpCS -> FeatureCallExpCS\n    CallExpCS -> LoopExpCS\n\n    LoopExpCS -> IteratorExpCS\n    LoopExpCS -> IterateExpCS\n\n--  IteratorExpCS[A.1] is parsed as OperationCallExpCS[B]\n    IteratorExpCS ::=                          -- [A.2]\n        primaryExpCS '->' simpleNameCS\n        '(' uninitializedVariableCS '|' OclExpressionCS ')'\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IteratorExpCS result = createIteratorExpCS(\n                            source,\n                            simpleNameCS,\n                            (VariableCS)getRhsSym(5),\n                            null,\n                            (OCLExpressionCS)getRhsSym(7)\n                        );\n                    setOffsets(result, source, getRhsIToken(8));\n                    setResult(result);\n          $EndCode\n        ./\n    IteratorExpCS ::=                          -- [A.3.1]\n        primaryExpCS '->' simpleNameCS\n        '(' simpleNameCS ',' uninitializedVariableCS '|' OclExpressionCS ')'\n        /.$BeginCode\n                    SimpleNameCS name = (SimpleNameCS)getRhsSym(5);\n                    VariableCS variableCS = createVariableCS(name, null, null);\n                    setOffsets(variableCS, name);\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IteratorExpCS result = createIteratorExpCS(\n                            source,\n                            simpleNameCS,\n                            variableCS,\n                            (VariableCS)getRhsSym(7),\n                            (OCLExpressionCS)getRhsSym(9)\n                        );\n                    setOffsets(result, source, getRhsIToken(10));\n                    setResult(result);\n          $EndCode\n        ./\n    IteratorExpCS ::=                          -- [A.3.2]\n        primaryExpCS '->' simpleNameCS '(' typedUninitializedVariableCS ','\n        uninitializedVariableCS '|' OclExpressionCS ')'\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IteratorExpCS result = createIteratorExpCS(\n                            source,\n                            simpleNameCS,\n                            (VariableCS)getRhsSym(5),\n                            (VariableCS)getRhsSym(7),\n                            (OCLExpressionCS)getRhsSym(9)\n                        );\n                    setOffsets(result, source, getRhsIToken(10));\n                    setResult(result);\n          $EndCode\n        ./\n--  IteratorExpCS[B] is parsed as OperationCallExpCS[C]\n--  IteratorExpCS[C] is parsed as AssociationClassCallExpCS[A.1]\n--  IteratorExpCS[D] is parsed as AssociationClassCallExpCS[A]\n--  IteratorExpCS[E] is parsed as AssociationClassCallExpCS[A]\n\n    IterateExpCS ::= primaryExpCS '->' simpleNameCS\n        '(' typedInitializedVariableCS '|' OclExpressionCS ')'\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IterateExpCS result = createIterateExpCS(\n                            source,\n                            simpleNameCS,\n                            (VariableCS)getRhsSym(5),\n                            null,\n                            (OCLExpressionCS)getRhsSym(7)\n                        );\n                    setOffsets(result, source, getRhsIToken(8));\n                    setResult(result);\n          $EndCode\n        ./\n    IterateExpCS ::= primaryExpCS '->' simpleNameCS\n        '(' uninitializedVariableCS ';' typedInitializedVariableCS '|' OclExpressionCS ')'\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IterateExpCS result = createIterateExpCS(\n                            source,\n                            simpleNameCS,\n                            (VariableCS)getRhsSym(5),\n                            (VariableCS)getRhsSym(7),\n                            (OCLExpressionCS)getRhsSym(9)\n                        );\n                    setOffsets(result, source, getRhsIToken(10));\n                    setResult(result);\n          $EndCode\n        ./\n\n    FeatureCallExpCS -> OperationCallExpCS\n    FeatureCallExpCS -> PropertyCallExpCS\n    FeatureCallExpCS -> NavigationCallExpCS\n    \n--  OperationCallExpCS[A] is realized by the infix OclExpressionCS productions\n    OperationCallExpCS ::= -- [B.1]\n        primaryExpCS '->' simpleNameCS '(' ')'\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    OperationCallExpCS result = createArrowOperationCallExpCS(\n                            source,\n                            (SimpleNameCS)getRhsSym(3),\n                            null,\n                            new BasicEList<OCLExpressionCS>()\n                        );\n                    setOffsets(result, source, getRhsIToken(5));\n                    setResult(result);\n          $EndCode\n        ./  \n    OperationCallExpCS ::= -- [B.2],IteratorExpCS[A.1]\n        primaryExpCS '->' simpleNameCS '(' OclExpressionCS ')'\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    OCLExpressionCS arg = (OCLExpressionCS)getRhsSym(5);\n                    OCLExpressionCS result;\n                    if (isIterator(simpleNameCS.getValue())) {\n                        result = createIteratorExpCS(\n                                source,\n                                simpleNameCS,\n                                null,\n                                null,\n                                arg\n                            );\n                    }\n                    else {\n                        EList<OCLExpressionCS> args = new BasicEList<OCLExpressionCS>();\n                        args.add(arg);\n                        result = createArrowOperationCallExpCS(\n                                source,\n                                simpleNameCS,\n                                null,\n                                args\n                            );\n                    }\n                    setOffsets(result, source, getRhsIToken(6));\n                    setResult(result);\n          $EndCode\n        ./  \n    OperationCallExpCS ::= -- [B.3.1]\n        primaryExpCS '->' simpleNameCS '(' notNameExpressionCS ',' argumentsCS ')'\n        /.$BeginCode\n                    EList<OCLExpressionCS> args = (EList<OCLExpressionCS>)getRhsSym(7);\n                    args.add(0, (OCLExpressionCS)getRhsSym(5));\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    OperationCallExpCS result = createArrowOperationCallExpCS(\n                            source,\n                            (SimpleNameCS)getRhsSym(3),\n                            null,\n                            args\n                        );\n                    setOffsets(result, source, getRhsIToken(8));\n                    setResult(result);\n          $EndCode\n        ./  \n    OperationCallExpCS ::= -- [B.3.2]\n        primaryExpCS '->' simpleNameCS '(' simpleNameCS ',' argumentsCS ')'\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(5);\n                    OCLExpressionCS variableExpCS = createVariableExpCS(\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            null\n                        );\n                    setOffsets(variableExpCS, simpleNameCS);\n                    EList<OCLExpressionCS> args = (EList<OCLExpressionCS>)getRhsSym(7);\n                    args.add(0, variableExpCS);\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    OperationCallExpCS result = createArrowOperationCallExpCS(\n                            source,\n                            (SimpleNameCS)getRhsSym(3),\n                            null,\n                            args\n                        );\n                    setOffsets(result, source, getRhsIToken(8));\n                    setResult(result);\n          $EndCode\n        ./  \n    OperationCallExpCS ::=\n        primaryExpCS '.' conceptualOperationNameCS isMarkedPreCSopt '(' argumentsCSopt ')'\n        /.$NewCase./\n    OperationCallExpCS ::= -- [C],[E],IteratorExpCS[B]\n        primaryExpCS '.' simpleNameCS isMarkedPreCSopt '(' argumentsCSopt ')'\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    CallExpCS result = createDotOperationCallExpCS(\n                            source,\n                            null,\n                            simpleNameCS,\n                            (IsMarkedPreCS)getRhsSym(4),\n                            (EList<OCLExpressionCS>)getRhsSym(6)\n                        );\n                    setOffsets(result, source, getRhsIToken(7));\n                    setResult(result);\n          $EndCode\n        ./  \n    OperationCallExpCS ::= -- [D],[F],[G.1]\n        simpleNameCS isMarkedPreCSopt '(' argumentsCSopt ')'\n        /.$BeginCode\n                    OperationCallExpCS result = createDotOperationCallExpCS(\n                            null,\n                            null,\n                            (SimpleNameCS)getRhsSym(1),\n                            (IsMarkedPreCS)getRhsSym(2),\n                            (EList<OCLExpressionCS>)getRhsSym(4)\n                        );\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(5));\n                    setResult(result);\n          $EndCode\n        ./\n    OperationCallExpCS ::= -- [G.2]\n        pathNameCS '::' unreservedSimpleNameCS '(' argumentsCSopt ')'\n        /.$BeginCode\n                    PathNameCS pathNameCS = (PathNameCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    OperationCallExpCS result = createDotOperationCallExpCS(\n                            null,\n                            pathNameCS,\n                            simpleNameCS,\n                            null,\n                            (EList<OCLExpressionCS>)getRhsSym(5)\n                        );\n                    setOffsets(result, pathNameCS, getRhsIToken(6));\n                    setResult(result);\n          $EndCode\n        ./\n--  OperationCallExpCS[H] is realized by the prefix OclExpressionCS productions\n    OperationCallExpCS ::= -- [I],[J]   \n        primaryExpCS '.' pathNameCS '::' unreservedSimpleNameCS isMarkedPreCSopt\n        '(' argumentsCSopt ')'\n        /.$BeginCode\n                    PathNameCS pathNameCS = (PathNameCS)getRhsSym(3);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(5);\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    CallExpCS result = createDotOperationCallExpCS(\n                            source,\n                            pathNameCS,\n                            simpleNameCS,\n                            (IsMarkedPreCS)getRhsSym(6),\n                            (EList<OCLExpressionCS>)getRhsSym(8)\n                        );\n                    setOffsets(result, source, getRhsIToken(9));\n                    setResult(result);\n          $EndCode\n        ./\n            \n--  NavigationCallExpCS -> PropertyCallExpCS -- parsed as FeatureCallExpCS\n    NavigationCallExpCS -> AssociationClassCallExpCS\n        \n--  PropertyCallExpCS[A] is parsed as AssociationClassCallExpCS[A.1]\n--  PropertyCallExpCS[B.1] is parsed as a SimpleNameExpCS\n--  PropertyCallExpCS[B.2] is parsed as a AssociationClassCallExpCS[B.1]\n    PropertyCallExpCS ::= -- [C] excluding [B]\n        pathNameCS '::' unreservedSimpleNameCS isMarkedPreCSopt\n        /.$BeginCode\n                    PathNameCS pathNameCS = (PathNameCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)getRhsSym(4);\n                    FeatureCallExpCS result = createFeatureCallExpCS(\n                            null,\n                            pathNameCS,\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            isMarkedPreCS\n                        );\n                    if (isMarkedPreCS != null) {\n                        setOffsets(result, pathNameCS, isMarkedPreCS);\n                    } else {\n                        setOffsets(result, pathNameCS, simpleNameCS);\n                    }\n                    setResult(result);\n          $EndCode\n        ./\n    PropertyCallExpCS ::= -- [D]\n        primaryExpCS '.' pathNameCS '::' unreservedSimpleNameCS isMarkedPreCSopt\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    PathNameCS pathNameCS = (PathNameCS)getRhsSym(3);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(5);\n                    IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)getRhsSym(6);\n                    FeatureCallExpCS result = createFeatureCallExpCS(\n                            source,\n                            pathNameCS,\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            isMarkedPreCS\n                        );\n                    if (isMarkedPreCS != null) {\n                        setOffsets(result, source, isMarkedPreCS);\n                    } else {\n                        setOffsets(result, source, simpleNameCS);\n                    }\n                    setResult(result);\n          $EndCode\n        ./\n\n    AssociationClassCallExpCS ::= -- [A.1],PropertyCallExpCS[A],IteratorExpCS[C,D,E]\n        primaryExpCS '.' simpleNameCS isMarkedPreCSopt\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)getRhsSym(4);\n                    FeatureCallExpCS result = createFeatureCallExpCS(\n                            source,\n                            null,\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            isMarkedPreCS\n                        );\n                    if (isMarkedPreCS != null) {\n                        setOffsets(result, source, isMarkedPreCS);\n                    } else {\n                        setOffsets(result, source, simpleNameCS);\n                    }\n                    setResult(result);\n          $EndCode\n        ./\n    AssociationClassCallExpCS ::= -- [A.2],IteratorExpCS[D,E]\n        primaryExpCS '.' simpleNameCS '[' argumentsCS ']' isMarkedPreCSopt\n        /.$BeginCode\n                    OCLExpressionCS source = (OCLExpressionCS)getRhsSym(1);\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n                    IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)getRhsSym(7);\n                    FeatureCallExpCS result = createFeatureCallExpCS(\n                            source,\n                            null,\n                            simpleNameCS,\n                            (EList<OCLExpressionCS>)getRhsSym(5),\n                            isMarkedPreCS\n                        );\n                    if (isMarkedPreCS != null) {\n                        setOffsets(result, source, isMarkedPreCS);\n                    } else {\n                        setOffsets(result, source, getRhsIToken(6));\n                    }\n                    setResult(result);\n          $EndCode\n        ./\n--  AssociationClassCallExpCS[B.1.1] parsed as SimpleNameExpCS\n--  AssociationClassCallExpCS[B.1.2] is added by Complete OCL\n    AssociationClassCallExpCS ::=  -- [B.2]\n        simpleNameCS '[' argumentsCS ']' isMarkedPreCSopt\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(1);\n                    IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)getRhsSym(5);\n                    VariableExpCS result = createVariableExpCS(\n                            simpleNameCS,\n                            (EList<OCLExpressionCS>)getRhsSym(3),\n                            isMarkedPreCS\n                        );\n                    if (isMarkedPreCS != null) {\n                        setOffsets(result, simpleNameCS, isMarkedPreCS);\n                    } else {\n                        setOffsets(result, simpleNameCS, getRhsIToken(4));\n                    }\n                    setResult(result);\n          $EndCode\n        ./\n\n    isMarkedPreCSopt ::= %empty\n        /.$BeginCode\n                    setResult(null);\n          $EndCode\n        ./\n\n    argumentsCSopt ::= %empty\n        /.$BeginCode\n                    setResult(new BasicEList<OCLExpressionCS>());\n          $EndCode\n        ./\n    argumentsCSopt -> argumentsCS\n\n    argumentsCS ::= OclExpressionCS\n        /.$BeginCode\n                    EList<OCLExpressionCS> result = new BasicEList<OCLExpressionCS>();\n                    result.add((OCLExpressionCS)getRhsSym(1));\n                    setResult(result);\n          $EndCode\n        ./\n    argumentsCS ::= argumentsCS ',' OclExpressionCS\n        /.$BeginCode\n                    EList<OCLExpressionCS> result = (EList<OCLExpressionCS>)getRhsSym(1);\n                    result.add((OCLExpressionCS)getRhsSym(3));\n                    setResult(result);\n          $EndCode\n        ./\n\n-----------------------------------------------------------------------\n--  Expressions\n-----------------------------------------------------------------------\n    -- An OclExpressionCS comprising just a SimpleNameCS is kept separate as\n    --  SimpleNameExpCS to avoid ambiguity when parsing \"a->b(c,d\" until the next\n    --  letter resolves the usage as a two iterator  or as a two or more argument\n    --  OperationCallExpCS.\n    -- An OclExpressionCS comprising one or more LetExpCS is kept separate to ensure\n    --  that let is right associative, whereas infix operators are left associative.\n    --   a = 64 / 16 / let b : Integer in 8 / let c : Integer in 4 \n    -- is\n    --   a = (64 / 16) / (let b : Integer in 8 / (let c : Integer in 4 ))\n    OclExpressionCS -> notNameExpressionCS\n    OclExpressionCS -> SimpleNameExpCS\n        \n--  VariableExpCS[.1] simpleNameCS parsed as SimpleNameExpCS\n    VariableExpCS ::= -- [.2]\n        selfKeywordCS\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(1);\n                    VariableExpCS result = createVariableExpCS(\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            null\n                        );\n                    setOffsets(result, simpleNameCS);\n                    setResult(result);\n          $EndCode\n        ./\n        \n    SimpleNameExpCS ::= -- AssociationClassCallExpCS[B.1.1],\n                        -- PropertyCallExpCS[B],VariableExpCS[.1]\n        simpleNameCS\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(1);\n                    VariableExpCS result = createVariableExpCS(\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>(),\n                            null\n                        );\n                    setOffsets(result, simpleNameCS);\n                    setResult(result);\n          $EndCode\n        ./\n\n    notNameExpressionCS -> impliesNotNameNotLetCS\n    notNameExpressionCS -> impliesWithLetCS\n    \n    impliesNotLetCS -> impliesNotNameNotLetCS\n    impliesNotLetCS -> SimpleNameExpCS\n    impliesNotNameNotLetCS -> xorNotNameNotLetCS\n    impliesNotNameNotLetCS ::= impliesNotLetCS implies xorNotLetCS\n        /.$NewCase./\n    impliesWithLetCS -> xorWithLetCS\n    impliesWithLetCS ::= impliesNotLetCS implies xorWithLetCS\n        /.$NewCase./\n\n    xorNotLetCS -> xorNotNameNotLetCS\n    xorNotLetCS -> SimpleNameExpCS\n    xorNotNameNotLetCS -> orNotNameNotLetCS\n    xorNotNameNotLetCS ::= xorNotLetCS xor orNotLetCS\n        /.$NewCase./\n    xorWithLetCS -> orWithLetCS\n    xorWithLetCS ::= xorNotLetCS xor orWithLetCS\n        /.$NewCase./\n\n    orNotLetCS -> orNotNameNotLetCS\n    orNotLetCS -> SimpleNameExpCS\n    orNotNameNotLetCS -> andNotNameNotLetCS\n    orNotNameNotLetCS ::= orNotLetCS or andNotLetCS\n        /.$NewCase./\n    orWithLetCS -> andWithLetCS\n    orWithLetCS ::= orNotLetCS or andWithLetCS\n        /.$NewCase./\n\n    andNotLetCS -> andNotNameNotLetCS\n    andNotLetCS -> SimpleNameExpCS\n    andNotNameNotLetCS -> equalityNotNameNotLetCS\n    andNotNameNotLetCS ::= andNotLetCS and equalityNotLetCS\n        /.$NewCase./\n    andWithLetCS -> equalityWithLetCS\n    andWithLetCS ::= andNotLetCS and equalityWithLetCS\n        /.$NewCase./\n\n    equalityNotLetCS -> equalityNotNameNotLetCS\n    equalityNotLetCS -> SimpleNameExpCS\n    equalityNotNameNotLetCS -> relationalNotNameNotLetCS\n    equalityNotNameNotLetCS ::= equalityNotLetCS '=' relationalNotLetCS\n        /.$NewCase./\n    equalityNotNameNotLetCS ::= equalityNotLetCS '<>' relationalNotLetCS\n        /.$NewCase./\n    equalityWithLetCS -> relationalWithLetCS\n    equalityWithLetCS ::= equalityNotLetCS '=' relationalWithLetCS\n        /.$NewCase./\n    equalityWithLetCS ::= equalityNotLetCS '<>' relationalWithLetCS\n        /.$NewCase./\n    \n    relationalNotLetCS -> relationalNotNameNotLetCS\n    relationalNotLetCS -> SimpleNameExpCS\n    relationalNotNameNotLetCS -> additiveNotNameNotLetCS\n    relationalNotNameNotLetCS ::= relationalNotLetCS '>' additiveNotLetCS\n        /.$NewCase./\n    relationalNotNameNotLetCS ::= relationalNotLetCS '<' additiveNotLetCS\n        /.$NewCase./\n    relationalNotNameNotLetCS ::= relationalNotLetCS '>=' additiveNotLetCS\n        /.$NewCase./\n    relationalNotNameNotLetCS ::= relationalNotLetCS '<=' additiveNotLetCS\n        /.$NewCase./\n    relationalWithLetCS -> additiveWithLetCS\n    relationalWithLetCS ::= relationalNotLetCS '>' additiveWithLetCS\n        /.$NewCase./\n    relationalWithLetCS ::= relationalNotLetCS '<' additiveWithLetCS\n        /.$NewCase./\n    relationalWithLetCS ::= relationalNotLetCS '>=' additiveWithLetCS\n        /.$NewCase./\n    relationalWithLetCS ::= relationalNotLetCS '<=' additiveWithLetCS\n        /.$NewCase./\n\n    additiveNotLetCS -> additiveNotNameNotLetCS\n    additiveNotLetCS -> SimpleNameExpCS\n    additiveNotNameNotLetCS -> multiplicativeNotNameNotLetCS\n    additiveNotNameNotLetCS ::= additiveNotLetCS '+' multiplicativeNotLetCS\n        /.$NewCase./\n    additiveNotNameNotLetCS ::= additiveNotLetCS '-' multiplicativeNotLetCS\n        /.$NewCase./\n    additiveWithLetCS -> multiplicativeWithLetCS\n    additiveWithLetCS ::= additiveNotLetCS '+' multiplicativeWithLetCS\n        /.$NewCase./\n    additiveWithLetCS ::= additiveNotLetCS '-' multiplicativeWithLetCS\n        /.$NewCase./\n    \n    multiplicativeNotLetCS -> multiplicativeNotNameNotLetCS\n    multiplicativeNotLetCS -> SimpleNameExpCS\n    multiplicativeNotNameNotLetCS -> unaryNotNameNotLetCS\n    multiplicativeNotNameNotLetCS ::= multiplicativeNotLetCS '*' unaryNotLetCS\n        /.$NewCase./\n    multiplicativeNotNameNotLetCS ::= multiplicativeNotLetCS '/' unaryNotLetCS\n        /.$NewCase./\n    multiplicativeWithLetCS -> unaryWithLetCS\n    multiplicativeWithLetCS ::= multiplicativeNotLetCS '*' unaryWithLetCS\n        /.$NewCase./\n    multiplicativeWithLetCS ::= multiplicativeNotLetCS '/' unaryWithLetCS\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = createSimpleNameCS(\n                                SimpleTypeEnum.KEYWORD_LITERAL,\n                                getRhsIToken(2)\n                            );\n                    setOffsets(simpleNameCS, getRhsIToken(2));\n                    OCLExpressionCS left = (OCLExpressionCS)getRhsSym(1);\n                    OCLExpressionCS right = (OCLExpressionCS)getRhsSym(3);\n                    EList<OCLExpressionCS> args = new BasicEList<OCLExpressionCS>();\n                    args.add(right);\n                    OperationCallExpCS result = createOperationCallExpCS(\n                            left,\n                            simpleNameCS,\n                            args\n                        );\n                    setOffsets(result, left, right);\n                    setResult(result);\n          $EndCode\n        ./\n    \n    unaryNotLetCS -> unaryNotNameNotLetCS\n    unaryNotLetCS -> SimpleNameExpCS\n    unaryNotNameNotLetCS -> primaryNotNameCS\n    unaryNotNameNotLetCS ::= '-' unaryNotLetCS\n        /.$NewCase./\n    unaryNotNameNotLetCS ::= not unaryNotLetCS\n        /.$NewCase./\n    unaryWithLetCS -> LetExpCS             -- OclExpressionCS[D]\n    unaryWithLetCS ::= '-' unaryWithLetCS\n        /.$NewCase./\n    unaryWithLetCS ::= not unaryWithLetCS\n        /.$BeginCode\n                    SimpleNameCS simpleNameCS = createSimpleNameCS(\n                                SimpleTypeEnum.KEYWORD_LITERAL,\n                                getRhsIToken(1)\n                            );\n                    setOffsets(simpleNameCS, getRhsIToken(1));\n                    OCLExpressionCS expr = (OCLExpressionCS)getRhsSym(2);\n                    OperationCallExpCS result = createOperationCallExpCS(\n                            expr,\n                            simpleNameCS,\n                            new BasicEList<OCLExpressionCS>()\n                        );\n                    setOffsets(result, simpleNameCS, expr);\n                    setResult(result);\n          $EndCode\n        ./\n\n    primaryExpCS -> primaryNotNameCS\n    primaryExpCS -> SimpleNameExpCS\n    \n    primaryNotNameCS -> CallExpCS       -- OclExpressionCS[A]\n    primaryNotNameCS -> VariableExpCS   -- OclExpressionCS[B]\n    primaryNotNameCS -> LiteralExpCS    -- OclExpressionCS[C]\n--  primaryNotNameCS -> OclMessageExpCS -- OclExpressionCS[E] is added by Complete OCL\n    primaryNotNameCS -> IfExpCS         -- OclExpressionCS[F]\n    primaryNotNameCS ::= '(' OclExpressionCS ')'\n        /.$BeginCode\n                    OCLExpressionCS result = (OCLExpressionCS)getRhsSym(2);\n                    if (result instanceof OperationCallExpCS) {\n                        ((OperationCallExpCS)result).setIsAtomic(true);\n                    }\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(3));\n                    setResult(result);\n          $EndCode\n        ./\n\n    IfExpCS ::= if OclExpressionCS then OclExpressionCS else OclExpressionCS endif\n        /.$BeginCode\n                    IfExpCS result = createIfExpCS(\n                            (OCLExpressionCS)getRhsSym(2),\n                            (OCLExpressionCS)getRhsSym(4),\n                            (OCLExpressionCS)getRhsSym(6)\n                        );\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(7));\n                    setResult(result);\n          $EndCode\n        ./\n\n    LetExpCS ::= let letVariablesCS in OclExpressionCS\n        /.$BeginCode\n                    OCLExpressionCS expr = (OCLExpressionCS)getRhsSym(4);\n                    LetExpCS result = createLetExpCS(\n                            (EList<VariableCS>)getRhsSym(2),\n                            expr\n                        );\n                    setOffsets(result, getRhsIToken(1), expr);\n                    setResult(result);\n          $EndCode\n        ./\n    \n    letVariablesCS ::= typedInitializedVariableCS \n        /.$BeginCode\n                    EList<VariableCS> result = new BasicEList<VariableCS>();\n                    result.add((VariableCS)getRhsSym(1));\n                    setResult(result);\n          $EndCode\n        ./\n    letVariablesCS ::= letVariablesCS ',' typedInitializedVariableCS\n        /.$BeginCode\n                    EList<VariableCS> result = (EList<VariableCS>)getRhsSym(1);\n                    result.add((VariableCS)getRhsSym(3));\n                    setResult(result);\n          $EndCode\n        ./\n%End\n", "meta": {"hexsha": "e5c221f3e2f137498c808654de8e7a03975adbbb", "size": 58559, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/parser/EssentialOCL.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/parser/EssentialOCL.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/parser/EssentialOCL.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.5668918919, "max_line_length": 113, "alphanum_fraction": 0.541556379, "num_tokens": 12656, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1732882016598637, "lm_q2_score": 0.015663646931101616, "lm_q1q2_score": 0.002714325208125642}}
{"text": "--\n-- An instance of this template must have a %Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     %eof_token\n--     %additional_interfaces\n--     %super_stream_class -- subclass com.ibm.lpg.Utf8LpgLexStream for getKind\n--     %prs_stream_class -- use /.PrsStream./ if not subclassing\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateD\n--\n%Options programming_Language=typescript,margin=4\n%Options table\n%options action-block=(\"*.ts\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.%_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.%file_prefix%Utf8LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.Object./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule %rule_number:  %rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.%Header%case %rule_number: { ./\n\n    $BeginAction /.%DefaultAction./\n\n    $EndAction\n    /.          break;\n                }./\n\n    $BeginJava\n    /.%BeginAction\n                %symbol_declarations./\n\n    $EndJava /.%EndAction./\n\n    $NoAction\n    /.%Header%case %rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n        public void ruleAction( ruleNumber : number )\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n\t            default:\n\t                ruleAction%rule_number(ruleNumber);\n\t                break;\n\t        }\n\t        return;\n\t    }\n\t\n\t    public void ruleAction%rule_number(ruleNumber : number )\n\t    {\n\t        switch (ruleNumber)\n\t        {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.\n    import { RuleAction, ParseTable, LexParser, ILexStream, IPrsStream, Monitor, LpgLexStream } from \"lpg2ts\";\n    ./\n%End\n\n%Headers\n    /.\n    export class %action_type extends %super_class implements RuleAction%additional_interfaces\n    {\n        private %super_stream_class utf8LexStream;\n        \n        private static ParseTable prs = new %prs_type();\n        public ParseTable getParseTable() { return prs; }\n\n        private LexParser lexParser = new LexParser();\n        public LexParser getParser() { return lexParser; }\n\n        public number getToken(i : number) { return lexParser.getToken(i); }\n        public number getRhsFirstTokenIndex(i : number) { return lexParser.getFirstToken(i); }\n        public number getRhsLastTokenIndex(i : number) { return lexParser.getLastToken(i); }\n\n        public number getLeftSpan() { return lexParser.getToken(1); }\n        public number getRightSpan() { return lexParser.getLastToken(); }\n  \n        public void resetKeywordLexer()\n        {\n            if (!this.kwLexer)\n                  this.kwLexer = new %kw_lexer_class(utf8LexStream.getInputBytes(), %_IDENTIFIER);\n            else this.kwLexer.setInputBytes(utf8LexStream.getInputBytes());\n        }\n  \n        public void reset(filename : string, number tab) \n        {\n            utf8LexStream = new %super_stream_class(filename, tab);\n            lexParser.reset((ILexStream) utf8LexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n\n        public void reset(byte[] input_bytes, filename : string)\n        {\n            reset(input_bytes, filename, 1);\n        }\n        \n        public void reset(byte[] input_bytes, filename : string, number tab)\n        {\n            utf8LexStream = new %super_stream_class(input_bytes, filename, tab);\n            lexParser.reset((ILexStream) utf8LexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n        \n        public %action_type(filename : string, number tab) \n        {\n            reset(filename, tab);\n        }\n\n        public %action_type(byte[] input_bytes, filename : string, number tab)\n        {\n            reset(input_bytes, filename, tab);\n        }\n\n        public %action_type(byte[] input_bytes, filename : string)\n        {\n            reset(input_bytes, filename, 1);\n        }\n\n        public %action_type() {}\n\n        public ILexStream getILexStream() { return utf8LexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public ILexStream getLexStream() { return utf8LexStream; }\n\n        private void initializeLexer(%prs_stream_class this.prsStream, number start_offset, number end_offset)\n        {\n            if (utf8LexStream.getInputBytes() == null)\n                throw new ReferenceError(\"LexStream was not initialized\");\n            utf8LexStream.setPrsStream(this.prsStream);\n            this.prsStream.makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n        public void lexer(%prs_stream_class this.prsStream)\n        {\n            lexer(null, this.prsStream);\n        }\n        \n        public void lexer(Monitor monitor, %prs_stream_class this.prsStream)\n        {\n            if (utf8LexStream.getInputBytes() == null)\n                throw new ReferenceError(\"Utf8LexStream was not initialized\");\n\n            utf8LexStream.setPrsStream(this.prsStream);\n\n            this.prsStream.makeToken(0, 0, 0); // Token list must start with a bad token\n                \n            lexParser.parseCharacters(monitor);  // Lex the input characters\n                \n            i : number = utf8LexStream.getStreamIndex();\n            this.prsStream.makeToken(i, i, %eof_token); // and end with the end of file token\n            this.prsStream.setStreamLength(this.prsStream.getSize());\n                \n            return;\n        }\n    ./\n%End\n\n%Rules\n    /.%BeginActions./\n%End\n\n%Trailers\n    /.\n        %EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "0466eeebf973b47d1a1406b10e4092aaeb015b5f", "size": 6266, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/Utf8LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/Utf8LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/Utf8LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.4824561404, "max_line_length": 110, "alphanum_fraction": 0.5863389722, "num_tokens": 1475, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09401017961657226, "lm_q2_score": 0.028870910288603963, "lm_q1q2_score": 0.0027141594619256026}}
{"text": "--\n-- An instance of this template must have a $Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--     $super_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateF\n--\n%Options programming_language=rt_cpp,margin=4\n%Options table\n%options action-block=(\"*.h\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.$_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.$file_prefix$LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.Object./\n\n    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream\n                  getPrsStream()./\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n               lexParser->setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 lexParser->setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getLastToken\n              lexParser->getSym./\n    $getToken /. // macro getToken is deprecated. Use function getToken\n                lexParser->getToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   lexParser->getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    lexParser->getLastToken./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.$Header$case $rule_number: { ./\n\n    $BeginAction /.$DefaultAction./\n\n    $EndAction\n    /.            break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n         void ruleAction(int ruleNumber)\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n                    default:\n                        ruleAction$rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n\n             void ruleAction$rule_number(int ruleNumber)\n            {\n                switch (ruleNumber)\n                {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.\n    ./\n%End\n\n%Headers\n    /.\n    #pragma once  \n    #include <iostream>\n    #include \"IPrsStream.h\"\n    #include \"Object.h\"\n    #include \"ParseTable.h\"\n    #include \"RuleAction.h\"\n    #include \"stringex.h\"\n    #include \"Token.h\"\n    #include \"$sym_type.h\"\n    #include \"$prs_type.h\"\n    #include \"$kw_lexer_class.h\"\n    #include \"LexParser.h\"\n    #include \"LpgLexStream.h\"\n     struct $action_type :public $super_class ,public RuleAction$additional_interfaces\n    {\n         struct  $super_stream_class;\n         $super_stream_class * lexStream = nullptr;\n        \n        ~$action_type(){\n            delete lexStream;\n            delete lexParser;\n        }\n\n         inline  static ParseTable* prs = new $prs_type();\n         ParseTable* getParseTable() { return prs; }\n\n         LexParser* lexParser = new LexParser();\n         LexParser* getParser() { return lexParser; }\n\n         int getToken(int i) { return lexParser->getToken(i); }\n         int getRhsFirstTokenIndex(int i) { return lexParser->getFirstToken(i); }\n         int getRhsLastTokenIndex(int i) { return lexParser->getLastToken(i); }\n\n         int getLeftSpan() { return lexParser->getToken(1); }\n         int getRightSpan() { return lexParser->getLastToken(); }\n  \n         void resetKeywordLexer()\n        {\n            if (kwLexer == nullptr)\n                  this->kwLexer = new $kw_lexer_class(lexStream->getInputChars(), $_IDENTIFIER);\n            else this->kwLexer->setInput(lexStream->getInputChars());\n        }\n  \n         void reset(const std::wstring& filename, int tab) \n        {\n            delete lexStream;\n            lexStream = new $super_stream_class(filename, tab);\n            lexParser->reset((ILexStream*) lexStream, prs,  this);\n            resetKeywordLexer();\n        }\n\n         void reset(shared_ptr_wstring input_chars, const std::wstring& filename)\n        {\n            reset(input_chars, filename, 1);\n        }\n        \n         void reset(shared_ptr_wstring input_chars, const std::wstring& filename, int tab)\n        {\n             delete lexStream;\n            lexStream = new $super_stream_class(input_chars, filename, tab);\n            lexParser->reset((ILexStream*) lexStream, prs,  this);\n            resetKeywordLexer();\n        }\n        \n         $action_type(const std::wstring& filename, int tab) \n        {\n            reset(filename, tab);\n        }\n\n         $action_type(shared_ptr_wstring input_chars, const std::wstring& filename, int tab)\n        {\n            reset(input_chars, filename, tab);\n        }\n\n         $action_type(shared_ptr_wstring input_chars, const std::wstring& filename)\n        {\n            reset(input_chars, filename, 1);\n        }\n\n         $action_type() {}\n\n         ILexStream* getILexStream() { return lexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n         ILexStream* getLexStream() { return lexStream; }\n\n         void initializeLexer($prs_stream_class *prsStream, int start_offset, int end_offset)\n        {\n            if (!lexStream->getInputChars())\n                throw  std::exception(\"LexStream was not initialized\");\n            lexStream->setPrsStream(prsStream);\n            prsStream->makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n         void addEOF($prs_stream_class *prsStream, int end_offset)\n        {\n            prsStream->makeToken(end_offset, end_offset, $eof_token); // and end with the end of file token\n            prsStream->setStreamLength(prsStream->getSize());\n        }\n\n         void lexer($prs_stream_class *prsStream)\n        {\n            lexer(nullptr, prsStream);\n        }\n        \n         void lexer(Monitor *monitor, $prs_stream_class *prsStream)\n        {\n            initializeLexer(prsStream, 0, -1);\n            lexParser->parseCharacters(monitor);  // Lex the input characters\n            addEOF(prsStream, lexStream->getStreamIndex());\n        }\n\n         void lexer($prs_stream_class *prsStream, int start_offset, int end_offset)\n        {\n            lexer(nullptr, prsStream, start_offset, end_offset);\n        }\n        \n         void lexer(Monitor* monitor, $prs_stream_class *prsStream, int start_offset, int end_offset)\n        {\n            if (start_offset <= 1)\n                 initializeLexer(prsStream, 0, -1);\n            else initializeLexer(prsStream, start_offset - 1, start_offset - 1);\n\n            lexParser->parseCharacters(monitor, start_offset, end_offset);\n\n            addEOF(prsStream, (end_offset >= lexStream->getStreamIndex() ? lexStream->getStreamIndex() : end_offset + 1));\n        }\n        \n         IPrsStream::Range *incrementalLexer(shared_ptr_wstring input_chars, int start_change_offset, int end_change_offset) {\n            int offset_adjustment = input_chars.size() - lexStream->getStreamLength();\n//*System.out.println(\"The offset adjustment is \" + offset_adjustment);\n            if (start_change_offset <= 0 && start_change_offset < input_chars.size())\n            {\n                std::string str = \"The start offset \";\n                std::stringex format;\n                format.format(\"%d\", (start_change_offset));\n                str += format;\n                str += \" is out of bounds for range 0..\";\n                format.format(\"%d\", (input_chars.size() - 1));\n                str += format;\n                throw  std::out_of_range(str);\n            }\n        \n            if (end_change_offset <= 0 && end_change_offset < input_chars.size())\n            {\n                std::string str = \"The end offset \";\n                std::stringex format;\n                format.format(\"%d\", (end_change_offset));\n                str += format;\n                str += \" is out of bounds for range 0..\";\n                format.format(\"%d\", (input_chars.size() - 1));\n                str += format;\n            }\n            //\n            // Get the potential list of tokens to be rescanned\n            //\n           Tuple<IToken*> affected_tokens = lexStream->getIPrsStream()->incrementalResetAtCharacterOffset(start_change_offset); \n            \n            //\n            // If the change occured between the first two affected tokens (or adjunct) and not immediately\n            // on the characted after the first token (or adjunct), restart the scanning after the first\n            // affected token. Otherwise, rescan the first token.\n            //\n            int affected_index = 0;\n            int repair_offset = start_change_offset;\n            if (affected_tokens.size() > 0) {\n                auto _token_0 = affected_tokens.get(0);\n                if (_token_0->getEndOffset() + 1 < start_change_offset) \n                {\n                     repair_offset = _token_0->getEndOffset() + 1;\n                     if (dynamic_cast<Token*>(_token_0))\n                    {  \n                           lexStream->getIPrsStream()->makeToken(_token_0, 0);\n                    }\n                    else {\n                            lexStream->getIPrsStream()->makeAdjunct(_token_0, 0);\n                    }\n\n                    affected_index++;                    \n                }\n                else \n                {\n                    repair_offset = _token_0->getStartOffset();\n                }\n            } \n\n            lexStream->setInputChars(input_chars);\n            lexStream->setStreamLength(input_chars.size());\n            lexStream->computeLineOffsets(repair_offset);\n\n            int first_new_token_index = lexStream->getIPrsStream()->getTokens().size(),\n                first_new_adjunct_index = lexStream->getIPrsStream()->getAdjuncts().size();\n            \n            resetKeywordLexer();\n            lexParser->resetTokenStream(repair_offset);\n            int next_offset;\n            do {\n//*System.out.println(\"Scanning token starting at \" + (lexStream->peek() - 1));            \n                next_offset = lexParser->incrementalParseCharacters();\n//*System.out.print(\"***Remaining string: \\\"\");\n//*for (int i = next_offset; i < input_chars.length; i++)\n//*System.out.print(input_chars[i]);\n//*System.out.println(\"\\\"\");                    \n                while (affected_index < affected_tokens.size() && \n                       affected_tokens.get(affected_index)->getStartOffset() + offset_adjustment < next_offset)\n//*{\n//*System.out.println(\"---Skipping token \" + affected_index + \": \\\"\" + affected_tokens.get(affected_index).toString() +\n//*\"\\\" starting at adjusted offset \" + (affected_tokens.get(affected_index).getStartOffset() + offset_adjustment));                           \n                    affected_index++;\n//*}\n            } while(next_offset <= end_change_offset &&          // still in the damage region and ...\n                    (affected_index < affected_tokens.size() &&  // not resynchronized with a token in the list of affected tokens\n                     affected_tokens.get(affected_index)->getStartOffset() + offset_adjustment != next_offset));\n\n            //\n            // If any new tokens were added, compute the first and the last one.\n            //\n            IToken* first_new_token = nullptr;\n              IToken*      last_new_token = nullptr;\n            if (first_new_token_index < lexStream->getIPrsStream()->getTokens().size()) {\n                first_new_token = lexStream->getIPrsStream()->getTokenAt(first_new_token_index);\n                last_new_token = lexStream->getIPrsStream()->getTokenAt(lexStream->getIPrsStream()->getTokens().size() - 1);\n            }\n            //\n            // If an adjunct was added prior to the first real token, chose it instead as the first token.\n            // Similarly, if adjucts were added after the last token, chose the last adjunct added as the last token.\n            //\n            if (first_new_adjunct_index < lexStream->getIPrsStream()->getAdjuncts().size()) {\n                if (first_new_token == nullptr ||\n                    lexStream->getIPrsStream()->getAdjunctAt(first_new_adjunct_index)->getStartOffset() <\n                    first_new_token->getStartOffset()) {\n                    first_new_token = lexStream->getIPrsStream()->getAdjunctAt(first_new_adjunct_index);\n                }\n                if (last_new_token == nullptr ||\n                    lexStream->getIPrsStream()->getAdjunctAt(lexStream->getIPrsStream()->getAdjuncts().size() - 1)->getEndOffset() >\n                    last_new_token->getEndOffset()) {\n                    last_new_token = lexStream->getIPrsStream()->getAdjunctAt(lexStream->getIPrsStream()->getAdjuncts().size() - 1);\n                }\n            }\n            \n            //\n            // For all remainng tokens (and adjuncts) in the list of affected tokens add them to the\n            // list of tokens (and adjuncts).\n            //\n            for (int i = affected_index; i < affected_tokens.size(); i++) {\n                if ( dynamic_cast< Token*>(affected_tokens.get(i)) )\n                     lexStream->getIPrsStream()->makeToken(affected_tokens.get(i), offset_adjustment);\n                else lexStream->getIPrsStream()->makeAdjunct(affected_tokens.get(i), offset_adjustment);\n//*System.out.println(\"+++Added affected token \" + i + \": \\\"\" + affected_tokens.get(i).toString() +\n//*\"\\\" starting at adjusted offset \" + (affected_tokens.get(i).getStartOffset() + offset_adjustment));                           \n            }\n            \n            return new IPrsStream::Range(lexStream->getIPrsStream(), first_new_token, last_new_token);\n        }\n\n        /**\n         * If a parse stream was not passed to this Lexical analyser then we\n         * simply report a lexical error. Otherwise, we produce a bad token.\n         */\n         void reportLexicalError(int startLoc, int endLoc) {\n            IPrsStream* prs_stream = lexStream->getIPrsStream();\n            if (prs_stream == nullptr)\n                lexStream->reportLexicalError(startLoc, endLoc);\n            else {\n                //\n                // Remove any token that may have been processed that fall in the\n                // range of the lexical error... then add one error token that spans\n                // the error range.\n                //\n                for (int i = prs_stream->getSize() - 1; i > 0; i--) {\n                    if (prs_stream->getStartOffset(i) >= startLoc)\n                         prs_stream->removeLastToken();\n                    else break;\n                }\n                prs_stream->makeToken(startLoc, endLoc, 0); // add an error token to the prsStream\n            }        \n        }\n    ./\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    };\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "fd3d43838b7700803825a5cfd2569acf3cb3b35e", "size": 15812, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/rt_cpp/LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/rt_cpp/LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/rt_cpp/LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.2047058824, "max_line_length": 142, "alphanum_fraction": 0.5607133822, "num_tokens": 3509, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1066906024668249, "lm_q2_score": 0.025178838957499283, "lm_q1q2_score": 0.0026863454977907597}}
{"text": "--\n-- An instance of this template must have a $Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass com.ibm.lpg.Utf8LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateD\n--\n%Options programming_language=rt_cpp,margin=4\n%Options table\n%options action-block=(\"*.h\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.$_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.$file_prefix$Utf8LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.Object./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.$Header$case $rule_number: { ./\n\n    $BeginAction /.$DefaultAction./\n\n    $EndAction\n    /.          break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n         void ruleAction( int ruleNumber)\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n\t            default:\n\t                ruleAction$rule_number(ruleNumber);\n\t                break;\n\t        }\n\t        return;\n\t    }\n\t\n\t     void ruleAction$rule_number(int ruleNumber)\n\t    {\n\t        switch (ruleNumber)\n\t        {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.\n    ./\n%End\n\n%Headers\n    /.\n\t#pragma once  \n    #include <iostream>\n    #include \"IPrsStream.h\"\n    #include \"Object.h\"\n    #include \"ParseTable.h\"\n    #include \"RuleAction.h\"\n    #include \"stringex.h\"\n    #include \"Token.h\"\n    #include \"$sym_type.h\"\n    #include \"$prs_type.h\"\n    #include \"$kw_lexer_class.h\"\n    #include \"LexParser.h\"\n    #include \"Utf8LpgLexStream.h\"\n    struct $action_type :public $super_class,  public RuleAction$additional_interfaces\n    {\n\t\tstruct  $super_stream_class;\n         $super_stream_class *lexStream= nullptr;\n        ~$action_type(){\n            delete lexStream;\n            delete lexParser;\n        }\n         inline  static ParseTable* prs = new $prs_type();\n         ParseTable* getParseTable() { return prs; }\n\n         LexParser* lexParser = new LexParser();\n         LexParser* getParser() { return lexParser; }\n\n         int getToken(int i) { return lexParser->getToken(i); }\n         int getRhsFirstTokenIndex(int i) { return lexParser->getFirstToken(i); }\n         int getRhsLastTokenIndex(int i) { return lexParser->getLastToken(i); }\n\n         int getLeftSpan() { return lexParser->getToken(1); }\n         int getRightSpan() { return lexParser->getLastToken(); }\n  \n         void resetKeywordLexer()\n        {\n            if (kwLexer == nullptr)\n                  this->kwLexer = new $kw_lexer_class(lexStream->getInputBytes(), $_IDENTIFIER);\n            else this->kwLexer->setInput(lexStream->getInputBytes());\n        }\n  \n         void reset(const std::wstring&  filename, int tab) \n        {\n\t\t\tdelete lexStream;\n            lexStream = new $super_stream_class(filename, tab);\n            lexParser->reset((ILexStream*) lexStream, prs,this);\n            resetKeywordLexer();\n        }\n\n         void reset(shared_ptr_string input_bytes, const std::wstring& filename)\n        {\n            reset(input_bytes, filename, 1);\n        }\n        \n         void reset(shared_ptr_string input_bytes, const std::wstring& filename, int tab)\n        {\n            lexStream = new $super_stream_class(input_bytes, filename, tab);\n            lexParser->reset((ILexStream*) lexStream, prs,  this);\n            resetKeywordLexer();\n        }\n        \n         $action_type(const std::wstring& filename, int tab) \n        {\n            reset(filename, tab);\n        }\n\n         $action_type(shared_ptr_string input_bytes, const std::wstring&  filename, int tab)\n        {\n            reset(input_bytes, filename, tab);\n        }\n\n         $action_type(shared_ptr_string input_bytes, const std::wstring&  filename)\n        {\n            reset(input_bytes, filename, 1);\n        }\n\n         $action_type() {}\n\n         ILexStream* getILexStream() { return lexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n         ILexStream* getLexStream() { return lexStream; }\n\n         void initializeLexer($prs_stream_class * prsStream, int start_offset, int end_offset)\n        {\n            if (lexStream->getInputBytes().size() == 0)\n                throw  std::exception(\"LexStream was not initialized\");\n            lexStream->setPrsStream(prsStream);\n            prsStream->makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n         void lexer($prs_stream_class* prsStream)\n        {\n            lexer(nullptr, prsStream);\n        }\n        \n         void lexer(Monitor* monitor, $prs_stream_class* prsStream)\n        {\n            if (lexStream->getInputBytes().size() == 0)\n                  throw  std::exception(\"lexStream was not initialized\");\n\n            lexStream->setPrsStream(prsStream);\n\n            prsStream->makeToken(0, 0, 0); // Token list must start with a bad token\n                \n            lexParser->parseCharacters(monitor);  // Lex the input characters\n                \n            int i = lexStream->getStreamIndex();\n            prsStream->makeToken(i, i, $eof_token); // and end with the end of file token\n            prsStream->setStreamLength(prsStream->getSize());\n                \n            return;\n        }\n    ./\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    };\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "15413aa56e3cebc98c9fe5eea384e9c5e1cc67d7", "size": 6440, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/rt_cpp/Utf8LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/rt_cpp/Utf8LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/rt_cpp/Utf8LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.2857142857, "max_line_length": 104, "alphanum_fraction": 0.5675465839, "num_tokens": 1570, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08269733589276139, "lm_q2_score": 0.03067580459071375, "lm_q1q2_score": 0.002536807316018967}}
{"text": "%Headers\n    --\n    -- Additional methods for the action class not provided in the template\n    --\n\n\t-- [cwd] Template provided by LPG defines a constructor that uses an Option\n\t--       class that does not exist in LPG Runtime.  Deleted this constructor\n\n    /.\n        final void makeToken(int kind)\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan();\n            makeToken(startOffset, endOffset, kind);\n            if (printTokens) printValue(startOffset, endOffset);\n        }\n\n        final void makeComment(int kind)\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan();\n            super.getIPrsStream().makeAdjunct(startOffset, endOffset, kind);\n        }\n\n        final void skipToken()\n        {\n            if (printTokens) printValue(getLeftSpan(), getRightSpan());\n        }\n\n        final void checkForKeyWord()\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan(),\n            kwKind = kwLexer.lexer(startOffset, endOffset);\n            makeToken(startOffset, endOffset, kwKind);\n            if (printTokens) printValue(startOffset, endOffset);\n        }\n\n        final void printValue(int startOffset, int endOffset)\n        {\n            String s = new String(getInputChars(), startOffset, endOffset - startOffset + 1);\n            System.out.print(s);\n        }\n\n        //\n        //\n        //\n        public final static int tokenKind[] =\n        {\n            Char_CtlCharNotWS,    // 000    0x00\n            Char_CtlCharNotWS,    // 001    0x01\n            Char_CtlCharNotWS,    // 002    0x02\n            Char_CtlCharNotWS,    // 003    0x03\n            Char_CtlCharNotWS,    // 004    0x04\n            Char_CtlCharNotWS,    // 005    0x05\n            Char_CtlCharNotWS,    // 006    0x06\n            Char_CtlCharNotWS,    // 007    0x07\n            Char_CtlCharNotWS,    // 008    0x08\n            Char_HT,              // 009    0x09\n            Char_LF,              // 010    0x0A\n            Char_CtlCharNotWS,    // 011    0x0B\n            Char_FF,              // 012    0x0C\n            Char_CR,              // 013    0x0D\n            Char_CtlCharNotWS,    // 014    0x0E\n            Char_CtlCharNotWS,    // 015    0x0F\n            Char_CtlCharNotWS,    // 016    0x10\n            Char_CtlCharNotWS,    // 017    0x11\n            Char_CtlCharNotWS,    // 018    0x12\n            Char_CtlCharNotWS,    // 019    0x13\n            Char_CtlCharNotWS,    // 020    0x14\n            Char_CtlCharNotWS,    // 021    0x15\n            Char_CtlCharNotWS,    // 022    0x16\n            Char_CtlCharNotWS,    // 023    0x17\n            Char_CtlCharNotWS,    // 024    0x18\n            Char_CtlCharNotWS,    // 025    0x19\n            Char_CtlCharNotWS,    // 026    0x1A\n            Char_CtlCharNotWS,    // 027    0x1B\n            Char_CtlCharNotWS,    // 028    0x1C\n            Char_CtlCharNotWS,    // 029    0x1D\n            Char_CtlCharNotWS,    // 030    0x1E\n            Char_CtlCharNotWS,    // 031    0x1F\n            Char_Space,           // 032    0x20\n            Char_Exclamation,     // 033    0x21\n            Char_DoubleQuote,     // 034    0x22\n            Char_Sharp,           // 035    0x23\n            Char_DollarSign,      // 036    0x24\n            Char_Percent,         // 037    0x25\n            Char_Ampersand,       // 038    0x26\n            Char_SingleQuote,     // 039    0x27\n            Char_LeftParen,       // 040    0x28\n            Char_RightParen,      // 041    0x29\n            Char_Star,            // 042    0x2A\n            Char_Plus,            // 043    0x2B\n            Char_Comma,           // 044    0x2C\n            Char_Minus,           // 045    0x2D\n            Char_Dot,             // 046    0x2E\n            Char_Slash,           // 047    0x2F\n            Char_0,               // 048    0x30\n            Char_1,               // 049    0x31\n            Char_2,               // 050    0x32\n            Char_3,               // 051    0x33\n            Char_4,               // 052    0x34\n            Char_5,               // 053    0x35\n            Char_6,               // 054    0x36\n            Char_7,               // 055    0x37\n            Char_8,               // 056    0x38\n            Char_9,               // 057    0x39\n            Char_Colon,           // 058    0x3A\n            Char_SemiColon,       // 059    0x3B\n            Char_LessThan,        // 060    0x3C\n            Char_Equal,           // 061    0x3D\n            Char_GreaterThan,     // 062    0x3E\n            Char_QuestionMark,    // 063    0x3F\n            Char_AtSign,          // 064    0x40\n            Char_A,               // 065    0x41\n            Char_B,               // 066    0x42\n            Char_C,               // 067    0x43\n            Char_D,               // 068    0x44\n            Char_E,               // 069    0x45\n            Char_F,               // 070    0x46\n            Char_G,               // 071    0x47\n            Char_H,               // 072    0x48\n            Char_I,               // 073    0x49\n            Char_J,               // 074    0x4A\n            Char_K,               // 075    0x4B\n            Char_L,               // 076    0x4C\n            Char_M,               // 077    0x4D\n            Char_N,               // 078    0x4E\n            Char_O,               // 079    0x4F\n            Char_P,               // 080    0x50\n            Char_Q,               // 081    0x51\n            Char_R,               // 082    0x52\n            Char_S,               // 083    0x53\n            Char_T,               // 084    0x54\n            Char_U,               // 085    0x55\n            Char_V,               // 086    0x56\n            Char_W,               // 087    0x57\n            Char_X,               // 088    0x58\n            Char_Y,               // 089    0x59\n            Char_Z,               // 090    0x5A\n            Char_LeftBracket,     // 091    0x5B\n            Char_BackSlash,       // 092    0x5C\n            Char_RightBracket,    // 093    0x5D\n            Char_Caret,           // 094    0x5E\n            Char__,               // 095    0x5F\n            Char_BackQuote,       // 096    0x60\n            Char_a,               // 097    0x61\n            Char_b,               // 098    0x62\n            Char_c,               // 099    0x63\n            Char_d,               // 100    0x64\n            Char_e,               // 101    0x65\n            Char_f,               // 102    0x66\n            Char_g,               // 103    0x67\n            Char_h,               // 104    0x68\n            Char_i,               // 105    0x69\n            Char_j,               // 106    0x6A\n            Char_k,               // 107    0x6B\n            Char_l,               // 108    0x6C\n            Char_m,               // 109    0x6D\n            Char_n,               // 110    0x6E\n            Char_o,               // 111    0x6F\n            Char_p,               // 112    0x70\n            Char_q,               // 113    0x71\n            Char_r,               // 114    0x72\n            Char_s,               // 115    0x73\n            Char_t,               // 116    0x74\n            Char_u,               // 117    0x75\n            Char_v,               // 118    0x76\n            Char_w,               // 119    0x77\n            Char_x,               // 120    0x78\n            Char_y,               // 121    0x79\n            Char_z,               // 122    0x7A\n            Char_LeftBrace,       // 123    0x7B\n            Char_VerticalBar,     // 124    0x7C\n            Char_RightBrace,      // 125    0x7D\n            Char_Tilde,           // 126    0x7E\n            Char_CtlCharNotWS,    // 127    0x7F\n\n            Char_Acute,           // for the acute accent 0xb4\n            Char_AfterASCIINotAcute,  // for all chars in range 0x80..0xfffe excluding the acute accent\n            Char_EOF              // for '\\uffff' or 65535\n        };\n\n        @Override public final int getKind(int i)  // Classify character at ith location\n        {\n            char c = (i >= getStreamLength() ? '\\uffff' : getCharValue(i));\n            return (c < 128)? // ASCII Character\n                      tokenKind[c] :\n                      (c == '\\uffff')?\n                           Char_EOF :\n                           (c == '\\u00b4')?\n                           Char_Acute :\n                               Char_AfterASCIINotAcute;\n        }\n    ./\n%End\n", "meta": {"hexsha": "8dc92f27537aad2806c1fdba193e5c1a853cc639", "size": 8519, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/xtext/essentialocl/lpg/LexerBasicMap.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/xtext/essentialocl/lpg/LexerBasicMap.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/xtext/essentialocl/lpg/LexerBasicMap.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 43.2436548223, "max_line_length": 103, "alphanum_fraction": 0.3965254138, "num_tokens": 2501, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.14804719051380197, "lm_q2_score": 0.016914911284419312, "lm_q1q2_score": 0.002504205093448485}}
{"text": "# Comment (till end of line)\n", "meta": {"hexsha": "4797a0076ff8928e718df3d705693bbe55f4ec3e", "size": 29, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Comments/GAP/comments.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Comments/GAP/comments.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Comments/GAP/comments.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 14.5, "max_line_length": 28, "alphanum_fraction": 0.6896551724, "num_tokens": 9, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.09670580110615865, "lm_q2_score": 0.025565211510389946, "lm_q1q2_score": 0.002472304259560648}}
{"text": "--\n-- An LPG Parser Template Using lpg.jar\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $additional_interfaces\n--     $super_stream_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   dtUnifiedTemplateF\n--\n%Options programming_language=csharp\n%Options table\n%Options margin=4\n%Options prefix=Char_\n%Options action-block=(\"*.cs\", \"/.\", \"./\")\n%Options ParseTable=LPG2.Runtime.ParseTable\n\n--\n-- The EOF and ERROR symbols are assigned a default here as a\n-- convenience.\n--\n%EOF\n    EOF\n%End\n\n%Define\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $BeginAction\n    /.$Header$case $rule_number: {./\n\n    $EndAction\n    /.          break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                    $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break;./\n\n    $NullAction\n    /.$Header$case $rule_number:\n                    $setResult(null);\n                    break;./\n\n    $BeginActions\n    /.\n        public void ruleAction(int ruleNumber)\n        {\n            switch (ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n\t            default:\n\t                ruleAction$rule_number(ruleNumber);\n\t                break;\n\t        }\n\t        return;\n\t    }\n\t\n\t    public void ruleAction$rule_number(int ruleNumber)\n\t    {\n\t        switch (ruleNumber)\n\t        {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n\n    $additional_interfaces /../\n    $super_stream_class /.LpgLexStream./\n%End\n\n%Globals\n    /.\n      using LPG2.Runtime;\n      using System;\n    ./\n%End\n\n%Headers\n    /.\n    public class $action_type : $super_stream_class , $sym_type, RuleAction$additional_interfaces\n    {\n        private static ParseTable prs = new $prs_type();\n        private DeterministicParser dtParser;\n\n        private void setResult(object _object) { dtParser.setSym1(_object); }\n        public DeterministicParser getParser() { return dtParser; }\n        public object getRhsSym(int i) { return dtParser.getSym(i); }\n        public int getRhsTokenIndex(int i) { return dtParser.getToken(i); }\n        public int getRhsFirstTokenIndex(int i) { return dtParser.getFirstToken(i); }\n        public int getRhsLastTokenIndex(int i) { return dtParser.getLastToken(i); }\n\n        public int getLeftSpan() { return dtParser.getFirstToken(); }\n        public int getRightSpan() { return dtParser.getLastToken(); }\n\n        public $action_type(string filename, int tab) :  base(filename, tab)\n        {\n           \n        }\n\n        public override string[] orderedExportedSymbols() { return orderedTerminalSymbols; }\n        public int getEOFTokenKind() { return $prs_type.EOFT_SYMBOL; }\n\n        public ILexStream getILexStream() { return ($super_stream_class) this; }\n        \n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public ILexStream getLexStream() { return ($super_stream_class) this; }\n\n        public $ast_type parser()\n        {\n            return parser(null, 0);\n        }\n            \n        public $ast_type parser(Monitor monitor)\n        {\n            return parser(monitor, 0);\n        }\n            \n        public $ast_type parser(int error_repair_count)\n        {\n            return parser(null, error_repair_count);\n        }\n            \n        public $ast_type parser(Monitor monitor, int error_repair_count)\n        {\n            try\n            {\n                dtParser = new DeterministicParser(this, prs, this);\n            }\n            catch (NotDeterministicParseTableException e)\n            {\n                 Console.Out.WriteLine(\"****Error: Regenerate $prs_type.cs with -NOBACKTRACK option\");\n                 return null;\n            }\n            catch (BadParseSymFileException e)\n            {\n                 Console.Out.WriteLine(\"****Error: Bad Parser Symbol File -- $sym_type.cs. Regenerate $prs_type.cs\");\n                 return null;\n            }\n            dtParser.setMonitor(monitor);\n\n            try\n            {\n                return ($ast_type) dtParser.parse();\n            }\n            catch (BadParseException e)\n            {\n                reset(e.error_token); // point to error token\n\n                 Console.Out.Write(\"Error detected on character \" + e.error_token);\n                if (e.error_token < getStreamLength())\n                      Console.Out.Write(\" at line \" + getLine(e.error_token) + \", column \" + getColumn(e.error_token));\n                else  Console.Out.Write(\" at end of file \");\n                 Console.Out.WriteLine(\" with kind \" + getKind(e.error_token));\n            }\n\n            return null;\n        }\n\n    ./\n\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "d18ae199ddcc5ac6baba986cbbe47b4e9ed29dc8", "size": 4963, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/csharp/dtUnifiedTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/csharp/dtUnifiedTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/csharp/dtUnifiedTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.192893401, "max_line_length": 119, "alphanum_fraction": 0.5379810598, "num_tokens": 1126, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.11124120945399738, "lm_q2_score": 0.021615331659687785, "lm_q1q2_score": 0.0024045156365729496}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2008 Eclipse.org and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   E.D. Willink - Initial API and implementation\n-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias):\n-- *        - 242153: LPG v 2.0.17 adoption.\n-- *        - 299396: Introducing new LPG templates.\n-- *        - 300534: Removing the use of deprecated macros.\n-- *\n-- * </copyright>\n-- */\n--\n-- Additional ERROR_TOKEN rules for The OCL Parser\n--\n\n%Import\n\tOCLParser.g\n%End\n\n%Import\n\tEssentialOCLErrors.gi\n%End\n\n%Rules\n\n-----------------------------------------------------------------------\n--\tCalls\n-----------------------------------------------------------------------\t\n\tOclMessageExpCS ::= primaryExpCS '^^' simpleNameCS ERROR_TOKEN\n\t\t/.$NewCase./\n\tOclMessageExpCS ::= primaryExpCS '^' simpleNameCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(2), OCLParserErrors.MISSING_MESSAGE_ARGUMENTS);\n\t\t\t\t\tOCLExpressionCS target = (OCLExpressionCS)getRhsSym(1);\n\t\t\t\t\tMessageExpCS result = createMessageExpCS(\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\tgetRhsIToken(2).getKind() == $sym_type.TK_CARET,\n\t\t\t\t\t\t\t(SimpleNameCS)getRhsSym(3),\n\t\t\t\t\t\t\tnew BasicEList<OCLMessageArgCS>()\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, target, getRhsIToken(4));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n-----------------------------------------------------------------------\n--\tContexts\n-----------------------------------------------------------------------\n\tclassifierContextDeclCS ::= context pathNameCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(3), OCLParserErrors.MISSING_INV_OR_DEF);\n\t\t\t\t\tClassifierContextDeclCS result = createClassifierContextDeclCS(\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t(PathNameCS)getRhsSym(2),\n\t\t\t\t\t\t\tnew BasicEList<InvOrDefCS>()\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\t\t\n\tdefExpressionCS ::= typedUninitializedVariableCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(2), OCLParserErrors.MISSING_EQUALS);\n\t\t\t\t\tVariableCS variableCS = (VariableCS)getRhsSym(1);\n\t\t\t\t\tDefExpressionCS result = createDefExpressionCS(\n\t\t\t\t\t\t\tvariableCS,\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, variableCS, getRhsIToken(2));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tdefExpressionCS ::= simpleNameCS ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tSimpleNameCS name = (SimpleNameCS)getRhsSym(1);\n\t\t\t\t\tVariableCS variableCS = createVariableCS(name, null, null);\n\t\t\t\t\tsetOffsets(variableCS, name, getRhsIToken(2));\n\t\t\t\t\tDefExpressionCS result = createDefExpressionCS(\n\t\t\t\t\t\t\tvariableCS,\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, variableCS, getRhsIToken(2));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\t\t\n\tinvOrDefCS ::= inv unreservedSimpleNameCS ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tInvCS result = createInvCS(\n\t\t\t\t\t\t\t(SimpleNameCS)getRhsSym(2),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\t\n    invOrDefCS ::= def unreservedSimpleNameCS ERROR_Colon\n        /.$BeginCode\n                    DefCS result = createDefCS(\n                            false,\n                            (SimpleNameCS)getRhsSym(2),\n                            null\n                        );\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(3));\n                    setResult(result);\n          $EndCode\n        ./\n    invOrDefCS ::= static def unreservedSimpleNameCS ERROR_Colon\n        /.$BeginCode\n                    DefCS result = createDefCS(\n                            true,\n                            (SimpleNameCS)getRhsSym(3),\n                            null\n                        );\n                    setOffsets(result, getRhsIToken(1), getRhsIToken(4));\n                    setResult(result);\n          $EndCode\n        ./\n\n\toperationCS1 ::= simpleNameCS '(' parametersCSopt ')' ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tOperationCS result = createOperationCS(\n\t\t\t\t\t\t\tgetRhsIToken(1),\n\t\t\t\t\t\t\tnew BasicEList<VariableCS>(),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(5));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\toperationCS1 ::= simpleNameCS ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(2), OCLParserErrors.MISSING_LPAREN);\n\t\t\t\t\tOperationCS result = createOperationCS(\n\t\t\t\t\t\t\tgetRhsIToken(1),\n\t\t\t\t\t\t\tnew BasicEList<VariableCS>(),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(2));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\toperationCS1 ::= ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(1), OCLParserErrors.MISSING_IDENTIFIER);\n\t\t\t\t\tOperationCS result = createOperationCS(\n\t\t\t\t\t\t\tgetRhsIToken(1),\n\t\t\t\t\t\t\tnew BasicEList<VariableCS>(),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\toperationCS2 ::= pathNameCS '::' unreservedSimpleNameCS '(' parametersCSopt ')' ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tPathNameCS pathNameCS = (PathNameCS)getRhsSym(1);\n\t\t\t\t\tSimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n\t\t\t\t\tOperationCS result = createOperationCS(\n\t\t\t\t\t\t\tpathNameCS,\n\t\t\t\t\t\t\tsimpleNameCS,\n\t\t\t\t\t\t\t(EList<VariableCS>)getRhsSym(5),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, pathNameCS, getRhsIToken(7));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\toperationCS2 ::= pathNameCS '::' ERROR_SimpleNameCS\n\t\t/.$BeginCode\n\t\t\t\t\tPathNameCS pathNameCS = (PathNameCS)getRhsSym(1);\n\t\t\t\t\tSimpleNameCS simpleNameCS = (SimpleNameCS)getRhsSym(3);\n\t\t\t\t\tOperationCS result = createOperationCS(\n\t\t\t\t\t\t\tpathNameCS,\n\t\t\t\t\t\t\tsimpleNameCS,\n\t\t\t\t\t\t\tnew BasicEList<VariableCS>(),\n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, pathNameCS, simpleNameCS);\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\t\t\n\tprePostOrBodyDeclCS ::= pre unreservedSimpleNameCS ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tPrePostOrBodyDeclCS result = createPrePostOrBodyDeclCS(\n\t\t\t\t\t\t\tPrePostOrBodyEnum.PRE_LITERAL,\n\t\t\t\t\t\t\t(SimpleNameCS)getRhsSym(2),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(3))\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tprePostOrBodyDeclCS ::= post unreservedSimpleNameCS ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tPrePostOrBodyDeclCS result = createPrePostOrBodyDeclCS(\n\t\t\t\t\t\t\tPrePostOrBodyEnum.POST_LITERAL,\n\t\t\t\t\t\t\t(SimpleNameCS)getRhsSym(2),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(3))\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tprePostOrBodyDeclCS ::= body unreservedSimpleNameCS ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tPrePostOrBodyDeclCS result = createPrePostOrBodyDeclCS(\n\t\t\t\t\t\t\tPrePostOrBodyEnum.BODY_LITERAL,\n\t\t\t\t\t\t\t(SimpleNameCS)getRhsSym(2),\n\t\t\t\t\t\t\tcreateInvalidLiteralExpCS(getRhsTokenText(3))\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\t\t\n\tinitOrDerValueCS ::= init ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tInitValueCS result = createInitValueCS(null);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(2), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tinitOrDerValueCS ::= derive ERROR_Colon\n\t\t/.$BeginCode\n\t\t\t\t\tDerValueCS result = createDerValueCS(null);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(2), getRhsIToken(3));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\n\tpackageDeclarationCS_A ::= package pathNameCS contextDeclsCSopt ERROR_Empty endpackage\n\t\t/.$BeginCode\n\t\t\t\t\tPackageDeclarationCS result = createPackageDeclarationCS(\n\t\t\t\t\t\t\t(PathNameCS)getRhsSym(2),\n\t\t\t\t\t\t\t(EList<ContextDeclCS>)getRhsSym(3)\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(5));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n\tpackageDeclarationCS_A ::= package pathNameCS contextDeclsCSopt ERROR_TOKEN\n\t\t/.$BeginCode\n\t\t\t\t\treportErrorTokenMessage(getRhsTokenIndex(4), OCLParserErrors.MISSING_ENDPACKAGE);\n\t\t\t\t\tPackageDeclarationCS result = createPackageDeclarationCS(\n\t\t\t\t\t\t\t(PathNameCS)getRhsSym(2),\n\t\t\t\t\t\t\t(EList<ContextDeclCS>)getRhsSym(3)\n\t\t\t\t\t\t);\n\t\t\t\t\tsetOffsets(result, getRhsIToken(1), getRhsIToken(4));\n\t\t\t\t\tsetResult(result);\n\t\t  $EndCode\n\t\t./\n%End\n", "meta": {"hexsha": "def42002dfc5ba0f6494e988fc8a0860c3e7153f", "size": 8331, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/parser/backtracking/OCLParserErrors.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/parser/backtracking/OCLParserErrors.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/parser/backtracking/OCLParserErrors.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.4377358491, "max_line_length": 93, "alphanum_fraction": 0.6344976593, "num_tokens": 2312, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.12421301807811348, "lm_q2_score": 0.019124038707532997, "lm_q1q2_score": 0.002375454565705338}}
{"text": "#\n# francy: Interactive Discrete Mathematics in GAP\n#\n\n#############################################################################\n##\n#M  Menu( <title> ) . . . . . . . . . . . . . . . a new menu entry\n##\nInstallMethod(Menu,\n  \"a title string\",\n  true,\n  [IsString,\n   IsCallback],\n  0,\nfunction(title, callback)\n  return Objectify(MenuObjectType, rec(\n    id       := GenerateID(),\n    title    := title,\n    callback := callback,\n    menus    := rec()\n  ));\nend);\n\nInstallOtherMethod(Menu,\n  \"a title string\",\n  true,\n  [IsString],\n  0,\nfunction(title)\n  return Menu(title, NoopCallback());\nend);\n\n#############################################################################\n##\n#M  Add( <menu>, <menu> ) . . . . . add menu to canvas\n##\nInstallOtherMethod(Add,\n  \"a menu, a menu\",\n  true,\n  [IsMenu,\n   IsMenu],\n  0,\nfunction(menu, object)\n  menu!.menus!.(object!.id) := object;\n  return menu;\nend);\n\nInstallOtherMethod(Add,\n  \"a canvas, a list of francy objects\",\n  true,\n  [IsMenu,\n   IsList],\n  0,\nfunction(menu, objects)\n  local object;\n  for object in objects do\n    Add(menu, object);\n  od;\n  return menu;\nend);\n\n#############################################################################\n##\n#M  Remove( <menu>, <menu> ) . . . . . remove menu from menu\n##\nInstallOtherMethod(Remove,\n  \"a menu, a menu\",\n  true,\n  [IsMenu,\n   IsMenu],\n  0,\nfunction(menu, object)\n  Unbind(menu!.menus!.(object!.id));\n  return menu;\nend);\n\nInstallOtherMethod(Remove,\n  \"a menu, a list of francy objects\",\n  true,\n  [IsMenu,\n   IsList],\n  0,\nfunction(menu, objects)\n  local object;\n  for object in objects do\n    Remove(menu, object);\n  od;\n  return menu;\nend);", "meta": {"hexsha": "f051862eed229d60a3ef839e2ce6276a8cc1b260", "size": 1652, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/menu.gi", "max_stars_repo_name": "LaGuer/francy", "max_stars_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 10, "max_stars_repo_stars_event_min_datetime": "2016-12-15T12:04:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-14T19:19:24.000Z", "max_issues_repo_path": "gap/menu.gi", "max_issues_repo_name": "LaGuer/francy", "max_issues_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 29, "max_issues_repo_issues_event_min_datetime": "2018-10-09T22:37:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:44:50.000Z", "max_forks_repo_path": "gap/menu.gi", "max_forks_repo_name": "LaGuer/francy", "max_forks_repo_head_hexsha": "1dd3d2f090f39740f9ca5b7e608298cda685e213", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2016-12-15T12:04:42.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-28T10:51:50.000Z", "avg_line_length": 18.5617977528, "max_line_length": 77, "alphanum_fraction": 0.5236077482, "num_tokens": 442, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1329642333263228, "lm_q2_score": 0.01744248508735249, "lm_q1q2_score": 0.002319226656945642}}
{"text": "--\n-- The Java Lexer\n--\n%Options list\n%Options fp=JavaLexer\n%options single_productions\n%options template=LexerTemplateF.gi\n%options filter=GJavaKWLexer.gi\n%options lalr=4\n$Define\n    --\n    -- Definition of macro used in the included file LexerBasicMapB.g\n    --\n    $kw_lexer_class /.$GJavaKWLexer./\n\n$End\n\n$Include\n    LexerBasicMapF.gi\n$End\n\n--$Include\n--    Differ.g\n--$End\n\n$Export\n\n    IDENTIFIER\n\n    IntegerLiteral\n    LongLiteral\n    FloatingPointLiteral\n    DoubleLiteral\n    CharacterLiteral\n    StringLiteral\n    PLUS_PLUS\n    MINUS_MINUS\n    EQUAL_EQUAL\n    LESS_EQUAL\n    GREATER_EQUAL\n    NOT_EQUAL\n    LEFT_SHIFT\n    RIGHT_SHIFT\n    UNSIGNED_RIGHT_SHIFT\n    PLUS_EQUAL\n    MINUS_EQUAL\n    MULTIPLY_EQUAL\n    DIVIDE_EQUAL\n    AND_EQUAL\n    OR_EQUAL\n    XOR_EQUAL\n    REMAINDER_EQUAL\n    LEFT_SHIFT_EQUAL\n    RIGHT_SHIFT_EQUAL\n    UNSIGNED_RIGHT_SHIFT_EQUAL\n    OR_OR\n    AND_AND\n    PLUS\n    MINUS\n    NOT\n    REMAINDER\n    XOR\n    AND\n    MULTIPLY\n    OR\n    TWIDDLE\n    DIVIDE\n    GREATER\n    LESS\n    LPAREN\n    RPAREN\n    LBRACE\n    RBRACE\n    LBRACKET\n    RBRACKET\n    SEMICOLON\n    QUESTION\n    AT\n    COLON\n    COMMA\n    DOT\n    EQUAL\n    ELLIPSIS\n\n$End\n\n$Terminals\n    CtlCharNotWS\n\n    LF   CR   HT   FF\n\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n    _\n\n    A    B    C    D    E    F    G    H    I    J    K    L    M\n    N    O    P    Q    R    S    T    U    V    W    X    Y    Z\n\n    0    1    2    3    4    5    6    7    8    9\n\n    AfterASCII   ::= '\\u0080..\\ufffe'\n    Space        ::= ' '\n    LF           ::= NewLine\n    CR           ::= Return\n    HT           ::= HorizontalTab\n    FF           ::= FormFeed\n    DoubleQuote  ::= '\"'\n    SingleQuote  ::= \"'\"\n    Percent      ::= '%'\n    VerticalBar  ::= '|'\n    Exclamation  ::= '!'\n    AtSign       ::= '@'\n    BackQuote    ::= '`'\n    Tilde        ::= '~'\n    Sharp        ::= '#'\n    DollarSign   ::= '$'\n    Ampersand    ::= '&'\n    Caret        ::= '^'\n    Colon        ::= ':'\n    SemiColon    ::= ';'\n    BackSlash    ::= '\\'\n    LeftBrace    ::= '{'\n    RightBrace   ::= '}'\n    LeftBracket  ::= '['\n    RightBracket ::= ']'\n    QuestionMark ::= '?'\n    Comma        ::= ','\n    Dot          ::= '.'\n    LessThan     ::= '<'\n    GreaterThan  ::= '>'\n    Plus         ::= '+'\n    Minus        ::= '-'\n    Slash        ::= '/'\n    Star         ::= '*'\n    LeftParen    ::= '('\n    RightParen   ::= ')'\n    Equal        ::= '='\n\n$End\n\n%Notice\n/.\n////////////////////////////////////////////////////////////////////////////////\n// Copyright (c) 2007 IBM Corporation.\n// All rights reserved. This program and the accompanying materials\n// are made available under the terms of the Eclipse Public License v1.0\n// which accompanies this distribution, and is available at\n// http://www.eclipse.org/legal/epl-v10.html\n//\n//Contributors:\n//    Philippe Charles (pcharles@us.ibm.com) - initial API and implementation\n\n////////////////////////////////////////////////////////////////////////////////\n./\n%End\n\n$Rules\n\n    Token ::= Identifier\n        /.$BeginAction\n                    checkForKeyWord();\n          $EndAction\n        ./\n    Token ::= '\"' SLBody '\"'\n        /.$BeginAction\n                    makeToken($_StringLiteral);\n          $EndAction\n        ./\n    Token ::= \"'\" NotSQ \"'\"\n        /.$BeginAction\n                    makeToken($_CharacterLiteral);\n          $EndAction\n        ./\n    Token ::= IntegerLiteral\n        /.$BeginAction\n                    makeToken($_IntegerLiteral);\n          $EndAction\n        ./\n    Token ::= FloatingPointLiteral\n        /.$BeginAction\n                    makeToken($_FloatingPointLiteral);\n          $EndAction\n        ./\n    Token ::= DoubleLiteral\n        /.$BeginAction\n                    makeToken($_DoubleLiteral);\n          $EndAction\n        ./\n    Token ::= '/' '*' Inside Stars '/'\n        /.$BeginAction\n                    skipToken();\n          $EndAction\n        ./\n    Token ::= SLC\n        /.$BeginAction\n                    skipToken();\n          $EndAction\n        ./\n    Token ::= WS -- White Space is scanned but not added to output vector\n        /.$BeginAction\n                    skipToken();\n          $EndAction\n        ./\n    Token ::= '+'\n        /.$BeginAction\n                    makeToken($_PLUS);\n          $EndAction\n        ./\n    Token ::= '-'\n        /.$BeginAction\n                    makeToken($_MINUS);\n          $EndAction\n        ./\n\n    Token ::= '*'\n        /.$BeginAction\n                    makeToken($_MULTIPLY);\n          $EndAction\n        ./\n\n    Token ::= '/'\n        /.$BeginAction\n                    makeToken($_DIVIDE);\n          $EndAction\n        ./\n\n    Token ::= '('\n        /.$BeginAction\n                    makeToken($_LPAREN);\n          $EndAction\n        ./\n\n    Token ::= ')'\n        /.$BeginAction\n                    makeToken($_RPAREN);\n          $EndAction\n        ./\n\n    Token ::= '='\n        /.$BeginAction\n                    makeToken($_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= ','\n        /.$BeginAction\n                    makeToken($_COMMA);\n          $EndAction\n        ./\n\n    Token ::= ':'\n        /.$BeginAction\n                    makeToken($_COLON);\n          $EndAction\n        ./\n\n    Token ::= ';'\n        /.$BeginAction\n                    makeToken($_SEMICOLON);\n          $EndAction\n        ./\n\n    Token ::= '^'\n        /.$BeginAction\n                    makeToken($_XOR);\n          $EndAction\n        ./\n\n    Token ::= '%'\n        /.$BeginAction\n                    makeToken($_REMAINDER);\n          $EndAction\n        ./\n\n    Token ::= '~'\n        /.$BeginAction\n                    makeToken($_TWIDDLE);\n          $EndAction\n        ./\n\n    Token ::= '|'\n        /.$BeginAction\n                    makeToken($_OR);\n          $EndAction\n        ./\n\n    Token ::= '&'\n        /.$BeginAction\n                    makeToken($_AND);\n          $EndAction\n        ./\n\n    Token ::= '<'\n        /.$BeginAction\n                    makeToken($_LESS);\n          $EndAction\n        ./\n\n    Token ::= '>'\n        /.$BeginAction\n                    makeToken($_GREATER);\n          $EndAction\n        ./\n\n    Token ::= '.'\n        /.$BeginAction\n                    makeToken($_DOT);\n          $EndAction\n        ./\n\n    Token ::= '!'\n        /.$BeginAction\n                    makeToken($_NOT);\n          $EndAction\n        ./\n\n    Token ::= '['\n        /.$BeginAction\n                    makeToken($_LBRACKET);\n          $EndAction\n        ./\n\n    Token ::= ']'\n        /.$BeginAction\n                    makeToken($_RBRACKET);\n          $EndAction\n        ./\n\n    Token ::= '{'\n        /.$BeginAction\n                    makeToken($_LBRACE);\n          $EndAction\n        ./\n\n    Token ::= '}'\n        /.$BeginAction\n                    makeToken($_RBRACE);\n          $EndAction\n        ./\n\n    Token ::= '?'\n        /.$BeginAction\n                    makeToken($_QUESTION);\n          $EndAction\n        ./\n\n    Token ::= '@'\n        /.$BeginAction\n                    makeToken($_AT);\n          $EndAction\n        ./\n\n    Token ::= '+' '+'\n        /.$BeginAction\n                    makeToken($_PLUS_PLUS);\n          $EndAction\n        ./\n\n    Token ::= '-' '-'\n        /.$BeginAction\n                    makeToken($_MINUS_MINUS);\n          $EndAction\n        ./\n\n    Token ::= '=' '='\n        /.$BeginAction\n                    makeToken($_EQUAL_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '<' '='\n        /.$BeginAction\n                    makeToken($_LESS_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '!' '='\n        /.$BeginAction\n                    makeToken($_NOT_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '<' '<'\n        /.$BeginAction\n                    makeToken($_LEFT_SHIFT);\n          $EndAction\n        ./\n\n    Token ::= '+' '='\n        /.$BeginAction\n                    makeToken($_PLUS_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '-' '='\n        /.$BeginAction\n                    makeToken($_MINUS_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '*' '='\n        /.$BeginAction\n                    makeToken($_MULTIPLY_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '/' '='\n        /.$BeginAction\n                    makeToken($_DIVIDE_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '&' '='\n        /.$BeginAction\n                    makeToken($_AND_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '|' '='\n        /.$BeginAction\n                    makeToken($_OR_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '^' '='\n        /.$BeginAction\n                    makeToken($_XOR_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '%' '='\n        /.$BeginAction\n                    makeToken($_REMAINDER_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '<' '<' '='\n        /.$BeginAction\n                    makeToken($_LEFT_SHIFT_EQUAL);\n          $EndAction\n        ./\n\n    Token ::= '|' '|'\n        /.$BeginAction\n                    makeToken($_OR_OR);\n          $EndAction\n        ./\n\n    Token ::= '&' '&'\n        /.$BeginAction\n                    makeToken($_AND_AND);\n          $EndAction\n        ./\n\n    Token ::= '.' '.' '.'\n        /.$BeginAction\n                    makeToken($_ELLIPSIS);\n          $EndAction\n        ./\n\n    IntegerLiteral -> Integer\n                    | Integer LetterLl\n                    | '0' LetterXx HexDigits\n                    | '0' LetterXx HexDigits LetterLl\n\n    DoubleLiteral -> Decimal\n                   | Decimal LetterForD\n                   | Decimal Exponent\n                   | Decimal Exponent LetterForD\n                   | Integer Exponent\n                   | Integer Exponent LetterForD\n                   | Integer LetterForD\n\n    FloatingPointLiteral -> Decimal LetterForF\n                          | Decimal Exponent LetterForF\n                          | Integer Exponent LetterForF\n                          | Integer LetterForF\n\n    Inside ::= Inside Stars NotSlashOrStar\n             | Inside '/'\n             | Inside NotSlashOrStar\n             | $empty\n\n    Stars -> '*'\n           | Stars '*'\n\n    SLC ::= '/' '/'\n          | SLC NotEol\n\n    SLBody -> $empty\n            | SLBody NotDQ\n\n    Integer -> Digit\n             | Integer Digit\n\n    HexDigits -> HexDigit\n               | HexDigits HexDigit\n\n    Decimal ::= '.' Integer\n              | Integer '.'\n              | Integer '.' Integer\n\n    Exponent ::= LetterEe Integer\n               | LetterEe '+' Integer\n               | LetterEe '-' Integer\n\n    WSChar -> Space\n            | LF\n            | CR\n            | HT\n            | FF\n\n    Letter -> LowerCaseLetter\n            | UpperCaseLetter\n            | _\n            | '$'\n            | '\\u0080..\\ufffe'\n\n    LowerCaseLetter -> a | b | c | d | e | f | g | h | i | j | k | l | m |\n                       n | o | p | q | r | s | t | u | v | w | x | y | z\n\n    UpperCaseLetter -> A | B | C | D | E | F | G | H | I | J | K | L | M |\n                       N | O | P | Q | R | S | T | U | V | W | X | Y | Z\n\n    Digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n    OctalDigit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7\n\n    a..f -> a | b | c | d | e | f | A | B | C | D | E | F\n\n    HexDigit -> Digit\n              | a..f\n\n    OctalDigits3 -> OctalDigit\n                  | OctalDigit OctalDigit\n                  | OctalDigit OctalDigit OctalDigit\n\n    LetterForD -> 'D'\n                | 'd'\n\n    LetterForF -> 'F'\n                | 'f'\n\n    LetterLl ->  'L'\n              | 'l'\n\n    LetterEe -> 'E'\n              | 'e'\n\n    LetterXx -> 'X'\n              | 'x'\n\n    WS -> WSChar\n        | WS WSChar\n\n    Identifier -> Letter\n                | Identifier Letter\n                | Identifier Digit\n\n    SpecialNotStar -> '+' | '-' | '/' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n                      '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                      '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#'\n\n    SpecialNotSlash -> '+' | '-' | -- exclude the star as well\n                       '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n                       '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                       '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#'\n\n    SpecialNotDQ -> '+' | '-' | '/' | '(' | ')' | '*' | '!' | '@' | '`' | '~' |\n                    '%' | '&' | '^' | ':' | ';' | \"'\" | '|' | '{' | '}' |\n                    '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#'\n\n    SpecialNotSQ -> '+' | '-' | '*' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n                    '%' | '&' | '^' | ':' | ';' | '/' | '|' | '{' | '}' |\n                    '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#'\n\n    NotSlashOrStar -> Letter\n                    | Digit\n                    | SpecialNotSlash\n                    | WSChar\n\n    Eol -> LF\n         | CR\n\n    NotEol -> Letter\n            | Digit\n            | Space\n            | '*'\n            | SpecialNotStar\n            | HT\n            | FF\n            | CtlCharNotWS\n\n    NotDQ -> Letter\n           | Digit\n           | SpecialNotDQ\n           | Space\n           | HT\n           | FF\n           | EscapeSequence\n           | '\\' u HexDigit HexDigit HexDigit HexDigit\n           | '\\' OctalDigit\n\n    NotSQ -> Letter\n           | Digit\n           | SpecialNotSQ\n           | Space\n           | HT\n           | FF\n           | EscapeSequence\n           | '\\' u HexDigit HexDigit HexDigit HexDigit\n           | '\\' OctalDigits3\n\n    EscapeSequence -> '\\' b\n                    | '\\' t\n                    | '\\' n\n                    | '\\' f\n                    | '\\' r\n                    | '\\' '\"'\n                    | '\\' \"'\"\n                    | '\\' '\\'\n$End\n", "meta": {"hexsha": "8ffe947e9c3203f5574e04361753a1180f96d48d", "size": 13802, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "JavaExample/grammar/GJavaLexer.gi", "max_stars_repo_name": "kuafuwang/LPGRuntimeCpp", "max_stars_repo_head_hexsha": "e68e2086716766a9c2f3af2490118b84d2c0e791", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-05-21T12:23:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-24T01:40:49.000Z", "max_issues_repo_path": "JavaExample/grammar/GJavaLexer.gi", "max_issues_repo_name": "kuafuwang/LPGRuntimeCpp", "max_issues_repo_head_hexsha": "e68e2086716766a9c2f3af2490118b84d2c0e791", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JavaExample/grammar/GJavaLexer.gi", "max_forks_repo_name": "kuafuwang/LPGRuntimeCpp", "max_forks_repo_head_hexsha": "e68e2086716766a9c2f3af2490118b84d2c0e791", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.1540930979, "max_line_length": 82, "alphanum_fraction": 0.376829445, "num_tokens": 3455, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.12421300835205339, "lm_q2_score": 0.018264281257528575, "lm_q1q2_score": 0.002268661320385649}}
{"text": "%Define\n    $kw_lexer_class /.NoKWLexer./\n    $_IDENTIFIER /.0./\n%End\n%Headers\n    --\n    -- Additional methods for the action class not provided in the template\n    --\n    /.\n         public class NoKWLexer\n        {\n            public int[] getKeywordKinds() { return null; }\n\n            public int lexer(int curtok, int lasttok) { return 0; }\n\n            public void setInputChars(char[] inputChars) { }\n\n             int getKind(int c) { return 0; }\n\n            public NoKWLexer(char[] inputChars, int identifierKind) { }\n        }\n    ./\n%End\n\n%Import\n    LexerBasicMapF.gi\n%End\n", "meta": {"hexsha": "95b64ed3779490a29e55585aedcd4425bb49695f", "size": 587, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/include/csharp/LexerVeryBasicMapF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/include/csharp/LexerVeryBasicMapF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/include/csharp/LexerVeryBasicMapF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 20.9642857143, "max_line_length": 75, "alphanum_fraction": 0.5706984668, "num_tokens": 154, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08882028275236159, "lm_q2_score": 0.024423090808575826, "lm_q1q2_score": 0.0021692658313043085}}
{"text": "--\n-- In a parser using this template, the following macro may be redefined:\n--\n--     $additional_interfaces\n--     $ast_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   btParserTemplateF\n--\n%Options programming_language=rt_cpp,margin=4,backtrack\n%Options table,error_maps,scopes\n%options prefix=TK_\n%options action-block=(\"*.h\", \"/.\", \"./\")\n%options action-block=(\"*.cpp\", \"/!\", \"!/\")\n%options ast-block=(\"/!\", \"!/\")\n%options ParseTable=ParseTable\n%options nt-check\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF_TOKEN to be consistent with LexerTemplateD and LexerTemplateE\n--\n%EOF\n    EOF_TOKEN\n%End\n\n%ERROR\n    ERROR_TOKEN\n%End\n\n%Define\n\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $BeginAction\n    /!$Header$case $rule_number: {\n                   //#line $next_line \"$input_file$\"!/\n\n    $EndAction\n    /!            break;\n                }!/\n\n    $BeginJava\n    /!$Header$case $rule_number: {\n                    $symbol_declarations\n                    //#line $next_line \"$input_file$\"!/\n\n    $EndJava /!$EndAction!/\n\n    $NoAction\n    /!$Header$case $rule_number:\n                    break;!/\n\n    $BadAction\n    /!$Header$case $rule_number:\n                    throw  std::exception(\"No action specified for rule \" + $rule_number);!/\n\n    $NullAction\n    /!$Header$case $rule_number:\n                    setResult(nullptr);\n                    break;!/\n\n    $BeginActions\n    /!\n         #include \"$action_type.h\"\n         void $action_type::ruleAction(int ruleNumber)\n        {\n            switch (ruleNumber)\n            {!/\n\n    $SplitActions\n    /!\n                    default:\n                        ruleAction$rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n        \n             void ruleAction$rule_number(int ruleNumber)\n            {\n                switch (ruleNumber)\n                {\n                    //#line $next_line \"$input_file$\"!/\n\n    $EndActions\n    /!\n                default:\n                    break;\n            }\n            return;\n        }!/\n\n    $entry_declarations\n    /.\n         $ast_class * parse$entry_name()\n        {\n            return parse$entry_name(nullptr, 0);\n        }\n            \n         $ast_class * parse$entry_name(Monitor* monitor)\n        {\n            return parse$entry_name(monitor, 0);\n        }\n            \n         $ast_class * parse$entry_name(int error_repair_count)\n        {\n            return parse$entry_name(nullptr, error_repair_count);\n        }\n            \n         $ast_class * parse$entry_name(Monitor *monitor, int error_repair_count)\n        {\n            btParser->setMonitor(monitor);\n            \n            try\n            {\n                return ($ast_class *) btParser->fuzzyParseEntry($sym_type::$entry_marker, error_repair_count);\n            }\n            catch (BadParseException& e)\n            {\n                prsStream->reset(e.error_token); // point to error token\n\n                 std::shared_ptr< DiagnoseParser> diagnoseParser = std::make_shared<DiagnoseParser>(prsStream, prsTable);\n                diagnoseParser->diagnoseEntry($sym_type::$entry_marker, e.error_token);\n            }\n\n            return nullptr;\n        }\n    ./\n\n    --\n    -- Macros that may be needed in a parser using this template\n    --\n    $additional_interfaces /../\n    $ast_class /.$ast_type./\n    $super_class /.Object./   \n    $unimplemented_symbols_warning /.false./\n\n    --\n    -- Old deprecated macros that should NEVER be used.\n    --\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n                getParser().setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 getParser().setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getRhsSym\n              getParser().getSym./\n    $getToken /. // macro getToken is deprecated. Use function getRhsTokenIndex\n                getParser().getToken./\n    $getIToken /. // macro getIToken is deprecated. Use function getRhsIToken\n                 prsStream->getIToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   getParser().getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    getParser().getLastToken./\n%End\n\n%Globals\n    /.\n#pragma once\n\n#include <iostream>\n#include \"AstPoolHolder.h\"\n#include \"BacktrackingParser.h\"\n#include \"DeterministicParser.h\"\n#include \"diagnose.h\"\n#include \"ErrorToken.h\"\n#include \"Exception.h\"\n#include \"IAbstractArrayList.h\"\n#include \"IAst.h\"\n#include \"IAstVisitor.h\"\n#include \"ILexStream.h\"\n#include \"$sym_type.h\"\n#include \"$prs_type.h\"\n#include \"Object.h\"\n#include \"ParseTable.h\"\n#include \"PrsStream.h\"\n#include \"RuleAction.h\"\n#include \"IcuUtil.h\"\n#include \"stringex.h\"\n#include \"Any.h\"\n    ./\n%End\n\n%Headers\n    /.\n     struct $action_type :public $super_class ,public RuleAction$additional_interfaces\n    {\n       \n        PrsStream* prsStream = nullptr;\n        ~$action_type (){\n            delete prsStream;\n            delete btParser;\n        }\n         bool unimplementedSymbolsWarning = $unimplemented_symbols_warning;\n\n         inline static ParseTable* prsTable = new $prs_type();\n         ParseTable* getParseTable() { return prsTable; }\n\n         BacktrackingParser* btParser = nullptr;\n         BacktrackingParser* getParser() { return btParser; }\n\n         void setResult(Object* object) { btParser->setSym1(object); }\n         Object* getRhsSym(int i) { return btParser->getSym(i); }\n\n         int getRhsTokenIndex(int i) { return btParser->getToken(i); }\n         IToken* getRhsIToken(int i) { return prsStream->getIToken(getRhsTokenIndex(i)); }\n        \n         int getRhsFirstTokenIndex(int i) { return btParser->getFirstToken(i); }\n         IToken* getRhsFirstIToken(int i) { return prsStream->getIToken(getRhsFirstTokenIndex(i)); }\n\n         int getRhsLastTokenIndex(int i) { return btParser->getLastToken(i); }\n         IToken* getRhsLastIToken(int i) { return prsStream->getIToken(getRhsLastTokenIndex(i)); }\n\n         int getLeftSpan() { return btParser->getFirstToken(); }\n         IToken* getLeftIToken()  { return prsStream->getIToken(getLeftSpan()); }\n\n         int getRightSpan() { return btParser->getLastToken(); }\n         IToken* getRightIToken() { return prsStream->getIToken(getRightSpan()); }\n\n         int getRhsErrorTokenIndex(int i)\n        {\n            int index = btParser->getToken(i);\n            IToken* err = prsStream->getIToken(index);\n            return ( dynamic_cast<ErrorToken*>(err) ? index : 0);\n        }\n         ErrorToken * getRhsErrorIToken(int i)\n        {\n            int index = btParser->getToken(i);\n            IToken* err = prsStream->getIToken(index);\n            return (ErrorToken*) ( dynamic_cast<ErrorToken*>(err) ? err : nullptr);\n        }\n\n         void reset(ILexStream* lexStream)\n        {\n            delete prsStream;\n            prsStream = new PrsStream(lexStream);\n            btParser->reset(prsStream);\n\n            try\n            {\n                prsStream->remapTerminalSymbols(orderedTerminalSymbols(), prsTable->getEoftSymbol());\n            }\n            catch (NullExportedSymbolsException& e) {\n            }\n            catch (NullTerminalSymbolsException& e) {\n            }\n            catch (UnimplementedTerminalsException& e)\n            {\n                if (unimplementedSymbolsWarning) {\n                   auto unimplemented_symbols = e.getSymbols();\n                    std::cout << \"The Lexer will not scan the following token(s):\" << std::endl;\n                    for (int i = 0; i < unimplemented_symbols.size(); i++)\n                    {\n                        auto id = unimplemented_symbols.at(i);\n                        std::wcout <<L\"    \" << $sym_type::orderedTerminalSymbols[id] << std::endl;               \n                    }\n                   std::cout <<std::endl;  \n                }\n            }\n            catch (UndefinedEofSymbolException& e)\n            {\n                std::stringex str= \"The Lexer does not implement the Eof symbol \";\n                str += IcuUtil::ws2s($sym_type::orderedTerminalSymbols[prsTable->getEoftSymbol()]);\n                throw  UndefinedEofSymbolException(str);\n            } \n        }\n        \n         $action_type(ILexStream* lexStream = nullptr)\n        {\n            try\n            {\n                btParser = new BacktrackingParser(prsStream, prsTable,  this);\n            }\n            catch (NotBacktrackParseTableException& e)\n            {\n                throw ( NotBacktrackParseTableException\n                                    (\"Regenerate $prs_type.java with -BACKTRACK option\"));\n            }\n            catch (BadParseSymFileException& e)\n            {\n                throw ( BadParseSymFileException(\"Bad Parser Symbol File -- $sym_type::java\"));\n            }\n\n            if(lexStream)\n            {\n                reset(lexStream);\n            }\n        }\n        \n\n        \n         int numTokenKinds() { return $sym_type::numTokenKinds; }\n         std::vector<std::wstring> orderedTerminalSymbols() { \n             return $sym_type::orderedTerminalSymbols; \n        }\n         std::wstring getTokenKindName(int kind) { return $sym_type::orderedTerminalSymbols[kind]; }\n         int getEOFTokenKind() { return prsTable->getEoftSymbol(); }\n         IPrsStream* getIPrsStream() { return prsStream; }\n\n        /**\n         * @deprecated replaced by {@link #getIPrsStream()}\n         *\n         */\n         PrsStream* getPrsStream() { return prsStream; }\n\n        /**\n         * @deprecated replaced by {@link #getIPrsStream()}\n         *\n         */\n         PrsStream* getParseStream() { return prsStream; }\n\n         $ast_class* parser()\n        {\n            return parser(nullptr, 0);\n        }\n        \n         $ast_class* parser(Monitor* monitor)\n        {\n            return parser(monitor, 0);\n        }\n        \n         $ast_class * parser(int error_repair_count)\n        {\n            return parser(nullptr, error_repair_count);\n        }\n\n         $ast_class * parser(Monitor* monitor, int error_repair_count)\n        {\n            btParser->setMonitor(monitor);\n            \n            try\n            {\n                return ($ast_class *) btParser->fuzzyParse(error_repair_count);\n            }\n            catch (BadParseException& e)\n            {\n                prsStream->reset(e.error_token); // point to error token\n\n                std::shared_ptr< DiagnoseParser> diagnoseParser = std::make_shared<DiagnoseParser>(prsStream, prsTable);\n                diagnoseParser->diagnose(e.error_token);\n            }\n\n            return nullptr;\n        }\n         void ruleAction(int ruleNumber);\n        //\n        // Additional entry points, if any\n        //\n        $entry_declarations\n    ./\n\n%End\n\n%Rules\n    /!$BeginActions!/\n%End\n\n%Trailers\n    /.\n    };\n    ./\n\n     /!\n        $EndActions\n    !/\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "0121eba233eebb1d44f516e4925efb36666ccd0a", "size": 11137, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/rt_cpp/btParserTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-05-21T12:23:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-24T01:40:49.000Z", "max_issues_repo_path": "templates/templates/rt_cpp/btParserTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/rt_cpp/btParserTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.6196808511, "max_line_length": 121, "alphanum_fraction": 0.5454790339, "num_tokens": 2579, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09268777863937602, "lm_q2_score": 0.022977367902892006, "lm_q1q2_score": 0.002129721189898758}}
{"text": "--\n-- In a parser using this template, the following macro may be redefined:\n--\n--     $additional_interfaces\n--     $ast_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   btParserTemplateF\n--\n%Options programming_language=csharp,margin=4,backtrack\n%Options table,error_maps,scopes\n%options prefix=TK_\n%options action-block=(\"*.cs\", \"/.\", \"./\")\n%options ParseTable=LPG2.Runtime.ParseTable\n%options nt-check\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF_TOKEN to be consistent with LexerTemplateD and LexerTemplateE\n--\n%EOF\n    EOF_TOKEN\n%End\n\n%ERROR\n    ERROR_TOKEN\n%End\n\n%Define\n\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $BeginAction\n    /.$Header$case $rule_number: {\n                   //#line $next_line \"$input_file$\"./\n\n    $EndAction\n    /.            break;\n                }./\n\n    $BeginJava\n    /.$Header$case $rule_number: {\n                    $symbol_declarations\n                    //#line $next_line \"$input_file$\"./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break;./\n\n    $BadAction\n    /.$Header$case $rule_number:\n                    throw (\"No action specified for rule \" + $rule_number);./\n\n    $NullAction\n    /.$Header$case $rule_number:\n                    setResult(null);\n                    break;./\n\n    $BeginActions\n    /.\n         // Casting object to various generic types\n        public void ruleAction(int ruleNumber)\n        {\n            switch (ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n                    default:\n                        ruleAction$rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n        \n            public void ruleAction$rule_number(int ruleNumber)\n            {\n                switch (ruleNumber)\n                {\n                    //#line $next_line \"$input_file$\"./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n\n    $entry_declarations\n    /.\n        public $ast_class parse$entry_name()\n        {\n            return parse$entry_name(null, 0);\n        }\n            \n        public $ast_class parse$entry_name(Monitor monitor)\n        {\n            return parse$entry_name(monitor, 0);\n        }\n            \n        public $ast_class parse$entry_name(int error_repair_count)\n        {\n            return parse$entry_name(null, error_repair_count);\n        }\n            \n        public $ast_class parse$entry_name(Monitor monitor, int error_repair_count)\n        {\n            btParser.setMonitor(monitor);\n            \n            try\n            {\n                return ($ast_class) btParser.fuzzyParseEntry($sym_type.$entry_marker, error_repair_count);\n            }\n            catch (BadParseException e)\n            {\n                prsStream.reset(e.error_token); // point to error token\n\n                DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable);\n                diagnoseParser.diagnoseEntry($sym_type.$entry_marker, e.error_token);\n            }\n\n            return null;\n        }\n    ./\n\n    --\n    -- Macros that may be needed in a parser using this template\n    --\n    $additional_interfaces /../\n    $ast_class /.$ast_type./\n    $super_class /.object./   \n    $unimplemented_symbols_warning /.false./\n\n    --\n    -- Old deprecated macros that should NEVER be used.\n    --\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n                getParser().setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 getParser().setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getRhsSym\n              getParser().getSym./\n    $getToken /. // macro getToken is deprecated. Use function getRhsTokenIndex\n                getParser().getToken./\n    $getIToken /. // macro getIToken is deprecated. Use function getRhsIToken\n                 prsStream.getIToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   getParser().getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    getParser().getLastToken./\n%End\n\n%Globals\n    /.\n    using  LPG2.Runtime;\n    using System;\n    ./\n%End\n\n%Headers\n    /.\n    public class $action_type : $super_class , RuleAction$additional_interfaces\n    {\n        private PrsStream prsStream = null;\n        \n        private bool unimplementedSymbolsWarning = $unimplemented_symbols_warning;\n\n        private static ParseTable prsTable = new $prs_type();\n        public ParseTable getParseTable() { return prsTable; }\n\n        private BacktrackingParser btParser = null;\n        public BacktrackingParser getParser() { return btParser; }\n\n        private void setResult(object _object) { btParser.setSym1(_object); }\n        public object getRhsSym(int i) { return btParser.getSym(i); }\n\n        public int getRhsTokenIndex(int i) { return btParser.getToken(i); }\n        public IToken getRhsIToken(int i) { return prsStream.getIToken(getRhsTokenIndex(i)); }\n        \n        public int getRhsFirstTokenIndex(int i) { return btParser.getFirstToken(i); }\n        public IToken getRhsFirstIToken(int i) { return prsStream.getIToken(getRhsFirstTokenIndex(i)); }\n\n        public int getRhsLastTokenIndex(int i) { return btParser.getLastToken(i); }\n        public IToken getRhsLastIToken(int i) { return prsStream.getIToken(getRhsLastTokenIndex(i)); }\n\n        public int getLeftSpan() { return btParser.getFirstToken(); }\n        public IToken getLeftIToken()  { return prsStream.getIToken(getLeftSpan()); }\n\n        public int getRightSpan() { return btParser.getLastToken(); }\n        public IToken getRightIToken() { return prsStream.getIToken(getRightSpan()); }\n\n        public int getRhsErrorTokenIndex(int i)\n        {\n            int index = btParser.getToken(i);\n            IToken err = prsStream.getIToken(index);\n            return (err is ErrorToken ? index : 0);\n        }\n        public ErrorToken getRhsErrorIToken(int i)\n        {\n            int index = btParser.getToken(i);\n            IToken err = prsStream.getIToken(index);\n            return (ErrorToken) (err is ErrorToken ? err : null);\n        }\n\n        public void reset(ILexStream lexStream)\n        {\n            prsStream = new PrsStream(lexStream);\n            btParser.reset(prsStream);\n\n            try\n            {\n                prsStream.remapTerminalSymbols(orderedTerminalSymbols(), prsTable.getEoftSymbol());\n            }\n            catch (NullExportedSymbolsException e) {\n            }\n            catch (NullTerminalSymbolsException e) {\n            }\n            catch (UnimplementedTerminalsException e)\n            {\n                if (unimplementedSymbolsWarning) {\n                    ArrayListHelper<int> unimplemented_symbols =  new ArrayListHelper<int>( e.getSymbols());\n                    Console.Out.WriteLine(\"The Lexer will not scan the following token(s):\");\n                    for (int i = 0; i < unimplemented_symbols.Count; i++)\n                    {\n                        int  id = unimplemented_symbols.get(i);\n                        Console.Out.WriteLine(\"    \" + $sym_type.orderedTerminalSymbols[id]);               \n                    }\n                    Console.Out.WriteLine();\n                }\n            }\n            catch (UndefinedEofSymbolException e)\n            {\n                throw (new UndefinedEofSymbolException\n                                    (\"The Lexer does not implement the Eof symbol \" +\n                                     $sym_type.orderedTerminalSymbols[prsTable.getEoftSymbol()]));\n            } \n        }\n        \n        public $action_type()\n        {\n            try\n            {\n                btParser = new BacktrackingParser(prsStream, prsTable, (RuleAction) this);\n            }\n            catch (NotBacktrackParseTableException e)\n            {\n                throw (new NotBacktrackParseTableException\n                                    (\"Regenerate $prs_type.cs with -BACKTRACK option\"));\n            }\n            catch (BadParseSymFileException e)\n            {\n                throw (new BadParseSymFileException(\"Bad Parser Symbol File -- $sym_type.cs\"));\n            }\n        }\n        \n        public $action_type(ILexStream lexStream):this()\n        {\n            \n            reset(lexStream);\n        }\n        \n        public int numTokenKinds() { return $sym_type.numTokenKinds; }\n        public string[] orderedTerminalSymbols() { return $sym_type.orderedTerminalSymbols; }\n        public string getTokenKindName(int kind) { return $sym_type.orderedTerminalSymbols[kind]; }\n        public int getEOFTokenKind() { return prsTable.getEoftSymbol(); }\n        public IPrsStream getIPrsStream() { return prsStream; }\n\n        /**\n         * @deprecated replaced by {@link #getIPrsStream()}\n         *\n         */\n        public PrsStream getPrsStream() { return prsStream; }\n\n        /**\n         * @deprecated replaced by {@link #getIPrsStream()}\n         *\n         */\n        public PrsStream getParseStream() { return prsStream; }\n\n        public $ast_class parser()\n        {\n            return parser(null, 0);\n        }\n        \n        public $ast_class parser(Monitor monitor)\n        {\n            return parser(monitor, 0);\n        }\n        \n        public $ast_class parser(int error_repair_count)\n        {\n            return parser(null, error_repair_count);\n        }\n\n        public $ast_class parser(Monitor monitor, int error_repair_count)\n        {\n            btParser.setMonitor(monitor);\n            \n            try\n            {\n                return ($ast_class) btParser.fuzzyParse(error_repair_count);\n            }\n            catch (BadParseException e)\n            {\n                prsStream.reset(e.error_token); // point to error token\n\n                DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable);\n                diagnoseParser.diagnose(e.error_token);\n            }\n\n            return null;\n        }\n\n        //\n        // Additional entry points, if any\n        //\n        $entry_declarations\n    ./\n\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "cb8ac42c85b63d547e39b8a345f6cebc752d9f65", "size": 10456, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/csharp/btParserTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/csharp/btParserTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/csharp/btParserTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.4839650146, "max_line_length": 108, "alphanum_fraction": 0.5519319051, "num_tokens": 2304, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.07369626767158909, "lm_q2_score": 0.028870904543998467, "lm_q1q2_score": 0.0021276779091954088}}
{"text": ">1apf\nGVPCLCDSDGPRPRGNTLSGILWFYPSGCPS2GWH1NCKAHGPNIGWCCKK2\n>1ahl\nGVSCLCDSDGPSVRGNTLSGTLWLYPSGCPS2GWH1NCKAHGPTIGWCCKQ2\n>1atx\nGAACLCKSDGPNTRGNSMSGTIWVF2GCPS2GWN1NCEGRA1IIGYCCKQ2\n>1sh1\n1AACKCDDEGPDIRTAPLTGTVDLG2SCNA2GWE1KCASYYTIIADCCRKKK\n>1bds\nAAPCFCSGKP7GRGDLWILRGTCPGGYGYTSNCYK2WPNICCYPH2\n", "meta": {"hexsha": "70aa1205ae9de62eb9d8a6a947b3a6b0c0dd1e8a", "size": 288, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "modules/pipelines/regressive_alignment/test/seatoxin_F2G.gap", "max_stars_repo_name": "JoseEspinosa/nf-benchmark", "max_stars_repo_head_hexsha": "833b18aad6939fa88f1ddedc7881f21195c94245", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-04-10T02:45:21.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-10T02:45:21.000Z", "max_issues_repo_path": "modules/pipelines/regressive_alignment/test/seatoxin_F2G.gap", "max_issues_repo_name": "JoseEspinosa/nf-benchmark", "max_issues_repo_head_hexsha": "833b18aad6939fa88f1ddedc7881f21195c94245", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 28, "max_issues_repo_issues_event_min_datetime": "2020-03-18T14:29:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-28T17:21:15.000Z", "max_forks_repo_path": "modules/pipelines/regressive_alignment/test/seatoxin_F2G.gap", "max_forks_repo_name": "JoseEspinosa/nf-benchmark", "max_forks_repo_head_hexsha": "833b18aad6939fa88f1ddedc7881f21195c94245", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2020-03-18T14:25:34.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-25T14:23:11.000Z", "avg_line_length": 26.1818181818, "max_line_length": 52, "alphanum_fraction": 0.9479166667, "num_tokens": 178, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.13117321357238923, "lm_q2_score": 0.015906395006520947, "lm_q1q2_score": 0.0020864929493571577}}
{"text": "--\n-- The Java Lexer\n--\n%Options fp=CncLexer\n%options single-productions\n%options package=CnCParser\n%options template=LexerTemplateF.gi\n%options filter=cncKWLexer.gi\n\n%Notice\n/.\n//\n// This file is part of the CNC-C implementation and\n// distributed under the Modified BSD License. \n// See LICENSE for details.\n// \n// I AM A GENERATED FILE. PLEASE DO NOT CHANGE ME!!!\n//\n./\n%End\n\n%Define\n    --\n    -- Definition of macro used in the included file LexerBasicMapB.g\n    --\n    $kw_lexer_class /.$cncKWLexer./\n    $_IDENTIFIER    /.$_T_NAME./\n\n%End\n\n%Include\n    LexerBasicMapF.gi\n%End\n\n%Export\n\n    T_NAME\n    T_NUMBER\n    T_QUOTEDVAL\n\n    SEMICOLON\n    RIGHT_ARROW\n    LEFT_ARROW\n    COLON_COLON\n    COMMA\n    LESS_THAN\n    GREATER_THAN\n    COLON\n    LEFT_PARENTHESIS\n    RIGHT_PARENTHESIS\n    LEFT_BRACKET\n    RIGHT_BRACKET\n    LEFT_BRACE\n    RIGHT_BRACE\n    EQUAL\n    AMPERSAND\n    STAR\n    DOT\n    DOT_DOT\n    PLUS\n    MINUS\n    SLASH\n    SHARP\n    ATSIGN\n\t--UNSIGNED\n    --STRUCT\n\n%End\n\n%Terminals\n    CtlCharNotWS\n\n    LF   CR   HT   FF\n\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n    _\n\n    A    B    C    D    E    F    G    H    I    J    K    L    M\n    N    O    P    Q    R    S    T    U    V    W    X    Y    Z\n\n    0    1    2    3    4    5    6    7    8    9\n\n    AfterASCII   ::= '\\u0080..\\ufffe'\n    Space        ::= ' '\n    LF           ::= NewLine\n    CR           ::= Return\n    HT           ::= HorizontalTab\n    FF           ::= FormFeed\n    DoubleQuote  ::= '\"'\n    SingleQuote  ::= \"'\"\n    Percent      ::= '%'\n    VerticalBar  ::= '|'\n    Exclamation  ::= '!'\n    AtSign       ::= '@'\n    BackQuote    ::= '`'\n    Tilde        ::= '~'\n    Sharp        ::= '#'\n    DollarSign   ::= '$'\n    Ampersand    ::= '&'\n    Caret        ::= '^'\n    Colon        ::= ':'\n    SemiColon    ::= ';'\n    BackSlash    ::= '\\'\n    LeftBrace    ::= '{'\n    RightBrace   ::= '}'\n    LeftBracket  ::= '['\n    RightBracket ::= ']'\n    QuestionMark ::= '?'\n    Comma        ::= ','\n    Dot          ::= '.'\n    LessThan     ::= '<'\n    GreaterThan  ::= '>'\n    Plus         ::= '+'\n    Minus        ::= '-'\n    Slash        ::= '/'\n    Star         ::= '*'\n    LeftParen    ::= '('\n    RightParen   ::= ')'\n    Equal        ::= '='\n    -- Unsigned\t ::= \"unsigned\"\n    -- Struct\t\t ::= \"struct\"\n\n%End\n\n%Start\n    Token\n%End\n\n%Rules\n\n    ---------------------  Rules for Scanned Tokens --------------------------------\n    -- The lexer creates an array list of tokens which is defined in the PrsStream class.\n    -- A token has three attributes: a start offset, an end offset and a kind.\n    -- \n    -- Only rules that produce complete tokens have actions to create token objects.\n    -- When making a token, calls to the methods, $getToken(1) and $getRightSpan(), \n    -- provide the offsets (i.e. the span) of a rule's right hand side (rhs) and thus of the token.\n    -- For a rule of the form A ::= A1 A2 ... An, the start offset of the rhs of A is given by\n    -- $getToken(1) or by $getLeftSpan() and the end offset by $getRightSpan().\n    --  \n    -- Regarding rules for parsing in general, note that for a rhs symbol Ai, the \n    -- method $getToken(i) returns the location of the leftmost character derived from Ai.  \n    -- The method $getLeftSpan(i) returns the same location unless Ai produces %Empty in which case\n    -- it returns the location of the last character derived before reducing Ai to %Empty. \n    -- The method $getRightSpan(i) returns the location of the rightmost character derived from Ai \n    -- unless Ai produces %Empty in which case it returns the location of the last character \n    -- derived before reducing Ai to %Empty.\n    --------------------------------------------------------------------------------\n    Token ::= ';'\n        /.\n                    makeToken($_SEMICOLON);\n        ./\n\n    Token ::= '-' '>'\n        /.\n                    makeToken($_RIGHT_ARROW);\n        ./\n\n    Token ::= '<' '-'\n        /.\n                    makeToken($_LEFT_ARROW);\n        ./\n\n    Token ::= ':' ':'\n        /.\n                    makeToken($_COLON_COLON);\n        ./\n\n    Token ::= ','\n        /.\n                    makeToken($_COMMA);\n        ./\n\n    Token ::= '<'\n        /.\n                    makeToken($_LESS_THAN);\n        ./\n\n    Token ::= '>'\n        /.\n                    makeToken($_GREATER_THAN);\n        ./\n\n    Token ::= ':'\n        /.\n                    makeToken($_COLON);\n        ./\n\n    Token ::= '('\n        /.\n                    makeToken($_LEFT_PARENTHESIS);\n        ./\n\n    Token ::= ')'\n        /.\n                    makeToken($_RIGHT_PARENTHESIS);\n        ./\n\n    Token ::= '['\n        /.\n                    makeToken($_LEFT_BRACKET);\n        ./\n\n    Token ::= ']'\n        /.\n                    makeToken($_RIGHT_BRACKET);\n        ./\n\n\tToken ::= '{'\n        /.\n                    makeToken($_LEFT_BRACE);\n        ./\n\n    Token ::= '}'\n        /.\n                    makeToken($_RIGHT_BRACE);\n        ./\n        \n    Token ::= '='\n        /.\n                    makeToken($_EQUAL);\n        ./\n\n\tToken ::= '@'\n        /.\n                    makeToken($_ATSIGN);\n        ./\n        \n    Token ::= Identifier\n        /.\n                    checkForKeyWord();\n        ./\n\n    Token ::= '&'\n        /.\n                    makeToken($_AMPERSAND);\n        ./\n\n    Token ::= '*'\n        /.\n                    makeToken($_STAR);\n        ./\n        \n    Token ::= '/'\n        /.\n                    makeToken($_SLASH);\n        ./\n\t\n\tToken ::= '+'\n        /.\n                    makeToken($_PLUS);\n        ./\n        \n    Token ::= '-'\n        /.\n                    makeToken($_MINUS);\n        ./\n\n    Token ::= '.'\n        /.\n                    makeToken($_DOT);\n        ./\n\t\n\tToken ::= '.' '.'\n        /.\n                    makeToken($_DOT_DOT);\n        ./\n   \n   \tToken ::= '#'\n        /.\n                    makeToken($_SHARP);\n        ./\n    --Token ::= 'u' 'n' 's' 'i' 'g' 'n' 'e' 'd'\n      --  /.\n       --             makeToken($_UNSIGNED);\n       -- ./\n    --Token ::= 's' 't' 'r' 'u' 'c' 't'\n      --  /.\n        --            makeToken($_STRUCT);\n        --./    \n    \n    Token ::= '\"' SLBody '\"'\n        /.\n                    makeToken($_T_QUOTEDVAL);\n        ./\n\n    Token ::= '\"' SLBody Eol -- TODO: remove the Eol from the string\n        /.\n                    makeToken($_T_QUOTEDVAL);\n        ./\n\n    Token ::= Integer\n        /.\n                    makeToken($_T_NUMBER);\n        ./\n    Token ::= WS -- White Space is scanned but not added to output vector\n        /.\n                    skipToken();\n        ./\n\n    Token ::= SLC\n        /.\n                    skipToken();\n        ./\n       \n\n    SLBody ::= %Empty\n             | SLBody NotDQ\n\n    SLC ::= '/' '/'\n          | SLC NotEol\n\n    NotEol -> Letter\n            | Digit\n            | Special\n            | Space\n            | HT\n            | FF\n            | CtlCharNotWS\n\n    Special -> '+' | '-' | '*' | '/' | '(' | ')' | '\"' | '!' | '@' | '`' | '~' |\n               '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n               '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#'\n\n    SpecialNotDQ -> '+' | '-' | '*' | '/' | '(' | ')' | '!' | '@' | '`' | '~' |\n                    '%' | '&' | '^' | ':' | ';' | \"'\" | '\\' | '|' | '{' | '}' |\n                    '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#'\n\n    Integer -> Digit\n             | Integer Digit\n\n    WSChar -> Space\n            | Eol\n            | HT\n            | FF\n\n    Eol -> LF\n         | CR\n\n    Letter -> LowerCaseLetter\n            | UpperCaseLetter\n            | _\n            | '$'\n            | '\\u0080..\\ufffe'\n\n    LowerCaseLetter -> a | b | c | d | e | f | g | h | i | j | k | l | m |\n                       n | o | p | q | r | s | t | u | v | w | x | y | z\n\n    UpperCaseLetter -> A | B | C | D | E | F | G | H | I | J | K | L | M |\n                       N | O | P | Q | R | S | T | U | V | W | X | Y | Z\n\n    Digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n    WS -> WSChar\n        | WS WSChar\n\n    Identifier -> Letter\n                | Identifier Letter\n                | Identifier Digit\n\n    NotDQ -> Letter\n           | Digit\n           | SpecialNotDQ\n           | Space\n           | HT\n           | FF\n%End\n", "meta": {"hexsha": "a946e1ad08850af5ccfd78ca062699c27adfa6f1", "size": 8342, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "CnCLPGParser/src/CnCParser/cncLexer.gi", "max_stars_repo_name": "pelmers/cnc-ocr", "max_stars_repo_head_hexsha": "1ee9690d9856bdf6bba1a468bfc21f28aed958ab", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "CnCLPGParser/src/CnCParser/cncLexer.gi", "max_issues_repo_name": "pelmers/cnc-ocr", "max_issues_repo_head_hexsha": "1ee9690d9856bdf6bba1a468bfc21f28aed958ab", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "CnCLPGParser/src/CnCParser/cncLexer.gi", "max_forks_repo_name": "pelmers/cnc-ocr", "max_forks_repo_head_hexsha": "1ee9690d9856bdf6bba1a468bfc21f28aed958ab", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.6070460705, "max_line_length": 99, "alphanum_fraction": 0.3893550707, "num_tokens": 2224, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.07585818419975078, "lm_q2_score": 0.02479816064603307, "lm_q1q2_score": 0.0018811434381017875}}
{"text": "--\n-- An instance of this template must have a $Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--     $super_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateF\n--\n%Options programming_language=java,margin=4\n%Options table\n%options action-block=(\"*.java\", \"/.\", \"./\")\n%options ParseTable=lpg.runtime.ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.$_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.$file_prefix$LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.Object./\n\n    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream\n                  getPrsStream()./\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n               lexParser.setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 lexParser.setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getLastToken\n              lexParser.getSym./\n    $getToken /. // macro getToken is deprecated. Use function getToken\n                lexParser.getToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   lexParser.getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    lexParser.getLastToken./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.$Header$case $rule_number: { ./\n\n    $BeginAction /.$DefaultAction./\n\n    $EndAction\n    /.            break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n        public void ruleAction(int ruleNumber)\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n                    default:\n                        ruleAction$rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n\n            public void ruleAction$rule_number(int ruleNumber)\n            {\n                switch (ruleNumber)\n                {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.import lpg.runtime.*;\n    ./\n%End\n\n%Headers\n    /.\n    public class $action_type extends $super_class implements RuleAction$additional_interfaces\n    {\n        private $super_stream_class lexStream;\n        \n        private static ParseTable prs = new $prs_type();\n        public ParseTable getParseTable() { return prs; }\n\n        private LexParser lexParser = new LexParser();\n        public LexParser getParser() { return lexParser; }\n\n        public int getToken(int i) { return lexParser.getToken(i); }\n        public int getRhsFirstTokenIndex(int i) { return lexParser.getFirstToken(i); }\n        public int getRhsLastTokenIndex(int i) { return lexParser.getLastToken(i); }\n\n        public int getLeftSpan() { return lexParser.getToken(1); }\n        public int getRightSpan() { return lexParser.getLastToken(); }\n  \n        public void resetKeywordLexer()\n        {\n            if (kwLexer == null)\n                  this.kwLexer = new $kw_lexer_class(lexStream.getInputChars(), $_IDENTIFIER);\n            else this.kwLexer.setInputChars(lexStream.getInputChars());\n        }\n  \n        public void reset(String filename, int tab) throws java.io.IOException\n        {\n            lexStream = new $super_stream_class(filename, tab);\n            lexParser.reset((ILexStream) lexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n\n        public void reset(char[] input_chars, String filename)\n        {\n            reset(input_chars, filename, 1);\n        }\n        \n        public void reset(char[] input_chars, String filename, int tab)\n        {\n            lexStream = new $super_stream_class(input_chars, filename, tab);\n            lexParser.reset((ILexStream) lexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n        \n        public $action_type(String filename, int tab) throws java.io.IOException \n        {\n            reset(filename, tab);\n        }\n\n        public $action_type(char[] input_chars, String filename, int tab)\n        {\n            reset(input_chars, filename, tab);\n        }\n\n        public $action_type(char[] input_chars, String filename)\n        {\n            reset(input_chars, filename, 1);\n        }\n\n        public $action_type() {}\n\n        public ILexStream getILexStream() { return lexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public ILexStream getLexStream() { return lexStream; }\n\n        private void initializeLexer($prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            if (lexStream.getInputChars() == null)\n                throw new NullPointerException(\"LexStream was not initialized\");\n            lexStream.setPrsStream(prsStream);\n            prsStream.makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n        private void addEOF($prs_stream_class prsStream, int end_offset)\n        {\n            prsStream.makeToken(end_offset, end_offset, $eof_token); // and end with the end of file token\n            prsStream.setStreamLength(prsStream.getSize());\n        }\n\n        public void lexer($prs_stream_class prsStream)\n        {\n            lexer(null, prsStream);\n        }\n        \n        public void lexer(Monitor monitor, $prs_stream_class prsStream)\n        {\n            initializeLexer(prsStream, 0, -1);\n            lexParser.parseCharacters(monitor);  // Lex the input characters\n            addEOF(prsStream, lexStream.getStreamIndex());\n        }\n\n        public void lexer($prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            lexer(null, prsStream, start_offset, end_offset);\n        }\n        \n        public void lexer(Monitor monitor, $prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            if (start_offset <= 1)\n                 initializeLexer(prsStream, 0, -1);\n            else initializeLexer(prsStream, start_offset - 1, start_offset - 1);\n\n            lexParser.parseCharacters(monitor, start_offset, end_offset);\n\n            addEOF(prsStream, (end_offset >= lexStream.getStreamIndex() ? lexStream.getStreamIndex() : end_offset + 1));\n        }\n        \n        public IPrsStream.Range incrementalLexer(char[] input_chars, int start_change_offset, int end_change_offset) {\n            int offset_adjustment = input_chars.length - lexStream.getStreamLength();\n//*System.out.println(\"The offset adjustment is \" + offset_adjustment);\n            if (start_change_offset <= 0 && start_change_offset < input_chars.length)\n                throw new IndexOutOfBoundsException(\"The start offset \" + start_change_offset +\n                                                    \" is out of bounds for range 0..\" + (input_chars.length - 1));\n            if (end_change_offset <= 0 && end_change_offset < input_chars.length)\n                throw new IndexOutOfBoundsException(\"The end offset \" + end_change_offset +\n                                                    \" is out of bounds for range 0..\" + (input_chars.length - 1));\n            \n            //\n            // Get the potential list of tokens to be rescanned\n            //\n            java.util.ArrayList<IToken> affected_tokens = lexStream.getIPrsStream().incrementalResetAtCharacterOffset(start_change_offset); \n            \n            //\n            // If the change occured between the first two affected tokens (or adjunct) and not immediately\n            // on the characted after the first token (or adjunct), restart the scanning after the first\n            // affected token. Otherwise, rescan the first token.\n            //\n            int affected_index = 0;\n            int repair_offset = start_change_offset;\n            if (affected_tokens.size() > 0) {\n                if (affected_tokens.get(0).getEndOffset() + 1 < start_change_offset) {\n                     repair_offset = affected_tokens.get(0).getEndOffset() + 1;\n                     if (affected_tokens.get(0) instanceof Token)\n                         lexStream.getIPrsStream().makeToken(affected_tokens.get(0), 0);\n                    else lexStream.getIPrsStream().makeAdjunct(affected_tokens.get(0), 0);\n                    affected_index++;                    \n                }\n                else repair_offset = affected_tokens.get(0).getStartOffset();\n            } \n\n            lexStream.setInputChars(input_chars);\n            lexStream.setStreamLength(input_chars.length);\n            lexStream.computeLineOffsets(repair_offset);\n\n            int first_new_token_index = lexStream.getIPrsStream().getTokens().size(),\n                first_new_adjunct_index = lexStream.getIPrsStream().getAdjuncts().size();\n            \n            resetKeywordLexer();\n            lexParser.resetTokenStream(repair_offset);\n            int next_offset;\n            do {\n//*System.out.println(\"Scanning token starting at \" + (lexStream.peek() - 1));            \n                next_offset = lexParser.incrementalParseCharacters();\n//*System.out.print(\"***Remaining string: \\\"\");\n//*for (int i = next_offset; i < input_chars.length; i++)\n//*System.out.print(input_chars[i]);\n//*System.out.println(\"\\\"\");                    \n                while (affected_index < affected_tokens.size() && \n                       affected_tokens.get(affected_index).getStartOffset() + offset_adjustment < next_offset)\n//*{\n//*System.out.println(\"---Skipping token \" + affected_index + \": \\\"\" + affected_tokens.get(affected_index).toString() +\n//*\"\\\" starting at adjusted offset \" + (affected_tokens.get(affected_index).getStartOffset() + offset_adjustment));                           \n                    affected_index++;\n//*}\n            } while(next_offset <= end_change_offset &&          // still in the damage region and ...\n                    (affected_index < affected_tokens.size() &&  // not resynchronized with a token in the list of affected tokens\n                     affected_tokens.get(affected_index).getStartOffset() + offset_adjustment != next_offset));\n\n            //\n            // If any new tokens were added, compute the first and the last one.\n            //\n            IToken first_new_token = null,\n                   last_new_token = null;\n            if (first_new_token_index < lexStream.getIPrsStream().getTokens().size()) {\n                first_new_token = lexStream.getIPrsStream().getTokenAt(first_new_token_index);\n                last_new_token = lexStream.getIPrsStream().getTokenAt(lexStream.getIPrsStream().getTokens().size() - 1);\n            }\n            //\n            // If an adjunct was added prior to the first real token, chose it instead as the first token.\n            // Similarly, if adjucts were added after the last token, chose the last adjunct added as the last token.\n            //\n            if (first_new_adjunct_index < lexStream.getIPrsStream().getAdjuncts().size()) {\n                if (first_new_token == null ||\n                    lexStream.getIPrsStream().getAdjunctAt(first_new_adjunct_index).getStartOffset() <\n                    first_new_token.getStartOffset()) {\n                    first_new_token = lexStream.getIPrsStream().getAdjunctAt(first_new_adjunct_index);\n                }\n                if (last_new_token == null ||\n                    lexStream.getIPrsStream().getAdjunctAt(lexStream.getIPrsStream().getAdjuncts().size() - 1).getEndOffset() >\n                    last_new_token.getEndOffset()) {\n                    last_new_token = lexStream.getIPrsStream().getAdjunctAt(lexStream.getIPrsStream().getAdjuncts().size() - 1);\n                }\n            }\n            \n            //\n            // For all remainng tokens (and adjuncts) in the list of affected tokens add them to the\n            // list of tokens (and adjuncts).\n            //\n            for (int i = affected_index; i < affected_tokens.size(); i++) {\n                if (affected_tokens.get(i) instanceof Token)\n                     lexStream.getIPrsStream().makeToken(affected_tokens.get(i), offset_adjustment);\n                else lexStream.getIPrsStream().makeAdjunct(affected_tokens.get(i), offset_adjustment);\n//*System.out.println(\"+++Added affected token \" + i + \": \\\"\" + affected_tokens.get(i).toString() +\n//*\"\\\" starting at adjusted offset \" + (affected_tokens.get(i).getStartOffset() + offset_adjustment));                           \n            }\n            \n            return new IPrsStream.Range(lexStream.getIPrsStream(), first_new_token, last_new_token);\n        }\n\n        /**\n         * If a parse stream was not passed to this Lexical analyser then we\n         * simply report a lexical error. Otherwise, we produce a bad token.\n         */\n        public void reportLexicalError(int startLoc, int endLoc) {\n            IPrsStream prs_stream = lexStream.getIPrsStream();\n            if (prs_stream == null)\n                lexStream.reportLexicalError(startLoc, endLoc);\n            else {\n                //\n                // Remove any token that may have been processed that fall in the\n                // range of the lexical error... then add one error token that spans\n                // the error range.\n                //\n                for (int i = prs_stream.getSize() - 1; i > 0; i--) {\n                    if (prs_stream.getStartOffset(i) >= startLoc)\n                         prs_stream.removeLastToken();\n                    else break;\n                }\n                prs_stream.makeToken(startLoc, endLoc, 0); // add an error token to the prsStream\n            }        \n        }\n    ./\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "25f47c74fe340801264895372b9de6d7e50513e1", "size": 14803, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/java/LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/java/LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/java/LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.0580474934, "max_line_length": 142, "alphanum_fraction": 0.5840032426, "num_tokens": 3185, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08632346953458801, "lm_q2_score": 0.02161533181725348, "lm_q1q2_score": 0.001865910437606692}}
{"text": "--\n-- An instance of this template must have a $Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass com.ibm.lpg.Utf8LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateD\n--\n%Options programming_language=csharp,margin=4\n%Options table\n%options action-block=(\"*.cs\", \"/.\", \"./\")\n%options ParseTable=LPG2.Runtime.ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.$_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.$file_prefix$Utf8LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.object./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.$Header$case $rule_number: { ./\n\n    $BeginAction /.$DefaultAction./\n\n    $EndAction\n    /.          break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n        public void ruleAction( int ruleNumber)\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n\t            default:\n\t                ruleAction$rule_number(ruleNumber);\n\t                break;\n\t        }\n\t        return;\n\t    }\n\t\n\t    public void ruleAction$rule_number(int ruleNumber)\n\t    {\n\t        switch (ruleNumber)\n\t        {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.\n    using LPG2.Runtime;\n    using System;\n    ./\n%End\n\n%Headers\n    /.\n    public class $action_type : $super_class , RuleAction$additional_interfaces\n    {\n        private $super_stream_class utf8LexStream;\n        \n        private static ParseTable prs = new $prs_type();\n        public ParseTable getParseTable() { return prs; }\n\n        private LexParser lexParser = new LexParser();\n        public LexParser getParser() { return lexParser; }\n\n        public int getToken(int i) { return lexParser.getToken(i); }\n        public int getRhsFirstTokenIndex(int i) { return lexParser.getFirstToken(i); }\n        public int getRhsLastTokenIndex(int i) { return lexParser.getLastToken(i); }\n\n        public int getLeftSpan() { return lexParser.getToken(1); }\n        public int getRightSpan() { return lexParser.getLastToken(); }\n  \n        public void resetKeywordLexer()\n        {\n            if (kwLexer == null)\n                  this.kwLexer = new $kw_lexer_class(utf8LexStream.getInputBytes(), $_IDENTIFIER);\n            else this.kwLexer.setInputBytes(utf8LexStream.getInputBytes());\n        }\n  \n        public void reset(string filename, int tab) \n        {\n            utf8LexStream = new $super_stream_class(filename, tab);\n            lexParser.reset((ILexStream) utf8LexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n\n        public void reset(byte[] input_bytes, string filename)\n        {\n            reset(input_bytes, filename, 1);\n        }\n        \n        public void reset(byte[] input_bytes, string filename, int tab)\n        {\n            utf8LexStream = new $super_stream_class(input_bytes, filename, tab);\n            lexParser.reset((ILexStream) utf8LexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n        \n        public $action_type(string filename, int tab)  \n        {\n            reset(filename, tab);\n        }\n\n        public $action_type(byte[] input_bytes, string filename, int tab)\n        {\n            reset(input_bytes, filename, tab);\n        }\n\n        public $action_type(byte[] input_bytes, string filename)\n        {\n            reset(input_bytes, filename, 1);\n        }\n\n        public $action_type() {}\n\n        public ILexStream getILexStream() { return utf8LexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public ILexStream getLexStream() { return utf8LexStream; }\n\n        private void initializeLexer($prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            if (utf8LexStream.getInputBytes() == null)\n                throw new NullReferenceException(\"LexStream was not initialized\");\n            utf8LexStream.setPrsStream(prsStream);\n            prsStream.makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n        public void lexer($prs_stream_class prsStream)\n        {\n            lexer(null, prsStream);\n        }\n        \n        public void lexer(Monitor monitor, $prs_stream_class prsStream)\n        {\n            if (utf8LexStream.getInputBytes() == null)\n                throw new NullReferenceException(\"Utf8LexStream was not initialized\");\n\n            utf8LexStream.setPrsStream(prsStream);\n\n            prsStream.makeToken(0, 0, 0); // Token list must start with a bad token\n                \n            lexParser.parseCharacters(monitor);  // Lex the input characters\n                \n            int i = utf8LexStream.getStreamIndex();\n            prsStream.makeToken(i, i, $eof_token); // and end with the end of file token\n            prsStream.setStreamLength(prsStream.getSize());\n                \n            return;\n        }\n    ./\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "835e8eac1a401c49b49e381c6932c50e5ee1082c", "size": 6078, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/csharp/Utf8LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/csharp/Utf8LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/csharp/Utf8LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.5414847162, "max_line_length": 103, "alphanum_fraction": 0.5804540967, "num_tokens": 1431, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08756383714196, "lm_q2_score": 0.02128734985311502, "lm_q1q2_score": 0.0018640020357220898}}
{"text": "%Globals\n    /.\n    import { %exp_type } from \".\\/%exp_type\";\n    ./\n%End\n%Trailers \n/. \n      export  class  %super_stream_class  extends LpgLexStream\n        {\n        public static tokenKind  : number[] =\n        [\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 000    0x00\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 001    0x01\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 002    0x02\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 003    0x03\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 004    0x04\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 005    0x05\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 006    0x06\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 007    0x07\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 008    0x08\n            %sym_type.%prefix%HT%suffix%,              // 009    0x09\n            %sym_type.%prefix%LF%suffix%,              // 010    0x0A\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 011    0x0B\n            %sym_type.%prefix%FF%suffix%,              // 012    0x0C\n            %sym_type.%prefix%CR%suffix%,              // 013    0x0D\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 014    0x0E\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 015    0x0F\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 016    0x10\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 017    0x11\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 018    0x12\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 019    0x13\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 020    0x14\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 021    0x15\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 022    0x16\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 023    0x17\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 024    0x18\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 025    0x19\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 026    0x1A\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 027    0x1B\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 028    0x1C\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 029    0x1D\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 030    0x1E\n            %sym_type.%prefix%CtlCharNotWS%suffix%,    // 031    0x1F\n            %sym_type.%prefix%Space%suffix%,           // 032    0x20\n            %sym_type.%prefix%Exclamation%suffix%,     // 033    0x21\n            %sym_type.%prefix%DoubleQuote%suffix%,     // 034    0x22\n            %sym_type.%prefix%Sharp%suffix%,           // 035    0x23\n            %sym_type.%prefix%DollarSign%suffix%,      // 036    0x24\n            %sym_type.%prefix%Percent%suffix%,         // 037    0x25\n            %sym_type.%prefix%Ampersand%suffix%,       // 038    0x26\n            %sym_type.%prefix%SingleQuote%suffix%,     // 039    0x27\n            %sym_type.%prefix%LeftParen%suffix%,       // 040    0x28\n            %sym_type.%prefix%RightParen%suffix%,      // 041    0x29\n            %sym_type.%prefix%Star%suffix%,            // 042    0x2A\n            %sym_type.%prefix%Plus%suffix%,            // 043    0x2B\n            %sym_type.%prefix%Comma%suffix%,           // 044    0x2C\n            %sym_type.%prefix%Minus%suffix%,           // 045    0x2D\n            %sym_type.%prefix%Dot%suffix%,             // 046    0x2E\n            %sym_type.%prefix%Slash%suffix%,           // 047    0x2F\n            %sym_type.%prefix%0%suffix%,               // 048    0x30\n            %sym_type.%prefix%1%suffix%,               // 049    0x31\n            %sym_type.%prefix%2%suffix%,               // 050    0x32\n            %sym_type.%prefix%3%suffix%,               // 051    0x33\n            %sym_type.%prefix%4%suffix%,               // 052    0x34\n            %sym_type.%prefix%5%suffix%,               // 053    0x35\n            %sym_type.%prefix%6%suffix%,               // 054    0x36\n            %sym_type.%prefix%7%suffix%,               // 055    0x37\n            %sym_type.%prefix%8%suffix%,               // 056    0x38\n            %sym_type.%prefix%9%suffix%,               // 057    0x39\n            %sym_type.%prefix%Colon%suffix%,           // 058    0x3A\n            %sym_type.%prefix%SemiColon%suffix%,       // 059    0x3B\n            %sym_type.%prefix%LessThan%suffix%,        // 060    0x3C\n            %sym_type.%prefix%Equal%suffix%,           // 061    0x3D\n            %sym_type.%prefix%GreaterThan%suffix%,     // 062    0x3E\n            %sym_type.%prefix%QuestionMark%suffix%,    // 063    0x3F\n            %sym_type.%prefix%AtSign%suffix%,          // 064    0x40\n            %sym_type.%prefix%A%suffix%,               // 065    0x41\n            %sym_type.%prefix%B%suffix%,               // 066    0x42\n            %sym_type.%prefix%C%suffix%,               // 067    0x43\n            %sym_type.%prefix%D%suffix%,               // 068    0x44\n            %sym_type.%prefix%E%suffix%,               // 069    0x45\n            %sym_type.%prefix%F%suffix%,               // 070    0x46\n            %sym_type.%prefix%G%suffix%,               // 071    0x47\n            %sym_type.%prefix%H%suffix%,               // 072    0x48\n            %sym_type.%prefix%I%suffix%,               // 073    0x49\n            %sym_type.%prefix%J%suffix%,               // 074    0x4A\n            %sym_type.%prefix%K%suffix%,               // 075    0x4B\n            %sym_type.%prefix%L%suffix%,               // 076    0x4C\n            %sym_type.%prefix%M%suffix%,               // 077    0x4D\n            %sym_type.%prefix%N%suffix%,               // 078    0x4E\n            %sym_type.%prefix%O%suffix%,               // 079    0x4F\n            %sym_type.%prefix%P%suffix%,               // 080    0x50\n            %sym_type.%prefix%Q%suffix%,               // 081    0x51\n            %sym_type.%prefix%R%suffix%,               // 082    0x52\n            %sym_type.%prefix%S%suffix%,               // 083    0x53\n            %sym_type.%prefix%T%suffix%,               // 084    0x54\n            %sym_type.%prefix%U%suffix%,               // 085    0x55\n            %sym_type.%prefix%V%suffix%,               // 086    0x56\n            %sym_type.%prefix%W%suffix%,               // 087    0x57\n            %sym_type.%prefix%X%suffix%,               // 088    0x58\n            %sym_type.%prefix%Y%suffix%,               // 089    0x59\n            %sym_type.%prefix%Z%suffix%,               // 090    0x5A\n            %sym_type.%prefix%LeftBracket%suffix%,     // 091    0x5B\n            %sym_type.%prefix%BackSlash%suffix%,       // 092    0x5C\n            %sym_type.%prefix%RightBracket%suffix%,    // 093    0x5D\n            %sym_type.%prefix%Caret%suffix%,           // 094    0x5E\n            %sym_type.%prefix%_%suffix%,               // 095    0x5F\n            %sym_type.%prefix%BackQuote%suffix%,       // 096    0x60\n            %sym_type.%prefix%a%suffix%,               // 097    0x61\n            %sym_type.%prefix%b%suffix%,               // 098    0x62\n            %sym_type.%prefix%c%suffix%,               // 099    0x63\n            %sym_type.%prefix%d%suffix%,               // 100    0x64\n            %sym_type.%prefix%e%suffix%,               // 101    0x65\n            %sym_type.%prefix%f%suffix%,               // 102    0x66\n            %sym_type.%prefix%g%suffix%,               // 103    0x67\n            %sym_type.%prefix%h%suffix%,               // 104    0x68\n            %sym_type.%prefix%i%suffix%,               // 105    0x69\n            %sym_type.%prefix%j%suffix%,               // 106    0x6A\n            %sym_type.%prefix%k%suffix%,               // 107    0x6B\n            %sym_type.%prefix%l%suffix%,               // 108    0x6C\n            %sym_type.%prefix%m%suffix%,               // 109    0x6D\n            %sym_type.%prefix%n%suffix%,               // 110    0x6E\n            %sym_type.%prefix%o%suffix%,               // 111    0x6F\n            %sym_type.%prefix%p%suffix%,               // 112    0x70\n            %sym_type.%prefix%q%suffix%,               // 113    0x71\n            %sym_type.%prefix%r%suffix%,               // 114    0x72\n            %sym_type.%prefix%s%suffix%,               // 115    0x73\n            %sym_type.%prefix%t%suffix%,               // 116    0x74\n            %sym_type.%prefix%u%suffix%,               // 117    0x75\n            %sym_type.%prefix%v%suffix%,               // 118    0x76\n            %sym_type.%prefix%w%suffix%,               // 119    0x77\n            %sym_type.%prefix%x%suffix%,               // 120    0x78\n            %sym_type.%prefix%y%suffix%,               // 121    0x79\n            %sym_type.%prefix%z%suffix%,               // 122    0x7A\n            %sym_type.%prefix%LeftBrace%suffix%,       // 123    0x7B\n            %sym_type.%prefix%VerticalBar%suffix%,     // 124    0x7C\n            %sym_type.%prefix%RightBrace%suffix%,      // 125    0x7D\n            %sym_type.%prefix%Tilde%suffix%,           // 126    0x7E\n\n            %sym_type.%prefix%AfterASCII%suffix%,      // for all chars in range 128..65534\n            %sym_type.%prefix%EOF%suffix%              // for '\\uffff' or 65535 \n        ];\n                \n        public    getKind(i :number)  : number // Classify character at ith location\n        {\n            let c = (i >= this.getStreamLength() ? 0xffff : this.getIntValue(i));\n            return (c < 128 // ASCII Character\n                      ? %super_stream_class.tokenKind[c]\n                      : c == 0xffff \n                           ? %sym_type.%prefix%EOF%suffix%\n                           : %sym_type.%prefix%AfterASCII%suffix%);\n        }\n\n        public  orderedExportedSymbols(): string[]  { return %exp_type.orderedTerminalSymbols; }\n\n      \n         constructor(fileName: string, inputChars?: string, tab?: number) {\n             super(fileName, inputChars, tab);\n         }\n        }\n./\n%End\n%Headers\n\n    --\n    -- Additional methods for the action class not provided in the template\n    --\n    /.\n\n        //\n        // The Lexer contains an array of characters as the input stream to be parsed.\n        // There are methods to retrieve and classify characters.\n        // The lexparser \"token\" is implemented simply as the index of the next character in the array.\n        // The Lexer : the abstract class LpgLexStream with an implementation of the abstract\n        // method getKind.  The template defines the Lexer class and the lexer() method.\n        // A driver creates the action class, \"Lexer\", passing an Option object to the constructor.\n        //\n       kwLexer? :  %kw_lexer_class ;\n       public   printTokens : boolean =false;\n       private static  readonly   ECLIPSE_TAB_VALUE: number = 4;\n\n        public  getKeywordKinds() : number [] { \n            if(!this.kwLexer){\n                throw Error(\"please initilize kwLexer\");\n            }\n            return this.kwLexer.getKeywordKinds(); \n        }\n\n\n\n        /**\n         * @deprecated function replaced by {@link %reset(content : string, filename : string)}\n         */\n        public  initialize(content : string, filename : string) : void\n        {\n            this.reset(filename,4,content);\n        }\n        \n        makeToken1(left_token : number,right_token : number, kind : number) : void\n        {\n            this.lexStream.makeToken(left_token, right_token, kind);\n        }\n        \n        makeToken( arg0 : number, arg1?: number, arg2? : number) : void\n        {\n            if(arg1 && arg2){\n            \n                this.makeToken1(arg0,arg1,arg2);\n                return ;\n            }\n            let  startOffset  = this.getLeftSpan();\n            let   endOffset = this.getRightSpan();\n            this.lexStream.makeToken(startOffset, endOffset, arg0);\n            if (this.printTokens)  this.printValue(startOffset, endOffset);\n        }\n\n        makeComment(kind : number) : void\n        {\n            let startOffset =  this.getLeftSpan(),\n                endOffset =  this.getRightSpan();\n            this.lexStream.getIPrsStream()?.makeAdjunct(startOffset, endOffset, kind);\n        }\n\n         skipToken() : void \n        {\n            if (this.printTokens)  this.printValue( this.getLeftSpan(),  this.getRightSpan());\n        }\n        \n         checkForKeyWord1() : void \n        {\n            if(!this.kwLexer){\n                throw Error(\"please initilize kwLexer\");\n            }\n            let startOffset =  this.getLeftSpan(),\n                endOffset =  this.getRightSpan();\n             let   kwKind = this.kwLexer.lexer(startOffset, endOffset);\n            this.lexStream.makeToken(startOffset, endOffset, kwKind);\n            if ( this.printTokens)  this.printValue(startOffset, endOffset);\n        }\n        \n        //\n        // This flavor of checkForKeyWord is necessary when the default kind\n        // (which is returned when the keyword filter doesn't match) is something\n        // other than _IDENTIFIER.\n        //\n         checkForKeyWord(defaultKind? :number) : void \n        {\n           if(!defaultKind){\n              this.checkForKeyWord1();\n              return;\n           }\n            if(!this.kwLexer){\n                throw Error(\"please initilize kwLexer\");\n            }\n            let startOffset =  this.getLeftSpan(),\n                endOffset =  this.getRightSpan();\n            let    kwKind =  this.kwLexer.lexer(startOffset, endOffset);\n            if (kwKind == %_IDENTIFIER)\n                kwKind = defaultKind;\n            this.lexStream.makeToken(startOffset, endOffset, kwKind);\n            if ( this.printTokens)  this.printValue(startOffset, endOffset);\n        }\n        \n         printValue(startOffset : number, endOffset : number) : void \n        {\n             let s = this.lexStream.getInputChars().substr(startOffset, endOffset - startOffset + 1);\n             console.log(s);\n        }\n\n      \n    ./\n%End\n", "meta": {"hexsha": "591fb99e96b78308acd73e97fe4374b0b2321260", "size": 14010, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerBasicMapF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerBasicMapF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/include/typescript/LexerBasicMapF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 51.3186813187, "max_line_length": 103, "alphanum_fraction": 0.4910778016, "num_tokens": 3926, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.12765261536566067, "lm_q2_score": 0.014281936704669332, "lm_q1q2_score": 0.0018231265728378655}}
{"text": "# This file has been generated by the GAP build system,\n# do not edit manually!\nGAParch=FAKE-GAP-ARCH\nGAP_ABI=64\nGAP_HPCGAP=no\n\nGAP_VERSION=\"4.12dev\"\nGAP_BUILD_VERSION=\"4.12dev\"\nGAP_LIBTOOL_CURRENT=8\nGAP_LIBTOOL_AGE=0\nGAP_KERNEL_MAJOR_VERSION=8\nGAP_KERNEL_MINOR_VERSION=0\n\nGAP_BIN_DIR=\"/workspace/destdir/share/gap\"\nGAP_LIB_DIR=\"/workspace/destdir/share/gap\"\n\nGAP=\"/workspace/destdir/bin/gap\"\nGAC=\"/workspace/destdir/share/gap/gac\"\n\nGAP_CC=\"cc \"\nGAP_CXX=\"c++ -std=gnu++11 \"\nGAP_CFLAGS=\"-g -O2\"\nGAP_CXXFLAGS=\"-g -O2\"\nGAP_CPPFLAGS=\"-I/workspace/destdir/include/gap -DUSE_JULIA_GC=1 -fPIC \"\nGAP_LDFLAGS=\"-L/workspace/destdir/lib \"\nGAP_LIBS=\"-lgmp\"\n", "meta": {"hexsha": "b5a99397cf2b2522f4c73ea1cfe4b8fe3931cca6", "size": 645, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "G/GAP_pkg/bundled/sysinfo.gap", "max_stars_repo_name": "MichelJuillard/Yggdrasil", "max_stars_repo_head_hexsha": "220f50ee0e857e9e4ddb289c26f3e0bfe8784065", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "G/GAP_pkg/bundled/sysinfo.gap", "max_issues_repo_name": "MichelJuillard/Yggdrasil", "max_issues_repo_head_hexsha": "220f50ee0e857e9e4ddb289c26f3e0bfe8784065", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "G/GAP_pkg/bundled/sysinfo.gap", "max_forks_repo_name": "MichelJuillard/Yggdrasil", "max_forks_repo_head_hexsha": "220f50ee0e857e9e4ddb289c26f3e0bfe8784065", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.8888888889, "max_line_length": 71, "alphanum_fraction": 0.7782945736, "num_tokens": 236, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.10374862132405092, "lm_q2_score": 0.01744248422544586, "lm_q1q2_score": 0.0018096336908565143}}
{"text": "%Headers\n    --\n    -- Additional methods for the action class not provided in the template\n    --\n    /.\n        //\n        // The Lexer contains an array of characters as the input stream to be parsed.\n        // There are methods to retrieve and classify characters.\n        // The lexparser \"token\" is implemented simply as the index of the next character in the array.\n        // The Lexer extends the abstract class LpgLexStream with an implementation of the abstract\n        // method getKind.  The template defines the Lexer class and the lexer() method.\n        // A driver creates the action class, \"Lexer\", passing an Option object to the constructor.\n        //\n        $kw_lexer_class *kwLexer= nullptr;\n        bool printTokens =false;\n          static const int ECLIPSE_TAB_VALUE = 4;\n\n        int*  getKeywordKinds() { return kwLexer->getKeywordKinds(); }\n\n       \n\n        /**\n         * @deprecated function replaced by {@link #reset(char [] content, const std::wstring& filename)}\n         */\n         void initialize(shared_ptr_wstring content, const std::wstring& filename)\n        {\n            reset(content, filename);\n        }\n        \n         void makeToken(int left_token, int right_token, int kind)\n        {\n            lexStream->makeToken(left_token, right_token, kind);\n        }\n        \n         void makeToken(int kind)\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan();\n            lexStream->makeToken(startOffset, endOffset, kind);\n            if (printTokens) printValue(startOffset, endOffset);\n        }\n\n         void makeComment(int kind)\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan();\n            lexStream->getIPrsStream()->makeAdjunct(startOffset, endOffset, kind);\n        }\n\n         void skipToken()\n        {\n            if (printTokens) printValue(getLeftSpan(), getRightSpan());\n        }\n        \n         void checkForKeyWord()\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan(),\n                kwKind = kwLexer->lexer(startOffset, endOffset);\n            lexStream->makeToken(startOffset, endOffset, kwKind);\n            if (printTokens) printValue(startOffset, endOffset);\n        }\n        \n        //\n        // This flavor of checkForKeyWord is necessary when the default kind\n        // (which is returned when the keyword filter doesn't match) is something\n        // other than _IDENTIFIER.\n        //\n         void checkForKeyWord(int defaultKind)\n        {\n            int startOffset = getLeftSpan(),\n                endOffset = getRightSpan(),\n                kwKind = kwLexer->lexer(startOffset, endOffset);\n            if (kwKind == $_IDENTIFIER)\n                kwKind = defaultKind;\n            lexStream->makeToken(startOffset, endOffset, kwKind);\n            if (printTokens) printValue(startOffset, endOffset);\n        }\n        \n         void printValue(int startOffset, int endOffset)\n        {\n           auto  input = lexStream->getInputChars().data();\n            std::wstring s(input + startOffset,input + startOffset+  endOffset - startOffset + 1);\n            std::wcout << (s) << std::endl ;\n        }\n\n        //\n        //\n        //\n         struct $super_stream_class :public LpgLexStream\n        {\n         inline static int tokenKind[] =\n        {\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 000    0x00\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 001    0x01\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 002    0x02\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 003    0x03\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 004    0x04\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 005    0x05\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 006    0x06\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 007    0x07\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 008    0x08\n            $sym_type::$prefix$HT$suffix$,              // 009    0x09\n            $sym_type::$prefix$LF$suffix$,              // 010    0x0A\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 011    0x0B\n            $sym_type::$prefix$FF$suffix$,              // 012    0x0C\n            $sym_type::$prefix$CR$suffix$,              // 013    0x0D\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 014    0x0E\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 015    0x0F\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 016    0x10\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 017    0x11\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 018    0x12\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 019    0x13\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 020    0x14\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 021    0x15\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 022    0x16\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 023    0x17\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 024    0x18\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 025    0x19\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 026    0x1A\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 027    0x1B\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 028    0x1C\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 029    0x1D\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 030    0x1E\n            $sym_type::$prefix$CtlCharNotWS$suffix$,    // 031    0x1F\n            $sym_type::$prefix$Space$suffix$,           // 032    0x20\n            $sym_type::$prefix$Exclamation$suffix$,     // 033    0x21\n            $sym_type::$prefix$DoubleQuote$suffix$,     // 034    0x22\n            $sym_type::$prefix$Sharp$suffix$,           // 035    0x23\n            $sym_type::$prefix$DollarSign$suffix$,      // 036    0x24\n            $sym_type::$prefix$Percent$suffix$,         // 037    0x25\n            $sym_type::$prefix$Ampersand$suffix$,       // 038    0x26\n            $sym_type::$prefix$SingleQuote$suffix$,     // 039    0x27\n            $sym_type::$prefix$LeftParen$suffix$,       // 040    0x28\n            $sym_type::$prefix$RightParen$suffix$,      // 041    0x29\n            $sym_type::$prefix$Star$suffix$,            // 042    0x2A\n            $sym_type::$prefix$Plus$suffix$,            // 043    0x2B\n            $sym_type::$prefix$Comma$suffix$,           // 044    0x2C\n            $sym_type::$prefix$Minus$suffix$,           // 045    0x2D\n            $sym_type::$prefix$Dot$suffix$,             // 046    0x2E\n            $sym_type::$prefix$Slash$suffix$,           // 047    0x2F\n            $sym_type::$prefix$0$suffix$,               // 048    0x30\n            $sym_type::$prefix$1$suffix$,               // 049    0x31\n            $sym_type::$prefix$2$suffix$,               // 050    0x32\n            $sym_type::$prefix$3$suffix$,               // 051    0x33\n            $sym_type::$prefix$4$suffix$,               // 052    0x34\n            $sym_type::$prefix$5$suffix$,               // 053    0x35\n            $sym_type::$prefix$6$suffix$,               // 054    0x36\n            $sym_type::$prefix$7$suffix$,               // 055    0x37\n            $sym_type::$prefix$8$suffix$,               // 056    0x38\n            $sym_type::$prefix$9$suffix$,               // 057    0x39\n            $sym_type::$prefix$Colon$suffix$,           // 058    0x3A\n            $sym_type::$prefix$SemiColon$suffix$,       // 059    0x3B\n            $sym_type::$prefix$LessThan$suffix$,        // 060    0x3C\n            $sym_type::$prefix$Equal$suffix$,           // 061    0x3D\n            $sym_type::$prefix$GreaterThan$suffix$,     // 062    0x3E\n            $sym_type::$prefix$QuestionMark$suffix$,    // 063    0x3F\n            $sym_type::$prefix$AtSign$suffix$,          // 064    0x40\n            $sym_type::$prefix$A$suffix$,               // 065    0x41\n            $sym_type::$prefix$B$suffix$,               // 066    0x42\n            $sym_type::$prefix$C$suffix$,               // 067    0x43\n            $sym_type::$prefix$D$suffix$,               // 068    0x44\n            $sym_type::$prefix$E$suffix$,               // 069    0x45\n            $sym_type::$prefix$F$suffix$,               // 070    0x46\n            $sym_type::$prefix$G$suffix$,               // 071    0x47\n            $sym_type::$prefix$H$suffix$,               // 072    0x48\n            $sym_type::$prefix$I$suffix$,               // 073    0x49\n            $sym_type::$prefix$J$suffix$,               // 074    0x4A\n            $sym_type::$prefix$K$suffix$,               // 075    0x4B\n            $sym_type::$prefix$L$suffix$,               // 076    0x4C\n            $sym_type::$prefix$M$suffix$,               // 077    0x4D\n            $sym_type::$prefix$N$suffix$,               // 078    0x4E\n            $sym_type::$prefix$O$suffix$,               // 079    0x4F\n            $sym_type::$prefix$P$suffix$,               // 080    0x50\n            $sym_type::$prefix$Q$suffix$,               // 081    0x51\n            $sym_type::$prefix$R$suffix$,               // 082    0x52\n            $sym_type::$prefix$S$suffix$,               // 083    0x53\n            $sym_type::$prefix$T$suffix$,               // 084    0x54\n            $sym_type::$prefix$U$suffix$,               // 085    0x55\n            $sym_type::$prefix$V$suffix$,               // 086    0x56\n            $sym_type::$prefix$W$suffix$,               // 087    0x57\n            $sym_type::$prefix$X$suffix$,               // 088    0x58\n            $sym_type::$prefix$Y$suffix$,               // 089    0x59\n            $sym_type::$prefix$Z$suffix$,               // 090    0x5A\n            $sym_type::$prefix$LeftBracket$suffix$,     // 091    0x5B\n            $sym_type::$prefix$BackSlash$suffix$,       // 092    0x5C\n            $sym_type::$prefix$RightBracket$suffix$,    // 093    0x5D\n            $sym_type::$prefix$Caret$suffix$,           // 094    0x5E\n            $sym_type::$prefix$_$suffix$,               // 095    0x5F\n            $sym_type::$prefix$BackQuote$suffix$,       // 096    0x60\n            $sym_type::$prefix$a$suffix$,               // 097    0x61\n            $sym_type::$prefix$b$suffix$,               // 098    0x62\n            $sym_type::$prefix$c$suffix$,               // 099    0x63\n            $sym_type::$prefix$d$suffix$,               // 100    0x64\n            $sym_type::$prefix$e$suffix$,               // 101    0x65\n            $sym_type::$prefix$f$suffix$,               // 102    0x66\n            $sym_type::$prefix$g$suffix$,               // 103    0x67\n            $sym_type::$prefix$h$suffix$,               // 104    0x68\n            $sym_type::$prefix$i$suffix$,               // 105    0x69\n            $sym_type::$prefix$j$suffix$,               // 106    0x6A\n            $sym_type::$prefix$k$suffix$,               // 107    0x6B\n            $sym_type::$prefix$l$suffix$,               // 108    0x6C\n            $sym_type::$prefix$m$suffix$,               // 109    0x6D\n            $sym_type::$prefix$n$suffix$,               // 110    0x6E\n            $sym_type::$prefix$o$suffix$,               // 111    0x6F\n            $sym_type::$prefix$p$suffix$,               // 112    0x70\n            $sym_type::$prefix$q$suffix$,               // 113    0x71\n            $sym_type::$prefix$r$suffix$,               // 114    0x72\n            $sym_type::$prefix$s$suffix$,               // 115    0x73\n            $sym_type::$prefix$t$suffix$,               // 116    0x74\n            $sym_type::$prefix$u$suffix$,               // 117    0x75\n            $sym_type::$prefix$v$suffix$,               // 118    0x76\n            $sym_type::$prefix$w$suffix$,               // 119    0x77\n            $sym_type::$prefix$x$suffix$,               // 120    0x78\n            $sym_type::$prefix$y$suffix$,               // 121    0x79\n            $sym_type::$prefix$z$suffix$,               // 122    0x7A\n            $sym_type::$prefix$LeftBrace$suffix$,       // 123    0x7B\n            $sym_type::$prefix$VerticalBar$suffix$,     // 124    0x7C\n            $sym_type::$prefix$RightBrace$suffix$,      // 125    0x7D\n            $sym_type::$prefix$Tilde$suffix$,           // 126    0x7E\n\n            $sym_type::$prefix$AfterASCII$suffix$,      // for all chars in range 128..65534\n            $sym_type::$prefix$EOF$suffix$              // for '\\uffff' or 65535 \n            \n        };\n                \n          int getKind(int i)  // Classify character at ith location\n        {\n            int c = (i >= getStreamLength() ? 0xffff : getCharValue(i));\n            return (c < 128 // ASCII Character\n                      ? tokenKind[c]\n                      : c == 0xffff\n                           ? $sym_type::$prefix$EOF$suffix$\n                           : $sym_type::$prefix$AfterASCII$suffix$);\n        }\n\n        std::vector<std::wstring> orderedExportedSymbols() { return $exp_type::orderedTerminalSymbols; }\n\n         $super_stream_class(const std::wstring& filename, int tab):LpgLexStream(filename, tab)\n        {\n            \n        }\n\n         $super_stream_class(shared_ptr_wstring input_chars, const std::wstring& filename, int tab):LpgLexStream(input_chars, filename, tab)\n        {\n           \n        }\n    \n         $super_stream_class(shared_ptr_wstring input_chars, const std::wstring& filename):LpgLexStream(input_chars, filename, 1)\n        {\n            \n        }\n        };\n    ./\n%End\n", "meta": {"hexsha": "f4c2fac1e8402bfc1b6e11f11f60e1f7d90b5629", "size": 13631, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/rt_cpp/LexerBasicMapF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/rt_cpp/LexerBasicMapF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/rt_cpp/LexerBasicMapF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 53.24609375, "max_line_length": 140, "alphanum_fraction": 0.4886655418, "num_tokens": 3792, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09138210554170037, "lm_q2_score": 0.019719126379084587, "lm_q1q2_score": 0.0018019752879636355}}
{"text": "--/**\n-- * <copyright>\n-- *\n-- * Copyright (c) 2008, 2009 IBM Corporation and others.\n-- * All rights reserved.   This program and the accompanying materials\n-- * are made available under the terms of the Eclipse Public License v2.0\n-- * which accompanies this distribution, and is available at\n-- * http://www.eclipse.org/legal/epl-v20.html\n-- *\n-- * Contributors:\n-- *   IBM - Initial API and implementation\n-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling\n-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - LPG v 2.0.17 adoption (242153)\n-- *   Adolfo Sanchez-Barbudo Herrera (Open Canarias) - Introducing new LPG templates (299396)\n-- *\n-- * </copyright>\n-- */\n--\n-- The OCL Backtracking KeyWord Lexer, which is nominally identical to the\n-- normal KeyWord Lexer, however the extra ERROR_TOKEN symbol makes it difficult\n-- to share reliably.\n--\n\n%options slr\n%options fp=OCLBacktrackingKWLexer,prefix=Char_\n%options noserialize\n%options package=org.eclipse.ocl.parser.backtracking\n%options template=../../lpg/KeywordTemplateF.gi\n%options export_terminals=(\"OCLBacktrackingParsersym.java\", \"TK_\")\n%options include_directory=\"..;../../lpg\"\n\n%Import\n\tOCLKWLexer.gi\n%End\n", "meta": {"hexsha": "7742457af63cf69daf55eb652a38f66e25d88d98", "size": 1230, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexer.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexer.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexer.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.1428571429, "max_line_length": 102, "alphanum_fraction": 0.7308943089, "num_tokens": 326, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.11436852316318397, "lm_q2_score": 0.015189049225915192, "lm_q1q2_score": 0.0017371491282208232}}
{"text": "--\n-- The Java KeyWord Lexer\n--\n%Options fp=JavaKWLexer,states\n%options template=KeywordTemplateF.gi\n\n%Include\n    KWLexerMapF.gi\n%End\n\n%Export\n    abstract\n    assert\n    boolean\n    break\n    byte\n    case\n    catch\n    char\n    class\n    const\n    continue\n    default\n    do\n    double\n    enum\n    else\n    extends\n    false\n    final\n    finally\n    float\n    for\n    goto\n    if\n    implements\n    import\n    instanceof\n    int\n    interface\n    long\n    native\n    new\n    null\n    package\n    private\n    protected\n    public\n    return\n    short\n    static\n    strictfp\n    super\n    switch\n    synchronized\n    this\n    throw\n    throws\n    transient\n    true\n    try\n    void\n    volatile\n    while\n    \n    BeginAction\n    BeginJava\n    EndAction\n    EndJava\n    NoAction\n    NullAction\n    BadAction\n%End\n\n%Terminals\n    a    b    c    d    e    f    g    h    i    j    k    l    m\n    n    o    p    q    r    s    t    u    v    w    x    y    z\n%End\n\n%Start\n    KeyWord\n%End\n\n%Notice\n/.\n////////////////////////////////////////////////////////////////////////////////\n// Copyright (c) 2007 IBM Corporation.\n// All rights reserved. This program and the accompanying materials\n// are made available under the terms of the Eclipse Public License v1.0\n// which accompanies this distribution, and is available at\n// http://www.eclipse.org/legal/epl-v10.html\n//\n//Contributors:\n//    Philippe Charles (pcharles@us.ibm.com) - initial API and implementation\n\n////////////////////////////////////////////////////////////////////////////////\n./\n%End\n%Globals\n    /.\n#include \"$sym_type.h\"\n#include \"$prs_type.h\"\n    ./\n%End\n%Rules\n\n    -- The Goal for the parser is a single Keyword\n\n    KeyWord ::= a b s t r a c t\n        /.$BeginAction\n            $setResult($_abstract);\n          $EndAction\n        ./\n\n              | a s s e r t\n        /.$BeginAction\n            $setResult($_assert);\n          $EndAction\n        ./\n\n              | b o o l e a n\n        /.$BeginAction\n            $setResult($_boolean);\n          $EndAction\n        ./\n\n              | b r e a k\n        /.$BeginAction\n            $setResult($_break);\n          $EndAction\n        ./\n\n              | b y t e\n        /.$BeginAction\n            $setResult($_byte);\n          $EndAction\n        ./\n\n              | c a s e\n        /.$BeginAction\n            $setResult($_case);\n          $EndAction\n        ./\n\n              | c a t c h\n        /.$BeginAction\n            $setResult($_catch);\n          $EndAction\n        ./\n\n              | c h a r\n        /.$BeginAction\n            $setResult($_char);\n          $EndAction\n        ./\n\n              | c l a s s\n        /.$BeginAction\n            $setResult($_class);\n          $EndAction\n        ./\n\n              | c o n s t\n        /.$BeginAction\n            $setResult($_const);\n          $EndAction\n        ./\n\n              | c o n t i n u e\n        /.$BeginAction\n            $setResult($_continue);\n          $EndAction\n        ./\n\n              | d e f a u l t\n        /.$BeginAction\n            $setResult($_default);\n          $EndAction\n        ./\n\n              | d o\n        /.$BeginAction\n            $setResult($_do);\n          $EndAction\n        ./\n\n              | d o u b l e\n        /.$BeginAction\n            $setResult($_double);\n          $EndAction\n        ./\n\n              | e l s e\n        /.$BeginAction\n            $setResult($_else);\n          $EndAction\n        ./\n\n              | e n u m\n        /.$BeginAction\n            $setResult($_enum);\n          $EndAction\n        ./\n\n              | e x t e n d s\n        /.$BeginAction\n            $setResult($_extends);\n          $EndAction\n        ./\n\n              | f a l s e\n        /.$BeginAction\n            $setResult($_false);\n          $EndAction\n        ./\n\n              | f i n a l\n        /.$BeginAction\n            $setResult($_final);\n          $EndAction\n        ./\n\n              | f i n a l l y\n        /.$BeginAction\n            $setResult($_finally);\n          $EndAction\n        ./\n\n              | f l o a t\n        /.$BeginAction\n            $setResult($_float);\n          $EndAction\n        ./\n\n              | f o r\n        /.$BeginAction\n            $setResult($_for);\n          $EndAction\n        ./\n\n              | g o t o\n        /.$BeginAction\n            $setResult($_goto);\n          $EndAction\n        ./\n\n              | i f\n        /.$BeginAction\n            $setResult($_if);\n          $EndAction\n        ./\n\n              | i m p l e m e n t s\n        /.$BeginAction\n            $setResult($_implements);\n          $EndAction\n        ./\n\n              | i m p o r t\n        /.$BeginAction\n            $setResult($_import);\n          $EndAction\n        ./\n\n              | i n s t a n c e o f\n        /.$BeginAction\n            $setResult($_instanceof);\n          $EndAction\n        ./\n\n              | i n t\n        /.$BeginAction\n            $setResult($_int);\n          $EndAction\n        ./\n\n              | i n t e r f a c e\n        /.$BeginAction\n            $setResult($_interface);\n          $EndAction\n        ./\n\n              | l o n g\n        /.$BeginAction\n            $setResult($_long);\n          $EndAction\n        ./\n\n              | n a t i v e\n        /.$BeginAction\n            $setResult($_native);\n          $EndAction\n        ./\n\n              | n e w\n        /.$BeginAction\n            $setResult($_new);\n          $EndAction\n        ./\n\n              | n u l l\n        /.$BeginAction\n            $setResult($_null);\n          $EndAction\n        ./\n\n              | p a c k a g e\n        /.$BeginAction\n            $setResult($_package);\n          $EndAction\n        ./\n\n              | p r i v a t e\n        /.$BeginAction\n            $setResult($_private);\n          $EndAction\n        ./\n\n              | p r o t e c t e d\n        /.$BeginAction\n            $setResult($_protected);\n          $EndAction\n        ./\n\n              | p u b l i c\n        /.$BeginAction\n            $setResult($_public);\n          $EndAction\n        ./\n\n              | r e t u r n\n        /.$BeginAction\n            $setResult($_return);\n          $EndAction\n        ./\n\n              | s h o r t\n        /.$BeginAction\n            $setResult($_short);\n          $EndAction\n        ./\n\n              | s t a t i c\n        /.$BeginAction\n            $setResult($_static);\n          $EndAction\n        ./\n\n              | s t r i c t f p\n        /.$BeginAction\n            $setResult($_strictfp);\n          $EndAction\n        ./\n\n              | s u p e r\n        /.$BeginAction\n            $setResult($_super);\n          $EndAction\n        ./\n\n              | s w i t c h\n        /.$BeginAction\n            $setResult($_switch);\n          $EndAction\n        ./\n\n              | s y n c h r o n i z e d\n        /.$BeginAction\n            $setResult($_synchronized);\n          $EndAction\n        ./\n\n              | t h i s\n        /.$BeginAction\n            $setResult($_this);\n          $EndAction\n        ./\n\n              | t h r o w\n        /.$BeginAction\n            $setResult($_throw);\n          $EndAction\n        ./\n\n              | t h r o w s\n        /.$BeginAction\n            $setResult($_throws);\n          $EndAction\n        ./\n\n              | t r a n s i e n t\n        /.$BeginAction\n            $setResult($_transient);\n          $EndAction\n        ./\n\n              | t r u e\n        /.$BeginAction\n            $setResult($_true);\n          $EndAction\n        ./\n\n              | t r y\n        /.$BeginAction\n            $setResult($_try);\n          $EndAction\n        ./\n\n              | v o i d\n        /.$BeginAction\n            $setResult($_void);\n          $EndAction\n        ./\n\n              | v o l a t i l e\n        /.$BeginAction\n            $setResult($_volatile);\n          $EndAction\n        ./\n\n              | w h i l e\n        /.$BeginAction\n            $setResult($_while);\n          $EndAction\n        ./\n\n    KeyWord ::= '$' bB eE gG iI nN aA cC tT iI oO nN\n        /.$BeginAction\n            $setResult($_BeginAction);\n          $EndAction\n        ./\n              | '$' bB eE gG iI nN jJ aA vV aA\n        /.$BeginAction\n            $setResult($_BeginJava);\n          $EndAction\n        ./\n\n    KeyWord ::= '$' eE nN dD aA cC tT iI oO nN\n        /.$BeginAction\n            $setResult($_EndAction);\n          $EndAction\n        ./\n              | '$' eE nN dD jJ aA vV aA\n        /.$BeginAction\n            $setResult($_EndJava);\n          $EndAction\n        ./\n\n    KeyWord ::= '$' nN oO aA cC tT iI oO nN\n        /.$BeginAction\n            $setResult($_NoAction);\n          $EndAction\n        ./\n    KeyWord ::= '$' nN uU lL lL aA cC tT iI oO nN\n        /.$BeginAction\n            $setResult($_NullAction);\n          $EndAction\n        ./\n    KeyWord ::= '$' bB aA dD aA cC tT iI oO nN\n        /.$BeginAction\n            $setResult($_BadAction);\n          $EndAction\n        ./\n\n    aA -> a | A\n    bB -> b | B \n    cC -> c | C\n    dD -> d | D\n    eE -> e | E\n    gG -> g | G\n    iI -> i | I \n    jJ -> j | J \n    lL -> l | L \n    nN -> n | N\n    oO -> o | O\n    tT -> t | T\n    uU -> u | U\n    vV -> v | V \n%End", "meta": {"hexsha": "c6ba617255e2e309b04655281dec9b616a116f5f", "size": 9107, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "JavaExample/grammar/GJavaKWLexer.gi", "max_stars_repo_name": "kuafuwang/LPGRuntimeCpp", "max_stars_repo_head_hexsha": "e68e2086716766a9c2f3af2490118b84d2c0e791", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-05-21T12:23:27.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-24T01:40:49.000Z", "max_issues_repo_path": "JavaExample/grammar/GJavaKWLexer.gi", "max_issues_repo_name": "kuafuwang/LPGRuntimeCpp", "max_issues_repo_head_hexsha": "e68e2086716766a9c2f3af2490118b84d2c0e791", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JavaExample/grammar/GJavaKWLexer.gi", "max_forks_repo_name": "kuafuwang/LPGRuntimeCpp", "max_forks_repo_head_hexsha": "e68e2086716766a9c2f3af2490118b84d2c0e791", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 19.012526096, "max_line_length": 80, "alphanum_fraction": 0.3956297354, "num_tokens": 2464, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.07055960009622167, "lm_q2_score": 0.024053553550309536, "lm_q1q2_score": 0.001697209119402894}}
{"text": "while true do\n    Print(\"SPAM\\n\");\nod;\n", "meta": {"hexsha": "a9f347669599202186a9b9f66707eb2b86368d8d", "size": 39, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Loops-Infinite/GAP/loops-infinite.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Loops-Infinite/GAP/loops-infinite.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Loops-Infinite/GAP/loops-infinite.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 9.75, "max_line_length": 20, "alphanum_fraction": 0.5897435897, "num_tokens": 13, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.06278921210458951, "lm_q2_score": 0.026355353993244613, "lm_q1q2_score": 0.0016548319119733762}}
{"text": "\nInstallMethod( JupyterRender, \"default fallback\"\n             , [ IsObject ],\nfunction(obj)\n    local str;\n    str := ViewString(obj);\n    RemoveCharacters(str, \"\\<\\>\\n\");\n    return Objectify( JupyterRenderableType\n                    , rec( data := rec( text\\/plain := str )\n                         , metadata := rec( text\\/plain := \"\") ) );\nend);\n\nInstallMethod( JupyterRender, \"default fallback\"\n               , [ IsJupyterRenderableRep ],\n               IdFunc);\n\nInstallMethod( JupyterRenderableData, \"for a JupyterRenderable\"\n               , [  IsJupyterRenderableRep ]\n               , x -> x!.data );\n\nInstallMethod( JupyterRenderableMetadata, \"for a JupyterRenderable\"\n               , [  IsJupyterRenderableRep ]\n               , x -> x!.metadata );\n\nInstallMethod( ViewString, \"for a JupyterRenderable\"\n               , [  IsJupyterRenderableRep ]\n               , x -> \"<jupyter renderable>\" );\n\nInstallMethod( JupyterRenderable, \"for a record and a record\"\n               , [ IsObject, IsObject ],\nfunction(data, metadata)\n    return Objectify( JupyterRenderableType\n                    , rec( data := data, metadata := metadata ) );\nend);\n", "meta": {"hexsha": "fc95e640513bde1301b8f9866129594f8ac32993", "size": 1158, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gap/JupyterRenderable.gi", "max_stars_repo_name": "isuruf/GapJupyterKernel", "max_stars_repo_head_hexsha": "dda6052d5ea0552b5e7e924cf856730835387d62", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gap/JupyterRenderable.gi", "max_issues_repo_name": "isuruf/GapJupyterKernel", "max_issues_repo_head_hexsha": "dda6052d5ea0552b5e7e924cf856730835387d62", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gap/JupyterRenderable.gi", "max_forks_repo_name": "isuruf/GapJupyterKernel", "max_forks_repo_head_hexsha": "dda6052d5ea0552b5e7e924cf856730835387d62", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.0857142857, "max_line_length": 67, "alphanum_fraction": 0.573402418, "num_tokens": 271, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.10521053670308635, "lm_q2_score": 0.01518905039612273, "lm_q1q2_score": 0.0015980481441862987}}
{"text": "--\n-- In a parser using this template, the following macro may be redefined:\n--\n--     %additional_interfaces\n--     %ast_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   btParserTemplateF\n--\n%Options programming_Language=typescript,margin=4,backtrack\n%Options table,error_maps,scopes\n%options prefix=TK_\n%options action-block=(\"*.ts\", \"/.\", \"./\")\n%options ParseTable=ParseTable\n%options nt-check\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF_TOKEN to be consistent with LexerTemplateD and LexerTemplateE\n--\n%EOF\n    EOF_TOKEN\n%End\n\n%ERROR\n    ERROR_TOKEN\n%End\n\n%Define\n\n    $Header\n    /.\n                //\n                // Rule %rule_number:  %rule_text\n                //\n                ./\n\n    $BeginAction\n    /.%Header%case %rule_number: {\n                   //#line %next_line \"%input_file%\"./\n\n    $EndAction\n    /.            break;\n                }./\n\n    $BeginJava\n    /.%Header%case %rule_number: {\n                    %symbol_declarations\n                    //#line %next_line \"%input_file%\"./\n\n    $EndJava /.%EndAction./\n\n    $NoAction\n    /.%Header%case %rule_number:\n                    break;./\n\n    $BadAction\n    /.%Header%case %rule_number:\n                    throw (\"No action specified for rule \" + %rule_number);./\n\n    $NullAction\n    /.%Header%case %rule_number:\n                    this.setResult(null);\n                    break;./\n\n    $BeginActions\n    /.\n        \n        public  ruleAction(ruleNumber : number) : void\n        {\n            switch (ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n                    default:\n                        this.ruleAction%rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n        \n            public  ruleAction%rule_number(ruleNumber  : number) : void\n            {\n                switch (ruleNumber)\n                {\n                    //#line %next_line \"%input_file%\"./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n\n    $entry_declarations\n    /.\n       \n        public  parse%entry_name(monitor? : Monitor, error_repair_count : number = 0) : %ast_class | null\n        {\n            this.btParser.setMonitor(monitor);\n            \n            try\n            {\n                return <%ast_class> this.btParser.fuzzyParseEntry(%sym_type.%entry_marker, error_repair_count);\n            }\n            catch (ex)\n            {\n                if( ex instanceof BadParseException ){\n                    let e = <BadParseException>(ex);\n\n                    this.prsStream.reset(e.error_token); // point to error token\n                    let diagnoseParser = new DiagnoseParser(this.prsStream, %action_type.prsTable);\n                    diagnoseParser.diagnoseEntry(%sym_type.%entry_marker, e.error_token);\n                }\n                else{\n                    throw ex;\n                }\n            }\n\n            return null;\n        }\n    ./\n\n    --\n    -- Macros that may be needed in a parser using this template\n    --\n    $additional_interfaces /../\n    $ast_class /.%ast_type./\n    $super_class /.Object./   \n    $unimplemented_symbols_warning /.false./\n\n    --\n    -- Old deprecated macros that should NEVER be used.\n    --\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n                this.getParser().setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 this.getParser().setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getRhsSym\n              this.getParser().getSym./\n    $getToken /. // macro getToken is deprecated. Use function getRhsTokenIndex\n                this.getParser().getToken./\n    $getIToken /. // macro getIToken is deprecated. Use function getRhsIToken\n                 this.prsStream.getIToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   this.getParser().getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    this.getParser().getLastToken./\n%End\n\n%Globals\n    /.\nimport {BadParseException, RuleAction, PrsStream, ParseTable, BacktrackingParser, IToken, ErrorToken, ILexStream, NullExportedSymbolsException, \nUnimplementedTerminalsException, Lpg, UndefinedEofSymbolException, NotBacktrackParseTableException, BadParseSymFileException, \nIPrsStream, Monitor, DiagnoseParser, IAst, IAstVisitor, IAbstractArrayList, NotDeterministicParseTableException,\n DeterministicParser, NullTerminalSymbolsException } from \"lpg2ts\";\nimport { %prs_type } from \".\\/%prs_type\";\nimport { %sym_type } from \".\\/%sym_type\";\n    ./\n%End\n\n%Headers\n    /.\n    export class %action_type extends %super_class implements RuleAction%additional_interfaces\n    {\n        private  prsStream  : PrsStream = new PrsStream();\n        \n        private  unimplementedSymbolsWarning : boolean = %unimplemented_symbols_warning;\n\n        private static  prsTable : ParseTable = new %prs_type();\n        public  getParseTable() : ParseTable { return %action_type.prsTable; }\n\n        private  btParser : BacktrackingParser ;\n        public  getParser() : BacktrackingParser{ return this.btParser; }\n\n        private  setResult(object1 : any) : void{ this.btParser.setSym1(object1); }\n        public  getRhsSym(i : number) : any{ return this.btParser.getSym(i); }\n\n        public  getRhsTokenIndex(i : number) : number{ return this.btParser.getToken(i); }\n        public  getRhsIToken(i : number) : IToken { return this.prsStream.getIToken(this.getRhsTokenIndex(i)); }\n        \n        public  getRhsFirstTokenIndex(i : number) : number { return this.btParser.getFirstToken(i); }\n        public  getRhsFirstIToken(i : number) : IToken{ return this.prsStream.getIToken(this.getRhsFirstTokenIndex(i)); }\n\n        public  getRhsLastTokenIndex(i : number):number { return this.btParser.getLastToken(i); }\n        public  getRhsLastIToken(i : number):IToken { return this.prsStream.getIToken(this.getRhsLastTokenIndex(i)); }\n\n        public getLeftSpan() :number { return this.btParser.getFirstToken(); }\n        public  getLeftIToken() :IToken { return this.prsStream.getIToken(this.getLeftSpan()); }\n\n        public getRightSpan() : number { return this.btParser.getLastToken(); }\n        public  getRightIToken() : IToken { return this.prsStream.getIToken(this.getRightSpan()); }\n\n        public  getRhsErrorTokenIndex(i : number) : number\n        {\n            let index = this.btParser.getToken(i);\n            let err = this.prsStream.getIToken(index);\n            return (err instanceof ErrorToken ? index : 0);\n        }\n        public  getRhsErrorIToken(i : number) : ErrorToken\n        {\n            let index = this.btParser.getToken(i);\n            let err = this.prsStream.getIToken(index);\n            return <ErrorToken> (err instanceof ErrorToken ? err : null);\n        }\n\n        public  reset(lexStream : ILexStream) : void\n        {\n            this.prsStream.resetLexStream(lexStream);\n            this.btParser.reset(this.prsStream);\n\n            try\n            {\n                this.prsStream.remapTerminalSymbols(this.orderedTerminalSymbols(), %action_type.prsTable.getEoftSymbol());\n            } \n            catch (e)\n            {     \n                if( e instanceof NullExportedSymbolsException){\n                    \n                }\n                else if( e instanceof UnimplementedTerminalsException){\n                    if (this.unimplementedSymbolsWarning) {\n                        let unimplemented_symbols = e.getSymbols();\n                        Lpg.Lang.System.Out.println(\"The Lexer will not scan the following token(s):\");\n                        for (let i : number = 0; i < unimplemented_symbols.size(); i++)\n                        {\n                            let id = <number>unimplemented_symbols.get(i);\n                            Lpg.Lang.System.Out.println(\"    \" + %sym_type.orderedTerminalSymbols[id]);               \n                        }\n                        Lpg.Lang.System.Out.println();\n                    }\n                }\n                else if( e instanceof UndefinedEofSymbolException){\n                    throw  (new UndefinedEofSymbolException\n                        (\"The Lexer does not implement the Eof symbol \" +\n                        %sym_type.orderedTerminalSymbols[%action_type.prsTable.getEoftSymbol()]));\n                }\n\n            }\n        }\n        \n        constructor(lexStream? :ILexStream)\n        {\n            super();\n            try\n            {\n                this.btParser = new BacktrackingParser(null, %action_type.prsTable, <RuleAction> this);\n            }\n            catch (e)\n            {\n                if(e instanceof NotBacktrackParseTableException)\n                throw (new NotBacktrackParseTableException\n                                    (\"Regenerate %prs_type.ts with -BACKTRACK option\"));\n                else if(e instanceof BadParseSymFileException){\n                    throw (new BadParseSymFileException(\"Bad Parser Symbol File -- %sym_type.ts\"));\n                }\n                else{\n                    throw e;\n                }\n            }\n            if(lexStream){\n              this.reset(lexStream);\n            }\n        }\n        \n       \n        \n        public  numTokenKinds() :number { return %sym_type.numTokenKinds; }\n        public  orderedTerminalSymbols()  : string[] { return %sym_type.orderedTerminalSymbols; }\n        public  getTokenKindName(kind : number ) : string { return %sym_type.orderedTerminalSymbols[kind]; }\n        public  getEOFTokenKind() : number{ return %action_type.prsTable.getEoftSymbol(); }\n        public  getIPrsStream()  : IPrsStream{ return this.prsStream; }\n\n        /**\n         * @deprecated replaced by {@link #getIPrsStream()}\n         *\n         */\n        public  getPrsStream()  : PrsStream{ return this.prsStream; }\n\n        /**\n         * @deprecated replaced by {@link #getIPrsStream()}\n         *\n         */\n        public  getParseStream() : PrsStream { return this.prsStream; }\n\n     \n\n        public parser(error_repair_count : number = 0 ,  monitor? : Monitor) :  %ast_class | null\n        {\n            this.btParser.setMonitor(monitor);\n            \n            try\n            {\n                return <%ast_class> this.btParser.fuzzyParse(error_repair_count);\n            }\n            catch (ex)\n            {\n               if( ex instanceof BadParseException ){\n                     let e = <BadParseException>(ex);\n                    this.prsStream.reset(e.error_token); // point to error token\n\n                    let diagnoseParser = new DiagnoseParser(this.prsStream, %action_type.prsTable);\n                    diagnoseParser.diagnose(e.error_token);\n                }\n                else{\n                    throw ex;\n                }\n            }\n\n            return null;\n        }\n\n        //\n        // Additional entry points, if any\n        //\n        %entry_declarations\n    ./\n\n%End\n\n%Rules\n    /.%BeginActions./\n%End\n\n%Trailers\n    /.\n        %EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "750b438877413015a02415a380596494dd98c212", "size": 11229, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/btParserTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG2", "max_stars_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/btParserTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG2", "max_issues_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lpg-generator-templates-2.1.00/templates/typescript/btParserTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG2", "max_forks_repo_head_hexsha": "5cda43c109633d951facbeac361e060dd6d59dcd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.4196428571, "max_line_length": 144, "alphanum_fraction": 0.5542790988, "num_tokens": 2491, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.07263671037579261, "lm_q2_score": 0.021948251875579822, "lm_q1q2_score": 0.0015942488147414385}}
{"text": "# This file has been generated by the GAP build system,\n# do not edit manually!\nGAParch=FAKE-GAP-ARCH\nGAP_ABI=64\nGAP_HPCGAP=no\n\nGAP_VERSION=\"4.12dev\"\nGAP_BUILD_VERSION=\"4.12dev\"\nGAP_LIBTOOL_CURRENT=8\nGAP_LIBTOOL_AGE=0\nGAP_KERNEL_MAJOR_VERSION=8\nGAP_KERNEL_MINOR_VERSION=0\n\nGAP_BIN_DIR=\"/workspace/destdir/share/gap\"\nGAP_LIB_DIR=\"/workspace/destdir/share/gap\"\n\nGAP=\"/workspace/destdir/bin/gap\"\nGAC=\"/workspace/destdir/share/gap/gac\"\n\nGAP_CC=\"cc \"\nGAP_CXX=\"c++ -std=gnu++11 \"\nGAP_CFLAGS=\"-g -O2\"\nGAP_CXXFLAGS=\"-g -O2\"\nGAP_CPPFLAGS=\"-I/workspace/destdir/include/gap -DHAVE_CONFIG_H -fPIC \"\nGAP_LDFLAGS=\"-L/workspace/destdir/lib \"\nGAP_LIBS=\"-lgmp\"\n\nGAP_OBJS=\"build/obj/src/ariths.c.lo build/obj/src/bags.c.lo build/obj/src/blister.c.lo build/obj/src/bool.c.lo build/obj/src/calls.c.lo build/obj/src/code.c.lo build/obj/src/collectors.cc.lo build/obj/src/compiler.c.lo build/obj/src/costab.c.lo build/obj/src/cyclotom.c.lo build/obj/src/debug.c.lo build/obj/src/dt.c.lo build/obj/src/dteval.c.lo build/obj/src/error.c.lo build/obj/src/exprs.c.lo build/obj/src/ffdata.c.lo build/obj/src/finfield.c.lo build/obj/src/funcs.c.lo build/obj/src/gap.c.lo build/obj/src/gaptime.c.lo build/obj/build/gap_version.c.lo build/obj/src/gvars.c.lo build/obj/src/hookintrprtr.c.lo build/obj/src/info.c.lo build/obj/src/integer.c.lo build/obj/src/intfuncs.c.lo build/obj/src/intrprtr.c.lo build/obj/src/io.c.lo build/obj/src/iostream.c.lo build/obj/src/libgap-api.c.lo build/obj/src/listfunc.c.lo build/obj/src/listoper.c.lo build/obj/src/lists.c.lo build/obj/src/macfloat.c.lo build/obj/src/modules_builtin.c.lo build/obj/src/modules.c.lo build/obj/src/objcftl.c.lo build/obj/src/objects.c.lo build/obj/src/objfgelm.cc.lo build/obj/src/objpcgel.cc.lo build/obj/src/objset.c.lo build/obj/src/opers.cc.lo build/obj/src/permutat.cc.lo build/obj/src/plist.c.lo build/obj/src/pperm.cc.lo build/obj/src/precord.c.lo build/obj/src/profile.c.lo build/obj/src/range.c.lo build/obj/src/rational.c.lo build/obj/src/read.c.lo build/obj/src/records.c.lo build/obj/src/saveload.c.lo build/obj/src/scanner.c.lo build/obj/src/sctable.c.lo build/obj/src/set.c.lo build/obj/src/stats.c.lo build/obj/src/streams.c.lo build/obj/src/stringobj.c.lo build/obj/src/syntaxtree.c.lo build/obj/src/sysfiles.c.lo build/obj/src/sysroots.c.lo build/obj/src/sysstr.c.lo build/obj/src/system.c.lo build/obj/src/tietze.c.lo build/obj/src/tracing.c.lo build/obj/src/trans.cc.lo build/obj/src/trycatch.c.lo build/obj/src/vars.c.lo build/obj/src/vec8bit.c.lo build/obj/src/vecffe.c.lo build/obj/src/vecgf2.c.lo build/obj/src/vector.c.lo build/obj/src/weakptr.c.lo build/obj/src/julia_gc.c.lo build/obj/src/c_oper1.c.lo build/obj/src/c_type1.c.lo build/obj/src/compstat.c.lo\"\n\nJULIA=\"\"\nJULIA_CPPFLAGS=\"-I/workspace/destdir/include/julia -fPIC\"\nJULIA_LDFLAGS=\"-L/workspace/destdir/lib -L/workspace/destdir/lib/julia\"\nJULIA_LIBS=\"-Wl,-rpath,/workspace/destdir/lib -Wl,-rpath,/workspace/destdir/lib/julia -ljulia\"\n", "meta": {"hexsha": "89e3640a4e49feeebb04a8d868b1fe712b2edf0c", "size": 2953, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "G/GAP_pkg/bundled/sysinfo.gap", "max_stars_repo_name": "sharanry/Yggdrasil", "max_stars_repo_head_hexsha": "d89cb4ffdc8e96ad39b6242b3574c59561c1b546", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 195, "max_stars_repo_stars_event_min_datetime": "2018-09-14T22:41:36.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-16T03:35:17.000Z", "max_issues_repo_path": "G/GAP_pkg/bundled/sysinfo.gap", "max_issues_repo_name": "sharanry/Yggdrasil", "max_issues_repo_head_hexsha": "d89cb4ffdc8e96ad39b6242b3574c59561c1b546", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2176, "max_issues_repo_issues_event_min_datetime": "2018-12-20T07:05:43.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:39:20.000Z", "max_forks_repo_path": "G/GAP_pkg/bundled/sysinfo.gap", "max_forks_repo_name": "sharanry/Yggdrasil", "max_forks_repo_head_hexsha": "d89cb4ffdc8e96ad39b6242b3574c59561c1b546", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 455, "max_forks_repo_forks_event_min_datetime": "2018-09-27T21:28:33.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T06:27:44.000Z", "avg_line_length": 86.8529411765, "max_line_length": 2072, "alphanum_fraction": 0.7761598375, "num_tokens": 962, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.09401018723156651, "lm_q2_score": 0.01615283431892381, "lm_q1q2_score": 0.0015185309786425003}}
{"text": "package main\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/unrolled/secure\" // or \"gopkg.in/unrolled/secure.v1\"\n)\n\nvar myHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"hello world\"))\n})\n\nfunc main() {\n\tsecureMiddleware := secure.New(secure.Options{\n\t\tAllowedHosts:          []string{\"example.com\", \"ssl.example.com\"},\n\t\tHostsProxyHeaders:     []string{\"X-Forwarded-Host\"},\n\t\tSSLRedirect:           true,\n\t\tSSLHost:               \"ssl.example.com\",\n\t\tSSLProxyHeaders:       map[string]string{\"X-Forwarded-Proto\": \"https\"},\n\t\tSTSSeconds:            315360000,\n\t\tSTSIncludeSubdomains:  true,\n\t\tSTSPreload:            true,\n\t\tFrameDeny:             true,\n\t\tContentTypeNosniff:    true,\n\t\tBrowserXssFilter:      true,\n\t\tContentSecurityPolicy: \"script-src $NONCE\",\n\t\tPublicKey:             `pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubdomains; report-uri=\"https://www.example.com/hpkp-report\"`,\n\t\tIsDevelopment: false,\n\t})\n\n\tapp := secureMiddleware.Handler(myHandler)\n\thttp.ListenAndServe(\"127.0.0.1:3000\", app)\n}\n", "meta": {"hexsha": "3ac731a85ff214957cd12eef4e4e775bb4b76117", "size": 1086, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "_test/secure.gi", "max_stars_repo_name": "visuo-dev/yaegi", "max_stars_repo_head_hexsha": "2d87bf432f5acddd94db5bad71817e1facdc34d7", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 2969, "max_stars_repo_stars_event_min_datetime": "2019-07-24T11:12:32.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-14T08:20:02.000Z", "max_issues_repo_path": "_test/secure.gi", "max_issues_repo_name": "visuo-dev/yaegi", "max_issues_repo_head_hexsha": "2d87bf432f5acddd94db5bad71817e1facdc34d7", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 369, "max_issues_repo_issues_event_min_datetime": "2019-07-24T15:50:26.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-16T08:33:33.000Z", "max_forks_repo_path": "_test/secure.gi", "max_forks_repo_name": "visuo-dev/yaegi", "max_forks_repo_head_hexsha": "2d87bf432f5acddd94db5bad71817e1facdc34d7", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 146, "max_forks_repo_forks_event_min_datetime": "2019-07-24T15:30:34.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-13T06:48:06.000Z", "avg_line_length": 31.9411764706, "max_line_length": 173, "alphanum_fraction": 0.6565377532, "num_tokens": 308, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.06008664680776121, "lm_q2_score": 0.024798158709109227, "lm_q1q2_score": 0.0014900382038370537}}
{"text": "method vfClipMan vfClipMan.mLoad <alias=vfClipMan_mLoad>( )   \n{   \n//\tthis->vForm.mCreateWin()\n\tustr empus\n\tstr  emps\n\tustr ustmp\n\tuint comp\n\tcomp as this\n\t\tcomp.AutoLang=1\n\t\tcomp.Border=$fbrdSizeable\n\t\tcomp.Bottom=0\n\t\tcomp.Caption=empus\n\t\tcomp.Enabled=1\n\t\tcomp.FormStyle=$fsChild\n\t\tcomp.Height=521\n\t\tcomp.HelpTopic=empus\n\t\tcomp.Hint=empus\n\t\tcomp.HorzAlign=$alhLeft\n\t\tcomp.IconName=empus\n\t\tcomp.Left=0\n\t\tcomp.Name=\"fClipMan\"\n\t\tcomp.Right=0\n\t\tcomp.StartPos=$spDesigned\n\t\tcomp.Style=emps\n\t\tcomp.TabOrder=0\n\t\tcomp.Tag=0\n\t\tcomp.Top=0\n\t\tcomp.TopMost=0\n\t\tcomp.VertAlign=$alvTop\n\t\tcomp.Visible=1\n\t\tcomp.Width=610\n\t\tcomp.WindowState=$wsNormal\n\t\tcomp.OnPosChanged.Set( this, fClipMan_PosChanged )\n\t\tcomp.OnCreate.Set( this, fClipMan_Create )\n\t\tcomp.OnCloseQuery.Set( this, fClipMan_Close )\n\t\tcomp.OnLanguage.Set( this, fClipMan_Lang )\n\t\tcomp as this.Tray0\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Caption=ustmp.fromutf8(\"progname\")\n\t\t\tcomp.Image=ustmp.fromutf8(\"main\\\\mclip\")\n\t\t\tcomp.Name=\"Tray0\"\n\t\t\tcomp.RBtnPopupMenu=.pmTray\n\t\t\tcomp.Tag=0\n\t\t\tcomp.Visible=1\n\t\t\tcomp.OnMouse.Set( this, fClipMan_TrayMouse )\n\t\tcomp as this.pmTray\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Name=\"pmTray\"\n\t\t\tcomp.Tag=0\n\t\t\tcomp as this.miTrayExit\n\t\t\tcomp.Owner = this.pmTray\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"exit\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"miTrayExit\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.OnClick.Set( this, fClipMan_Exit )\n\t\t\tcomp as this.mPref\n\t\t\tcomp.Owner = this.pmTray\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"preferences\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=1\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"mPref\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.OnClick.Set( this, fClipMan_Settings )\n\t\t\tcomp as this.mAbout\n\t\t\tcomp.Owner = this.pmTray\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"about\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=1\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"mAbout\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.OnClick.Set( this, fClipMan_About )\n\t\tcomp as this.Menu0\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Name=\"Menu0\"\n\t\t\tcomp.Tag=0\n\t\t\tcomp as this.MenuItem0\n\t\t\tcomp.Owner = this.Menu0\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"tools\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"MenuItem0\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp as this.MenuItem1\n\t\t\t\tcomp.Owner = this.MenuItem0\n\t\t\t\t\tcomp.AutoCheck=0\n\t\t\t\t\tcomp.AutoLang=1\n\t\t\t\t\tcomp.Caption=ustmp.fromutf8(\"settings\")\n\t\t\t\t\tcomp.Checked=0\n\t\t\t\t\tcomp.Ellipsis=0\n\t\t\t\t\tcomp.Enabled=1\n\t\t\t\t\tcomp.Image=empus\n\t\t\t\t\tcomp.Name=\"MenuItem1\"\n\t\t\t\t\tcomp.RadioCheck=0\n\t\t\t\t\tcomp.Separator=0\n\t\t\t\t\tcomp.ShortKey=empus\n\t\t\t\t\tcomp.Tag=0\n\t\t\t\t\tcomp.Visible=1\n\t\t\t\t\tcomp.OnClick.Set( this, fClipMan_Settings )\n\tcomp as this\n\t\tcomp.ClientHeight=476\n\t\tcomp.ClientWidth=592\n\t\tcomp.Menu=.Menu0\n\n\treturn this\n}\n\nmethod vfClipMan vfClipMan.init( )\n{\n   this.pTypeId = vfClipMan         \n   return this\n}\nfunc init_vfClipMan <entry>()\n{\n   regcomp( vfClipMan, \"vfClipMan\", vForm, $vForm_last,\n      %{ %{$mLoad,     vfClipMan_mLoad}},\n      0->collection )\n      \n}\n", "meta": {"hexsha": "f000d2536988126480f48057ab2c0b2a3d77151e", "size": 3555, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "src/main/clipman.gi", "max_stars_repo_name": "novostrim/macroclip", "max_stars_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-10-24T13:17:43.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-08T06:01:14.000Z", "max_issues_repo_path": "src/main/clipman.gi", "max_issues_repo_name": "novostrim/macroclip", "max_issues_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/clipman.gi", "max_forks_repo_name": "novostrim/macroclip", "max_forks_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.7884615385, "max_line_length": 62, "alphanum_fraction": 0.682137834, "num_tokens": 1295, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.07055959227836445, "lm_q2_score": 0.01883313168021146, "lm_q1q2_score": 0.0013288580926804692}}
{"text": "--\n-- An instance of this template must have a $Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--     $super_class\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateF\n--\n%Options programming_language=csharp,margin=4\n%Options table\n%options action-block=(\"*.cs\", \"/.\", \"./\")\n%options ParseTable=LPG2.Runtime.ParseTable\n%Options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.$_EOF_TOKEN./\n    \n    $additional_interfaces /../\n    $super_stream_class /.$file_prefix$LpgLexStream./\n    $prs_stream_class /.IPrsStream./\n    $super_class /.object./\n\n    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream\n                  getPrsStream()./\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n               lexParser.setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 lexParser.setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getLastToken\n              lexParser.getSym./\n    $getToken /. // macro getToken is deprecated. Use function getToken\n                lexParser.getToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   lexParser.getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    lexParser.getLastToken./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //\n                ./\n\n    $DefaultAction\n    /.$Header$case $rule_number: { ./\n\n    $BeginAction /.$DefaultAction./\n\n    $EndAction\n    /.            break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /.$Header$case $rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n        public void ruleAction(int ruleNumber)\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n                    default:\n                        ruleAction$rule_number(ruleNumber);\n                        break;\n                }\n                return;\n            }\n\n            public void ruleAction$rule_number(int ruleNumber)\n            {\n                switch (ruleNumber)\n                {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.\n    using LPG2.Runtime;\n    using System;\n    ./\n%End\n\n%Headers\n    /.\n    public class $action_type : $super_class , RuleAction$additional_interfaces\n    {\n        private $super_stream_class lexStream;\n        \n        private static ParseTable prs = new $prs_type();\n        public ParseTable getParseTable() { return prs; }\n\n        private LexParser lexParser = new LexParser();\n        public LexParser getParser() { return lexParser; }\n\n        public int getToken(int i) { return lexParser.getToken(i); }\n        public int getRhsFirstTokenIndex(int i) { return lexParser.getFirstToken(i); }\n        public int getRhsLastTokenIndex(int i) { return lexParser.getLastToken(i); }\n\n        public int getLeftSpan() { return lexParser.getToken(1); }\n        public int getRightSpan() { return lexParser.getLastToken(); }\n  \n        public void resetKeywordLexer()\n        {\n            if (kwLexer == null)\n                  this.kwLexer = new $kw_lexer_class(lexStream.getInputChars(), $_IDENTIFIER);\n            else this.kwLexer.setInputChars(lexStream.getInputChars());\n        }\n  \n        public void reset(string filename, int tab) \n        {\n            lexStream = new $super_stream_class(filename, tab);\n            lexParser.reset((ILexStream) lexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n\n        public void reset(char[] input_chars, string filename)\n        {\n            reset(input_chars, filename, 1);\n        }\n        \n        public void reset(char[] input_chars, string filename, int tab)\n        {\n            lexStream = new $super_stream_class(input_chars, filename, tab);\n            lexParser.reset((ILexStream) lexStream, prs, (RuleAction) this);\n            resetKeywordLexer();\n        }\n        \n        public $action_type(string filename, int tab)  \n        {\n            reset(filename, tab);\n        }\n\n        public $action_type(char[] input_chars, string filename, int tab)\n        {\n            reset(input_chars, filename, tab);\n        }\n\n        public $action_type(char[] input_chars, string filename)\n        {\n            reset(input_chars, filename, 1);\n        }\n\n        public $action_type() {}\n\n        public ILexStream getILexStream() { return lexStream; }\n\n        /**\n         * @deprecated replaced by {@link #getILexStream()}\n         */\n        public ILexStream getLexStream() { return lexStream; }\n\n        private void initializeLexer($prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            if (lexStream.getInputChars() == null)\n                throw new NullReferenceException(\"LexStream was not initialized\");\n            lexStream.setPrsStream(prsStream);\n            prsStream.makeToken(start_offset, end_offset, 0); // Token list must start with a bad token\n        }\n\n        private void addEOF($prs_stream_class prsStream, int end_offset)\n        {\n            prsStream.makeToken(end_offset, end_offset, $eof_token); // and end with the end of file token\n            prsStream.setStreamLength(prsStream.getSize());\n        }\n\n        public void lexer($prs_stream_class prsStream)\n        {\n            lexer(null, prsStream);\n        }\n        \n        public void lexer(Monitor monitor, $prs_stream_class prsStream)\n        {\n            initializeLexer(prsStream, 0, -1);\n            lexParser.parseCharacters(monitor);  // Lex the input characters\n            addEOF(prsStream, lexStream.getStreamIndex());\n        }\n\n        public void lexer($prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            lexer(null, prsStream, start_offset, end_offset);\n        }\n        \n        public void lexer(Monitor monitor, $prs_stream_class prsStream, int start_offset, int end_offset)\n        {\n            if (start_offset <= 1)\n                 initializeLexer(prsStream, 0, -1);\n            else initializeLexer(prsStream, start_offset - 1, start_offset - 1);\n\n            lexParser.parseCharacters(monitor, start_offset, end_offset);\n\n            addEOF(prsStream, (end_offset >= lexStream.getStreamIndex() ? lexStream.getStreamIndex() : end_offset + 1));\n        }\n        \n       \n\n        /**\n         * If a parse stream was not passed to this Lexical analyser then we\n         * simply report a lexical error. Otherwise, we produce a bad token.\n         */\n        public void reportLexicalError(int startLoc, int endLoc) {\n            IPrsStream prs_stream = lexStream.getIPrsStream();\n            if (prs_stream == null)\n                lexStream.reportLexicalError(startLoc, endLoc);\n            else {\n                //\n                // Remove any token that may have been processed that fall in the\n                // range of the lexical error... then add one error token that spans\n                // the error range.\n                //\n                for (int i = prs_stream.getSize() - 1; i > 0; i--) {\n                    if (prs_stream.getStartOffset(i) >= startLoc)\n                         prs_stream.removeLastToken();\n                    else break;\n                }\n                prs_stream.makeToken(startLoc, endLoc, 0); // add an error token to the prsStream\n            }        \n        }\n    ./\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "b18732f1af23e87311bbe2281f94f25a608e7d9d", "size": 8463, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "templates/templates/csharp/LexerTemplateF.gi", "max_stars_repo_name": "kuafuwang/LPG-VScode", "max_stars_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-05T12:16:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T13:09:19.000Z", "max_issues_repo_path": "templates/templates/csharp/LexerTemplateF.gi", "max_issues_repo_name": "kuafuwang/LPG-VScode", "max_issues_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "templates/templates/csharp/LexerTemplateF.gi", "max_forks_repo_name": "kuafuwang/LPG-VScode", "max_forks_repo_head_hexsha": "90e2abb06cf8debfd30d8caf27aec81ad6886fde", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.1174377224, "max_line_length": 120, "alphanum_fraction": 0.575918705, "num_tokens": 1922, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.0656048374590693, "lm_q2_score": 0.020023442495597368, "lm_q1q2_score": 0.0013136346902946862}}
{"text": "InfiniteLoop := function()\n\tlocal n;\n\tn := 1;\n\twhile true do\n\t\tDisplay(n);\n\t\tn := n + 1;\n\tod;\nend;\n\n# Prepare some coffee\nInfiniteLoop();\n", "meta": {"hexsha": "0d7abe081f03030d28a6b63d2ee702fa9d5e4a20", "size": 138, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "Task/Integer-sequence/GAP/integer-sequence.gap", "max_stars_repo_name": "LaudateCorpus1/RosettaCodeData", "max_stars_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_stars_repo_licenses": ["Info-ZIP"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-11-09T22:08:38.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T22:08:38.000Z", "max_issues_repo_path": "Task/Integer-sequence/GAP/integer-sequence.gap", "max_issues_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_issues_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_issues_repo_licenses": ["Info-ZIP"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Task/Integer-sequence/GAP/integer-sequence.gap", "max_forks_repo_name": "seanwallawalla-forks/RosettaCodeData", "max_forks_repo_head_hexsha": "9ad63ea473a958506c041077f1d810c0c7c8c18d", "max_forks_repo_licenses": ["Info-ZIP"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-11-09T22:08:40.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-09T22:08:40.000Z", "avg_line_length": 11.5, "max_line_length": 26, "alphanum_fraction": 0.6086956522, "num_tokens": 45, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO\n\n", "lm_q1_score": 0.08882028757623953, "lm_q2_score": 0.014728616687884881, "lm_q1q2_score": 0.0013081999698181356}}
{"text": "%Options fp=LPGKWLexer\r\n%options single-productions\r\n%options template=KeywordTemplateF.gi\r\n\r\n%Include\r\n    --\r\n    -- Each upper case letter is mapped into is corresponding\r\n    -- lower case counterpart. For example, if an 'A' appears\r\n    -- in the input, it is mapped into Char_a just like 'a'.\r\n    --\r\n    KWLexerFoldedCaseMapF.gi\r\n%End\r\n\r\n%Export\r\n   ALIAS_KEY\r\n   AST_KEY\r\n   DEFINE_KEY\r\n   DISJOINTPREDECESSORSETS_KEY\r\n   DROPRULES_KEY\r\n   DROPSYMBOLS_KEY\r\n   EMPTY_KEY\r\n   END_KEY\r\n   ERROR_KEY\r\n   EOL_KEY\r\n   EOF_KEY \r\n   EXPORT_KEY\r\n   GLOBALS_KEY\r\n   HEADERS_KEY\r\n   IDENTIFIER_KEY\r\n   IMPORT_KEY\r\n   INCLUDE_KEY\r\n   KEYWORDS_KEY\r\n   NAMES_KEY\r\n   NOTICE_KEY\r\n   OPTIONS_KEY\r\n   RECOVER_KEY\r\n   RULES_KEY\r\n   SOFT_KEYWORDS_KEY\r\n   START_KEY\r\n   TERMINALS_KEY\r\n   TRAILERS_KEY\r\n   TYPES_KEY\r\n%End\r\n%Globals\r\n    /.\r\n#pragma once\r\n#include \"LPGLexerprs.h\"\r\n#include \"tuple.h\"\r\n#include \"LPGKWLexerprs.h\"\r\n#include \"LPGParsersym.h\"\r\n    ./\r\n%End\r\n%Start\r\n    Keyword\r\n%End\r\n\r\n%Notice\r\n/.\r\n////////////////////////////////////////////////////////////////////////////////\r\n// Copyright (c) 2007 IBM Corporation.\r\n// All rights reserved. This program and the accompanying materials\r\n// are made available under the terms of the Eclipse Public License v1.0\r\n// which accompanies this distribution, and is available at\r\n// http://www.eclipse.org/legal/epl-v10.html\r\n//\r\n//Contributors:\r\n//    Philippe Charles (pcharles@us.ibm.com) - initial API and implementation\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n./\r\n%End\r\n\r\n%Rules\r\n    Keyword ::= KeyPrefix a l i a s\r\n        /.$BeginJava\r\n            $setResult($_ALIAS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix a s t\r\n        /.$BeginJava\r\n            $setResult($_AST_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix d e f i n e\r\n        /.$BeginJava\r\n            $setResult($_DEFINE_KEY);\r\n          $EndJava\r\n        ./\r\n     Keyword ::= KeyPrefix d i s j o i n t p r e d e c e s s o r s e t s\r\n        /.$BeginJava\r\n            $setResult($_DISJOINTPREDECESSORSETS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix d r o p r u l e s\r\n        /.$BeginJava\r\n            $setResult($_DROPRULES_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix d r o p s y m b o l s\r\n        /.$BeginJava\r\n            $setResult($_DROPSYMBOLS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix e m p t y\r\n        /.$BeginJava\r\n            $setResult($_EMPTY_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix e n d\r\n        /.$BeginJava\r\n            $setResult($_END_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix e r r o r\r\n        /.$BeginJava\r\n            $setResult($_ERROR_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix e o l\r\n        /.$BeginJava\r\n            $setResult($_EOL_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix e o f\r\n        /.$BeginJava\r\n            $setResult($_EOF_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix e x p o r t\r\n        /.$BeginJava\r\n            $setResult($_EXPORT_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix g l o b a l s\r\n        /.$BeginJava\r\n            $setResult($_GLOBALS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix h e a d e r s\r\n        /.$BeginJava\r\n            $setResult($_HEADERS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix i d e n t i f i e r\r\n        /.$BeginJava\r\n            $setResult($_IDENTIFIER_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix i m p o r t\r\n        /.$BeginJava\r\n            $setResult($_IMPORT_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix i n c l u d e\r\n        /.$BeginJava\r\n            $setResult($_INCLUDE_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix k e y w o r d s\r\n        /.$BeginJava\r\n            $setResult($_KEYWORDS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix s o f t k e y w o r d s\r\n        /.$BeginJava\r\n            $setResult($_SOFT_KEYWORDS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix n a m e s\r\n        /.$BeginJava\r\n            $setResult($_NAMES_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix n o t i c e\r\n        /.$BeginJava\r\n            $setResult($_NOTICE_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix t e r m i n a l s\r\n        /.$BeginJava\r\n            $setResult($_TERMINALS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix r e c o v e r\r\n        /.$BeginJava\r\n            $setResult($_RECOVER_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix r u l e s\r\n        /.$BeginJava\r\n            $setResult($_RULES_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix s t a r t \r\n        /.$BeginJava\r\n            $setResult($_START_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix t r a i l e r s\r\n        /.$BeginJava\r\n            $setResult($_TRAILERS_KEY);\r\n          $EndJava\r\n        ./\r\n    Keyword ::= KeyPrefix t y p e s\r\n        /.$BeginJava\r\n            $setResult($_TYPES_KEY);\r\n          $EndJava\r\n        ./\r\n        \r\n    KeyPrefix -> '$' | '%'\r\n%End\r\n", "meta": {"hexsha": "8b97005debb0c3a2f882daa9a95c3ad01fd6f464", "size": 5268, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "examples/lpg2/grammer/LPGKWLexer.gi", "max_stars_repo_name": "The-LALR-parser-generator-LPG/LPG-cpp-runtime", "max_stars_repo_head_hexsha": "44edc28698cec616fab425a5bc8c57fed56638cf", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "examples/lpg2/grammer/LPGKWLexer.gi", "max_issues_repo_name": "The-LALR-parser-generator-LPG/LPG-cpp-runtime", "max_issues_repo_head_hexsha": "44edc28698cec616fab425a5bc8c57fed56638cf", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/lpg2/grammer/LPGKWLexer.gi", "max_forks_repo_name": "The-LALR-parser-generator-LPG/LPG-cpp-runtime", "max_forks_repo_head_hexsha": "44edc28698cec616fab425a5bc8c57fed56638cf", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.8490566038, "max_line_length": 81, "alphanum_fraction": 0.4933561124, "num_tokens": 1391, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.054198729823185576, "lm_q2_score": 0.024053553244230634, "lm_q1q2_score": 0.001303672033571665}}
{"text": "--\n-- An instance of this template must have a $Export section and the export_terminals option\n--\n-- Macros that may be redefined in an instance of this template\n--\n--     $eof_token\n--     $additional_interfaces\n--     $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind\n--     $prs_stream_class -- use /.PrsStream./ if not subclassing\n--\n-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateD\n--\n%options programming_language=java,margin=4\n%options table\n%options action-block=(\"*.java\", \"/.\", \"./\")\n%options ParseTable=lpg.runtime.ParseTable\n%options prefix=Char_\n\n--\n-- This template requires that the name of the EOF token be set\n-- to EOF and that the prefix be \"Char_\" to be consistent with\n-- KeywordTemplateD.\n--\n%Eof\n    EOF\n%End\n\n--\n-- This template also requires that the name of the parser EOF\n-- Token to be exported be set to EOF_TOKEN\n--\n%Export\n    EOF_TOKEN\n%End\n\n%Define\n    --\n    -- Macros that are be needed in an instance of this template\n    --\n    $eof_token /.$_EOF_TOKEN./\n\n    $additional_interfaces /../\n    $super_stream_class /.AbstractLexer./\n    $prs_stream_class /.AbstractParser./\n    $environment_class /.BasicEnvironment./\n    $adapt_environment /.environment./\n\n\n    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream\n                  getPrsStream()./\n    $setSym1 /. // macro setSym1 is deprecated. Use function setResult\n               lexParser.setSym1./\n    $setResult /. // macro setResult is deprecated. Use function setResult\n                 lexParser.setSym1./\n    $getSym /. // macro getSym is deprecated. Use function getLastToken\n              lexParser.getSym./\n    $getToken /. // macro getToken is deprecated. Use function getToken\n                lexParser.getToken./\n    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan\n                   lexParser.getFirstToken./\n    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan\n                    lexParser.getLastToken./\n\n    --\n    -- Macros useful for specifying actions\n    --\n    $Header\n    /.\n                //\n                // Rule $rule_number:  $rule_text\n                //./\n\n    $DefaultAction\n    /. $Header\n                case $rule_number: { ./\n\n    $BeginAction /.$DefaultAction./\n\n    $EndAction\n    /.          break;\n                }./\n\n    $BeginJava\n    /.$BeginAction\n                $symbol_declarations./\n\n    $EndJava /.$EndAction./\n\n    $NoAction\n    /. $Header\n                case $rule_number:\n                    break; ./\n\n    $BeginActions\n    /.\n        public void ruleAction( int ruleNumber)\n        {\n            switch(ruleNumber)\n            {./\n\n    $SplitActions\n    /.\n\t            default:\n\t                ruleAction$rule_number(ruleNumber);\n\t                break;\n\t        }\n\t        return;\n\t    }\n\n\t    public void ruleAction$rule_number(int ruleNumber)\n\t    {\n\t        switch (ruleNumber)\n\t        {./\n\n    $EndActions\n    /.\n                default:\n                    break;\n            }\n            return;\n        }./\n%End\n\n%Globals\n    /.import lpg.runtime.*;\n    import org.eclipse.ocl.lpg.AbstractLexer;\n    import org.eclipse.ocl.lpg.AbstractParser;\n    ./\n%End\n\n%Headers\n    /.\n    @SuppressWarnings(\"nls\")\n    public class $action_type extends $super_stream_class implements $exp_type, $sym_type, RuleAction$additional_interfaces\n    {\n        private static ParseTable prs = new $prs_type();\n        //\n        // The Lexer contains an array of characters as the input stream to be parsed.\n        // There are methods to retrieve and classify characters.\n        // The lexparser \"token\" is implemented simply as the index of the next character in the array.\n        // The Lexer extends the abstract class LpgLexStream with an implementation of the abstract\n        // method getKind.  The template defines the Lexer class and the lexer() method.\n        // A driver creates the action class, \"Lexer\", passing an Option object to the constructor.\n        //\n        protected $kw_lexer_class kwLexer;\n        protected boolean printTokens;\n        private $prs_stream_class parser;\n        private LexParser lexParser = new LexParser(this, prs, this);\n\n        private final $environment_class oclEnvironment;\n\n        public $action_type($environment_class environment) {\n            super($adapt_environment);\n            oclEnvironment = environment;\n        }\n\n\t\tpublic $action_class($environment_class environment, char[] chars) {\n\t\t\tthis(environment, chars, \"OCL\", ECLIPSE_TAB_VALUE);\n\t\t\tkwLexer = new $kw_lexer_class(getInputChars(), $_IDENTIFIER);\n\t\t}\n\n        public $action_type($environment_class environment, char[] input_chars, String filename, int tab)  {\n            super($adapt_environment, input_chars, filename, tab);\n            oclEnvironment = environment;\n        }\n\n\t\tpublic $environment_class getOCLEnvironment() {\n        \treturn oclEnvironment;\n        }\n\n        @Override\n        public int [] getKeywordKinds() { return kwLexer.getKeywordKinds(); }\n\n        public int getLeftSpan() { return lexParser.getFirstToken(); }\n        public $prs_stream_class getParser() { return parser; }\n        public int getRhsFirstTokenIndex(int i) { return lexParser.getFirstToken(i); }\n        public int getRhsLastTokenIndex(int i) { return lexParser.getLastToken(i); }\n        public int getRightSpan() { return lexParser.getLastToken(); }\n\n        @Override\n        public int getToken(int i) { return lexParser.getToken(i); }\n\n        @Override\n        public void initialize(char [] content, String filename)\n        {\n            super.initialize(content, filename);\n            if (kwLexer == null)\n                 kwLexer = new $kw_lexer_class(getInputChars(), $_IDENTIFIER);\n            else\n                 kwLexer.setInputChars(getInputChars());\n        }\n\n        @Override\n        public String[] orderedExportedSymbols() { return $exp_type.orderedTerminalSymbols; }\n\n\t    @Override\n\t    public void setInputChars(char[] inputChars) {\n\t\t\tsuper.setInputChars(inputChars);\n\t\t\tkwLexer = new $kw_lexer_class(getInputChars(), $_IDENTIFIER);\n\t\t}\n\n        @Override\n        public void lexToTokens(Monitor monitor, $prs_stream_class parser)\n        {\n            if (getInputChars() == null)\n                throw new NullPointerException(\"LexStream was not initialized\");\n\n            this.parser = parser;\n\n            parser.makeToken(0, 0, 0); // Token list must start with a bad token\n\n            lexParser.parseCharacters(monitor);  // Lex the input characters\n\n            int i = getStreamIndex();\n            parser.makeToken(i, i, $eof_token); // and end with the end of file token\n            parser.setStreamLength(parser.getSize());\n\n            return;\n        }\n    ./\n%End\n\n%Rules\n    /.$BeginActions./\n%End\n\n%Trailers\n    /.\n        $EndActions\n    }\n    ./\n%End\n\n--\n-- E N D   O F   T E M P L A T E\n--\n", "meta": {"hexsha": "b08c075298bf4debda9d31ddb501d28fb1f2ebae", "size": 6919, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "org/eclipse/ocl/xtext/essentialocl/lpg/LexerTemplateD.gi", "max_stars_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_stars_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "org/eclipse/ocl/xtext/essentialocl/lpg/LexerTemplateD.gi", "max_issues_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_issues_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "org/eclipse/ocl/xtext/essentialocl/lpg/LexerTemplateD.gi", "max_forks_repo_name": "andreasdomanowski/com.crossecore.generator.easirius", "max_forks_repo_head_hexsha": "501ba89682e22888eb62a35c92b2402abdb4c8f0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.194092827, "max_line_length": 123, "alphanum_fraction": 0.6145396734, "num_tokens": 1576, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.06853749683715711, "lm_q2_score": 0.01883312779088908, "lm_q1q2_score": 0.0012907754364018362}}
{"text": "method myform.resload()\n{\n   //this.btn1.caption = \" textres( 143 )\"\n   //image = imageres(10)\n   \n}\n\nmethod myform myform.compinit()\n{   \n  \n   this.width = 400   \n   this.height = 400   \n   //this.p_typeid = myform\n   this.caption = \"Gentee Forms Designer (Demo version 0.1)\".ustr()\n   //this.onresize = getid( \"@m_resize\", %{myform} )\n   \n   panleft = &newcomp( vPanel, (&this)->vcomp )\n   uint xpanleft = panleft\n   xpanleft as vPanel \n   xpanleft.width = 203  \n   xpanleft.x = 0   \n   xpanleft.Border = $brdNone\n   xpanleft.vertalign = $alvClient\n   xpanleft.horzalign = $alhLeft//$ALIGN_VTOPBOTTOMOFF//$ALIGN_VCLIENT   \n      \n   //uint xpanright = &newcomp( vPanel, this )//(&this)->vcomp )\n   this.panright.owner = this\n   uint xpanright as this.panright\n   xpanright.x = xpanleft.x + xpanleft.width + 4\n   xpanright.vertalign = $alvClient\n   xpanright.horzalign = $alhLeftRight\n   xpanright.right = 0\n   xpanright.name = \"right\"\n      \n   \n   uint t as newcomp( vTab, panleft->vcomp )->vTab      \n   t.y = 0\n   t.height = 85\n   t.horzalign = $alhClient   \n   t.vertalign = $alvTop   \n   /*uint tp as newcomp( vTabPage, t )->vTabPage   \n   tp.caption = \"Controls\"   \n   this.bt_arrow.owner = tp    \n   uint bt_bt as this.bt_arrow\n   bt_bt.caption = \" \"   \n   bt_bt.btnstyle = $bsAsRadioBtn\n   bt_bt.y =0\n   bt_bt.x=0\n   bt_bt.height = 20 \n   bt_bt.width = 65\n   bt_bt.onclick.set( this, \"bt_arrowc\" )\n        \n   \n   //bt_bt as newcomp( vBtn, panleft->vcomp )\n   this.bt_btn.owner = tp \n   bt_bt as this.bt_btn   \n   bt_bt.x=65\n   bt_bt.y = 0\n   bt_bt.height =20\n   bt_bt.width =65   \n   bt_bt.caption = \"Btn\"   \n   bt_bt.onclick.set( this, \"bt_btnc\" )\n   //this.bt_arrow.checked = 1    \n   bt_bt.btnstyle = $bsAsRadioBtn\n   \n   \n   this.bt_panel.owner = tp\n   bt_bt as this.bt_panel\n   bt_bt.x=130\n   bt_bt.y = 0\n   bt_bt.height =20\n   bt_bt.width =65\n   bt_bt.caption = \"Panel\"   \n   bt_bt.onclick.set( this, \"bt_panelc\" )\n   bt_bt.btnstyle = $bsAsRadioBtn\n      \n   this.bt_edit.owner = tp\n   bt_bt as this.bt_edit\n   bt_bt.x=0\n   bt_bt.y = 20\n   bt_bt.height =20\n   bt_bt.width =65\n   bt_bt.caption = \"Edit\"   \n   bt_bt.onclick.set( this, \"bt_editc\" )\n   bt_bt.btnstyle = $bsAsRadioBtn\n   \n   uint h = 20\n   uint y = 90\n   bt_bt as newcomp( vBtn, panleft->vcomp )->vBtn\n   bt_bt as vBtn   \n   bt_bt.y = y\n   bt_bt.height =h   \n   bt_bt.caption = \"Build\"\n   bt_bt.vertalign = $alvTop\n   bt_bt.horzalign = $alhLeftRight\n   bt_bt.x=10\n   bt_bt.right =10\n   bt_bt.onclick.set( this, \"build\" )//getid( \"@build\", %{myform} )\n   \n   y += h\n   bt_bt as this.bsave\n   bt_bt.owner = panleft->vcomp   \n   bt_bt.y = y\n   bt_bt.height =h   \n   bt_bt.caption = \"Save\"\n   bt_bt.vertalign = $alvTop\n   bt_bt.horzalign = $alhLeftRight\n   bt_bt.x=10\n   bt_bt.right =10\n   bt_bt.onclick.set( this, \"save\" )// =getid( \"@save\", %{myform} )\n   \n   y += h\n   bt_bt as this.bopen\n   bt_bt.owner = panleft->vcomp  \n   bt_bt.y = y\n   bt_bt.height =h   \n   bt_bt.caption = \"New\"\n   bt_bt.vertalign = $alvTop\n   bt_bt.horzalign = $alhLeftRight\n   bt_bt.x=10\n   bt_bt.right =10\n   bt_bt.onclick.set( this, \"new\" )// =getid( \"@open\", %{myform} )\n   \n   y += h\n   bt_bt as this.babout\n   bt_bt.owner = panleft->vcomp  \n   bt_bt.y = y\n   bt_bt.height =h   \n   bt_bt.caption = \"About\"\n   bt_bt.vertalign = $alvTop\n   bt_bt.horzalign = $alhLeftRight\n   bt_bt.x=10\n   bt_bt.right =10\n   bt_bt.onclick.set( this, \"about\" )\n   \n   this.edcur.owner = panleft->vcomp\n   this.edcur.horzalign = $alhClient\n   this.edcur.readonly = 1\n   this.edcur.y = 175\n   this.edcur.height = 24\n   \n   t as newcomp( vtab, panleft->vcomp )->vtab\n      \n   t.y = 200\n   t.height = 200\n   t.horzalign = $alhClient   \n   t.vertalign = $alvTopBottom\n   \n   tp as newcomp( vtabpage, t )->vtabpage\n \n   //print( \"\\(&tp)\\n\" )\n   tp.caption = \"Properties\"   \n  \n   uint x as newcomp(vproplist, tp)->vproplist\n   this.prl = &x         \n   x.horzalign = $alhClient\n   x.vertalign = $alvClient\n   plist = &x\n   x.onprop.set( this, \"propset\" )\n   x.ongetlist.set( this, \"getlist\" )\n     \n   uint tpe as newcomp( vtabpage, t )->vtabpage\n   tpe.caption = \"Events\"   \n   //tpe.pageidx = 0\n   x as newcomp(vproplist, tpe)->vproplist  \n   this.evl = &x \n   x.horzalign = $alhClient\n   x.vertalign = $alvClient//TopBottom   \n   x.onprop.set( this, \"eventset\" )\n   x.ondblclick.set( this, \"eventdblclick\" )\n   //x.ongetlist.set( this, \"getlist\" )\n     \n   cm.addcomp( \"vctrl\", vctrl )\n   cm.addcomp( \"vBtn\",  vBtn )\n   cm.addcomp( \"vPanel\", vPanel )   \n   cm.addcomp( \"vEdit\", vEdit )\n   //cm.addcomp( \"vlistbox\", vlistbox )\n   cm.addcomp( \"vform\", vform )\n   */\n   /*uint xwin as newcompdes( vform, xpanright )->vctrl\n   edform = &xwin   \n   xwin.name = this.getnewname( xwin->vform.typename )\n   xwin.p_designing = 1\n   xwin.x = 0\n   xwin.y = 0*/ \n   /*wined = &newcomp( vwined, xpanright )   \n   wined->vwined.onselect.set( this, \"ctrlselect\" )// =getid( \"@ctrlselect\", %{myform} )   \n   wined->vwined.ondelete.set( this, \"ctrldelete\" )\n   wined->vwined.onnew.set( this, \"wineditnew\" )\n   this.srcfile = \"example\"\n   wined->vwined.select( edform->vctrl )*/   \n//print( \"xxx\\n\" )\n//   this.load()\n//print( \"xxx 2\\n\" ) \n   this.bt_arrow.Checked = 1\n   return this\n}", "meta": {"hexsha": "097c6f066d2de6ecf4b04f30eda2865bc1f744bc", "size": 5203, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "programs/visedit/viseditor.gi", "max_stars_repo_name": "gentee/c-gentee", "max_stars_repo_head_hexsha": "f231d698ef7ed54406888619427db7432dccec0e", "max_stars_repo_licenses": ["MIT-0", "MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2018-04-09T01:42:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-21T11:14:49.000Z", "max_issues_repo_path": "programs/visedit/viseditor.gi", "max_issues_repo_name": "gentee/c-gentee", "max_issues_repo_head_hexsha": "f231d698ef7ed54406888619427db7432dccec0e", "max_issues_repo_licenses": ["MIT-0", "MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "programs/visedit/viseditor.gi", "max_forks_repo_name": "gentee/c-gentee", "max_forks_repo_head_hexsha": "f231d698ef7ed54406888619427db7432dccec0e", "max_forks_repo_licenses": ["MIT-0", "MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.4111675127, "max_line_length": 91, "alphanum_fraction": 0.6111858543, "num_tokens": 1834, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.08632347188514872, "lm_q2_score": 0.014281932273109848, "lm_q1q2_score": 0.0012328659790433961}}
{"text": "MANIFEST\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000056427\u00000011610\u000000000000146\u000012754727571\u0000011213\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000cgibson\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000installer_version: 4\nimage_type: unittest\nversion: gftv200-40.1\nplatforms: [ GFLT110 ]\nmultiloader: 1\n\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000loader.gflt110.bin\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000056427\u00000011610\u000000000000013\u000012746742433\u0000013163\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000cgibson\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000gflt110.bin\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000kernel.img\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000056427\u00000011610\u000000000000012\u000012677613710\u0000012021\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000cgibson\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000kernel.img\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", "meta": {"hexsha": "8d7ed9b375931025a7f755b5b7f39392683eea97", "size": 10240, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "ginstall/testdata/img/image_gflt110_platform_loader.gi", "max_stars_repo_name": "DentonGentry/gfiber-platform", "max_stars_repo_head_hexsha": "2ba5266103aad0b7b676555eebd3c2061ddb8333", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2017-09-24T03:11:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T04:29:14.000Z", "max_issues_repo_path": "ginstall/testdata/img/image_gflt110_platform_loader.gi", "max_issues_repo_name": "DentonGentry/gfiber-platform", "max_issues_repo_head_hexsha": "2ba5266103aad0b7b676555eebd3c2061ddb8333", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ginstall/testdata/img/image_gflt110_platform_loader.gi", "max_forks_repo_name": "DentonGentry/gfiber-platform", "max_forks_repo_head_hexsha": "2ba5266103aad0b7b676555eebd3c2061ddb8333", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2017-10-05T23:04:10.000Z", "max_forks_repo_forks_event_max_datetime": "2017-10-05T23:04:10.000Z", "avg_line_length": 1706.6666666667, "max_line_length": 9626, "alphanum_fraction": 0.03203125, "num_tokens": 10016, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.1192029314092759, "lm_q2_score": 0.009859855248985793, "lm_q1q2_score": 0.0011753236489502425}}
{"text": "    \"reviewTitle\": \"Good place to stay for a business trip\",\n    \"reviewText\": \"cleanest rooms in town.\",\n    \"reviewerCity\": \"Olathe\",\n    \"reviewerState\": \"KS\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-09-12T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"End of Day 3\",\n    \"reviewText\": \"Nice Hotel just need a few things fixed, back door card reader didn't work. so long walk to car to unload. But Front Desk was very friendly and helpful. Room was clean, quite and comfortable. Bed was very good. Breakfast was good, WiFi was good.\",\n    \"reviewerCity\": \"Coalinga\",\n    \"reviewerState\": \"CA\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-08-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"End of Day 3\",\n    \"reviewText\": \"check your sheets before crawling in bed here! worst hotel stay ever! yuck!\",\n    \"reviewerCity\": \"Coalinga\",\n    \"reviewerState\": \"CA\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-03-16T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"End of Day 3\",\n    \"reviewText\": \"Cleanest rooms in town.\",\n    \"reviewerCity\": \"Coalinga\",\n    \"reviewerState\": \"CA\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-03-16T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"End of Day 3\",\n    \"reviewText\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    \"reviewerCity\": \"Coalinga\",\n    \"reviewerState\": \"CA\",\n    \"reviewRating\": 0\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-14T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great Choice\",\n    \"reviewText\": \"Staying here for just under two weeks while working in town. At first the check in didn't go so well, they person I spoke to in the phone never reserved the rooms, after a short wait all that was taken care of by the very helpful and patient staff. Overall this place is very clean and friendly. Would stay again\",\n    \"reviewerCity\": \"Coalinga\",\n    \"reviewerState\": \"CA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-06-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great Choice\",\n    \"reviewText\": \"don't take the elevator. i got stuck in it for 45 minutes.\",\n    \"reviewerCity\": \"Coalinga\",\n    \"reviewerState\": \"CA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-01-09T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Clean but...\",\n    \"reviewText\": \"I think it is overpriced for what you get. The rooms need updating, and oh my gosh, the mattress was horrible. Like a 30 year old box spring. My husband and I would roll to the middle and you can feel the springs. Terrible night sleep due to the mattress and the loud cars outside the window. All night long... More\",\n    \"reviewerCity\": \"Bixby\",\n    \"reviewerState\": \"OK\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-08-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Clean but...\",\n    \"reviewText\": \"Check your sheets before crawling in bed here! Worst hotel stay EVER! Yuck!\",\n    \"reviewerCity\": \"Bixby\",\n    \"reviewerState\": \"OK\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-03-27T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great front desk, tired rooms\",\n    \"reviewText\": \"The upside: very helpful, friendly front desk staff- worked quickly to initiate a room change after cleanliness complaint, made helpful restaurant suggestions. Quick check in. Comfortable beds. Good continental breakfast: biscuits and gravy, a variety if yogurts, waffles, sausage etc The downside: it is not very clean- in fact I was sort of grossed out. Rooms were dusty, carpet soiled.... More\",\n    \"reviewerCity\": \"Minneapolis\",\n    \"reviewerState\": \"MN\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-02-22T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great front desk, tired rooms\",\n    \"reviewText\": \"newly remodelled. rooms are comfortable\",\n    \"reviewerCity\": \"Minneapolis\",\n    \"reviewerState\": \"MN\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-19T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Quiet clean and reasonable\",\n    \"reviewText\": \"I stayed here one night as I traveled to Texas. My room was clean, bed was very comfortable and I felt very safe as I was traveling solo. Breakfast was good. Clerk gave me a recommendation for a local restaurant for supper which was excellent.\",\n    \"reviewerCity\": \"Dixon\",\n    \"reviewerState\": \"IL\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-07-01T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Quiet clean and reasonable\",\n    \"reviewText\": \"$80 bucks with tax!\",\n    \"reviewerCity\": \"Dixon\",\n    \"reviewerState\": \"IL\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-03-21T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Would stay again\",\n    \"reviewText\": \"Easy to get to. Friendly staff. Great amenities. Good breakfast. Clean and comfortable room. Close to many dinner options. Starbucks is next door. Decent value. A couple miles west of Joplin business area.\",\n    \"reviewerCity\": \"Plano\",\n    \"reviewerState\": \"TX\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-06T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"you get what you pay for\",\n    \"reviewText\": \"Hotel was clean and appeared to be recently renovated. Upon arrival was told by hotel staff that there was not water due to construction project nearby that broke a water line. The room was clean but smelled very musty. Pool area was nice. Biggest complaint is that we stayed for two nights and our room was not cleaned on our... More\",\n    \"reviewerCity\": \"Centerton\",\n    \"reviewerState\": \"AR\",\n    \"reviewRating\": 2\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-29T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Good place\",\n    \"reviewText\": \"Nice place for the money, newer beds and seems to have been remodeled recently. Decent breakfast and above average staff. Bathrooms were clean and everything worked accordingly .ask the front desk for some local restaurant recommendations they have a list that we found helpful. Would stay here again. .\",\n    \"reviewerCity\": \"Iowa City\",\n    \"reviewerState\": \"IA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2012-02-22T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Good place\",\n    \"reviewText\": \"Newly remodelled. Rooms are comfortable\",\n    \"reviewerCity\": \"Iowa City\",\n    \"reviewerState\": \"IA\",\n    \"reviewRating\": 4\n  }]\n} {\n  \"_id\": {\n    \"$oid\": \"5cf9dcbe433d2b44c0de410e\"\n  },\n  \"name\": \"Motel 6\",\n  \"categories\": [\"Hotels\", \"Lodging\", \"Motels\"],\n  \"location\": {\n    \"country\": \"US\",\n    \"state\": \"DC\",\n    \"city\": \"Somerset\",\n    \"postalCode\": \"42501\",\n    \"address\": \"1532 S Highway 27\",\n    \"coordinates\": {\n      \"type\": \"Point\",\n      \"coordinates\": [-84.61848, 37.072174]\n    }\n  },\n  \"reviews\": [{\n    \"reviewId\": \"\",\n    \"reviewTitle\": \"\",\n    \"reviewText\": \"Horrible experience never go!!!! Employees are rude and can't sleep because the beds are so hard!!!!\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewTitle\": \"\",\n    \"reviewText\": \"The do NOT accept there coupon that they have in the travel book. Rooms were clean but small and smelled of paint. Fresh paint is good but not until you air out the room before costomers are placed in them. Ended up costing 75 for 2 people.\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 3\n  }]\n} {\n  \"_id\": {\n    \"$oid\": \"5cf9dcbe433d2b44c0de410f\"\n  },\n  \"name\": \"Hampton Inn Dublin\",\n  \"categories\": [\"Hotels\"],\n  \"location\": {\n    \"country\": \"US\",\n    \"state\": \"MD\",\n    \"city\": \"Dublin\",\n    \"postalCode\": \"24084\",\n    \"address\": \"4420 Cleburne Blvd\",\n    \"coordinates\": {\n      \"type\": \"Point\",\n      \"coordinates\": [-80.69685, 37.07256]\n    }\n  },\n  \"reviews\": [{\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-03-15T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Surpassed all expectations\",\n    \"reviewText\": \"Great value. Newly remodeled and appointed rooms were beautiful. Clean and comfortable with a very competent and friendly staff. Excellent breakfast.\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-08-19T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Surpassed all expectations\",\n    \"reviewText\": \"I only spent one night. It was a quite stay.\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-10-10T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Very nice hotel - about 10-15 mins. from RU\",\n    \"reviewText\": \"Was very satisfied with the hotel. We stayed here for Radford University's parents weekend. Was the best hotel that we've stayed in so far. About a 10-15 minute ride to RU.\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-09-25T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Nice Hotel\",\n    \"reviewText\": \"Room was very nice and bed was very comfortable. Super friendly staff.\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-02T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Dublin Hampton Inn\",\n    \"reviewText\": \"The hotel was located near the highway and was a convenient stop for an overnight on our way home from vacation. The facility was a bit worn, but adequate for the night. The toilet emptied and refilled the entire time.\",\n    \"reviewerCity\": \"\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-22T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Slept well, quiet location\",\n    \"reviewText\": \"The beds were very comfortable and the staff friendly. This Hampton Inn is not pet friendly and the hallway had a strong smell of cigarette smoke (though not the room). There is no thermostat, just a blower with settings for low heat, high heat, etc. that I had to get up and adjust in the night. But otherwise the room... More\",\n    \"reviewerCity\": \"Macon\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-11-14T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great for the price!\",\n    \"reviewText\": \"One of the better Hamptons I've stayed at. Clean, comfortable...would definitely stay here again.\",\n    \"reviewerCity\": \"Macon\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2013-11-15T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great for the price!\",\n    \"reviewText\": \"One of the better Hamptons I've stayed at. Clean, comfortable...would definitely stay here again.\",\n    \"reviewerCity\": \"Macon\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-05-07T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great for the price!\",\n    \"reviewText\": \"One of the better Hamptons I've stayed at. Clean, comfortable...would definitely stay here again.\",\n    \"reviewerCity\": \"Macon\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-03-08T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great for the price!\",\n    \"reviewText\": \"The way we came in, it was a little off the beaten track, but would definitely stay there again, if needed. Friendly service, great breakfast, more importantly, very clean! Definitely recommend!\",\n    \"reviewerCity\": \"Macon\",\n    \"reviewerState\": \"\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-23T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great\",\n    \"reviewText\": \"One of the cleanest Hamton Inns I have ever stayed in! Staff was very nice and helpful . I called for a roll away bed and it appeared in about 2 minutes. Room was exceptionally clean and bed was very comfortable.\",\n    \"reviewerCity\": \"Richmond\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-13T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Very nice stay\",\n    \"reviewText\": \"The hotel is clean, comfortable and quiet. The staff is very friendly and helpful and the parking is easy. A perfect place to stay when I visit Blacksburg! This is my second stay in this hotel, and I anticipate there being many more.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2013-09-29T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"The facilities were very nice.\",\n    \"reviewText\": \"The staff was very helpful and the breakfast was very good!\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-05-10T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Close to Radford University\",\n    \"reviewText\": \"We needed a place to stay the night as we were moving our son out of his place at Radford for the summer. It was graduation weekend and there were no decent places available close by. Although the Hampton Inn was about 15 miles from our destination, it was a clean comfortable -place to stay anfd worth driving a few extra miles.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2013-08-25T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Showing Wear\",\n    \"reviewText\": \"I have stayed at this Hampton Inn before because it is relatively easy on and off I-81. The property is starting to show wear and tear in the rooms.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-08-28T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Convenient and Standard\",\n    \"reviewText\": \"You can pretty much count on Hampton for cleanliness and a decent breakfast. Unlike a box of chocolates, you know what you'll get.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-09-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Convenient and Standard\",\n    \"reviewText\": \"You can pretty much count on Hampton for cleanliness and a decent breakfast. Unlike a box of chocolates, you know what you'll get.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-16T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Nice stay\",\n    \"reviewText\": \"The hotel was very clean and right off I81. I was visiting my son at Radford and it was an easy 15 mins from the campus. Breakfast was good too.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-10-13T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Loved The Breakfast\",\n    \"reviewText\": \"I particularly want to commend the excellent breakfast.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-06-27T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Loved The Breakfast\",\n    \"reviewText\": \"I particularly want to commend the excellent breakfast.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-10-17T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Loved The Breakfast\",\n    \"reviewText\": \"I particularly want to commend the excellent breakfast.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-07-27T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Not bad for a one night stay, but not exceptional\",\n    \"reviewText\": \"We had a late check-in at this hotel as we were on the road. It took a bit for us to be assisted at the front desk as the staff member was in the back somewhere, but this was understandable since it was past midnight when we arrived. Overall, the room was satisfactory. It was clean and the bed was comfortable. The TV and appliances seemed new, but the air unit was older and noisy. The tub was a little dated as well. The hotel itself is definitely a bit worn. The exterior is not as inviting as some of the surrounding hotels. Our breakfast experience was also not up to par with other hotels in this chain as the tables were dirty, the trash was overflowing, and the whole area was just very messy. After another guest pointed this out, some of the issues were fixed. I would stay here again if the price were right and I were just passing through, but would definitely check the prices of some of the newer surrounding hotels first.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-06-10T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Not bad for a one night stay, but not exceptional\",\n    \"reviewText\": \"Staff was great!\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-01T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Nice place to stay\",\n    \"reviewText\": \"Room was very clean and comfortable. Staff was incredibly friendly. Will definitely stay there again.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-05-09T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Very convenient to local colleges\",\n    \"reviewText\": \"We needed a room close to Radford for my sons Graduation, the staff was more than helpful, rooms were clean and the pool was great to distract my younger children from the days activities.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-07-09T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Very convenient to local colleges\",\n    \"reviewText\": \"Disappointing breakfast. Outof coffee several times, then coffee that must have been run through the grounds a second time. Inattentive server for a weekend crowd. I'll pass on this property next time.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-06-05T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Dublin, VA wedding\",\n    \"reviewText\": \"We were very happy staying at the hotel. The beds were comfy, the room and bathroom were spotless. It was nice and quiet and the hotel was quite full when we were there. Having Shoney's right next door was perfect for some meals and within a close proximity there are other eateries, shopping stores, etc. We would definitely stay again at this hotel.\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-03-16T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"hard to find\",\n    \"reviewText\": \"after you get off 81 take second left. the hotel arrow sign is misleading\",\n    \"reviewerCity\": \"Virginia Beach\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-05-06T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"nice, clean hotel rooms...breakfast bar was very good hot food...lots of choices\",\n    \"reviewText\": \"The staff at the hotel were wonderful. We were stranded there because of car trouble and the staff at Kings Tires in Pulaski sent us to Hampton. When the van was finally fixed 2 day later, the staff at Hampton even offered to take us back to Pulaski (about 10miles away) to get the van. Food was always hot and... More\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-07-13T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"nice, clean hotel rooms...breakfast bar was very good hot food...lots of choices\",\n    \"reviewText\": \"This was a quick trip to Dublin VA for a funeral. They were very accommodating and got me in my room earlier so I could dress for funeral. I did not get back until late and then left early the next morning. I would stay there again if I happen to be in the area.\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-07-30T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"nice, clean hotel rooms...breakfast bar was very good hot food...lots of choices\",\n    \"reviewText\": \"Hotel was terrific. Hotels.com however couldn't get anything right. I made the initial reservation, and called back and asked for a change on the arrival date. After being VERY specific on what I wanted on the change, Hotels.com goofed it up. If I had not called back to the hotel to check, my stay would have been a disaster. Will have to re-assess my use of Hotels.com\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-06-11T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Comfortable Stay\",\n    \"reviewText\": \"Clean rooms, spacious and comfortable\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-03-12T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Will skip next time\",\n    \"reviewText\": \"Toilet was broken. Made dripping water sounds all night. Shower curtain smelled like body odor. Ventilation system was very loud. Walls were very thin and could hear everything, including when the blow dryer was off, was in, next door they the adjoining room door. Didn't sleep a wink. Front desk was curt. Good coffee and breakfast though.\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-08-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great stay\",\n    \"reviewText\": \"Pleasantly surprised. Loved having a fridge and the coffee in the room was great! Flavored creamers:) Bathroom amenities were really nice too. The breakfast was really good. And there was nice hot coffee in the lobby, but once there were no cups. My only complaint was the way the curtains were set up. It took three nights of bright parking lot lights in our faces to figure out that there were shades way in behind that would block the light. The curtains needed instructions!\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-09-05T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great stay!\",\n    \"reviewText\": \"Only stayed 1 night but really enjoyed the nice comfortable king-size bed.\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-01-16T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great stay!\",\n    \"reviewText\": \"Great, I enjoyed my stay af the Hampton Inn\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-09-19T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great stay!\",\n    \"reviewText\": \"Great, I enjoyed my stay af the Hampton Inn\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-01-08T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great stay!\",\n    \"reviewText\": \"Clean comfortable, friendly\",\n    \"reviewerCity\": \"Atlantic Beach\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-11-20T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Good People skills\",\n    \"reviewText\": \"Great service, great cookies, breakfast typical, Complintary internet work well, Just need a Jacuzzi in the pool area. The hallway on the 3rd floor smelled a little Smokey, but the room was fine no smoke smell at all.\",\n    \"reviewerCity\": \"Greensboro\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-11-01T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Experience\",\n    \"reviewText\": \"The hotel was typical Hampton inn quality that I have become accustomed to. The one outstanding part of my stay was I forgot my prescription sunglasses in the room. Around noon time I received a call from Kelly that they had found them and what would I like for them to do. That is outstanding customer service. Keep up the... More\",\n    \"reviewerCity\": \"spencere\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-24T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Overall a nice hotel\",\n    \"reviewText\": \"Overall the hotel is a nice place and the staff is friendly enough. Maybe I have seen one too many Hotel Impossible episodes, but to borrow a term from Anthony Melchiorri, nothing skeeves me out more than someone else's hair. My stay was otherwise perfect until the next morning when I stepped into the shower and opened my eyes to... More\",\n    \"reviewerCity\": \"South Windsor\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-08-23T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Overall a nice hotel\",\n    \"reviewText\": \"Overall the hotel is a nice place and the staff is friendly enough. Maybe I have seen one too many Hotel Impossible episodes, but to borrow a term from Anthony Melchiorri, nothing skeeves me out more than someone else's hair. My stay was otherwise perfect until the next morning when I stepped into the shower and opened my eyes to... More\",\n    \"reviewerCity\": \"South Windsor\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-08-06T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Overall a nice hotel\",\n    \"reviewText\": \"Overall the hotel is a nice place and the staff is friendly enough. Maybe I have seen one too many Hotel Impossible episodes, but to borrow a term from Anthony Melchiorri, nothing skeeves me out more than someone else's hair. My stay was otherwise perfect until the next morning when I stepped into the shower and opened my eyes to... More\",\n    \"reviewerCity\": \"South Windsor\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-05-03T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"LOVE HAMPTON\",\n    \"reviewText\": \"We prefer Hampton Inn when we travel! Hotels and amenities are very consistent except for prices! Pricing is very surprising at times! We have only had one problem with Hampton Inn! The air conditioning went out but we were in a new room in minutes!\",\n    \"reviewerCity\": \"Hendersonville\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-08-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"LOVE HAMPTON\",\n    \"reviewText\": \"Clean and service was great. Will stay here again!\",\n    \"reviewerCity\": \"Hendersonville\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-08-10T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Very comfortable and clean\",\n    \"reviewText\": \"I was very impressed with all the updates to the hotel It was very clean and comfortable. The staff was very friendly and helpful. The beds were very comfortable.\",\n    \"reviewerCity\": \"Hendersonville\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2014-09-13T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Never disappointed with Hampton Inns!\",\n    \"reviewText\": \"I really appreciate the dependability of Hampton Inns - they are always clean, comfortable, reasonably priced, and the staff is helpful and friendly. At the Hampton Inn Dublin, I gave a four out of five for room comfort simply because we ended up with a room that seemed a little smaller than what we usually get at a typical Hampton Inn (but it was a full hotel with the Virginia Tech home game weekend and we do have 2 adults and 3 kids in our family!) and because the bed pillows didn't seem as numerous and as comfortable as we've come to expect (firstworldproblems, right). Overall, very satisfactory! The kids had fun in the indoor pool, everyone slept well and we were on our way to our destination the next morning after coffee and a tasty little breakfast :)\",\n    \"reviewerCity\": \"Hendersonville\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-08-04T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Never disappointed with Hampton Inns!\",\n    \"reviewText\": \"I really appreciate the dependability of Hampton Inns - they are always clean, comfortable, reasonably priced, and the staff is helpful and friendly. At the Hampton Inn Dublin, I gave a four out of five for room comfort simply because we ended up with a room that seemed a little smaller than what we usually get at a typical Hampton Inn (but it was a full hotel with the Virginia Tech home game weekend and we do have 2 adults and 3 kids in our family!) and because the bed pillows didn't seem as numerous and as comfortable as we've come to expect (firstworldproblems, right). Overall, very satisfactory! The kids had fun in the indoor pool, everyone slept well and we were on our way to our destination the next morning after coffee and a tasty little breakfast :)\",\n    \"reviewerCity\": \"Hendersonville\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-26T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Home Away From Home\",\n    \"reviewText\": \"A BIG thank you to everyone that makes this our home away from home: Kelly Taylor (front desk), also Taylor makes great omelettes Shanna, Carlie, Diane, Jen Cathy, to name a few. Keep on the Great Work! We will definitely recommend this to our friends colleagues. Tom Kathy Stephenson (Room 223)\",\n    \"reviewerCity\": \"Kernersville\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-11-02T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Watch out for things that go bump in the night !!!\",\n    \"reviewText\": \"Well for starters my wife and I checked in late at night, d/t driving conditions because of the rainy weather. I was tired and exhausted and just wanted a shower and a nice clean bed to lay down.No sooner than my head hit the pillow(which you really shudnt call it a pillow) that my wife is jumping up and down... More\",\n    \"reviewerCity\": \"Washington DC\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-11-18T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Smoked out.\",\n    \"reviewText\": \"We only stayed one night on our way to Alabama. The room smelled so bad of smoke that I could taste it. My nose was stuffy all night. After we got to our next hotel and I opened my suitcase the pajamas I wore to bed the night I stayed there and the close I got there in still smelled like smoke. And this is coming from an ex smoker of 20 years. Pretty bad.\",\n    \"reviewerCity\": \"Washington DC\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-08-08T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Perfect for our trip\",\n    \"reviewText\": \"We headed to southern VA to watch minor league baseball. A couple of rainouts, but still a good long weekend. The hotel is located just off the highway with easy access. The staff could not be any nicer - truly a southern thing! Breakfast was very good with lots of choices.\",\n    \"reviewerCity\": \"Washington DC\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-07-04T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Unhappy traveler\",\n    \"reviewText\": \"The internet was down!!!!\",\n    \"reviewerCity\": \"Washington DC\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 2\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-13T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Hampton Inn, Dublin, Va\",\n    \"reviewText\": \"I enjoyed this hotel and would use it again. It was clean, staff courteous and helpful. I loved that it was just off I-81 with easy on/off access. The room could have been a bit larger and brighter. I was disappointed that pets were not allowed and would have opted to stay at the HI in Radford for that reason... More\",\n    \"reviewerCity\": \"Fayetteville\",\n    \"reviewerState\": \"NC\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-01-15T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Wonderful hotel!\",\n    \"reviewText\": \"We stopped at this hotel because of its convenience location. We have stayed at many Hampton Inns and this is one of the best at which we have stayed! The staff is very friendly and helpful. It was VERY clean and the breakfast was awesome! We are planning on staying here again in the near future!\",\n    \"reviewerCity\": \"Sherman\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-08-07T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"good stay at Hampton\",\n    \"reviewText\": \"A little tricky to access, but not bad. Drive up to hotel through gas stations. Hotel staff was very welcoming and accommodating of any need we had. very comfortable bed. clean room. pool was wonderful. breakfast was nice. (sausage, waffles, french toast, fruit, oatmeal etc)\",\n    \"reviewerCity\": \"Sherman\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-17T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Best Hampton Inn ever\",\n    \"reviewText\": \"This Hampton Inn is amazing. So glad we found it. Convenient location to the interstate but we were most impressed because it is so nice, clean and comfortable. The service was impeccable. We will definitely return if we are ever in the area again.\",\n    \"reviewerCity\": \"Chelsea\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-17T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Best Hampton Inn ever\",\n    \"reviewText\": \"to share your opinion of this businesswith YP visitors across the United Statesand in your neighborhood\",\n    \"reviewerCity\": \"Chelsea\",\n    \"reviewerState\": \"CT\",\n    \"reviewRating\": 0\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-23T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Your Basic Hampton Inn\",\n    \"reviewText\": \"This is a typical Hampton Inn with the standard reception area and lobby. This particular hotel still has smoking rooms and they are on the top floor. I usually like top floor rooms as I am sensitive to noise from above and this time I had to deal with a hallway that had the stale, cloying smell of old smoke.... More\",\n    \"reviewerCity\": \"Huntsville\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-28T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Best in the area. Excellent staff.\",\n    \"reviewText\": \"I have stayed in over 1000 hotels after a long career traveling to 50 states and over 20 countries. I rate hotels on cleanliness .... comfort of rooms. ... staff responsiveness. and comparison with other hotels in the area. This is the winner in the Dublin and Pulaski area by far. Healthy or country breakfast. Your choice. Great indoor pool.... More\",\n    \"reviewerCity\": \"Northern Virginia\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-05T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Should have been good, but it wasn't.\",\n    \"reviewText\": \"There are 2 other motels to choose from in the same area, unfortunately I made the wrong choice! I arrived in the late evening after a long drive from Florida, without a reservation. Front desk clerk said there were many rooms available, but evidently gave me the worst one! She was not able to find my HHonors membership and claimed... More\",\n    \"reviewerCity\": \"Montreal\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-01-10T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Transiting Southwest Virginia\",\n    \"reviewText\": \"Easy access from I-81. Very clean older building that has been very nicely maintained. Suite was spotless. Everything worked and there were tons of electrical sockets conveniently located. Plentiful access around desk. Checkin/out was smooth and friendly. Nearby (200 feet) Shoney's had a seafood/beef/chicken/veggie buffet....above average, clean restaurant with friendly service.\",\n    \"reviewerCity\": \"Palm Beach\",\n    \"reviewerState\": \"FL\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-12T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"WORST HAMPTON INN EXPERIENCE EVER!!!!!!!\",\n    \"reviewText\": \"We checked in around 7 P.M. after a long, demanding day and were so looking forward to a restful evening and night. When we opened the door to our room, we noticed a fairly strong smell but thought it was probably just some cleaning agent that had been used and thought that once we turned on the fan to the... More\",\n    \"reviewerCity\": \"Roanoke\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-30T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Clean and VERY Nice Staff.\",\n    \"reviewText\": \"The manager works as hard as the front desk and she will go out of her way to make you happy. Also, this location is quieter than I thought and they have an Indoor Pool. The Breakfast is always fresh. I just hope they will update the Climate control to a New Generation Wall Mount Digital Control.\",\n    \"reviewerCity\": \"Rochester\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-10-14T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Clean\",\n    \"reviewText\": \"It was nice,the staff was great. I would stay there again even though it was a little pricey.\",\n    \"reviewerCity\": \"Rochester\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-10-14T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Clean\",\n    \"reviewText\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    \"reviewerCity\": \"Rochester\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 0\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-15T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Dublin VA Hampton Inn\",\n    \"reviewText\": \"As always, a stay at a Hampton is always a great experience. I have been staying in Hampton Inns for many years and have always been extremely satisfied. There was only 1 exception about 4 years ago, and, I received a 100 refund because I was dissatisfied with the facility. I learned later that the hotel was sold to a... More\",\n    \"reviewerCity\": \"Rochester\",\n    \"reviewerState\": \"VA\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-05-05T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Dublin Hampton Inn\",\n    \"reviewText\": \"After spending 14 hours in a car , we were relieved that this Hampton Inn was quiet and we were able to get a very good night sleep. The breakfast we had the following morning had everything we needed for the last leg of our trip home. It was very filling and and delicious.\",\n    \"reviewerCity\": \"Saratoga Springs\",\n    \"reviewerState\": \"NY\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-13T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Nice and Quiet hotel\",\n    \"reviewText\": \"Stayed at the Hampton Inn, Dublin, VA. The hotel room was clean and the beds were extremely comfortable. The staff was nice also. One thing went wrong, my door keys didn't work. I went through four sets of keys. I think the door was the problem. Otherwise the hotel was great. I would recommend for families, couples or business trips.\",\n    \"reviewerCity\": \"Ellenwood\",\n    \"reviewerState\": \"NY\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-12-28T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great place is tyou enjoy smoking!\",\n    \"reviewText\": \"Simply disgusting. I reserved a non smoking room on a non smoking floor. Almost seemed liked the rule was you couldn't stay at this hotel unless you smoked. It was gross. And this was on a non-smoking floor with non smoking rooms. As soon as you stepped off the elevator you gagged. Sickening. Again, unless you like smoking. Then this... More\",\n    \"reviewerCity\": \"Harpers Ferry\",\n    \"reviewerState\": \"NY\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2013-03-25T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Great place is tyou enjoy smoking!\",\n    \"reviewText\": \"the gps is wrong... follow the sign when you first get off of 81... it's right there.\",\n    \"reviewerCity\": \"Harpers Ferry\",\n    \"reviewerState\": \"NY\",\n    \"reviewRating\": 1\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-11-25T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Only Average Compared to other Hampton Inns\",\n    \"reviewText\": \"Stayed at this hotel because of it's location. Furnishings were only average, and there were no local meal discounts which I have had at other H.I.'s. On the plus side the room was very quiet. Had dinner at the local Fatz which I enjoyed\",\n    \"reviewerCity\": \"Greenville\",\n    \"reviewerState\": \"SC\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-16T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Dublin Hampton Inn VA\",\n    \"reviewText\": \"Enjoyed stay. Staff was very friendly but complimentary breakfast (sausage and egg omelet) was not warm but otherwise good selection of breakfast items. We appreciate getting a comfortable clean room at the last minute. We recommend this hotel.\",\n    \"reviewerCity\": \"Birmingham\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 5\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-11-17T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Friendly Stay\",\n    \"reviewText\": \"changed schedule and unexpectedly stayed here. Extremely friendly and helpful staff. Everything clean and fresh. Close to I-81 but no highway sound. Good restaurant next door and in close proximity. Well lit parking lot. Good value for your money.\",\n    \"reviewerCity\": \"Dublin\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-05-04T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"I like Hampton Inns\",\n    \"reviewText\": \"This hotel is typical of Hampton Inns. I really like Hampton's beds and bedding, always clean and soft. The bathrooms are always clean, although this one had one minor maintenance problem which the front desk immediately called for repairs.\",\n    \"reviewerCity\": \"Ashburn\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-21T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Bathroom!!!\",\n    \"reviewText\": \"Place was fine for the price, however a few disappointments: Pool drained very slowly off deck Pillows sucked! No fan in the bathrooms Nasty!! Front desk charges the wrong accounts! Kids had a blast, shower was hot, had a good time- but it was good because Of the company of our friends!\",\n    \"reviewerCity\": \"Kings Nympton\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 3\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2015-10-22T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Was Not Expecting...\",\n    \"reviewText\": \"The hotel was great. However, I was not expecting dogs at the hotel since it is not a pet friendly hotel. A large dog was barking in the room next to me which was disturbing. I went downstairs to get coffee and saw a poodle. When I inquired about it at the front desk, they said there is only supposed... More\",\n    \"reviewerCity\": \"Woodbridge\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 4\n  }, {\n    \"reviewId\": \"\",\n    \"reviewDate\": {\n      \"$date\": \"2016-04-18T00:00:00.000Z\"\n    },\n    \"reviewTitle\": \"Excellent staff\",\n    \"reviewText\": \"This hotel is clean and the staff is both professional and friendly. They made our stay very pleasant. The room is very clean and has everything you would need for a stay away from home. We will stay at this hotel again because of the friendly staff.\",\n    \"reviewerCity\": \"Staffor\",\n    \"reviewerState\": \"AL\",\n    \"reviewRating\": 5\n  }]\n} {\n  \"_id\": {\n    \"$oid\": \"5cf9dcbe433d2b44c0de4110\"\n  },\n", "meta": {"hexsha": "348ec6cc41d5fe648790b364211b15cb13daf182", "size": 45810, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "dataLake/data/restaurants/reviews-1-chunk.gi", "max_stars_repo_name": "bigdatakid/mongodb-demos", "max_stars_repo_head_hexsha": "b7bec91bf92fff12041193318535e98c729dd51f", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2019-10-10T18:35:07.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-10T18:35:07.000Z", "max_issues_repo_path": "dataLake/data/restaurants/reviews-1-chunk.gi", "max_issues_repo_name": "bigdatakid/mongodb-demos", "max_issues_repo_head_hexsha": "b7bec91bf92fff12041193318535e98c729dd51f", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dataLake/data/restaurants/reviews-1-chunk.gi", "max_forks_repo_name": "bigdatakid/mongodb-demos", "max_forks_repo_head_hexsha": "b7bec91bf92fff12041193318535e98c729dd51f", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.7642357642, "max_line_length": 958, "alphanum_fraction": 0.6529796988, "num_tokens": 12837, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.04885778139204432, "lm_q2_score": 0.023330766177010947, "lm_q1q2_score": 0.0011398894735853023}}
{"text": "method vForm0 vForm0.mLoad <alias=vForm0_mLoad>( )   \n{   \n//\tthis->vForm.mCreateWin()\n\tustr ustmp\n\tuint comp\n\tcomp as this\n\twith comp\n\t{\n\t\t.AutoLang=1\n\t\t.Border=$fbrdDialog\n\t\t.Bottom=0\n\t\t.Caption=ustmp.fromutf8(\"Gentee Manager\")\n\t\t.Enabled=1\n\t\t.FormStyle=$fsChild\n\t\t.Height=400\n\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t.HorzAlign=$alhLeft\n\t\t.IconName=ustmp.fromutf8(\"\")\n\t\t.Left=0\n\t\t.Name=\"Form0\"\n\t\t.Right=0\n\t\t.StartPos=$spScreenCenter\n\t\t.Style=\"\"\n\t\t.Tag=0\n\t\t.Top=0\n\t\t.TopMost=0\n\t\t.VertAlign=$alvTop\n\t\t.Visible=1\n\t\t.Width=595\n\t\t.WindowState=$wsNormal\n\t\t.OnCreate.Set( this, Form0_appinit )\n\n\t\tuint comp\n\t\tcomp as this.Tab0\n\t\tcomp.Owner = this\n\t\twith comp\n\t\t{\n\t\t\t.AutoLang=1\n\t\t\t.Bottom=52\n\t\t\t.Enabled=1\n\t\t\t.Height=305\n\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t.HorzAlign=$alhLeftRight\n\t\t\t.Left=15\n\t\t\t.Name=\"Tab0\"\n\t\t\t.Right=12\n\t\t\t.Style=\"\"\n\t\t\t.TabOrder=0\n\t\t\t.Tag=0\n\t\t\t.Top=10\n\t\t\t.VertAlign=$alvTopBottom\n\t\t\t.Visible=1\n\t\t\t.Width=560\n\n\t\t\tuint comp\n\t\t\tcomp as this.TabItem0\n\t\t\tcomp.Owner = this.Tab0\n\t\t\twith comp\n\t\t\t{\n\t\t\t\t.AutoLang=1\n\t\t\t\t.Bottom=0\n\t\t\t\t.Caption=ustmp.fromutf8(\"Application\")\n\t\t\t\t.Enabled=1\n\t\t\t\t.Height=276\n\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t.Left=4\n\t\t\t\t.Name=\"TabItem0\"\n\t\t\t\t.Right=0\n\t\t\t\t.Style=\"\"\n\t\t\t\t.Tag=0\n\t\t\t\t.Top=25\n\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t.Visible=1\n\t\t\t\t.Width=552\n\n\t\t\t\tuint comp\n\t\t\t\tcomp as this.Btn0\n\t\t\t\tcomp.Owner = this.TabItem0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"Gentee IDE (Debugger)\")\n\t\t\t\t\t.Checked=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=35\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=25\n\t\t\t\t\t.Name=\"Btn0\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=0\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=30\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=225\n\t\t\t\t\t.OnClick.Set( this, Form0_runide )\n\t\t\t\t}\n\t\t\t\tcomp as this.Btn1\n\t\t\t\tcomp.Owner = this.TabItem0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"Gentee Studio\")\n\t\t\t\t\t.Checked=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=35\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=25\n\t\t\t\t\t.Name=\"Btn1\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=1\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=80\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=225\n\t\t\t\t\t.OnClick.Set( this, Form0_runstudio )\n\t\t\t\t}\n\t\t\t\tcomp as this.Btn2\n\t\t\t\tcomp.Owner = this.TabItem0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"VisEdit (Demo)\")\n\t\t\t\t\t.Checked=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=35\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=25\n\t\t\t\t\t.Name=\"Btn2\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=2\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=180\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=225\n\t\t\t\t\t.OnClick.Set( this, Form0_runvis )\n\t\t\t\t}\n\t\t\t\tcomp as this.Panel0\n\t\t\t\tcomp.Owner = this.TabItem0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Border=$brdGroupBox\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"Documentation\")\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=160\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=290\n\t\t\t\t\t.Name=\"Panel0\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=3\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=20\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=250\n\n\t\t\t\t\tuint comp\n\t\t\t\t\tcomp as this.Btn5\n\t\t\t\t\tcomp.Owner = this.Panel0\n\t\t\t\t\twith comp\n\t\t\t\t\t{\n\t\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t\t.Bottom=0\n\t\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t\t.Caption=ustmp.fromutf8(\"Help v2.5\")\n\t\t\t\t\t\t.Checked=0\n\t\t\t\t\t\t.Enabled=1\n\t\t\t\t\t\t.Height=35\n\t\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t\t.Left=20\n\t\t\t\t\t\t.Name=\"Btn5\"\n\t\t\t\t\t\t.Right=0\n\t\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t\t.TabOrder=0\n\t\t\t\t\t\t.Tag=0\n\t\t\t\t\t\t.Top=95\n\t\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t\t.Visible=1\n\t\t\t\t\t\t.Width=205\n\t\t\t\t\t\t.OnClick.Set( this, Form0_openchm25 )\n\t\t\t\t\t}\n\t\t\t\t\tcomp as this.Btn3\n\t\t\t\t\tcomp.Owner = this.Panel0\n\t\t\t\t\twith comp\n\t\t\t\t\t{\n\t\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t\t.Bottom=0\n\t\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t\t.Caption=ustmp.fromutf8(\"Help v3\")\n\t\t\t\t\t\t.Checked=0\n\t\t\t\t\t\t.Enabled=1\n\t\t\t\t\t\t.Height=35\n\t\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t\t.Left=20\n\t\t\t\t\t\t.Name=\"Btn3\"\n\t\t\t\t\t\t.Right=0\n\t\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t\t.TabOrder=1\n\t\t\t\t\t\t.Tag=0\n\t\t\t\t\t\t.Top=35\n\t\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t\t.Visible=1\n\t\t\t\t\t\t.Width=205\n\t\t\t\t\t\t.OnClick.Set( this, Form0_openchm3 )\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcomp as this.Btn8\n\t\t\t\tcomp.Owner = this.TabItem0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"GeViewer\")\n\t\t\t\t\t.Checked=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=35\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=25\n\t\t\t\t\t.Name=\"Btn8\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=4\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=130\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=225\n\t\t\t\t\t.OnClick.Set( this, Form0_runviewer )\n\t\t\t\t}\n\t\t\t}\n\t\t\tcomp as this.TabItem1\n\t\t\tcomp.Owner = this.Tab0\n\t\t\twith comp\n\t\t\t{\n\t\t\t\t.AutoLang=1\n\t\t\t\t.Bottom=0\n\t\t\t\t.Caption=ustmp.fromutf8(\"Associate Ext.\")\n\t\t\t\t.Enabled=1\n\t\t\t\t.Height=276\n\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t.Left=4\n\t\t\t\t.Name=\"TabItem1\"\n\t\t\t\t.Right=0\n\t\t\t\t.Style=\"\"\n\t\t\t\t.Tag=0\n\t\t\t\t.Top=25\n\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t.Visible=0\n\t\t\t\t.Width=552\n\n\t\t\t\tuint comp\n\t\t\t\tcomp as this.Label0\n\t\t\t\tcomp.Owner = this.TabItem1\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"Current Gentee compiler:\")\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=25\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=20\n\t\t\t\t\t.Name=\"Label0\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.TextHorzAlign=$talhLeft\n\t\t\t\t\t.TextVertAlign=$talvTop\n\t\t\t\t\t.Top=20\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=680\n\t\t\t\t\t.WordWrap=0\n\t\t\t\t\t.AutoSize=0\n\t\t\t\t}\n\t\t\t\tcomp as this.vRegcur\n\t\t\t\tcomp.Owner = this.TabItem1\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.Enabled=0\n\t\t\t\t\t.Height=30\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=20\n\t\t\t\t\t.MaxLen=32768\n\t\t\t\t\t.Multiline=0\n\t\t\t\t\t.Name=\"vRegcur\"\n\t\t\t\t\t.Password=0\n\t\t\t\t\t.ReadOnly=0\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.ScrollBars=$sbNone\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=1\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Text=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Top=45\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=480\n\t\t\t\t\t.WordWrap=0\n\t\t\t\t\t.Border=1\n\t\t\t\t}\n\t\t\t\tcomp as this.vRegnew\n\t\t\t\tcomp.Owner = this.TabItem1\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=30\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=20\n\t\t\t\t\t.MaxLen=32768\n\t\t\t\t\t.Multiline=0\n\t\t\t\t\t.Name=\"vRegnew\"\n\t\t\t\t\t.Password=0\n\t\t\t\t\t.ReadOnly=0\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.ScrollBars=$sbNone\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=2\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Text=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Top=95\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=480\n\t\t\t\t\t.WordWrap=0\n\t\t\t\t\t.Border=1\n\t\t\t\t}\n\t\t\t\tcomp as this.Btn6\n\t\t\t\tcomp.Owner = this.TabItem1\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"Change .G command line\")\n\t\t\t\t\t.Checked=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=30\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=20\n\t\t\t\t\t.Name=\"Btn6\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=3\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=145\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=225\n\t\t\t\t\t.OnClick.Set( this, Form0_changegline )\n\t\t\t\t}\n\t\t\t\tcomp as this.Btn7\n\t\t\t\tcomp.Owner = this.TabItem1\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=0\n\t\t\t\t\t.BtnStyle=$bsClassic\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"Set default command line\")\n\t\t\t\t\t.Checked=0\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=35\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t\t.Left=20\n\t\t\t\t\t.Name=\"Btn7\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=4\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=210\n\t\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=225\n\t\t\t\t\t.OnClick.Set( this, Form0_setdefault )\n\t\t\t\t}\n\t\t\t}\n\t\t\t.CurIndex=0\n\t\t}\n\t\tcomp as this.Btn4\n\t\tcomp.Owner = this\n\t\twith comp\n\t\t{\n\t\t\t.AutoLang=1\n\t\t\t.Bottom=0\n\t\t\t.BtnStyle=$bsClassic\n\t\t\t.Caption=ustmp.fromutf8(\"Exit\")\n\t\t\t.Checked=0\n\t\t\t.Enabled=1\n\t\t\t.Height=30\n\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t.HorzAlign=$alhLeft\n\t\t\t.Left=225\n\t\t\t.Name=\"Btn4\"\n\t\t\t.Right=0\n\t\t\t.Style=\"\"\n\t\t\t.TabOrder=1\n\t\t\t.Tag=0\n\t\t\t.Top=325\n\t\t\t.VertAlign=$alvTop\n\t\t\t.Visible=1\n\t\t\t.Width=130\n\t\t\t.OnClick.Set( this, Form0_exit )\n\t\t}\n\t}\n\n\treturn this\n}\n\nmethod vForm0 vForm0.init( )\n{\n   this.pTypeId = vForm0         \n   return this\n}\nfunc init_vForm0 <entry>()\n{   \n\n   regcomp( vForm0, \"vForm0\", vForm, $vForm_last,\n      %{ %{$mLoad,     vForm0_mLoad}},\n      0->collection )\n      \n}\n", "meta": {"hexsha": "39c9f931a6471362f903f87597c5176b74c7c214", "size": 8918, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "programs/gmanager/gmanager.gi", "max_stars_repo_name": "gentee/c-gentee", "max_stars_repo_head_hexsha": "f231d698ef7ed54406888619427db7432dccec0e", "max_stars_repo_licenses": ["MIT-0", "MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2018-04-09T01:42:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-21T11:14:49.000Z", "max_issues_repo_path": "programs/gmanager/gmanager.gi", "max_issues_repo_name": "gentee/c-gentee", "max_issues_repo_head_hexsha": "f231d698ef7ed54406888619427db7432dccec0e", "max_issues_repo_licenses": ["MIT-0", "MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "programs/gmanager/gmanager.gi", "max_forks_repo_name": "gentee/c-gentee", "max_forks_repo_head_hexsha": "f231d698ef7ed54406888619427db7432dccec0e", "max_forks_repo_licenses": ["MIT-0", "MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.8940677966, "max_line_length": 56, "alphanum_fraction": 0.5624579502, "num_tokens": 3287, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.0656048392859768, "lm_q2_score": 0.016152833874908692, "lm_q1q2_score": 0.0010597040703764667}}
{"text": "package main\n\nimport (\n\t\"github.com/containous/yaegi/interp\"\n)\n\nfunc main() {\n\ti := interp.New(interp.Opt{})\n\ti.Eval(`println(\"Hello\")`)\n}\n\n// Output:\n// Hello\n", "meta": {"hexsha": "0148e2fc08e5ef0dded532bec7c00f555fb528d8", "size": 160, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "_test/interp.gi", "max_stars_repo_name": "blasrodri/yaegi", "max_stars_repo_head_hexsha": "f60bc4bae6bef6308de4c409491a409e896f7677", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-07-27T12:20:42.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-28T17:59:54.000Z", "max_issues_repo_path": "_test/interp.gi", "max_issues_repo_name": "blasrodri/yaegi", "max_issues_repo_head_hexsha": "f60bc4bae6bef6308de4c409491a409e896f7677", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "_test/interp.gi", "max_forks_repo_name": "blasrodri/yaegi", "max_forks_repo_head_hexsha": "f60bc4bae6bef6308de4c409491a409e896f7677", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2019-10-23T17:20:59.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-05T02:04:10.000Z", "avg_line_length": 11.4285714286, "max_line_length": 37, "alphanum_fraction": 0.6375, "num_tokens": 47, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.026355354375619578, "lm_q2_score": 0.037892424049191194, "lm_q1q2_score": 0.0009986682639676837}}
{"text": "version\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000300145\u00000011610\u000000000000016\u000012523536103\u0000011462\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000dgentry\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000gfibertv-40.2\n\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000rootfs.squashfs\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000300145\u00000011610\u000000000000012\u000012523536621\u0000013146\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000dgentry\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000rootfs.img\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000vmlinuz\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000300145\u00000011610\u000000000000012\u000012523536672\u0000011510\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000dgentry\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000kernel.img\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000loader.bin\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00000000640\u00000300145\u00000011610\u000000000000012\u000012523536403\u0000012011\u0000 0\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ustar  \u0000dgentry\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000eng\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000loader.img\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", "meta": {"hexsha": "7d7ee1a6a4caca20f79240564563916751be25a0", "size": 10240, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "ginstall/testdata/img/image_v2.gi", "max_stars_repo_name": "DentonGentry/gfiber-platform", "max_stars_repo_head_hexsha": "2ba5266103aad0b7b676555eebd3c2061ddb8333", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2017-09-24T03:11:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T04:29:14.000Z", "max_issues_repo_path": "ginstall/testdata/img/image_v2.gi", "max_issues_repo_name": "DentonGentry/gfiber-platform", "max_issues_repo_head_hexsha": "2ba5266103aad0b7b676555eebd3c2061ddb8333", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ginstall/testdata/img/image_v2.gi", "max_forks_repo_name": "DentonGentry/gfiber-platform", "max_forks_repo_head_hexsha": "2ba5266103aad0b7b676555eebd3c2061ddb8333", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2017-10-05T23:04:10.000Z", "max_forks_repo_forks_event_max_datetime": "2017-10-05T23:04:10.000Z", "avg_line_length": 5120.0, "max_line_length": 9714, "alphanum_fraction": 0.0327148438, "num_tokens": 10025, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.10521054511997296, "lm_q2_score": 0.009412589804700949, "lm_q1q2_score": 0.0009903037043432867}}
{"text": "method vfBtnList vfBtnList.mLoad <alias=vfBtnList_mLoad>( )   \n{   \n//\tthis->vForm.mCreateWin()\n\tustr empus\n\tstr  emps\n\tustr ustmp\n\tuint comp\n\tcomp as this\n\t\tcomp.AutoLang=1\n\t\tcomp.Border=$fbrdNone\n\t\tcomp.Bottom=0\n\t\tcomp.Caption=empus\n\t\tcomp.Enabled=1\n\t\tcomp.FormStyle=$fsChild\n\t\tcomp.Height=226\n\t\tcomp.HelpTopic=empus\n\t\tcomp.Hint=empus\n\t\tcomp.HorzAlign=$alhClient\n\t\tcomp.IconName=empus\n\t\tcomp.Left=0\n\t\tcomp.Name=\"fBtnList\"\n\t\tcomp.Right=0\n\t\tcomp.StartPos=$spDesigned\n\t\tcomp.Style=emps\n\t\tcomp.TabOrder=0\n\t\tcomp.Tag=0\n\t\tcomp.Top=0\n\t\tcomp.TopMost=1\n\t\tcomp.VertAlign=$alvClient\n\t\tcomp.Visible=1\n\t\tcomp.Width=378\n\t\tcomp.WindowState=$wsNormal\n\t\tcomp.OnCreate.Set( this, fBtnList_Create )\n\t\tcomp as this.sbMain\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.AutoScroll=1\n\t\t\tcomp.Border=$brdNone\n\t\t\tcomp.Bottom=27\n\t\t\tcomp.Enabled=1\n\t\t\tcomp.Height=181\n\t\t\tcomp.HelpTopic=empus\n\t\t\tcomp.Hint=empus\n\t\t\tcomp.HorzAlign=$alhClient\n\t\t\tcomp.HorzRange=46\n\t\t\tcomp.Left=0\n\t\t\tcomp.Name=\"sbMain\"\n\t\t\tcomp.Right=0\n\t\t\tcomp.Style=emps\n\t\t\tcomp.TabOrder=0\n\t\t\tcomp.Tag=0\n\t\t\tcomp.Top=0\n\t\t\tcomp.VertAlign=$alvClient\n\t\t\tcomp.VertRange=52\n\t\t\tcomp.Visible=1\n\t\t\tcomp.Width=360\n\t\t\tcomp.OnMouse.Set( this, fBtnList_Mouse )\n\t\t\tcomp as this.tbItems\n\t\t\tcomp.Owner = this.sbMain\n\t\t\t\tcomp.AutoLang=0\n\t\t\t\tcomp.AutoSize=0\n\t\t\t\tcomp.Bottom=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Height=26\n\t\t\t\tcomp.HelpTopic=empus\n\t\t\t\tcomp.Hint=empus\n\t\t\t\tcomp.HorzAlign=$alhLeftRight\n\t\t\t\tcomp.ImageList=ustmp.fromutf8(\"project\")\n\t\t\t\tcomp.Left=46\n\t\t\t\tcomp.Name=\"tbItems\"\n\t\t\t\tcomp.Right=-2\n\t\t\t\tcomp.ShowCaption=$tscRight\n\t\t\t\tcomp.ShowDivider=0\n\t\t\t\tcomp.Style=emps\n\t\t\t\tcomp.TabOrder=0\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Top=0\n\t\t\t\tcomp.VertAlign=$alvTop\n\t\t\t\tcomp.Vertical=1\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.Width=316\n\t\t\t\tcomp.Wrapable=1\n\t\t\t\tcomp.OnMouse.Set( this, fBtnList_ItemMouse )\n\t\t\tcomp as this.tbPaste\n\t\t\tcomp.Owner = this.sbMain\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.AutoSize=0\n\t\t\t\tcomp.Bottom=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Height=25\n\t\t\t\tcomp.HelpTopic=empus\n\t\t\t\tcomp.Hint=empus\n\t\t\t\tcomp.HorzAlign=$alhLeft\n\t\t\t\tcomp.ImageList=ustmp.fromutf8(\"project\")\n\t\t\t\tcomp.Left=23\n\t\t\t\tcomp.Name=\"tbPaste\"\n\t\t\t\tcomp.Right=0\n\t\t\t\tcomp.ShowCaption=$tscNone\n\t\t\t\tcomp.ShowDivider=0\n\t\t\t\tcomp.Style=emps\n\t\t\t\tcomp.TabOrder=1\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Top=0\n\t\t\t\tcomp.VertAlign=$alvTop\n\t\t\t\tcomp.Vertical=1\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.Width=23\n\t\t\t\tcomp.Wrapable=1\n\t\t\tcomp as this.tbCopy\n\t\t\tcomp.Owner = this.sbMain\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.AutoSize=0\n\t\t\t\tcomp.Bottom=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Height=52\n\t\t\t\tcomp.HelpTopic=empus\n\t\t\t\tcomp.Hint=empus\n\t\t\t\tcomp.HorzAlign=$alhLeft\n\t\t\t\tcomp.ImageList=ustmp.fromutf8(\"project\")\n\t\t\t\tcomp.Left=0\n\t\t\t\tcomp.Name=\"tbCopy\"\n\t\t\t\tcomp.Right=0\n\t\t\t\tcomp.ShowCaption=$tscNone\n\t\t\t\tcomp.ShowDivider=0\n\t\t\t\tcomp.Style=emps\n\t\t\t\tcomp.TabOrder=2\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Top=0\n\t\t\t\tcomp.VertAlign=$alvTop\n\t\t\t\tcomp.Vertical=1\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.Width=23\n\t\t\t\tcomp.Wrapable=1\n\tcomp as this\n\t\tcomp.ClientHeight=181\n\t\tcomp.ClientWidth=360\n\n\treturn this\n}\n\nmethod vfBtnList vfBtnList.init( )\n{\n   this.pTypeId = vfBtnList         \n   return this\n}\nfunc init_vfBtnList <entry>()\n{\n   regcomp( vfBtnList, \"vfBtnList\", vForm, $vForm_last,\n      %{ %{$mLoad,     vfBtnList_mLoad}},\n      0->collection )\n      \n}\n", "meta": {"hexsha": "9126ebd5a17b0e35396cf7f594103d2f47c891bb", "size": 3222, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "src/main/btnlist.gi", "max_stars_repo_name": "novostrim/macroclip", "max_stars_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-10-24T13:17:43.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-08T06:01:14.000Z", "max_issues_repo_path": "src/main/btnlist.gi", "max_issues_repo_name": "novostrim/macroclip", "max_issues_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/btnlist.gi", "max_forks_repo_name": "novostrim/macroclip", "max_forks_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.0588235294, "max_line_length": 62, "alphanum_fraction": 0.6784605835, "num_tokens": 1196, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.06656918897050167, "lm_q2_score": 0.012624947563364833, "lm_q1q2_score": 0.0008404325200883081}}
{"text": "\"GameInfo\"\n{\n\t//\n\t// gameinfo.gi is the non-branch-varying content and can be integrated between branches.\n\t// Branch-varying info, such as the game/title and app IDs, is in gameinfo_branchspecific.gi.\n\t//\n\n\tgamelogo 1\n\ttype\t\tmultiplayer_only\n\n\tnomodels 1\n\tnohimodel 1\n\tnocrosshair 0\n\tGameData\t\"dota.fgd\"\n\tSupportsDX8\t0\n\tnodegraph 0\n\ttonemapping 0 // Hide tonemapping ui in tools mode\n\n\tFileSystem\n\t{\n\t\t//\n\t\t// The code that loads this file automatically does a few things here:\n\t\t//\n\t\t// 1. For each \"Game\" search path, it adds a \"GameBin\" path, in <dir>\\bin\n\t\t// 2. For each \"Game\" search path, it adds another \"Game\" path in front of it with _<langage> at the end.\n\t\t//    For example: c:\\hl2\\cstrike on a french machine would get a c:\\hl2\\cstrike_french path added to it.\n\t\t// 3. For the first \"Game\" search path, it adds a search path called \"MOD\".\n\t\t// 4. For the first \"Game\" search path, it adds a search path called \"DEFAULT_WRITE_PATH\".\n\t\t//\n\n\t\t//\n\t\t// Search paths are relative to the exe directory\\..\\\n\t\t//\n\t\tSearchPaths\n\t\t{\n\t\t\t// These are optional language paths. They must be mounted first, which is why there are first in the list.\n\t\t\t// *LANGUAGE* will be replaced with the actual language name. If not running a specific language, these paths will not be mounted\n\t\t\tGame\t\t\t\tsolyanka\n\t\t\tGame_Language\t\tdota_*LANGUAGE*\n\n\t\t\t// These are optional low-violence paths. They will only get mounted if you're in a low-violence mode.\n\t\t\tGame_LowViolence\tdota_lv\n\n\t\t\tGame\t\t\t\tsolyanka\n\t\t\tGame\t\t\t\tdota\n\t\t\tGame\t\t\t\tcore\n\n\t\t\tMod\t\t\t\t\tsolyanka\n\t\t\tMod\t\t\t\t\tdota\n\n\t\t\tWrite\t\t\t\tdota\n\n\t\t\t// These are optional language paths. They must be mounted first, which is why there are first in the list.\n\t\t\t// *LANGUAGE* will be replaced with the actual language name. If not running a specific language, these paths will not be mounted\n\t\t\tAddonRoot_Language\tdota_*LANGUAGE*_addons\n\n\t\t\tAddonRoot\t\t\tdota_addons\n\n\t\t\t// Note: addon content is included in publiccontent by default.\n\t\t\tPublicContent\t\tdota_core\n\t\t\tPublicContent\t\tcore\n\t\t}\n\n\t\tAddonsChangeDefaultWritePath 0\n\t}\n\n\tMaterialSystem2\n\t{\n\t\tRenderModes\n\t\t{\n\t\t\t\"game\" \"Default\"\n\t\t\t\"game\" \"DotaDeferred\"\n\t\t\t\"game\" \"DotaForward\"\n\t\t\t\"game\" \"Depth\"\n\n\t\t\t\"tools\" \"ToolsVis\" // Visualization modes for all shaders (lighting only, normal maps only, etc.)\n\t\t\t\"tools\" \"ToolsWireframe\" // This should use the ToolsVis mode above instead of being its own mode\n\t\t\t\"tools\" \"ToolsUtil\" // Meant to be used to render tools sceneobjects that are mod-independent, like the origin grid\n\t\t}\n\t}\n\n\tEngine2\n\t{\n\t\t\"HasModAppSystems\" \"1\"\n\t\t\"Capable64Bit\" \"1\"\n\t\t\"UsesVGui\" \"0\"\n\t\t\"UsesPanorama\" \"1\"\n\t\t\"PanoramaUIClientFromClient\" \"1\" // IPanoramaUIClient is implemented by client.dll\n\t\t\"HasGameUI\" \"1\" // dota uses gameui\n\t\t\"GameUIFromClient\" \"1\"  // AND that gameui comes from client.dll\n\t\t\"URLName\" \"dota2\"\n\t\t\"MsaaOverrideType\" \"0\"\n\t\t\"UsesBink\" \"0\"\n        \"MaxNetworkableEntities\" \"10000\"\n        \"MaxNonNetworkableEntities\" \"10000\"\n        \"DefaultDXVersion\" \"11\"\n        // The shader binary cache on Linux can be over 100MB so\n        // we have to allow very large allocations.\n\t\t\"AllocWarnMB_linuxsteamrt64\" \"200\"\n\t\t// Also currently demo files are loaded entirely into\n\t\t// memory for 64-bit binaries so they can use well\n\t\t// over 100MB at load time.  Zoid is looking at\n\t\t// converting that to streaming.\n\t\t\"AllocWarnMB_osx64\" \"200\"\n\t\t\"AllocWarnMB_pc64\" \"200\"\n\t\t\"AllocWarnMB\" \"100\"\n\t\t// There are some known large virtual reservations, such as the SBH, which\n\t\t// bypass this limit so we can be fairly conservative.\n\t\t\"ReserveWarnMB\" \"64\"\n\n\t\t\"DefaultRenderSystem\"\t\t\t\t\t\"-vulkan\" [ $LINUX || $OSX ] // macOS/Linux default to Vulkan\n\t\t\"SupportsVulkanParticleOptimizations\"\t\"1\"\n\n\t\t\"RenderingPipeline\"\n\t\t{\n\t\t\t\"SkipPostProcessing\" \"1\"\n\t\t\t\"SupportsMSAA\" \"0\"\n\t\t}\n\n\t\t\"BugBait\"\n\t\t{\n\t\t\t// Used by 'bug:' in chat to normalize report settings during playtests\n\t\t\t\"Owner\" \"triage*\"\n\t\t\t\"Severity\" \"high\"\n\t\t\t\"Priority\" \"none\"\n\t\t\t\"Category\" \"---\"\n\t\t\t\"Product\" \"dota\"\n\t\t\t\"Component\" \"dota\"\n\t\t}\n\t}\n\n\tSceneFileCache\n\t{\n\t\t\"ServerUsesSceneImageFile\" \"0\"\n\t}\n\n\tSceneSystem\n\t{\n\t\t\"SunLightManagerCount\" \"0\"\n\t\t\"TransformTextureRowCount\" \"256\"\n\t\t\"CMTAtlasWidth\" \"1024\"\n\t\t\"CMTAtlasHeight\" \"512\"\n\t\t\"CMTAtlasChunkSize\" \"128\"\n\t\t\"DrawParticleChildrenSeparateFromParents\" \"1\"\n\t\t\"MaxAutoPartitions\" \"8\"\n\t\t\"LayerBatchThreshold\" \"512\" [ $OSX && $CPU_EMULATED ] // Apple M1 - increase sc_layer_batch_threshold from 128 -> 512. Reduces TBDR memory bandwidth.\n\t}\n\t\n\tSoundSystem\n\t{\n\t\t\"SteamAudioEnabled\" \"0\"\n\t\t\"DefaultWindowsXAudio\" \"1\"\n\t}\n\n\tToolsEnvironment\n\t{\n\t\t\"Engine\"\t\"Source 2\"\n\t\t\"ToolsDir\"\t\"../sdktools\"\t// NOTE: Default Tools path. This is relative to the mod path.\n\t\t\"DeveloperHelpURL\" \"https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools\"\n\t\t\"ToolsProductName\" \"Dota2 Workshop Tools\"\n\t\t\"HideCoreMod\"\t\"1\"\n\t}\n\n\tHammer\n\t{\n\t\t\"fgd\"\t\t\t\t\t\t\"dota.fgd\"\t// NOTE: This is relative to the 'mod' path.\n\t\t\"GameFeatureSet\"\t\t\t\"Dota\"\n\t\t\"LoadScriptEntities\"\t\t\"0\"\n\t\t\"DefaultTextureScale\"\t\t\"0.250000\"\n\t\t\"DefaultSolidEntity\"\t\t\"trigger_dota\"\n\t\t\"DefaultPointEntity\"\t\t\"info_player_start_dota\"\n\t\t\"NavMarkupEntity\"\t\t\t\"func_nav_markup\"\n\t\t\"EnableDotaTools\"\t\t\t\"1\"\n\t\t\"DefaultGridTileSet\"\t\t\"/maps/tilesets/radiant_basic.vmap\"\n\t\t\"DefaultGridTileSet2\"\t\t\"/maps/tilesets/dire_basic.vmap\"\n\t\t\"DotaMaxTrees\"\t\t\t\t\"8000\"\n\t\t\"AddonMapCommand\"\t\t\t\"dota_launch_custom_game\"\n\t\t\"PostMapLoadCommands\"\t\t\"jointeam good\" // Commands sent to the console by hammer after it finishes building a map and loads it\n\t\t\"RequiredGameEntities\"\t\t\"info_player_start_goodguys|info_player_start_dota; info_player_start_badguys|info_player_start_dota; env_global_light; ent_dota_game_events\"\n\t\t\"UnitsFiles\"\t\t\t\t\"scripts/npc/npc_units.txt; scripts/npc/npc_units_staging.txt; scripts/npc/npc_units_custom.txt; scripts/npc/npc_heroes.txt; scripts/npc/npc_heroes_staging.txt\"\n\t\t\"ItemsFiles\"\t\t\t\t\"scripts/npc/items.txt; scripts/npc/items_staging.txt; scripts/npc/npc_items_custom.txt\"\n\t\t\"OverlayBoxSize\"\t\t\t\"16\"\n\t\t\"TileGridBlendOrderBGRA\"\t\"1\"\n\t\t\"TileGridBlendDefaultColor\"\t\"0 255 0\"\n\t}\n\n\tMaterialEditor\n\t{\n\t\t\"DefaultShader\"\t\t\t\"global_lit_simple\"\n\t\t\"ExpressionHelpUrl\"\t\t\"https://intranet.valvesoftware.com/index.php/Source_2.0/Shader_Format#Shader.2FMaterial_Expression_Syntax\"\n\t}\n\n\tModelCompile\n\t{\n\t\t\"UseShadowFastPathHeuristic\"\t\"1\"\n\t}\n\t\n\tModelDoc\n\t{\n\t\t\"models_gamedata\"\t\t\t\"models_gamedata.fgd\"\n\t\t\"export_modeldoc\"\t\t\t\"0\"\n\t\t\"features\"\t\t\t\t\t\"econitems;editorconfig\"\n\t}\n\n\tResourceCompiler\n\t{\n\t\t// Overrides of the default builders as specified in code, this controls which map builder steps\n\t\t// will be run when resource compiler is run for a map without specifiying any specific map builder\n\t\t// steps. Additionally this controls which builders are displayed in the hammer build dialog.\n\t\tDefaultMapBuilders\n\t\t{\n\t\t\t\"light\"\t\t\"0\"\t// Dota does not use baked lighting\n\t\t\t\"envmap\"\t\"0\"\t// Dota doesn't generate environment maps from the map\n\t\t\t\"gridnav\"\t\"1\"\t// Dota generates its grid navigation data by default\n\t\t}\n\t\t\"DotaTileGrid\"\t\"1\"\n\t}\n\n\tRenderPipelineAliases\n\t{\n\t\t\"Tools\"\t\t\t\"Dota:Forward\"\n\t\t\"EnvMapBake\"\t\"Dota\"\n\t}\n\t\n\tAnimationSystem\n\t{\n\t\tNumDecodeCaches \"16\"\n\t\tDecodeCacheMemoryKB \"512\"\n\t}\n\n\tParticles\n\t{\n\t\t\"GameSupportsLegacyShaders\"\t\"1\"\n\t}\n\n\tPanorama\n\t{\n\t\t\"UsesSvg\" \"1\"\n\t}\n\n\tRenderSystem\n\t{\n\t\tSwapChainSampleableDepth 1\n\t\t\"VulkanUseSecondaryCommandBuffers\"\t\"1\" // Use secondary command buffers for more efficiency on tiled based renderers. All platforms to limit configurations.\n\t\t\"VulkanSteamShaderCache\"\t\t\t\"1\"\n\t\t\"OpenGLForceSM30\"\t\t\t\t\t\"1\"\n\t}\n}\n", "meta": {"hexsha": "8e4b43324cf07b8706d9cc8a58f1e8fd54c3c7b7", "size": 7467, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "game/dota/gameinfo.gi", "max_stars_repo_name": "DazzledAtheist/solyanka-dota2", "max_stars_repo_head_hexsha": "fd4407056a1a816988602e5ca7f64be43b73d1b2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-08-01T16:06:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-16T05:37:49.000Z", "max_issues_repo_path": "game/dota/gameinfo.gi", "max_issues_repo_name": "LinkinWires/solyanka-dota2", "max_issues_repo_head_hexsha": "fd4407056a1a816988602e5ca7f64be43b73d1b2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "game/dota/gameinfo.gi", "max_forks_repo_name": "LinkinWires/solyanka-dota2", "max_forks_repo_head_hexsha": "fd4407056a1a816988602e5ca7f64be43b73d1b2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.9879518072, "max_line_length": 178, "alphanum_fraction": 0.7139413419, "num_tokens": 2399, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.05921024742104522, "lm_q2_score": 0.010986944755786042, "lm_q1q2_score": 0.0006505397173914468}}
{"text": "\"GameInfo\"\n{\n\tgame \t\t\"Dota 2\"\n\ttitle \t\t\"Dota 2\"\n\n\tgamelogo 1\n\ttype\t\tmultiplayer_only\n\n\tnomodels 1\n\tnohimodel 1\n\tnocrosshair 0\n\tGameData\t\"dota.fgd\"\n\tSupportsDX8\t0\n\tnodegraph 0\n\ttonemapping 0 // Hide tonemapping ui in tools mode\n\n\tFileSystem\n\t{\n\t\tSteamAppId\t\t\t\t570\n\t\tBreakpadAppId\t\t\t373300\t// Report crashes under beta DLC, not the S1 game.  Delete this when all clients are switched to S2\n\t\tBreakpadAppId_Tools\t\t375360  // Use a separate bucket of buckets for \"-tools\" crashes so that they don't get drowned out by game crashes. Falls back to BreakpadAppId/SteamAppId if missing\n\t\t\n\t\t//\n\t\t// The code that loads this file automatically does a few things here:\n\t\t//\n\t\t// 1. For each \"Game\" search path, it adds a \"GameBin\" path, in <dir>\\bin\n\t\t// 2. For each \"Game\" search path, it adds another \"Game\" path in front of it with _<langage> at the end.\n\t\t//    For example: c:\\hl2\\cstrike on a french machine would get a c:\\hl2\\cstrike_french path added to it.\n\t\t// 3. For the first \"Game\" search path, it adds a search path called \"MOD\".\n\t\t// 4. For the first \"Game\" search path, it adds a search path called \"DEFAULT_WRITE_PATH\".\n\t\t//\n\n\t\t//\n\t\t// Search paths are relative to the exe directory\\..\\\n\t\t//\n\t\tSearchPaths\n\t\t{\n\t\t\t// These are optional language paths. They must be mounted first, which is why there are first in the list.\n\t\t\t// *LANGUAGE* will be replaced with the actual language name. If not running a specific language, these paths will not be mounted\n\t\t\tGame_Language\t\tdota_*LANGUAGE*\n\n\t\t\t// These are optional low-violence paths. They will only get mounted if you're in a low-violence mode.\n\t\t\tGame_LowViolence\tdota_lv\n\n\t\t\tGame\t\t\t\tdota\n\t\t\tGame\t\t\t\tcore\n\n\t\t\tMod\t\t\t\t\tdota\n\n\t\t\tAddonRoot\t\t\tdota_addons\n\n\t\t\t// Note: addon content is included in publiccontent by default.\n\t\t\tPublicContent\t\tdota_core\n\t\t\tPublicContent\t\tcore\n\t\t}\n\n\t\tAddonsChangeDefaultWritePath 0\n\t}\n\n\tMaterialSystem2\n\t{\n\t\tRenderModes\n\t\t{\n\t\t\t\"game\" \"Default\"\n\t\t\t\"game\" \"DotaDeferred\"\n\t\t\t\"game\" \"DotaForward\"\n\t\t\t\"game\" \"Depth\"\n\n\t\t\t\"tools\" \"ToolsVis\" // Visualization modes for all shaders (lighting only, normal maps only, etc.)\n\t\t\t\"tools\" \"ToolsWireframe\" // This should use the ToolsVis mode above instead of being its own mode\n\t\t\t\"tools\" \"ToolsUtil\" // Meant to be used to render tools sceneobjects that are mod-independent, like the origin grid\n\t\t}\n\t}\n\t \n\tEngine2\n\t{\n\t\t\"HasModAppSystems\" \"1\"\n\t\t\"Capable64Bit\" \"1\"\n\t\t\"UsesVGui\" \"0\"\n\t\t\"UsesScaleform\" \"1\"\n\t\t\"UsesPanorama\" \"1\"\n\t\t\"PanoramaUIClientFromClient\" \"1\" // IPanoramaUIClient is implemented by client.dll\n\t\t\"HasGameUI\" \"1\" // dota uses gameui\n\t\t\"GameUIFromClient\" \"1\"  // AND that gameui comes from client.dll\n\t\t\"URLName\" \"dota2\"\n\t\t\"MsaaOverrideType\" \"0\"\n\t\t\"UsesBink\" \"0\"\n        \"MaxNetworkableEntities\" \"10000\"\n        \"MaxNonNetworkableEntities\" \"10000\"\n        \"DefaultDXVersion\" \"9\"\n        // The shader binary cache on Linux can be over 100MB so\n        // we have to allow very large allocations.\n\t\t\"AllocWarnMB_linuxsteamrt64\" \"200\"\n\t\t// Also currently demo files are loaded entirely into\n\t\t// memory for 64-bit binaries so they can use well\n\t\t// over 100MB at load time.  Zoid is looking at\n\t\t// converting that to streaming.\n\t\t\"AllocWarnMB_osx64\" \"200\"\n\t\t\"AllocWarnMB_pc64\" \"200\"\n\t\t\"AllocWarnMB\" \"100\"\n\t\t// There are some known large virtual reservations, such as the SBH, which\n\t\t// bypass this limit so we can be fairly conservative.\n\t\t\"ReserveWarnMB\" \"64\"\n\n\t\t\"RenderingPipeline\"\n\t\t{\n\t\t\t\"SkipPostProcessing\" \"1\"\n\t\t\t\"SupportsMSAA\" \"0\"\n\t\t}\n\t\t\n\t\t\"BugBait\"\n\t\t{\n\t\t\t// Used by 'bug:' in chat to normalize report settings during playtests\n\t\t\t\"Owner\" \"triage*\" \n\t\t\t\"Severity\" \"high\"\n\t\t\t\"Priority\" \"none\"\n\t\t\t\"Category\" \"---\"\n\t\t\t\"Product\" \"dota\"\n\t\t\t\"Component\" \"dota\"\n\t\t}\n\t}\n\n\tSceneFileCache\n\t{\n\t\t\"ServerUsesSceneImageFile\" \"0\"\n\t}\n\n\tSceneSystem\n\t{\n\t\t\"NoSunLightManager\" \"1\"\n\t\t\"TransformTextureRowCount\" \"256\"\n\t\t\"CMTAtlasWidth\" \"512\"\n\t\t\"CMTAtlasHeight\" \"512\"\n\t\t\"CMTAtlasChunkSize\" \"128\"\n\t\t\"DrawParticleChildrenSeparateFromParents\" \"1\"\n\t}\n\t\n\tSoundSystem\n\t{\n\t\t\"DisableSteamAudio\" \"1\"\n\t\t\"DefaultWindowsXAudio\" \"1\"\n\t}\n\n\tToolsEnvironment\n\t{\n\t\t\"Engine\"\t\"Source 2\"\n\t\t\"ToolsDir\"\t\"../sdktools\"\t// NOTE: Default Tools path. This is relative to the mod path.\n\t\t\"DeveloperHelpURL\" \"https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools\"\n\t\t\"ToolsProductName\" \"Dota2 Workshop Tools\"\n\t}\n\t\n\tHammer\n\t{\n\t\t\"fgd\"\t\t\t\t\t\"dota.fgd\"\t// NOTE: This is relative to the 'mod' path.\n\t\t\"GameFeatureSet\"\t\t\"Dota\"\n\t\t\"LoadScriptEntities\"\t\"0\"\n\t\t\"DefaultTextureScale\"\t\"0.250000\"\n\t\t\"DefaultSolidEntity\"\t\"trigger_dota\"\n\t\t\"DefaultPointEntity\"\t\"info_player_start_dota\"\n\t\t\"NavMarkupEntity\"\t\t\"func_nav_markup\"\n\t\t\"EnableDotaTools\"\t\t\"1\"\n\t\t\"DefaultGridTileSet\"\t\"/maps/tilesets/radiant_basic.vmap\"\n\t\t\"DefaultGridTileSet2\"\t\"/maps/tilesets/dire_basic.vmap\"\n\t\t\"DotaMaxTrees\"\t\t\t\"8000\"\n\t\t\"AddonMapCommand\"\t\t\"dota_launch_custom_game\"\n\t\t\"PostMapLoadCommands\"\t\"jointeam good\" // Commands sent to the console by hammer after it finishes building a map and loads it\n\t\t\"RequiredGameEntities\"\t\"info_player_start_goodguys|info_player_start_dota; info_player_start_badguys|info_player_start_dota; env_global_light; ent_dota_game_events\"\n\t\t\"UnitsFiles\"\t\t\t\"scripts/npc/npc_units.txt; scripts/npc/npc_units_custom.txt; scripts/npc/npc_heroes.txt\"\n\t\t\"ItemsFiles\"\t\t\t\"scripts/npc/items.txt; scripts/npc/npc_items_custom.txt\"\n\t\t\"OverlayBoxSize\"\t\t\"16\"\n\t\t\"TileGridBlendOrderBGRA\"\t\"1\"\n\t\t\"TileGridBlendDefaultColor\"\t\"0 255 0\"\n\t}\n\n\tMaterialEditor\n\t{\n\t\t\"DefaultShader\"\t\t\t\"global_lit_simple\"\n\t\t\"ExpressionHelpUrl\"\t\t\"https://intranet.valvesoftware.com/index.php/Source_2.0/Shader_Format#Shader.2FMaterial_Expression_Syntax\"\n\t}\n\t\n\tResourceCompiler\n\t{\n\t\t// Overrides of the default builders as specified in code, this controls which map builder steps\n\t\t// will be run when resource compiler is run for a map without specifiying any specific map builder\n\t\t// steps. Additionally this controls which builders are displayed in the hammer build dialog.\n\t\tDefaultMapBuilders\n\t\t{\t\t\t\n\t\t\t\"light\"\t\t\"0\"\t// Dota does not use baked lighting\n\t\t\t\"envmap\"\t\"0\"\t// Dota doesn't generate environment maps from the map\n\t\t\t\"gridnav\"\t\"1\"\t// Dota generates its grid navigation data by default\n\t\t}\n\t\t\"DotaTileGrid\"\t\"1\"\n\t}\n\n\tRenderPipelineAliases\n\t{\n\t\t\"Tools\"\t\t\t\"Dota:Forward\"\n\t\t\"EnvMapBake\"\t\"Dota\"\n\t}\n\t\n\tRenderSystem\n\t{\n\t\t// rendersystemvulkan setting that determines how many partitions scenesystem places\n\t\t// in each job. The higher the number, the more work per command buffer. Vulkan has higher \n\t\t// cost per command buffer than software contexts so settings this higher reduces \n\t\t// overall number of command buffers.\n\t\t\"VulkanSceneSystemJobCost\"\t\t\"2\"\n\t}\n}\n", "meta": {"hexsha": "0ec9670cbde96c43a618411e63f73166806d940c", "size": 6599, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "testdata/gameinfo.gi", "max_stars_repo_name": "13k/kv-go", "max_stars_repo_head_hexsha": "48b2ce1e14fcaa877600081b1aa80cf46bcdeaaf", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "testdata/gameinfo.gi", "max_issues_repo_name": "13k/kv-go", "max_issues_repo_head_hexsha": "48b2ce1e14fcaa877600081b1aa80cf46bcdeaaf", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "testdata/gameinfo.gi", "max_forks_repo_name": "13k/kv-go", "max_forks_repo_head_hexsha": "48b2ce1e14fcaa877600081b1aa80cf46bcdeaaf", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.4238095238, "max_line_length": 189, "alphanum_fraction": 0.7155629641, "num_tokens": 2099, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.05749327395561901, "lm_q2_score": 0.010818450028235378, "lm_q1q2_score": 0.0006219881112485108}}
{"text": "\"GameInfo\"\n{\n\tgame \t\t\"Dota 2\"\n\ttitle \t\t\"Dota 2\"\n\n\tgamelogo 1\n\ttype\t\tmultiplayer_only\n\n\tnomodels 1\n\tnohimodel 1\n\tnocrosshair 0\n\tGameData\t\"dota.fgd\"\n\tSupportsDX8\t0\n\tnodegraph 0\n\ttonemapping 0 // Hide tonemapping ui in tools mode\n\n\tFileSystem\n\t{\n\t\tSteamAppId\t\t\t\t570\n\t\tBreakpadAppId\t\t\t373300\t// Report crashes under beta DLC, not the S1 game.  Delete this when all clients are switched to S2\n\t\tBreakpadAppId_Tools\t\t375360  // Use a separate bucket of buckets for \"-tools\" crashes so that they don't get drowned out by game crashes. Falls back to BreakpadAppId/SteamAppId if missing\n\n\t\t//\n\t\t// The code that loads this file automatically does a few things here:\n\t\t//\n\t\t// 1. For each \"Game\" search path, it adds a \"GameBin\" path, in <dir>\\bin\n\t\t// 2. For each \"Game\" search path, it adds another \"Game\" path in front of it with _<langage> at the end.\n\t\t//    For example: c:\\hl2\\cstrike on a french machine would get a c:\\hl2\\cstrike_french path added to it.\n\t\t// 3. For the first \"Game\" search path, it adds a search path called \"MOD\".\n\t\t// 4. For the first \"Game\" search path, it adds a search path called \"DEFAULT_WRITE_PATH\".\n\t\t//\n\n\t\t//\n\t\t// Search paths are relative to the exe directory\\..\\\n\t\t//\n\t\tSearchPaths\n\t\t{\n\t\t\tGame\t\t\t\tdota_divine_ui\n\t\t\tGame\t\t\t\tdota\n\t\t\tGame\t\t\t\tcore\n\n\t\t\tMod\t\t\t\t\tdota_divine_ui\n\t\t\tMod\t\t\t\t\tdota\n\n\t\t\tAddonRoot\t\t\tdota_addons\n\n\t\t\t// Note: addon content is included in publiccontent by default.\n\t\t\tPublicContent\t\tdota_core\n\t\t\tPublicContent\t\tcore\n\t\t}\n\t}\n\n\tMaterialSystem2\n\t{\n\t\tRenderModes\n\t\t{\n\t\t\t\"game\" \"Default\"\n\t\t\t\"game\" \"DotaDeferred\"\n\t\t\t\"game\" \"DotaForward\"\n\t\t\t\"game\" \"Depth\"\n\n\t\t\t\"tools\" \"ToolsVis\" // Visualization modes for all shaders (lighting only, normal maps only, etc.)\n\t\t\t\"tools\" \"ToolsWireframe\" // This should use the ToolsVis mode above instead of being its own mode\n\t\t\t\"tools\" \"ToolsUtil\" // Meant to be used to render tools sceneobjects that are mod-independent, like the origin grid\n\t\t}\n\t}\n\n\tEngine2\n\t{\n\t\t\"HasModAppSystems\" \"1\"\n\t\t\"Capable64Bit\" \"1\"\n\t\t\"UsesScaleform\" \"1\"\n\t\t\"HasGameUI\" \"1\" // dota uses gameui\n\t\t\"GameUIFromClient\" \"1\"  // AND that gameui comes from client.dll\n\t\t\"URLName\" \"dota2\"\n\t\t\"UsesBink\" \"0\"\n\t\t\"RenderingPipeline\"\n\t\t{\n\t\t\t\"SkipPostProcessing\" \"1\"\n\t\t\t\"SupportsMSAA\" \"0\"\n\t\t}\n\t\t\n\t\t\"BugBait\"\n\t\t{\n\t\t\t// Used by 'bug:' in chat to normalize report settings during playtests\n\t\t\t\"Owner\" \"triage*\" \n\t\t\t\"Severity\" \"high\"\n\t\t\t\"Priority\" \"none\"\n\t\t\t\"Category\" \"---\"\n\t\t\t\"Product\" \"dota\"\n\t\t\t\"Component\" \"dota\"\n\t\t}\n\t}\n\n\tSceneSystem\n\t{\n\t\t\"NoSunLightManager\" \"1\"\n\t}\n\n\tToolsEnvironment\n\t{\n\t\t\"Engine\"\t\"Source 2\"\n\t\t\"ToolsDir\"\t\"../sdktools\"\t// NOTE: Default Tools path. This is relative to the mod path.\n\t\t\"DeveloperHelpURL\" \"https://intranet.valvesoftware.com/wiki/Source_2_SDK\"\n\t\t\"ToolsProductName\" \"Dota2 Workshop Tools\"\n\t}\n\t\n\tHammer\n\t{\n\t\t\"fgd\"\t\t\t\t\t\"../dota/dota.fgd\"\t// NOTE: This is relative to the 'mod' path.\n\t\t\"GameFeatureSet\"\t\t\"Dota\"\n\t\t\"LoadScriptEntities\"\t\"0\"\n\t\t\"DefaultTextureScale\"\t\"0.250000\"\n\t\t\"DefaultSolidEntity\"\t\"trigger_multiple\"\n\t\t\"DefaultPointEntity\"\t\"info_player_start_goodguys\"\n\t\t\"NavMarkupEntity\"\t\t\"func_nav_markup\"\n\t\t\"EnableDotaTools\"\t\t\"1\"\n\t\t\"DefaultGridTileSet\"\t\"/maps/tilesets/radiant_basic.vmap\"\n\t\t\"DefaultGridTileSet2\"\t\"/maps/tilesets/dire_basic.vmap\"\n\t\t\"AddonMapCommand\"\t\t\"dota_launch_custom_game\"\n\t\t\"PostMapLoadCommands\"\t\"jointeam good\" // Commands sent to the console by hammer after it finishes building a map and loads it\n\t\t\"RequiredGameEntities\"\t\"info_player_start_goodguys; info_player_start_badguys; env_global_light; ent_dota_game_events\"\n\t}\n\n\tMaterialEditor\n\t{\n\t\t\"DefaultShader\"\t\t\t\"hero\"\n\t}\n\t\n\tResourceCompiler\n\t{\n\t\t// Overrides of the default builders as specified in code, this controls which map builder steps\n\t\t// will be run when resource compiler is run for a map without specifiying any specific map builder\n\t\t// steps. Additionally this controls which builders are displayed in the hammer build dialog.\n\t\tDefaultMapBuilders\n\t\t{\t\t\t\n\t\t\t\"light\"\t\t\"0\"\t// Dota does not use baked lighting\n\t\t\t\"envmap\"\t\"0\"\t// Dota doesn't generate environment maps from the map\n\t\t\t\"gridnav\"\t\"1\"\t// Dota generates its grid navigation data by default\n\t\t}\n\t}\n\n\tRenderPipelineAliases\n\t{\n\t\t\"Tools\"\t\t\t\"Dota\"\n\t\t\"EnvMapBake\"\t\"Dota\"\n\t}\n\t\n\tSource1Import\n\t{\n\t\t\"importmod\"\t\t\t\"dota_divine_ui\"\n\t\t\"importdir\"\t\t\t\"..\\dota_divine_ui\"\n\t\t\"onlyimportleafiestmod\"\t\"1\" // only directly import assets in dota_divine_ui\n\t\t\"ispeermod\"\t\t\t\"1\"  // is this mod in a peer dir of dota.\n\t\t\"ignoreParticleManifest\" \"1\"\t\n\t\t\"getSkinningFromLod0ByDefault\" \"0\"\n\t\t\"createStaticOverlays\" \"1\"\t// info_overlay entities will be converted to static overlay nodes instead of preserved as Info_overlay entities\n\t}\n}\n", "meta": {"hexsha": "37bc11cc65e66ba9ff7250444d91f46743f15759", "size": 4622, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "gameinfo.gi", "max_stars_repo_name": "dota2-divine-ui/divine-ui", "max_stars_repo_head_hexsha": "1d7f5967cb86b49eb0daf15490bc49f20ca943a3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-01-21T00:57:16.000Z", "max_stars_repo_stars_event_max_datetime": "2018-01-21T00:57:16.000Z", "max_issues_repo_path": "gameinfo.gi", "max_issues_repo_name": "dota2-divine-ui/divine-ui", "max_issues_repo_head_hexsha": "1d7f5967cb86b49eb0daf15490bc49f20ca943a3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gameinfo.gi", "max_forks_repo_name": "dota2-divine-ui/divine-ui", "max_forks_repo_head_hexsha": "1d7f5967cb86b49eb0daf15490bc49f20ca943a3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.8875, "max_line_length": 189, "alphanum_fraction": 0.7031588057, "num_tokens": 1523, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.06008664512463807, "lm_q2_score": 0.010013571389468939, "lm_q1q2_score": 0.0006016819105092491}}
{"text": "method vfClipTools vfClipTools.mLoad <alias=vfClipTools_mLoad>( )   \n{   \n//\tthis->vForm.mCreateWin()\n\tustr empus\n\tstr  emps\n\tustr ustmp\n\tuint comp\n\tcomp as this\n\t\tcomp.AutoLang=1\n\t\tcomp.Border=$fbrdSizeToolWin\n\t\tcomp.Bottom=0\n\t\tcomp.Caption=empus\n\t\tcomp.Enabled=1\n\t\tcomp.FormStyle=$fsPopup\n\t\tcomp.Height=575\n\t\tcomp.HelpTopic=empus\n\t\tcomp.Hint=empus\n\t\tcomp.HorzAlign=$alhLeft\n\t\tcomp.IconName=empus\n\t\tcomp.Left=0\n\t\tcomp.Name=\"fClipTools\"\n\t\tcomp.Right=0\n\t\tcomp.StartPos=$spDesigned\n\t\tcomp.Style=emps\n\t\tcomp.TabOrder=0\n\t\tcomp.Tag=0\n\t\tcomp.Top=0\n\t\tcomp.TopMost=1\n\t\tcomp.VertAlign=$alvTop\n\t\tcomp.Visible=1\n\t\tcomp.Width=398\n\t\tcomp.WindowState=$wsNormal\n\t\tcomp.OnMouse.Set( this, fClipTools_fm )\n\t\tcomp.OnCreate.Set( this, fClipTools_Create )\n\t\tcomp.OnDestroy.Set( this, fClipTools_Destroy )\n\t\tcomp.OnCloseQuery.Set( this, fClipTools_Close )\n\t\tcomp as this.Tab0\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Bottom=0\n\t\t\tcomp.Enabled=1\n\t\t\tcomp.FixedWidth=0\n\t\t\tcomp.Height=530\n\t\t\tcomp.HelpTopic=empus\n\t\t\tcomp.Hint=empus\n\t\t\tcomp.HorzAlign=$alhClient\n\t\t\tcomp.ImageList=ustmp.fromutf8(\"groups\")\n\t\t\tcomp.Left=0\n\t\t\tcomp.Name=\"Tab0\"\n\t\t\tcomp.Right=0\n\t\t\tcomp.Style=emps\n\t\t\tcomp.TabOrder=0\n\t\t\tcomp.TabStyle=$tsNone\n\t\t\tcomp.Tag=0\n\t\t\tcomp.Top=0\n\t\t\tcomp.VertAlign=$alvTopBottom\n\t\t\tcomp.Visible=1\n\t\t\tcomp.Width=380\n\t\t\tcomp as this.tiHistory\n\t\t\tcomp.Owner = this.Tab0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Bottom=0\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"history\")\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Height=501\n\t\t\t\tcomp.HelpTopic=empus\n\t\t\t\tcomp.Hint=empus\n\t\t\t\tcomp.HorzAlign=$alhLeft\n\t\t\t\tcomp.ImageId=ustmp.fromutf8(\"history\")\n\t\t\t\tcomp.Left=4\n\t\t\t\tcomp.Name=\"tiHistory\"\n\t\t\t\tcomp.Right=0\n\t\t\t\tcomp.Style=emps\n\t\t\t\tcomp.TabOrder=0\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Top=25\n\t\t\t\tcomp.VertAlign=$alvTop\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.Width=372\n\t\tcomp as this.Tab0\n\t\tcomp.Owner = this\n\t\t\tcomp.CurIndex=0\n\t\tcomp as this.ToolBar0\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.AutoSize=0\n\t\t\tcomp.Bottom=5\n\t\t\tcomp.Enabled=1\n\t\t\tcomp.Height=25\n\t\t\tcomp.HelpTopic=empus\n\t\t\tcomp.Hint=empus\n\t\t\tcomp.HorzAlign=$alhLeft\n\t\t\tcomp.ImageList=ustmp.fromutf8(\"main\")\n\t\t\tcomp.Left=0\n\t\t\tcomp.Name=\"ToolBar0\"\n\t\t\tcomp.Right=0\n\t\t\tcomp.ShowCaption=$tscNone\n\t\t\tcomp.ShowDivider=0\n\t\t\tcomp.Style=emps\n\t\t\tcomp.TabOrder=1\n\t\t\tcomp.Tag=0\n\t\t\tcomp.Top=500\n\t\t\tcomp.VertAlign=$alvBottom\n\t\t\tcomp.Vertical=0\n\t\t\tcomp.Visible=0\n\t\t\tcomp.Width=75\n\t\t\tcomp.Wrapable=0\n\t\t\tcomp as this.tbiMainWin\n\t\t\tcomp.Owner = this.ToolBar0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"mainwin\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Hint=empus\n\t\t\t\tcomp.ImageId=ustmp.fromutf8(\"mclip\")\n\t\t\t\tcomp.Index=0\n\t\t\t\tcomp.Name=\"tbiMainWin\"\n\t\t\t\tcomp.ShowCaption=0\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.TBIStyle=$tbsAsCheckBox\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.OnClick.Set( this, fClipTools_MainWin )\n\t\t\tcomp as this.ToolBarItem0\n\t\t\tcomp.Owner = this.ToolBar0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"ToolBarItem0\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Hint=empus\n\t\t\t\tcomp.ImageId=empus\n\t\t\t\tcomp.Index=1\n\t\t\t\tcomp.Name=\"ToolBarItem0\"\n\t\t\t\tcomp.ShowCaption=0\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.TBIStyle=$tbsButton\n\t\t\t\tcomp.Visible=1\n\t\tcomp as this.Tray0\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Caption=ustmp.fromutf8(\"progname\")\n\t\t\tcomp.Image=ustmp.fromutf8(\"main\\\\mclip\")\n\t\t\tcomp.Name=\"Tray0\"\n\t\t\tcomp.RBtnPopupMenu=.pmTray\n\t\t\tcomp.Tag=0\n\t\t\tcomp.Visible=0\n\t\t\tcomp.OnMouse.Set( this, fClipTools_Tray )\n\t\tcomp as this.pmTray\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Name=\"pmTray\"\n\t\t\tcomp.Tag=0\n\t\t\tcomp as this.miExit\n\t\t\tcomp.Owner = this.pmTray\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"exit\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"miExit\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.OnClick.Set( this, fClipTools_Exit )\n\t\tcomp as this.timerRestore\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Enabled=0\n\t\t\tcomp.Interval=1000\n\t\t\tcomp.Name=\"timerRestore\"\n\t\t\tcomp.Tag=0\n\t\t\tcomp.OnTimer.Set( this, fClipTools_Restore )\n\t\tcomp as this.pmBtns\n\t\tcomp.Owner = this\n\t\t\tcomp.AutoLang=1\n\t\t\tcomp.Name=\"pmBtns\"\n\t\t\tcomp.Tag=0\n\t\t\tcomp.OnBeforeShow.Set( this, fClipTools_PopupBtns )\n\t\t\tcomp.OnAfterShow.Set( this, fClipTools_PopupClose )\n\t\t\tcomp as this.miCopyToNotices\n\t\t\tcomp.Owner = this.pmBtns\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"copytonotices\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"miCopyToNotices\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=0\n\t\t\tcomp as this.miDelete\n\t\t\tcomp.Owner = this.pmBtns\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"delete\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"miDelete\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=1\n\t\t\t\tcomp.OnClick.Set( this, fClipTools_DeleteItem )\n\t\t\tcomp as this.MenuItem0\n\t\t\tcomp.Owner = this.pmBtns\n\t\t\t\tcomp.AutoCheck=0\n\t\t\t\tcomp.AutoLang=1\n\t\t\t\tcomp.Caption=ustmp.fromutf8(\"edit\")\n\t\t\t\tcomp.Checked=0\n\t\t\t\tcomp.Ellipsis=0\n\t\t\t\tcomp.Enabled=1\n\t\t\t\tcomp.Image=empus\n\t\t\t\tcomp.Name=\"MenuItem0\"\n\t\t\t\tcomp.RadioCheck=0\n\t\t\t\tcomp.Separator=0\n\t\t\t\tcomp.ShortKey=empus\n\t\t\t\tcomp.Tag=0\n\t\t\t\tcomp.Visible=0\n\t\t\t\tcomp.OnClick.Set( this, fClipTools_EditItem )\n\tcomp as this\n\t\tcomp.ClientHeight=530\n\t\tcomp.ClientWidth=380\n\n\treturn this\n}\n\nmethod vfClipTools vfClipTools.init( )\n{\n   this.pTypeId = vfClipTools         \n   return this\n}\nfunc init_vfClipTools <entry>()\n{\n   regcomp( vfClipTools, \"vfClipTools\", vForm, $vForm_last,\n      %{ %{$mLoad,     vfClipTools_mLoad}},\n      0->collection )\n      \n}\n", "meta": {"hexsha": "af66dfbf488734634e32576061c36a9df96d8acc", "size": 5747, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "src/main/cliptools.gi", "max_stars_repo_name": "novostrim/macroclip", "max_stars_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-10-24T13:17:43.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-08T06:01:14.000Z", "max_issues_repo_path": "src/main/cliptools.gi", "max_issues_repo_name": "novostrim/macroclip", "max_issues_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/cliptools.gi", "max_forks_repo_name": "novostrim/macroclip", "max_forks_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.0803212851, "max_line_length": 68, "alphanum_fraction": 0.6899251784, "num_tokens": 2115, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.05184546371976373, "lm_q2_score": 0.010986943713429492, "lm_q1q2_score": 0.0005696231916856949}}
{"text": "method vfHistItem vfHistItem.mLoad <alias=vfHistItem_mLoad>( )   \n{   \n//\tthis->vForm.mCreateWin()\n\tustr ustmp\n\tuint comp\n\tcomp as this\n\twith comp\n\t{\n\t\t.AutoLang=1\n\t\t.Border=$fbrdSizeable\n\t\t.Bottom=0\n\t\t.Caption=ustmp.fromutf8(\"\")\n\t\t.Enabled=1\n\t\t.FormStyle=$fsPopup\n\t\t.Height=429\n\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t.HorzAlign=$alhLeft\n\t\t.IconName=ustmp.fromutf8(\"\")\n\t\t.Left=0\n\t\t.Name=\"fHistItem\"\n\t\t.Right=0\n\t\t.StartPos=$spScreenCenter\n\t\t.Style=\"\"\n\t\t.TabOrder=0\n\t\t.Tag=0\n\t\t.Top=0\n\t\t.TopMost=0\n\t\t.VertAlign=$alvTop\n\t\t.Visible=0\n\t\t.Width=608\n\t\t.WindowState=$wsNormal\n\t\t.OnCreate.Set( this, fHistItem_Create )\n\n\t\tuint comp\n\t\tcomp as this.Splitter0\n\t\tcomp.Owner = this\n\t\twith comp\n\t\t{\n\t\t\t.AutoLang=1\n\t\t\t.AutoSize=1\n\t\t\t.Bottom=0\n\t\t\t.Enabled=1\n\t\t\t.FixedPart=$sfpRight\n\t\t\t.Height=400\n\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t.HorzAlign=$alhClient\n\t\t\t.Left=0\n\t\t\t.LeftMinSize=0\n\t\t\t.Name=\"Splitter0\"\n\t\t\t.Orientation=$soHorizontal\n\t\t\t.Right=0\n\t\t\t.RightMinSize=0\n\t\t\t.SplitterWidth=0\n\t\t\t.Style=\"\"\n\t\t\t.TabOrder=0\n\t\t\t.Tag=0\n\t\t\t.Top=0\n\t\t\t.VertAlign=$alvClient\n\t\t\t.Visible=1\n\t\t\t.Width=600\n\n\t\t\tuint comp\n\t\t\tcomp as this.Panel0\n\t\t\tcomp.Owner = this.Splitter0\n\t\t\twith comp\n\t\t\t{\n\t\t\t\t.AutoLang=1\n\t\t\t\t.Border=$brdNone\n\t\t\t\t.Bottom=0\n\t\t\t\t.Caption=ustmp.fromutf8(\"\")\n\t\t\t\t.Enabled=1\n\t\t\t\t.Height=350\n\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t.Left=0\n\t\t\t\t.Name=\"Panel0\"\n\t\t\t\t.Right=0\n\t\t\t\t.Style=\"\"\n\t\t\t\t.TabOrder=0\n\t\t\t\t.Tag=0\n\t\t\t\t.Top=0\n\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t.Visible=1\n\t\t\t\t.Width=600\n\n\t\t\t\tuint comp\n\t\t\t\tcomp as this.pTop\n\t\t\t\tcomp.Owner = this.Panel0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Border=$brdNone\n\t\t\t\t\t.Bottom=65\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=285\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhClient\n\t\t\t\t\t.Left=0\n\t\t\t\t\t.Name=\"pTop\"\n\t\t\t\t\t.Right=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=0\n\t\t\t\t\t.Tag=0\n\t\t\t\t\t.Top=0\n\t\t\t\t\t.VertAlign=$alvTopBottom\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=600\n\t\t\t\t}\n\t\t\t\tcomp as this.e_wincaption\n\t\t\t\tcomp.Owner = this.Panel0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AddColon=1\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=38\n\t\t\t\t\t.Btn1Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Btn1Image=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Btn2Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Btn2Image=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"wincaption\")\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=25\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeftRight\n\t\t\t\t\t.LabelPos=$lpLeft\n\t\t\t\t\t.Left=160\n\t\t\t\t\t.LEStyle=$lsSimple\n\t\t\t\t\t.MaxLen=32768\n\t\t\t\t\t.Multiline=0\n\t\t\t\t\t.Name=\"e_wincaption\"\n\t\t\t\t\t.Password=0\n\t\t\t\t\t.ReadOnly=1\n\t\t\t\t\t.Right=10\n\t\t\t\t\t.ScrollBars=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=1\n\t\t\t\t\t.Tag=33\n\t\t\t\t\t.Text=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Top=287\n\t\t\t\t\t.VertAlign=$alvBottom\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=430\n\n\t\t\t\t\tuint comp\n\t\t\t\t}\n\t\t\t\tcomp as this.e_fileexe\n\t\t\t\tcomp.Owner = this.Panel0\n\t\t\t\twith comp\n\t\t\t\t{\n\t\t\t\t\t.AddColon=1\n\t\t\t\t\t.AutoLang=1\n\t\t\t\t\t.Bottom=8\n\t\t\t\t\t.Btn1Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Btn1Image=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Btn2Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Btn2Image=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Caption=ustmp.fromutf8(\"fileexe\")\n\t\t\t\t\t.Enabled=1\n\t\t\t\t\t.Height=25\n\t\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t\t.HorzAlign=$alhLeftRight\n\t\t\t\t\t.LabelPos=$lpLeft\n\t\t\t\t\t.Left=160\n\t\t\t\t\t.LEStyle=$lsSimple\n\t\t\t\t\t.MaxLen=32768\n\t\t\t\t\t.Multiline=0\n\t\t\t\t\t.Name=\"e_fileexe\"\n\t\t\t\t\t.Password=0\n\t\t\t\t\t.ReadOnly=1\n\t\t\t\t\t.Right=10\n\t\t\t\t\t.ScrollBars=0\n\t\t\t\t\t.Style=\"\"\n\t\t\t\t\t.TabOrder=3\n\t\t\t\t\t.Tag=33\n\t\t\t\t\t.Text=ustmp.fromutf8(\"\")\n\t\t\t\t\t.Top=317\n\t\t\t\t\t.VertAlign=$alvBottom\n\t\t\t\t\t.Visible=1\n\t\t\t\t\t.Width=430\n\n\t\t\t\t\tuint comp\n\t\t\t\t}\n\t\t\t}\n\t\t\tcomp as this.DlgBtns0\n\t\t\tcomp.Owner = this.Splitter0\n\t\t\twith comp\n\t\t\t{\n\t\t\t\t.AutoLang=1\n\t\t\t\t.Border=$brdNone\n\t\t\t\t.Bottom=0\n\t\t\t\t.Caption=ustmp.fromutf8(\"\")\n\t\t\t\t.CurWizard=0\n\t\t\t\t.CustomCaption=ustmp.fromutf8(\"\")\n\t\t\t\t.DisableNext=0\n\t\t\t\t.Enabled=1\n\t\t\t\t.Height=50\n\t\t\t\t.HelpTopic=ustmp.fromutf8(\"\")\n\t\t\t\t.Hint=ustmp.fromutf8(\"\")\n\t\t\t\t.HorzAlign=$alhLeft\n\t\t\t\t.Indent=15\n\t\t\t\t.Left=0\n\t\t\t\t.MaxWizard=0\n\t\t\t\t.Name=\"DlgBtns0\"\n\t\t\t\t.Right=0\n\t\t\t\t.ShowApply=1\n\t\t\t\t.ShowCancel=0\n\t\t\t\t.ShowClose=1\n\t\t\t\t.ShowCustom=0\n\t\t\t\t.ShowDone=$dsdNone\n\t\t\t\t.ShowHelp=1\n\t\t\t\t.ShowLine=1\n\t\t\t\t.Style=\"\"\n\t\t\t\t.TabOrder=1\n\t\t\t\t.Tag=0\n\t\t\t\t.Top=350\n\t\t\t\t.VertAlign=$alvTop\n\t\t\t\t.Visible=1\n\t\t\t\t.Width=600\n\t\t\t\t.Wizard=1\n\n\t\t\t\tuint comp\n\t\t\t}\n\t\t\t.Distance=350\n\t\t}\n\t\t.ClientHeight=400\n\t\t.ClientWidth=600\n\t}\n\n\treturn this\n}\n\nmethod vfHistItem vfHistItem.init( )\n{\n   this.pTypeId = vfHistItem         \n   return this\n}\nfunc init_vfHistItem <entry>()\n{\n   regcomp( vfHistItem, \"vfHistItem\", vForm, $vForm_last,\n      %{ %{$mLoad,     vfHistItem_mLoad}},\n      0->collection )\n      \n}\n", "meta": {"hexsha": "3780924a00e636fd231c0681426cc750319bb369", "size": 4649, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "src/main/histitem.gi", "max_stars_repo_name": "novostrim/macroclip", "max_stars_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-10-24T13:17:43.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-08T06:01:14.000Z", "max_issues_repo_path": "src/main/histitem.gi", "max_issues_repo_name": "novostrim/macroclip", "max_issues_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/histitem.gi", "max_forks_repo_name": "novostrim/macroclip", "max_forks_repo_head_hexsha": "a5ff71b62e17f99930700fdd7335553ae50aebdb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 18.5219123506, "max_line_length": 65, "alphanum_fraction": 0.5921703592, "num_tokens": 1724, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.044680874088941155, "lm_q2_score": 0.008577486522496009, "lm_q1q2_score": 0.0003832495953112339}}
{"text": "#NGSId1\tNGSId2\tSuperScaffoldId\tXmapGapLength\tAdjustedGapLength\tNGSLength1\tNGSLength2\n", "meta": {"hexsha": "04eeffec9333e2a612b0d25c262639fc8b40a42d", "size": 85, "ext": "gap", "lang": "GAP", "max_stars_repo_path": "tools/bionano/test-data/test_04.gap", "max_stars_repo_name": "pavanvidem/galaxytools", "max_stars_repo_head_hexsha": "339363f6c9d817bc2c35997b4dfdd3ca99a37055", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tools/bionano/test-data/test_04.gap", "max_issues_repo_name": "pavanvidem/galaxytools", "max_issues_repo_head_hexsha": "339363f6c9d817bc2c35997b4dfdd3ca99a37055", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tools/bionano/test-data/test_04.gap", "max_forks_repo_name": "pavanvidem/galaxytools", "max_forks_repo_head_hexsha": "339363f6c9d817bc2c35997b4dfdd3ca99a37055", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.5, "max_line_length": 84, "alphanum_fraction": 0.9058823529, "num_tokens": 34, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.03461883585116161, "lm_q2_score": 0.01048908905603042, "lm_q1q2_score": 0.0003631200522589328}}
{"text": ".data\nfirebase.json\nnode_modules\n.DS_Store\n.env\npackage-lock.json\nbuild\n", "meta": {"hexsha": "ed5480a7dd05b8e68ec931c248bfbbbaed1c8952", "size": 72, "ext": "gi", "lang": "GAP", "max_stars_repo_path": "packages/generator-basebot/generators/app/templates/.gi", "max_stars_repo_name": "ans-group/basebot", "max_stars_repo_head_hexsha": "839ea2461e33642997deb3397cf2e545ddc3981f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2019-04-11T08:37:17.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-14T00:52:07.000Z", "max_issues_repo_path": "packages/generator-basebot/generators/app/templates/.gi", "max_issues_repo_name": "ans-group/basebot", "max_issues_repo_head_hexsha": "839ea2461e33642997deb3397cf2e545ddc3981f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 17, "max_issues_repo_issues_event_min_datetime": "2019-11-12T19:55:55.000Z", "max_issues_repo_issues_event_max_datetime": "2020-12-11T11:23:17.000Z", "max_forks_repo_path": "packages/generator-basebot/generators/app/templates/.gi", "max_forks_repo_name": "ans-group/basebot", "max_forks_repo_head_hexsha": "839ea2461e33642997deb3397cf2e545ddc3981f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2020-03-03T15:18:20.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-03T13:42:47.000Z", "avg_line_length": 9.0, "max_line_length": 17, "alphanum_fraction": 0.8194444444, "num_tokens": 20, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.01771229974044725, "lm_q2_score": 0.009859857522027459, "lm_q1q2_score": 0.00017464075182825384}}
{"text": "ok Merge branch 'master' of github.com:INFINITY-RUBER/Machine_Learning_A-Z_Hands-On-Python-R-In-Data-Science\n\n# Por favor ingrese un mensaje de commit que explique por qu\u00e9 es necesaria esta fusi\u00f3n,\n# especialmente si esto fusiona un upstream actualizado en una rama de t\u00f3pico.\n#\n# L\u00edneas comenzando con '#' ser\u00e1n ignoradas, y un mensaje vac\u00edo aborta\n# el commit.\n", "meta": {"hexsha": "3aa2d6a6030e1be25f432312c80f967946f8085d", "size": 363, "ext": "gi", "lang": "GAP", "max_stars_repo_path": ".gi", "max_stars_repo_name": "INFINITY-RUBER/Machine_Learning_A-Z_Hands-On-Python-R-In-Data-Science", "max_stars_repo_head_hexsha": "3c3c0e8079b66d9b9a62fe3ae47b9e4e9fea0fd4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": ".gi", "max_issues_repo_name": "INFINITY-RUBER/Machine_Learning_A-Z_Hands-On-Python-R-In-Data-Science", "max_issues_repo_head_hexsha": "3c3c0e8079b66d9b9a62fe3ae47b9e4e9fea0fd4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": ".gi", "max_forks_repo_name": "INFINITY-RUBER/Machine_Learning_A-Z_Hands-On-Python-R-In-Data-Science", "max_forks_repo_head_hexsha": "3c3c0e8079b66d9b9a62fe3ae47b9e4e9fea0fd4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.375, "max_line_length": 108, "alphanum_fraction": 0.7878787879, "num_tokens": 100, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.019124034514724466, "lm_q2_score": 0.005301895370384844, "lm_q1q2_score": 0.00010139363005669762}}
{"text": "# phpstorm project files\n.idea\n\n# netbeans project files\nnbproject\n\n# zend studio for eclipse project files\n.buildpath\n.project\n.settings\n\n# sublime text project / workspace files\n*.sublime-project\n*.sublime-workspace\n\n# windows thumbnail cache\nThumbs.db\n\n# composer vendor dir\n/vendor\n# cubrid install dir\n/cubrid\n\n# composer itself is not needed\ncomposer.phar\n\n# composer.lock in applications is ignored since it's automatically created by composer when application is installed\n/apps/*/composer.lock\n\n# Mac DS_Store Files\n.DS_Store\n\n# phpunit itself is not needed\nphpunit.phar\n# local phpunit config\n/phpunit.xml\n\n# ignore dev installed apps and extensions\n/apps\n/extensions\n\n# NPM packages\n/node_modules", "meta": {"hexsha": "7f31a7cb2e0754b66ec43810f5220f6b6532825d", "size": 707, "ext": "gi", "lang": "GAP", "max_stars_repo_path": ".gi", "max_stars_repo_name": "natalka76/evaluetion", "max_stars_repo_head_hexsha": "b50a167045dd4161f5ee568ee5cf60a3fe7873f3", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": ".gi", "max_issues_repo_name": "natalka76/evaluetion", "max_issues_repo_head_hexsha": "b50a167045dd4161f5ee568ee5cf60a3fe7873f3", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": ".gi", "max_forks_repo_name": "natalka76/evaluetion", "max_forks_repo_head_hexsha": "b50a167045dd4161f5ee568ee5cf60a3fe7873f3", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.4418604651, "max_line_length": 117, "alphanum_fraction": 0.7864214993, "num_tokens": 164, "lm_name": "Qwen/Qwen-72B", "lm_label": "1. NO\n2. NO", "lm_q1_score": 0.008711382656200792, "lm_q2_score": 0.005139611640440794, "lm_q1q2_score": 4.477312370414363e-05}}
