chakravala / Dendriform.jl

Dendriform di-algebra algorithms to compute using Loday's arithmetic on groves of planar binary trees
GNU General Public License v3.0
16 stars 5 forks source link

Bug in README Example #3

Closed bhgomes closed 5 years ago

bhgomes commented 5 years ago

Running this snippet from the README

using Dendriform
Grove(2,3) * [1,2,3] ∪ [3,2,1] |> GroveBin

gives:

Extend Grove Degree Level,
 1|Θ 2|Θ
Extend Grove Degree Level,
 3|Θ 4|Θ 5|Θ 6|Θ
ERROR: DimensionMismatch("arrays could not be broadcast to a common size")
Stacktrace:
 [1] _bcs1 at ./broadcast.jl:438 [inlined]
 [2] _bcs at ./broadcast.jl:432 [inlined]
 [3] broadcast_shape at ./broadcast.jl:426 [inlined]
 [4] combine_axes at ./broadcast.jl:421 [inlined]
 [5] instantiate at ./broadcast.jl:255 [inlined]
 [6] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(|),Tuple{BitArray{1},BitArray{1}}}) at ./broadcast.jl:753
 [7] union(::Grove, ::Grove) at /Users/brandongomes/.julia/packages/Dendriform/THQ0v/src/arithmetic.jl:16
 [8] union(::Grove, ::Array{Int64,1}) at /Users/brandongomes/.julia/packages/Dendriform/THQ0v/src/arithmetic.jl:27
 [9] top-level scope at none:0

under this environment:

julia> versioninfo()
Julia Version 1.1.1
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-3540M CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, ivybridge)

(v1.1) pkg> status
    Status `~/.julia/environments/v1.1/Project.toml`
  [c3fe647b] AbstractAlgebra v0.5.0
  [621f4979] AbstractFFTs v0.4.1
  [9e5c662f] AbstractInstances v0.1.0
  [0bf59076] AdvancedHMC v0.1.8
  [c7e460c6] ArgParse v0.6.2
  [65a8f2f4] ArraysOfArrays v0.3.0
  [c52e3926] Atom v0.8.5
  [38eea1fd] AugmentedGaussianProcesses v0.4.2
  [6710c13c] AutoGrad v1.1.4
  [77b51b56] AverageShiftedHistograms v0.8.0
  [fbb218c0] BSON v0.2.3
  [ecbce9bc] BenchmarkProfiles v0.2.0
  [6e4b80f9] BenchmarkTools v0.4.2
  [76274a88] Bijectors v0.3.0
  [ad839575] Blink v0.10.1
  [8e7c35d0] BlockArrays v0.9.1
  [764a87c0] BoundaryValueDiffEq v2.2.3
  [3391f64e] CDDLib v0.5.2
  [aaaa29a8] Clustering v0.13.1
  [593b3428] CmdStan v5.1.0
  [5ae59095] Colors v0.9.5
  [861a8166] Combinatorics v0.7.0
  [ed09eef8] ComputationalResources v0.3.0
  [a6e380b2] ControlSystems v0.5.3
  [150eb455] CoordinateTransformations v0.5.0
  [8a292aeb] Cuba v2.0.0
  [667455a9] Cubature v1.3.1
  [d58978e5] Dagger v0.8.0
  [124859b0] DataDeps v0.6.2
  [a93c6f00] DataFrames v0.18.3
  [864edb3b] DataStructures v0.15.0
  [bcd4f6db] DelayDiffEq v5.4.1
  [d8da5c1c] Dendriform v0.2.1
  [ebbdde9d] DiffEqBayes v1.1.0
  [aae7a2af] DiffEqFlux v0.5.0
  [41bf760c] DiffEqSensitivity v3.2.3
  [ef61062a] DiffEqUncertainty v1.1.0
  [0c46a032] DifferentialEquations v6.4.0
  [22fd7b30] DirectSum v0.2.4
  [b4f34e82] Distances v0.8.0
  [aaf54ef3] DistributedArrays v0.6.2
  [31c24e10] Distributions v0.20.0
  [968ba79b] DocOpt v0.4.0
  [e30172f5] Documenter v0.22.4
  [fa6b7ba4] DualNumbers v0.6.2
  [bbc10e6e] DynamicHMC v1.0.5
  [fdbdab4c] ElasticArrays v0.4.0
  [01fcc997] FTPClient v1.0.1
  [5789e2e9] FileIO v1.0.7
  [8fc22ac5] FilePaths v0.7.0
  [1a297f60] FillArrays v0.6.3
  [587475ba] Flux v0.8.3
  [0e18b5df] FluxJS v0.2.0
  [9dda63f9] ForceImport v0.0.3
  [f6369f11] ForwardDiff v0.10.3
  [c91e804a] Gadfly v1.0.1
  [bc5e4493] GitHub v5.1.1
  [aa1b3936] GraphIO v0.4.0
  [a2cc645c] GraphPlot v0.3.1
  [4df31cd9] Grassmann v0.1.7
  [e54cec92] GroupedErrors v0.2.1
  [19dc6840] HCubature v1.4.0
  [3e1990a7] Hecke v0.6.2
  [6735fb99] Hive v0.3.0
  [50ceba7f] HyperDualNumbers v4.0.0
  [7073ff75] IJulia v1.18.1
  [916415d5] Images v0.17.3
  [6deec6e2] IndexedTables v0.12.1
  [4858937d] InfiniteArrays v0.1.1
  [c601a237] Interact v0.10.2
  [8197267c] IntervalSets v0.3.1
  [d8418881] Intervals v0.5.1
  [4138dd39] JLD v0.9.1
  [033835bb] JLD2 v0.1.2
  [682c06a0] JSON v0.20.0
  [4076af6c] JuMP v0.19.2
  [a93385a2] JuliaDB v0.12.0
  [2c06ca41] JuliaDBMeta v0.4.2
  [e5e0dc1b] Juno v0.7.0
  [5888135b] KeywordDispatch v0.3.0
  [1902f260] Knet v1.2.2
  [23fbe1c1] Latexify v0.8.2
  [50d2b5c4] Lazy v0.13.2
  [5078a376] LazyArrays v0.9.0
  [b4f0291d] LazySets v1.13.0
  [edad4870] Leibniz v0.0.1
  [b27032c2] LibCURL v0.5.1
  [093fc24a] LightGraphs v1.2.0
  [2f5eb75a] LightGraphsFlows v0.3.0
  [6fdf6af0] LogDensityProblems v0.8.2
  [c7f686f2] MCMCChains v0.3.10
  [add582a8] MLJ v0.2.5
  [d491faf4] MLJModels v0.2.5
  [1914dd2f] MacroTools v0.5.0
  [ee78f7c6] Makie v0.9.4
  [5424a776] Mamba v0.12.1
  [b51810bb] MatrixDepot v0.8.0
  [eff96d63] Measurements v2.0.0
  [283c5d60] MeshCat v0.6.0
  [e6723b4c] Meshing v0.4.1
  [626554b9] MetaGraphs v0.6.1
  [dbeba491] Metalhead v0.3.0
  [3ae66bd7] Miletus v1.0.0
  [e1d29d7a] Missings v0.4.1
  [961ee093] ModelingToolkit v0.2.0
  [4fe8b98c] Mongoc v0.3.2
  [0987c9cc] MonteCarloMeasurements v0.3.4
  [39abe10b] MySQL v0.7.0
  [872c559c] NNlib v0.6.0
  [dd2c4c9e] NearestNeighborDescent v0.2.0
  [b8a86587] NearestNeighbors v0.4.3
  [2edaba10] Nemo v0.14.0
  [46757867] NetworkLayout v0.2.0
  [d0dd6a25] ONNX v0.1.1
  [6fe1bfb0] OffsetArrays v0.11.1
  [5fb14364] OhMyREPL v0.5.1
  [a15396b6] OnlineStats v0.23.0
  [429524aa] Optim v0.18.1
  [1dea7af3] OrdinaryDiffEq v5.8.1
  [3b7a836e] PGFPlots v3.1.1
  [8314cec4] PGFPlotsX v1.0.0
  [65888b18] ParameterizedFunctions v4.1.1
  [ccf2f8ad] PlotThemes v0.3.0
  [91a5bcdd] Plots v0.25.2
  [67491407] Polyhedra v0.5.1
  [3a141323] PolynomialRoots v0.2.0
  [c46f51b8] ProfileView v0.4.1
  [92933f4c] ProgressMeter v0.9.0
  [438e738f] PyCall v1.91.2
  [d330b81b] PyPlot v2.8.1
  [a8468747] QHull v0.1.0
  [94ee1d12] Quaternions v0.4.0
  [ce6b1742] RDatasets v0.6.2
  [0d4725de] Readables v0.3.3
  [731186ca] RecursiveArrayTools v0.20.0
  [93e0c654] Reduce v1.1.1
  [bfcbc1eb] ReduceLinAlg v0.1.0
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v0.5.2
  [6038ab10] Rotations v0.11.1
  [0aa819cd] SQLite v0.8.1
  [b3480ff6] ShapesOfVariables v0.2.0
  [1277b4bf] ShiftedArrays v0.5.0
  [55797a34] SimpleGraphs v0.3.0
  [47aef6b3] SimpleWeightedGraphs v1.1.0
  [276daf66] SpecialFunctions v0.7.2
  [90137ffa] StaticArrays v0.11.0
  [4c8beaf5] StaticGraphs v0.1.0
  [2913bbd2] StatsBase v0.30.0
  [4c63d2b9] StatsFuns v0.8.0
  [f3b207a7] StatsPlots v0.11.0
  [789caeaf] StochasticDiffEq v6.5.0
  [09ab397b] StructArrays v0.3.4
  [123dc426] SymEngine v0.5.0
  [24249f21] SymPy v1.0.4
  [a906b1d5] Symata v0.4.5
  [bd369af6] Tables v0.2.6
  [6aa5eb33] TaylorSeries v0.10.0
  [48a634ad] Tensors v1.1.0
  [a759f4b9] TimerOutputs v0.5.0
  [fce5fe82] Turing v0.6.17
  [9d95f2ec] TypedTables v1.2.0
  [dcd9ba68] UncertainData v0.1.8
  [b8865327] UnicodePlots v1.1.0
  [1986cc42] Unitful v0.15.0
  [6fb2a4bd] UnitfulAngles v0.5.0
  [98cad3c8] ValueHistories v0.5.1
  [72f80fcb] VoronoiDelaunay v0.3.1
  [5872b779] Yao v0.5.0
  [e88e6eb3] Zygote v0.3.2
  [8ba89e20] Distributed
  [37e2e46d] LinearAlgebra
chakravala commented 5 years ago

@bhgomes sorry for getting back at you so late, the bug is due to a missing parenthesis

julia> Grove(2,3) * ([1,2,3] ∪ [3,2,1]) |> GroveBin
2981131286847743360614880957207748817969 Y6 #30/132 [54.75%]

the README now includes the necessary parenthesis, thanks for reporting