private DotNode AddBasisBlades(AstFrame frame) { var innerTable = DotUtils.Table() .SetBorder(0); innerTable .AddRow() .AddCells("Grade", "Index", "ID", "Name", "Indexed Name", "Binary Name", "Grade + Index Name"); foreach (var cell in innerTable.FirstRow) { cell .SetBorder(1) .SetSides(DotSides.Top, DotSides.Bottom); } for (var grade = 0; grade <= frame.VSpaceDimension; grade++) { var n = frame.KvSpaceDimension(grade); for (var index = 0; index < n; index++) { var basisBlade = frame.BasisBlade(grade, index); innerTable .AddRow() .AddCells( basisBlade.Grade.ToString(), basisBlade.Index.ToString(), basisBlade.BasisBladeId.ToString(), basisBlade.Name, basisBlade.IndexedName, basisBlade.BinaryIndexedName, basisBlade.GradeIndexName ); } } var table = DotUtils.Table() .SetBorder(0); table.AddRows( DotUtils.Cell().SetContents("Basis Blades".Bold()), DotUtils.Cell().SetContents(innerTable) ); var node = Graph .AddNode("Basis Blades") .SetLabel(table); Graph.AddEdge("Inner Product Matrix", "Basis Blades"); return(node); }
/// <summary> /// Convert this binding pattern into a multivector value /// </summary> /// <param name="basisBladeToVarName"></param> /// <returns></returns> public AstValueMultivector ToValue(Func <AstFrameBasisBlade, string> basisBladeToVarName) { var frameInfo = new AstFrame(BaseFrameMultivector.AssociatedFrameMultivector.ParentFrame); var mv = GaMultivector.CreateZero(BaseFrameMultivector.AssociatedFrameMultivector.ParentFrame.GaSpaceDimension); foreach (var pair in _patternDictionary) { mv[pair.Key] = pair.Value.IsConstant ? pair.Value.ConstantSymbolicScalar : MathematicaScalar.Create( SymbolicUtils.Cas, basisBladeToVarName(frameInfo.BasisBlade(pair.Key)) ); } return (new AstValueMultivector( GMacValueMultivector.Create( BaseFrameMultivector.AssociatedFrameMultivector, mv ) )); }