The length operator “#” returns the length of the table if the response function would have been transformed to a table. Note that the length for response functions in Tri-diagonal, Anderson, or ListOfPoles format is 2, for Natural impurity format the length is 1.
The script
acon = {0, 1, 1, 1, 1, 1, 1} bcon = { sqrt(1/2), 0.5, 0.5, 0.5, 0.5, 0.5} Gcon = ResponseFunction.New( {acon,bcon,mu=0,type="Tri"} ) aval = {0, -1, -1, -1, -1, -1, -1} bval = { sqrt(1/2), 0.5, 0.5, 0.5, 0.5, 0.5} Gval = ResponseFunction.New( {aval,bval,mu=0,type="Tri"} ) a0=0 b0=1 G = ResponseFunction.New( {{a0,b0},val=Gval,con=Gcon,mu=0,type="Nat", name="D"} ) print("The lenght of Gval is ",#Gval,"while it contains the elements acon and bcon") print("The length of G is ",#G,"while it only contains the element {a0,b0}") print("The other elements are not indexed by a consequitive number and thus not included in the counting")
Returns
The lenght of Gval is 2 while it contains the elements acon and bcon The length of G is 1 while it only contains the element {a0,b0} The other elements are not indexed by a consequitive number and thus not included in the counting