scikit-complexity 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scikit_complexity-0.2.0.dist-info/METADATA +317 -0
- scikit_complexity-0.2.0.dist-info/RECORD +1748 -0
- scikit_complexity-0.2.0.dist-info/WHEEL +4 -0
- scikit_complexity-0.2.0.dist-info/entry_points.txt +4 -0
- scikit_complexity-0.2.0.dist-info/licenses/LICENSE +21 -0
- skcomplex/__init__.py +1 -0
- skcomplex/analysis/__init__.py +101 -0
- skcomplex/analysis/_alignment.py +263 -0
- skcomplex/analysis/_automata.py +658 -0
- skcomplex/analysis/_base.py +841 -0
- skcomplex/analysis/_clusters.py +298 -0
- skcomplex/analysis/_coarse_grain.py +183 -0
- skcomplex/analysis/_collapse.py +318 -0
- skcomplex/analysis/_complexity.py +129 -0
- skcomplex/analysis/_computational_mechanics.py +220 -0
- skcomplex/analysis/_correlation.py +364 -0
- skcomplex/analysis/_defects.py +111 -0
- skcomplex/analysis/_discovery.py +101 -0
- skcomplex/analysis/_displacement.py +135 -0
- skcomplex/analysis/_distribution.py +327 -0
- skcomplex/analysis/_domains.py +220 -0
- skcomplex/analysis/_embedding.py +235 -0
- skcomplex/analysis/_emergence.py +503 -0
- skcomplex/analysis/_entropy.py +425 -0
- skcomplex/analysis/_ergodicity.py +228 -0
- skcomplex/analysis/_events.py +301 -0
- skcomplex/analysis/_fit.py +368 -0
- skcomplex/analysis/_groups.py +205 -0
- skcomplex/analysis/_information.py +488 -0
- skcomplex/analysis/_invariants.py +409 -0
- skcomplex/analysis/_irreversibility.py +421 -0
- skcomplex/analysis/_kramers_moyal.py +104 -0
- skcomplex/analysis/_large_deviations.py +378 -0
- skcomplex/analysis/_linearization.py +231 -0
- skcomplex/analysis/_local_information.py +166 -0
- skcomplex/analysis/_loops.py +394 -0
- skcomplex/analysis/_lyapunov.py +342 -0
- skcomplex/analysis/_markov.py +303 -0
- skcomplex/analysis/_mode_decomposition.py +209 -0
- skcomplex/analysis/_motifs.py +239 -0
- skcomplex/analysis/_neighbors.py +303 -0
- skcomplex/analysis/_networks.py +286 -0
- skcomplex/analysis/_operator.py +312 -0
- skcomplex/analysis/_partial_information.py +118 -0
- skcomplex/analysis/_passage.py +244 -0
- skcomplex/analysis/_recurrence.py +202 -0
- skcomplex/analysis/_reservoirs.py +387 -0
- skcomplex/analysis/_rolling.py +168 -0
- skcomplex/analysis/_scaling.py +370 -0
- skcomplex/analysis/_sections.py +225 -0
- skcomplex/analysis/_signatures.py +250 -0
- skcomplex/analysis/_sparse_identification.py +398 -0
- skcomplex/analysis/_spectrum.py +164 -0
- skcomplex/analysis/_stability.py +547 -0
- skcomplex/analysis/_surrogates.py +127 -0
- skcomplex/analysis/_symbolic.py +639 -0
- skcomplex/analysis/types.py +43 -0
- skcomplex/base.py +159 -0
- skcomplex/core/__init__.py +1 -0
- skcomplex/core/base.py +150 -0
- skcomplex/core/elements/__init__.py +21 -0
- skcomplex/core/elements/_base.py +84 -0
- skcomplex/core/elements/_compartment.py +52 -0
- skcomplex/core/elements/_density.py +52 -0
- skcomplex/core/elements/_element.py +80 -0
- skcomplex/core/elements/_field.py +192 -0
- skcomplex/core/elements/_group.py +241 -0
- skcomplex/core/elements/_lattice.py +115 -0
- skcomplex/core/elements/_point.py +66 -0
- skcomplex/core/interactions/__init__.py +89 -0
- skcomplex/core/interactions/_advection.py +134 -0
- skcomplex/core/interactions/_base.py +361 -0
- skcomplex/core/interactions/_cascade.py +195 -0
- skcomplex/core/interactions/_choice.py +320 -0
- skcomplex/core/interactions/_conservation.py +164 -0
- skcomplex/core/interactions/_coupling.py +741 -0
- skcomplex/core/interactions/_crossing.py +136 -0
- skcomplex/core/interactions/_diffusion.py +99 -0
- skcomplex/core/interactions/_encounter.py +201 -0
- skcomplex/core/interactions/_euler_lagrange.py +183 -0
- skcomplex/core/interactions/_evolution.py +520 -0
- skcomplex/core/interactions/_feedback.py +79 -0
- skcomplex/core/interactions/_gradient.py +293 -0
- skcomplex/core/interactions/_grouping.py +399 -0
- skcomplex/core/interactions/_hamiltonian.py +191 -0
- skcomplex/core/interactions/_hyperedge.py +96 -0
- skcomplex/core/interactions/_imitation.py +357 -0
- skcomplex/core/interactions/_impulse.py +133 -0
- skcomplex/core/interactions/_interaction.py +58 -0
- skcomplex/core/interactions/_jump.py +201 -0
- skcomplex/core/interactions/_life_cycle.py +424 -0
- skcomplex/core/interactions/_local_rule.py +134 -0
- skcomplex/core/interactions/_map.py +239 -0
- skcomplex/core/interactions/_matching.py +701 -0
- skcomplex/core/interactions/_movement.py +377 -0
- skcomplex/core/interactions/_neighbor.py +88 -0
- skcomplex/core/interactions/_optimization.py +206 -0
- skcomplex/core/interactions/_pair.py +82 -0
- skcomplex/core/interactions/_pair_coupling.py +169 -0
- skcomplex/core/interactions/_rate.py +240 -0
- skcomplex/core/interactions/_reaction.py +466 -0
- skcomplex/core/interactions/_reinforcement.py +226 -0
- skcomplex/core/interactions/_relaxation.py +103 -0
- skcomplex/core/interactions/_sampling.py +177 -0
- skcomplex/core/interactions/_satisfiability.py +145 -0
- skcomplex/core/interactions/_sign_adjustment.py +222 -0
- skcomplex/core/interactions/_topology.py +215 -0
- skcomplex/core/interactions/_training.py +184 -0
- skcomplex/core/interactions/_transfer.py +669 -0
- skcomplex/core/interactions/_transition.py +427 -0
- skcomplex/core/laws/__init__.py +60 -0
- skcomplex/core/laws/_base.py +194 -0
- skcomplex/core/laws/_bilinear.py +91 -0
- skcomplex/core/laws/_boundary.py +59 -0
- skcomplex/core/laws/_cascade.py +79 -0
- skcomplex/core/laws/_crossing.py +87 -0
- skcomplex/core/laws/_dissipator.py +79 -0
- skcomplex/core/laws/_drive.py +56 -0
- skcomplex/core/laws/_emission.py +81 -0
- skcomplex/core/laws/_encounter.py +96 -0
- skcomplex/core/laws/_equation.py +105 -0
- skcomplex/core/laws/_extremal.py +94 -0
- skcomplex/core/laws/_flux.py +108 -0
- skcomplex/core/laws/_fractional_noise.py +65 -0
- skcomplex/core/laws/_generator.py +66 -0
- skcomplex/core/laws/_gradient_step.py +89 -0
- skcomplex/core/laws/_jump.py +137 -0
- skcomplex/core/laws/_local_rule.py +92 -0
- skcomplex/core/laws/_match.py +321 -0
- skcomplex/core/laws/_noise.py +125 -0
- skcomplex/core/laws/_rate.py +82 -0
- skcomplex/core/laws/_rule.py +82 -0
- skcomplex/core/laws/_sample.py +65 -0
- skcomplex/core/laws/_transfer.py +165 -0
- skcomplex/core/laws/_transition.py +77 -0
- skcomplex/core/laws/_update.py +121 -0
- skcomplex/core/laws/utils/__init__.py +142 -0
- skcomplex/core/laws/utils/_agents.py +127 -0
- skcomplex/core/laws/utils/_components.py +63 -0
- skcomplex/core/laws/utils/_conditions.py +198 -0
- skcomplex/core/laws/utils/_contractions.py +74 -0
- skcomplex/core/laws/utils/_delays.py +170 -0
- skcomplex/core/laws/utils/_history.py +167 -0
- skcomplex/core/laws/utils/_local_operators.py +68 -0
- skcomplex/core/laws/utils/_lookups.py +40 -0
- skcomplex/core/laws/utils/_moments.py +122 -0
- skcomplex/core/laws/utils/_operators.py +237 -0
- skcomplex/core/laws/utils/_phase.py +126 -0
- skcomplex/core/laws/utils/_pointwise.py +160 -0
- skcomplex/core/laws/utils/_reductions.py +942 -0
- skcomplex/core/laws/utils/_signals.py +214 -0
- skcomplex/core/laws/utils/_tables.py +4 -0
- skcomplex/core/laws/utils/_tensors.py +235 -0
- skcomplex/core/spaces/__init__.py +52 -0
- skcomplex/core/spaces/_adjacency.py +34 -0
- skcomplex/core/spaces/_base.py +218 -0
- skcomplex/core/spaces/_box.py +41 -0
- skcomplex/core/spaces/_cayley.py +352 -0
- skcomplex/core/spaces/_cone.py +65 -0
- skcomplex/core/spaces/_continuous.py +93 -0
- skcomplex/core/spaces/_continuous_time.py +27 -0
- skcomplex/core/spaces/_discrete_time.py +53 -0
- skcomplex/core/spaces/_generator.py +51 -0
- skcomplex/core/spaces/_lattice.py +194 -0
- skcomplex/core/spaces/_lattice_neighborhood.py +50 -0
- skcomplex/core/spaces/_memory.py +45 -0
- skcomplex/core/spaces/_mesh.py +71 -0
- skcomplex/core/spaces/_moore.py +49 -0
- skcomplex/core/spaces/_nearest.py +41 -0
- skcomplex/core/spaces/_network.py +256 -0
- skcomplex/core/spaces/_phase.py +136 -0
- skcomplex/core/spaces/_radius.py +40 -0
- skcomplex/core/spaces/_static_time.py +34 -0
- skcomplex/core/spaces/_triangular.py +37 -0
- skcomplex/core/spaces/_von_neumann.py +51 -0
- skcomplex/core/specs/__init__.py +25 -0
- skcomplex/core/specs/_census_record_spec.py +72 -0
- skcomplex/core/specs/_census_spec.py +40 -0
- skcomplex/core/specs/_compiled_agents_spec.py +62 -0
- skcomplex/core/specs/_compiled_element_spec.py +59 -0
- skcomplex/core/specs/_compiled_interaction_spec.py +33 -0
- skcomplex/core/specs/_lattice_context_spec.py +40 -0
- skcomplex/core/specs/_lattice_state_spec.py +49 -0
- skcomplex/core/specs/_node_spec.py +64 -0
- skcomplex/core/specs/_operator_view_spec.py +135 -0
- skcomplex/core/specs/_scenario_spec.py +45 -0
- skcomplex/core/specs/_subsystem_spec.py +24 -0
- skcomplex/core/system.py +140 -0
- skcomplex/core/types.py +249 -0
- skcomplex/engine/__init__.py +5 -0
- skcomplex/engine/_utils.py +278 -0
- skcomplex/engine/backends/__init__.py +13 -0
- skcomplex/engine/backends/_base.py +329 -0
- skcomplex/engine/backends/_jax.py +285 -0
- skcomplex/engine/backends/_numba.py +601 -0
- skcomplex/engine/backends/_numba_components.py +67 -0
- skcomplex/engine/backends/_numba_loops.py +163 -0
- skcomplex/engine/backends/_numba_neighbours.py +435 -0
- skcomplex/engine/backends/_numba_printer.py +1023 -0
- skcomplex/engine/backends/_numba_stencils.py +66 -0
- skcomplex/engine/backends/_numpy.py +215 -0
- skcomplex/engine/compile/__init__.py +27 -0
- skcomplex/engine/compile/_base.py +582 -0
- skcomplex/engine/compile/_bound_renewal_spec.py +47 -0
- skcomplex/engine/compile/_compilation.py +351 -0
- skcomplex/engine/compile/_compile.py +100 -0
- skcomplex/engine/compile/_complex.py +216 -0
- skcomplex/engine/compile/_draw_lowering.py +373 -0
- skcomplex/engine/compile/_field_lowering.py +1668 -0
- skcomplex/engine/compile/_flows.py +691 -0
- skcomplex/engine/compile/_forms.py +48 -0
- skcomplex/engine/compile/_laws.py +42 -0
- skcomplex/engine/compile/_learning_compiler.py +481 -0
- skcomplex/engine/compile/_member_reductions.py +206 -0
- skcomplex/engine/compile/_members.py +244 -0
- skcomplex/engine/compile/_observables.py +940 -0
- skcomplex/engine/compile/_observer.py +185 -0
- skcomplex/engine/compile/_pass_compiler.py +1534 -0
- skcomplex/engine/compile/_probe.py +78 -0
- skcomplex/engine/compile/_renewal_law.py +70 -0
- skcomplex/engine/compile/passes/__init__.py +34 -0
- skcomplex/engine/compile/passes/_agents.py +111 -0
- skcomplex/engine/compile/passes/_agents_problem.py +143 -0
- skcomplex/engine/compile/passes/_census.py +808 -0
- skcomplex/engine/compile/passes/_check_fractional_noise.py +107 -0
- skcomplex/engine/compile/passes/_collect.py +31 -0
- skcomplex/engine/compile/passes/_compile_encounters.py +301 -0
- skcomplex/engine/compile/passes/_complex.py +198 -0
- skcomplex/engine/compile/passes/_conserved_noise.py +224 -0
- skcomplex/engine/compile/passes/_core.py +116 -0
- skcomplex/engine/compile/passes/_declare_renewals.py +84 -0
- skcomplex/engine/compile/passes/_draws.py +29 -0
- skcomplex/engine/compile/passes/_encounter_functions.py +60 -0
- skcomplex/engine/compile/passes/_encounter_jacobian.py +25 -0
- skcomplex/engine/compile/passes/_encounter_problem.py +32 -0
- skcomplex/engine/compile/passes/_events.py +204 -0
- skcomplex/engine/compile/passes/_expand_flows.py +32 -0
- skcomplex/engine/compile/passes/_field_functions.py +647 -0
- skcomplex/engine/compile/passes/_field_jacobian.py +38 -0
- skcomplex/engine/compile/passes/_field_problem.py +106 -0
- skcomplex/engine/compile/passes/_flatten.py +339 -0
- skcomplex/engine/compile/passes/_flows_problem.py +29 -0
- skcomplex/engine/compile/passes/_form.py +82 -0
- skcomplex/engine/compile/passes/_fractional_form.py +172 -0
- skcomplex/engine/compile/passes/_fractional_problem.py +91 -0
- skcomplex/engine/compile/passes/_functions.py +485 -0
- skcomplex/engine/compile/passes/_hilbert_space_error.py +10 -0
- skcomplex/engine/compile/passes/_hyperedges.py +598 -0
- skcomplex/engine/compile/passes/_jacobian.py +38 -0
- skcomplex/engine/compile/passes/_kernels.py +407 -0
- skcomplex/engine/compile/passes/_lattices.py +818 -0
- skcomplex/engine/compile/passes/_layout.py +667 -0
- skcomplex/engine/compile/passes/_lower_fields.py +225 -0
- skcomplex/engine/compile/passes/_lower_flows.py +28 -0
- skcomplex/engine/compile/passes/_markov.py +329 -0
- skcomplex/engine/compile/passes/_mask_requests.py +121 -0
- skcomplex/engine/compile/passes/_members.py +30 -0
- skcomplex/engine/compile/passes/_noise.py +196 -0
- skcomplex/engine/compile/passes/_operator_compiler.py +843 -0
- skcomplex/engine/compile/passes/_orders.py +409 -0
- skcomplex/engine/compile/passes/_owners.py +90 -0
- skcomplex/engine/compile/passes/_particles.py +69 -0
- skcomplex/engine/compile/passes/_plan.py +130 -0
- skcomplex/engine/compile/passes/_problem.py +802 -0
- skcomplex/engine/compile/passes/_reduction_lowering.py +1193 -0
- skcomplex/engine/compile/passes/_reductions.py +84 -0
- skcomplex/engine/compile/passes/_renewal_problem.py +357 -0
- skcomplex/engine/compile/passes/_request_jumps.py +51 -0
- skcomplex/engine/compile/passes/_residences.py +140 -0
- skcomplex/engine/compile/passes/_rows.py +162 -0
- skcomplex/engine/compile/passes/_set_renewals_apart.py +29 -0
- skcomplex/engine/compile/passes/_set_rules_apart.py +28 -0
- skcomplex/engine/compile/passes/_specs.py +1317 -0
- skcomplex/engine/compile/passes/_split_requests.py +44 -0
- skcomplex/engine/compile/passes/_topology_functions.py +265 -0
- skcomplex/engine/compile/passes/_topology_problem.py +27 -0
- skcomplex/engine/compile/passes/_towards.py +66 -0
- skcomplex/engine/compile/passes/_unpack_matches.py +29 -0
- skcomplex/engine/compile/passes/_unpack_renewals.py +41 -0
- skcomplex/engine/problems/__init__.py +61 -0
- skcomplex/engine/problems/_base.py +150 -0
- skcomplex/engine/problems/_base_problem_spec.py +153 -0
- skcomplex/engine/problems/_block_spec.py +48 -0
- skcomplex/engine/problems/_born_spec.py +24 -0
- skcomplex/engine/problems/_cascade_kernel.py +134 -0
- skcomplex/engine/problems/_collision_kernel.py +147 -0
- skcomplex/engine/problems/_compiled_delay_spec.py +21 -0
- skcomplex/engine/problems/_compiled_request_spec.py +46 -0
- skcomplex/engine/problems/_control_problem_spec.py +90 -0
- skcomplex/engine/problems/_declarations_spec.py +126 -0
- skcomplex/engine/problems/_delayed_state_spec.py +50 -0
- skcomplex/engine/problems/_diffusive_limit_spec.py +50 -0
- skcomplex/engine/problems/_draw_kernel.py +128 -0
- skcomplex/engine/problems/_drive_kernel.py +65 -0
- skcomplex/engine/problems/_dynamics_spec.py +28 -0
- skcomplex/engine/problems/_edge_row_search.py +78 -0
- skcomplex/engine/problems/_edge_search.py +64 -0
- skcomplex/engine/problems/_encounter_kernel.py +200 -0
- skcomplex/engine/problems/_event_kernel.py +70 -0
- skcomplex/engine/problems/_expression_printer.py +410 -0
- skcomplex/engine/problems/_extremal_kernel.py +125 -0
- skcomplex/engine/problems/_field_operator_kernel.py +105 -0
- skcomplex/engine/problems/_finite_volume_kernel.py +423 -0
- skcomplex/engine/problems/_flow_term_spec.py +45 -0
- skcomplex/engine/problems/_frame_spec.py +105 -0
- skcomplex/engine/problems/_jacobian_kernel.py +575 -0
- skcomplex/engine/problems/_kernel_spec.py +130 -0
- skcomplex/engine/problems/_kinetic_problem_spec.py +23 -0
- skcomplex/engine/problems/_law_kernel.py +604 -0
- skcomplex/engine/problems/_learning_problem_spec.py +67 -0
- skcomplex/engine/problems/_linear_term_spec.py +50 -0
- skcomplex/engine/problems/_loop_term_spec.py +44 -0
- skcomplex/engine/problems/_lowered_kernels_spec.py +59 -0
- skcomplex/engine/problems/_markov_kernel.py +68 -0
- skcomplex/engine/problems/_metric_search.py +155 -0
- skcomplex/engine/problems/_monte_carlo_kernel.py +213 -0
- skcomplex/engine/problems/_neighborhood_kernel.py +594 -0
- skcomplex/engine/problems/_noise_term_spec.py +26 -0
- skcomplex/engine/problems/_observed_spec.py +22 -0
- skcomplex/engine/problems/_operator_kernel.py +102 -0
- skcomplex/engine/problems/_operator_lowering.py +323 -0
- skcomplex/engine/problems/_operator_problem_spec.py +138 -0
- skcomplex/engine/problems/_output_spec.py +78 -0
- skcomplex/engine/problems/_pair_search.py +86 -0
- skcomplex/engine/problems/_partials_spec.py +27 -0
- skcomplex/engine/problems/_partition_spec.py +39 -0
- skcomplex/engine/problems/_printed_spec.py +24 -0
- skcomplex/engine/problems/_problem_functions_spec.py +102 -0
- skcomplex/engine/problems/_problem_spec.py +365 -0
- skcomplex/engine/problems/_random_stream.py +49 -0
- skcomplex/engine/problems/_record_spec.py +22 -0
- skcomplex/engine/problems/_recorded_spec.py +21 -0
- skcomplex/engine/problems/_reduction_kernel.py +254 -0
- skcomplex/engine/problems/_reduction_schedule_spec.py +97 -0
- skcomplex/engine/problems/_reference_spec.py +114 -0
- skcomplex/engine/problems/_relation_spec.py +29 -0
- skcomplex/engine/problems/_renewal_kernel.py +250 -0
- skcomplex/engine/problems/_request_spec.py +27 -0
- skcomplex/engine/problems/_rule_kernel.py +227 -0
- skcomplex/engine/problems/_set_symbol_spec.py +28 -0
- skcomplex/engine/problems/_source_loader.py +113 -0
- skcomplex/engine/problems/_static_search.py +42 -0
- skcomplex/engine/problems/_steps.py +39 -0
- skcomplex/engine/problems/_sweep_spec.py +26 -0
- skcomplex/engine/problems/_symmetry_spec.py +29 -0
- skcomplex/engine/problems/_too_dense.py +8 -0
- skcomplex/engine/problems/_topology_kernel.py +589 -0
- skcomplex/engine/problems/_transfer_network.py +4 -0
- skcomplex/engine/problems/_transfer_network_spec.py +50 -0
- skcomplex/engine/problems/_transfer_state_spec.py +68 -0
- skcomplex/engine/runtime/__init__.py +22 -0
- skcomplex/engine/runtime/_as_fast_as_possible.py +17 -0
- skcomplex/engine/runtime/_base.py +137 -0
- skcomplex/engine/runtime/_conservation.py +125 -0
- skcomplex/engine/runtime/_invariants.py +100 -0
- skcomplex/engine/runtime/_real_time.py +55 -0
- skcomplex/engine/runtime/_recorder.py +84 -0
- skcomplex/engine/runtime/_simulations.py +665 -0
- skcomplex/engine/runtime/_trajectories.py +314 -0
- skcomplex/engine/solvers/__init__.py +95 -0
- skcomplex/engine/solvers/_base.py +372 -0
- skcomplex/engine/solvers/_caputo.py +194 -0
- skcomplex/engine/solvers/_collocation.py +334 -0
- skcomplex/engine/solvers/_convolution.py +155 -0
- skcomplex/engine/solvers/_cosimulation.py +400 -0
- skcomplex/engine/solvers/_crank_nicolson.py +32 -0
- skcomplex/engine/solvers/_defaults.py +34 -0
- skcomplex/engine/solvers/_etdrk4.py +86 -0
- skcomplex/engine/solvers/_euler_maruyama.py +161 -0
- skcomplex/engine/solvers/_event_locator.py +249 -0
- skcomplex/engine/solvers/_external.py +94 -0
- skcomplex/engine/solvers/_fractional_abm.py +126 -0
- skcomplex/engine/solvers/_fractional_euler_maruyama.py +322 -0
- skcomplex/engine/solvers/_gillespie.py +135 -0
- skcomplex/engine/solvers/_gradient_descent.py +353 -0
- skcomplex/engine/solvers/_grunwald_letnikov.py +83 -0
- skcomplex/engine/solvers/_heun.py +89 -0
- skcomplex/engine/solvers/_history.py +184 -0
- skcomplex/engine/solvers/_horizon_error.py +10 -0
- skcomplex/engine/solvers/_imex2.py +40 -0
- skcomplex/engine/solvers/_imex_euler.py +35 -0
- skcomplex/engine/solvers/_jump_trajectories.py +98 -0
- skcomplex/engine/solvers/_kinetics.py +242 -0
- skcomplex/engine/solvers/_l1.py +91 -0
- skcomplex/engine/solvers/_lammps.py +745 -0
- skcomplex/engine/solvers/_lammps_fix_spec.py +41 -0
- skcomplex/engine/solvers/_lattice.py +79 -0
- skcomplex/engine/solvers/_lindblad.py +70 -0
- skcomplex/engine/solvers/_maps.py +105 -0
- skcomplex/engine/solvers/_mesa.py +1624 -0
- skcomplex/engine/solvers/_milstein.py +93 -0
- skcomplex/engine/solvers/_monte_carlo.py +43 -0
- skcomplex/engine/solvers/_operator.py +212 -0
- skcomplex/engine/solvers/_optimal_control.py +368 -0
- skcomplex/engine/solvers/_pontryagin.py +298 -0
- skcomplex/engine/solvers/_renewal.py +90 -0
- skcomplex/engine/solvers/_renewals.py +190 -0
- skcomplex/engine/solvers/_rk4.py +263 -0
- skcomplex/engine/solvers/_root.py +176 -0
- skcomplex/engine/solvers/_rows.py +49 -0
- skcomplex/engine/solvers/_scipy_ode.py +602 -0
- skcomplex/engine/solvers/_sde.py +164 -0
- skcomplex/engine/solvers/_semi_lagrangian.py +213 -0
- skcomplex/engine/solvers/_solver.py +159 -0
- skcomplex/engine/solvers/_split.py +394 -0
- skcomplex/engine/solvers/_ssprk.py +147 -0
- skcomplex/engine/solvers/_strang_splitting.py +178 -0
- skcomplex/engine/solvers/_unitary.py +68 -0
- skcomplex/engine/solvers/_velocity_verlet.py +171 -0
- skcomplex/engine/solvers/_yoshida4.py +242 -0
- skcomplex/engine/types.py +90 -0
- skcomplex/engine/viz/__init__.py +35 -0
- skcomplex/engine/viz/_agents.py +223 -0
- skcomplex/engine/viz/_axes.py +146 -0
- skcomplex/engine/viz/_base.py +365 -0
- skcomplex/engine/viz/_bodies.py +334 -0
- skcomplex/engine/viz/_cayley.py +133 -0
- skcomplex/engine/viz/_expectation.py +208 -0
- skcomplex/engine/viz/_histograms.py +218 -0
- skcomplex/engine/viz/_images.py +307 -0
- skcomplex/engine/viz/_matrices.py +141 -0
- skcomplex/engine/viz/_meshes.py +149 -0
- skcomplex/engine/viz/_points.py +238 -0
- skcomplex/engine/viz/_rerun.py +527 -0
- skcomplex/engine/viz/_rings.py +127 -0
- skcomplex/engine/viz/_scalars.py +129 -0
- skcomplex/engine/viz/_sites.py +228 -0
- skcomplex/errors.py +112 -0
- skcomplex/experiments/__init__.py +36 -0
- skcomplex/experiments/_base.py +373 -0
- skcomplex/experiments/_basin_stability.py +153 -0
- skcomplex/experiments/_calibration.py +194 -0
- skcomplex/experiments/_experiment.py +327 -0
- skcomplex/experiments/_grid.py +36 -0
- skcomplex/experiments/_latin_hypercube.py +44 -0
- skcomplex/experiments/_morris.py +50 -0
- skcomplex/experiments/_one_at_a_time.py +28 -0
- skcomplex/experiments/_orbit_diagram.py +146 -0
- skcomplex/experiments/_random.py +44 -0
- skcomplex/experiments/_results.py +148 -0
- skcomplex/experiments/_rows.py +45 -0
- skcomplex/experiments/_saltelli.py +50 -0
- skcomplex/experiments/_sensitivity.py +122 -0
- skcomplex/experiments/_sobol.py +43 -0
- skcomplex/experiments/specs/__init__.py +1 -0
- skcomplex/experiments/specs/_task_spec.py +78 -0
- skcomplex/experiments/types.py +14 -0
- skcomplex/models/__init__.py +18 -0
- skcomplex/models/_catalog.py +243 -0
- skcomplex/models/_model_catalog.py +270 -0
- skcomplex/models/_model_entry.py +170 -0
- skcomplex/models/_model_listing.py +38 -0
- skcomplex/models/biology/__init__.py +1 -0
- skcomplex/models/biology/collective_behaviour/__init__.py +48 -0
- skcomplex/models/biology/collective_behaviour/_alarm.py +99 -0
- skcomplex/models/biology/collective_behaviour/_ant.py +101 -0
- skcomplex/models/biology/collective_behaviour/_ant_view.py +24 -0
- skcomplex/models/biology/collective_behaviour/_boid.py +104 -0
- skcomplex/models/biology/collective_behaviour/_boid_view.py +25 -0
- skcomplex/models/biology/collective_behaviour/_branch.py +41 -0
- skcomplex/models/biology/collective_behaviour/_decisions.py +149 -0
- skcomplex/models/biology/collective_behaviour/_flight.py +52 -0
- skcomplex/models/biology/collective_behaviour/_flocking.py +75 -0
- skcomplex/models/biology/collective_behaviour/_flocks.py +169 -0
- skcomplex/models/biology/collective_behaviour/_foraging.py +232 -0
- skcomplex/models/biology/collective_behaviour/_ground.py +67 -0
- skcomplex/models/biology/collective_behaviour/_leadership.py +207 -0
- skcomplex/models/biology/collective_behaviour/_morse_potential.py +87 -0
- skcomplex/models/biology/collective_behaviour/_pheromone.py +55 -0
- skcomplex/models/biology/collective_behaviour/_rats.py +41 -0
- skcomplex/models/biology/collective_behaviour/_schooling.py +102 -0
- skcomplex/models/biology/collective_behaviour/_self_propulsion.py +64 -0
- skcomplex/models/biology/collective_behaviour/_shoal_member_view.py +25 -0
- skcomplex/models/biology/collective_behaviour/_swimming.py +66 -0
- skcomplex/models/biology/collective_behaviour/_trail_choice.py +105 -0
- skcomplex/models/biology/collective_behaviour/_trails.py +245 -0
- skcomplex/models/biology/collective_behaviour/_walker.py +97 -0
- skcomplex/models/biology/collective_behaviour/_walker_view.py +23 -0
- skcomplex/models/biology/common/__init__.py +3 -0
- skcomplex/models/biology/common/excitable/__init__.py +7 -0
- skcomplex/models/biology/common/excitable/_fitzhugh_nagumo.py +121 -0
- skcomplex/models/biology/common/kinetics/__init__.py +7 -0
- skcomplex/models/biology/common/kinetics/_michaelis_menten.py +137 -0
- skcomplex/models/biology/common/networks/__init__.py +9 -0
- skcomplex/models/biology/common/networks/_edge_draw.py +95 -0
- skcomplex/models/biology/common/networks/_weighted_edge.py +48 -0
- skcomplex/models/biology/common/pharmacokinetics/__init__.py +7 -0
- skcomplex/models/biology/common/pharmacokinetics/_dosing.py +125 -0
- skcomplex/models/biology/common/populations/__init__.py +19 -0
- skcomplex/models/biology/common/populations/_exponential_growth.py +66 -0
- skcomplex/models/biology/common/populations/_gompertz_growth.py +75 -0
- skcomplex/models/biology/common/populations/_growth.py +176 -0
- skcomplex/models/biology/common/populations/_logistic_growth.py +92 -0
- skcomplex/models/biology/common/populations/_mortality.py +69 -0
- skcomplex/models/biology/common/populations/_population.py +41 -0
- skcomplex/models/biology/common/populations/_power_law_growth.py +71 -0
- skcomplex/models/biology/common/stigmergy/__init__.py +7 -0
- skcomplex/models/biology/common/stigmergy/_evaporation.py +95 -0
- skcomplex/models/biology/ecology/__init__.py +128 -0
- skcomplex/models/biology/ecology/_abundance.py +52 -0
- skcomplex/models/biology/ecology/_agent_predation.py +170 -0
- skcomplex/models/biology/ecology/_cell_quota.py +163 -0
- skcomplex/models/biology/ecology/_clustering.py +96 -0
- skcomplex/models/biology/ecology/_communities.py +234 -0
- skcomplex/models/biology/ecology/_competition.py +95 -0
- skcomplex/models/biology/ecology/_cow.py +49 -0
- skcomplex/models/biology/ecology/_cow_view.py +15 -0
- skcomplex/models/biology/ecology/_emotion_marks.py +65 -0
- skcomplex/models/biology/ecology/_factories.py +322 -0
- skcomplex/models/biology/ecology/_forager.py +116 -0
- skcomplex/models/biology/ecology/_forager_view.py +25 -0
- skcomplex/models/biology/ecology/_fronts.py +128 -0
- skcomplex/models/biology/ecology/_generalized_lotka_volterra.py +66 -0
- skcomplex/models/biology/ecology/_grass.py +96 -0
- skcomplex/models/biology/ecology/_grass_view.py +17 -0
- skcomplex/models/biology/ecology/_grazing.py +66 -0
- skcomplex/models/biology/ecology/_habitat_patch.py +49 -0
- skcomplex/models/biology/ecology/_herding.py +84 -0
- skcomplex/models/biology/ecology/_higher_order.py +102 -0
- skcomplex/models/biology/ecology/_hopping.py +68 -0
- skcomplex/models/biology/ecology/_instability.py +180 -0
- skcomplex/models/biology/ecology/_linear_growth.py +70 -0
- skcomplex/models/biology/ecology/_meadow.py +102 -0
- skcomplex/models/biology/ecology/_microbe.py +47 -0
- skcomplex/models/biology/ecology/_microbial_communities.py +90 -0
- skcomplex/models/biology/ecology/_mutualism.py +81 -0
- skcomplex/models/biology/ecology/_neutral.py +144 -0
- skcomplex/models/biology/ecology/_neutral_replacement.py +54 -0
- skcomplex/models/biology/ecology/_organism.py +63 -0
- skcomplex/models/biology/ecology/_organism_view.py +15 -0
- skcomplex/models/biology/ecology/_parasitism.py +78 -0
- skcomplex/models/biology/ecology/_pasture.py +83 -0
- skcomplex/models/biology/ecology/_pasture_view.py +16 -0
- skcomplex/models/biology/ecology/_pioneer_growth.py +101 -0
- skcomplex/models/biology/ecology/_plant.py +56 -0
- skcomplex/models/biology/ecology/_plant_view.py +16 -0
- skcomplex/models/biology/ecology/_predation.py +290 -0
- skcomplex/models/biology/ecology/_predation_interaction.py +71 -0
- skcomplex/models/biology/ecology/_predator.py +63 -0
- skcomplex/models/biology/ecology/_predator_prey_events.py +120 -0
- skcomplex/models/biology/ecology/_predator_view.py +17 -0
- skcomplex/models/biology/ecology/_prey.py +52 -0
- skcomplex/models/biology/ecology/_prey_view.py +15 -0
- skcomplex/models/biology/ecology/_rosenzweig_macarthur.py +91 -0
- skcomplex/models/biology/ecology/_seasonal_logistic_growth.py +71 -0
- skcomplex/models/biology/ecology/_sequential.py +114 -0
- skcomplex/models/biology/ecology/_sheep.py +63 -0
- skcomplex/models/biology/ecology/_sheep_view.py +17 -0
- skcomplex/models/biology/ecology/_speciation.py +71 -0
- skcomplex/models/biology/ecology/_stand.py +47 -0
- skcomplex/models/biology/ecology/_stigmergic_predator.py +98 -0
- skcomplex/models/biology/ecology/_stigmergic_prey.py +54 -0
- skcomplex/models/biology/ecology/_stigmergy.py +413 -0
- skcomplex/models/biology/ecology/_succession.py +92 -0
- skcomplex/models/biology/ecology/_successional_growth.py +88 -0
- skcomplex/models/biology/ecology/_triplet.py +55 -0
- skcomplex/models/biology/ecology/_wolf.py +63 -0
- skcomplex/models/biology/ecology/_wolf_sheep.py +156 -0
- skcomplex/models/biology/ecology/_wolf_view.py +17 -0
- skcomplex/models/biology/epidemiology/__init__.py +53 -0
- skcomplex/models/biology/epidemiology/_active_host.py +61 -0
- skcomplex/models/biology/epidemiology/_adaptive.py +316 -0
- skcomplex/models/biology/epidemiology/_agents.py +484 -0
- skcomplex/models/biology/epidemiology/_carrier.py +66 -0
- skcomplex/models/biology/epidemiology/_degree_class.py +65 -0
- skcomplex/models/biology/epidemiology/_factories.py +186 -0
- skcomplex/models/biology/epidemiology/_host.py +49 -0
- skcomplex/models/biology/epidemiology/_immunity_loss.py +84 -0
- skcomplex/models/biology/epidemiology/_infection.py +93 -0
- skcomplex/models/biology/epidemiology/_networks.py +170 -0
- skcomplex/models/biology/epidemiology/_outbreaks.py +216 -0
- skcomplex/models/biology/epidemiology/_person.py +103 -0
- skcomplex/models/biology/epidemiology/_person_view.py +23 -0
- skcomplex/models/biology/epidemiology/_recovery.py +92 -0
- skcomplex/models/biology/epidemiology/_recurrent.py +149 -0
- skcomplex/models/biology/epidemiology/_spreading.py +144 -0
- skcomplex/models/biology/epidemiology/_subpopulation.py +92 -0
- skcomplex/models/biology/epidemiology/_traveller.py +65 -0
- skcomplex/models/biology/epidemiology/_traveller_view.py +17 -0
- skcomplex/models/biology/epidemiology/_vaccination.py +184 -0
- skcomplex/models/biology/epidemiology/_walker.py +66 -0
- skcomplex/models/biology/epidemiology/_walker_view.py +17 -0
- skcomplex/models/biology/evolution/__init__.py +60 -0
- skcomplex/models/biology/evolution/_adaptive_climbing.py +106 -0
- skcomplex/models/biology/evolution/_catalysis.py +76 -0
- skcomplex/models/biology/evolution/_catalytic_link.py +21 -0
- skcomplex/models/biology/evolution/_chemical.py +111 -0
- skcomplex/models/biology/evolution/_climber.py +125 -0
- skcomplex/models/biology/evolution/_climber_view.py +19 -0
- skcomplex/models/biology/evolution/_coevolution.py +148 -0
- skcomplex/models/biology/evolution/_cyclic_species.py +44 -0
- skcomplex/models/biology/evolution/_dependency_field.py +56 -0
- skcomplex/models/biology/evolution/_finite_populations.py +287 -0
- skcomplex/models/biology/evolution/_games.py +143 -0
- skcomplex/models/biology/evolution/_genotype_class.py +42 -0
- skcomplex/models/biology/evolution/_individual.py +54 -0
- skcomplex/models/biology/evolution/_individual_view.py +16 -0
- skcomplex/models/biology/evolution/_locus.py +47 -0
- skcomplex/models/biology/evolution/_master_sequence.py +55 -0
- skcomplex/models/biology/evolution/_molecule.py +47 -0
- skcomplex/models/biology/evolution/_moran_step.py +83 -0
- skcomplex/models/biology/evolution/_networks.py +194 -0
- skcomplex/models/biology/evolution/_prebiotic.py +169 -0
- skcomplex/models/biology/evolution/_replicator.py +109 -0
- skcomplex/models/biology/evolution/_strategy.py +42 -0
- skcomplex/models/biology/evolution/_substitution.py +113 -0
- skcomplex/models/biology/evolution/_substitutions.py +126 -0
- skcomplex/models/biology/evolution/_tangled_nature_life_cycle.py +159 -0
- skcomplex/models/biology/evolution/_taxon.py +49 -0
- skcomplex/models/biology/neuroscience/__init__.py +63 -0
- skcomplex/models/biology/neuroscience/_conductances.py +193 -0
- skcomplex/models/biology/neuroscience/_delayed_synapse.py +70 -0
- skcomplex/models/biology/neuroscience/_excitable.py +178 -0
- skcomplex/models/biology/neuroscience/_fitz_hugh_nagumo_neuron.py +46 -0
- skcomplex/models/biology/neuroscience/_global_inhibition.py +71 -0
- skcomplex/models/biology/neuroscience/_hodgkin_huxley.py +103 -0
- skcomplex/models/biology/neuroscience/_inhibitor.py +62 -0
- skcomplex/models/biology/neuroscience/_inhibitor_drive.py +61 -0
- skcomplex/models/biology/neuroscience/_izhikevich.py +77 -0
- skcomplex/models/biology/neuroscience/_leaky_integrate_and_fire.py +80 -0
- skcomplex/models/biology/neuroscience/_mutual_inhibition.py +55 -0
- skcomplex/models/biology/neuroscience/_networks.py +235 -0
- skcomplex/models/biology/neuroscience/_neural_field_site.py +66 -0
- skcomplex/models/biology/neuroscience/_neural_fields.py +94 -0
- skcomplex/models/biology/neuroscience/_neurons.py +129 -0
- skcomplex/models/biology/neuroscience/_polyhomeostatic_neuron.py +93 -0
- skcomplex/models/biology/neuroscience/_populations.py +333 -0
- skcomplex/models/biology/neuroscience/_pulse_coupling.py +71 -0
- skcomplex/models/biology/neuroscience/_rate_unit.py +67 -0
- skcomplex/models/biology/neuroscience/_spike_reset.py +95 -0
- skcomplex/models/biology/neuroscience/_spiking_neuron.py +67 -0
- skcomplex/models/biology/neuroscience/_synapses.py +226 -0
- skcomplex/models/biology/neuroscience/_terman_wang.py +113 -0
- skcomplex/models/biology/neuroscience/_theta_neuron.py +66 -0
- skcomplex/models/biology/neuroscience/_wilson_cowan.py +122 -0
- skcomplex/models/biology/neuroscience/types.py +8 -0
- skcomplex/models/biology/oncology/__init__.py +212 -0
- skcomplex/models/biology/oncology/_androgen_receptor_prostate.py +240 -0
- skcomplex/models/biology/oncology/_androgen_suppression.py +109 -0
- skcomplex/models/biology/oncology/_angiogenesis.py +306 -0
- skcomplex/models/biology/oncology/_angiogenesis_immunotherapy_tumour.py +247 -0
- skcomplex/models/biology/oncology/_angiogenic_tumour.py +110 -0
- skcomplex/models/biology/oncology/_antiangiogenic.py +227 -0
- skcomplex/models/biology/oncology/_bone_marrow_blood.py +196 -0
- skcomplex/models/biology/oncology/_cell_cycle.py +85 -0
- skcomplex/models/biology/oncology/_cell_kinetics.py +285 -0
- skcomplex/models/biology/oncology/_cell_quota_prostate.py +207 -0
- skcomplex/models/biology/oncology/_cell_survival.py +72 -0
- skcomplex/models/biology/oncology/_checkpoint_tumour.py +161 -0
- skcomplex/models/biology/oncology/_chemoimmunotherapy_tumour.py +251 -0
- skcomplex/models/biology/oncology/_chemotherapy.py +565 -0
- skcomplex/models/biology/oncology/_chemovirotherapy_tumour.py +139 -0
- skcomplex/models/biology/oncology/_clonal_tumour.py +134 -0
- skcomplex/models/biology/oncology/_combination_therapy.py +989 -0
- skcomplex/models/biology/oncology/_delayed_vaccinated_tumour.py +341 -0
- skcomplex/models/biology/oncology/_dormant_cell_cycle.py +95 -0
- skcomplex/models/biology/oncology/_erythropoiesis.py +129 -0
- skcomplex/models/biology/oncology/_exponential_linear_growth.py +66 -0
- skcomplex/models/biology/oncology/_gene_viral_therapy.py +480 -0
- skcomplex/models/biology/oncology/_glioma_brain.py +165 -0
- skcomplex/models/biology/oncology/_growth.py +378 -0
- skcomplex/models/biology/oncology/_her2_tumour.py +156 -0
- skcomplex/models/biology/oncology/_hormone_therapy.py +985 -0
- skcomplex/models/biology/oncology/_immune_competition.py +241 -0
- skcomplex/models/biology/oncology/_immunotherapy.py +1001 -0
- skcomplex/models/biology/oncology/_intermittent_suppression.py +130 -0
- skcomplex/models/biology/oncology/_irradiated_tumour.py +105 -0
- skcomplex/models/biology/oncology/_irradiation.py +97 -0
- skcomplex/models/biology/oncology/_kirschner_panetta_tumour.py +132 -0
- skcomplex/models/biology/oncology/_leukaemia_stem_cells.py +150 -0
- skcomplex/models/biology/oncology/_linear_quadratic_survival.py +112 -0
- skcomplex/models/biology/oncology/_log_kill.py +81 -0
- skcomplex/models/biology/oncology/_metastasis_chemotherapy.py +211 -0
- skcomplex/models/biology/oncology/_multidrug_resistance.py +201 -0
- skcomplex/models/biology/oncology/_oncolytic_virus.py +68 -0
- skcomplex/models/biology/oncology/_oncolytic_virus_dendritic.py +155 -0
- skcomplex/models/biology/oncology/_optimal_chemotherapy.py +157 -0
- skcomplex/models/biology/oncology/_optimal_immunotherapy.py +137 -0
- skcomplex/models/biology/oncology/_optimal_therapy.py +208 -0
- skcomplex/models/biology/oncology/_piecewise_linear_prostate.py +147 -0
- skcomplex/models/biology/oncology/_radiation_competition.py +104 -0
- skcomplex/models/biology/oncology/_radiotherapy.py +311 -0
- skcomplex/models/biology/oncology/_resistance_switching.py +148 -0
- skcomplex/models/biology/oncology/_resting_hunting_chemotherapy.py +136 -0
- skcomplex/models/biology/oncology/_sirna_tgf_beta.py +189 -0
- skcomplex/models/biology/oncology/_sprout.py +65 -0
- skcomplex/models/biology/oncology/_sprout_view.py +17 -0
- skcomplex/models/biology/oncology/_stem_cell_differentiation.py +262 -0
- skcomplex/models/biology/oncology/_stem_cells.py +548 -0
- skcomplex/models/biology/oncology/_suppressed_tumour.py +338 -0
- skcomplex/models/biology/oncology/_tamoxifen_tumour.py +172 -0
- skcomplex/models/biology/oncology/_tcr_gene_therapy.py +98 -0
- skcomplex/models/biology/oncology/_therapy_switch.py +86 -0
- skcomplex/models/biology/oncology/_tissue.py +71 -0
- skcomplex/models/biology/oncology/_tumour_cell.py +85 -0
- skcomplex/models/biology/oncology/_tumour_cell_view.py +21 -0
- skcomplex/models/biology/oncology/_tumour_immune_chemotherapy.py +169 -0
- skcomplex/models/biology/oncology/_vaccinated_tumour.py +180 -0
- skcomplex/models/biology/oncology/_vascular_support.py +71 -0
- skcomplex/models/biology/oncology/_vascularized_spheroid.py +264 -0
- skcomplex/models/biology/oncology/_vasculature.py +42 -0
- skcomplex/models/biology/oncology/_vessel.py +49 -0
- skcomplex/models/biology/oncology/_vessel_view.py +15 -0
- skcomplex/models/biology/physiology/__init__.py +46 -0
- skcomplex/models/biology/physiology/_adaptivity.py +277 -0
- skcomplex/models/biology/physiology/_cardiac.py +167 -0
- skcomplex/models/biology/physiology/_chamber.py +71 -0
- skcomplex/models/biology/physiology/_circulation.py +97 -0
- skcomplex/models/biology/physiology/_coagulation.py +130 -0
- skcomplex/models/biology/physiology/_contour_cell.py +61 -0
- skcomplex/models/biology/physiology/_contour_uptake.py +61 -0
- skcomplex/models/biology/physiology/_exchange.py +165 -0
- skcomplex/models/biology/physiology/_exchanging_cell.py +83 -0
- skcomplex/models/biology/physiology/_fitz_hugh_nagumo.py +46 -0
- skcomplex/models/biology/physiology/_glucose_control.py +136 -0
- skcomplex/models/biology/physiology/_mackey_glass.py +81 -0
- skcomplex/models/biology/physiology/_pharmacokinetics.py +104 -0
- skcomplex/models/biology/physiology/_physiology.py +118 -0
- skcomplex/models/biology/physiology/_regulation.py +251 -0
- skcomplex/models/biology/physiology/_resistive_flow.py +67 -0
- skcomplex/models/biology/physiology/_toxicity.py +164 -0
- skcomplex/models/biology/systems_biology/__init__.py +52 -0
- skcomplex/models/biology/systems_biology/_boolean.py +141 -0
- skcomplex/models/biology/systems_biology/_boolean_function.py +84 -0
- skcomplex/models/biology/systems_biology/_boolean_models.py +206 -0
- skcomplex/models/biology/systems_biology/_boolean_node.py +41 -0
- skcomplex/models/biology/systems_biology/_cascades.py +178 -0
- skcomplex/models/biology/systems_biology/_clocks.py +274 -0
- skcomplex/models/biology/systems_biology/_generalized_mass_action.py +123 -0
- skcomplex/models/biology/systems_biology/_genes.py +296 -0
- skcomplex/models/biology/systems_biology/_min_proteins.py +230 -0
- skcomplex/models/biology/systems_biology/_networks.py +359 -0
- skcomplex/models/biology/systems_biology/_phosphorylation_loop.py +121 -0
- skcomplex/models/biology/systems_biology/_probabilistic.py +75 -0
- skcomplex/models/biology/systems_biology/_probabilistic_function.py +127 -0
- skcomplex/models/biology/systems_biology/_probabilistic_node.py +47 -0
- skcomplex/models/biology/systems_biology/_repression.py +104 -0
- skcomplex/models/biology/systems_biology/_s_system.py +88 -0
- skcomplex/models/biology/systems_biology/_species.py +44 -0
- skcomplex/models/biology/systems_biology/_threshold_function.py +63 -0
- skcomplex/models/biology/systems_biology/types.py +9 -0
- skcomplex/models/chemistry/__init__.py +1 -0
- skcomplex/models/chemistry/common/__init__.py +3 -0
- skcomplex/models/chemistry/common/kinetics/__init__.py +9 -0
- skcomplex/models/chemistry/common/kinetics/_brusselator.py +61 -0
- skcomplex/models/chemistry/common/kinetics/_cubic_autocatalysis.py +80 -0
- skcomplex/models/chemistry/kinetics/__init__.py +38 -0
- skcomplex/models/chemistry/kinetics/_catalyst_pellet.py +60 -0
- skcomplex/models/chemistry/kinetics/_cubic_autocatalysis.py +60 -0
- skcomplex/models/chemistry/kinetics/_cyclic.py +130 -0
- skcomplex/models/chemistry/kinetics/_hodgepodge.py +157 -0
- skcomplex/models/chemistry/kinetics/_nanoparticles.py +103 -0
- skcomplex/models/chemistry/kinetics/_oregonator.py +76 -0
- skcomplex/models/chemistry/kinetics/_oscillators.py +244 -0
- skcomplex/models/chemistry/kinetics/_pulsed_electrode.py +107 -0
- skcomplex/models/chemistry/kinetics/_reactions.py +332 -0
- skcomplex/models/chemistry/kinetics/_reactors.py +144 -0
- skcomplex/models/chemistry/pattern_formation/__init__.py +15 -0
- skcomplex/models/chemistry/pattern_formation/_brusselator.py +62 -0
- skcomplex/models/chemistry/pattern_formation/_gray_scott.py +68 -0
- skcomplex/models/chemistry/pattern_formation/_reaction_diffusion.py +268 -0
- skcomplex/models/chemistry/pattern_formation/_schnakenberg.py +67 -0
- skcomplex/models/computer_science/__init__.py +1 -0
- skcomplex/models/computer_science/automata/__init__.py +56 -0
- skcomplex/models/computer_science/automata/_automata.py +229 -0
- skcomplex/models/computer_science/automata/_automaton.py +202 -0
- skcomplex/models/computer_science/automata/_binary_cell.py +41 -0
- skcomplex/models/computer_science/automata/_codes.py +73 -0
- skcomplex/models/computer_science/automata/_diffusion_cell.py +47 -0
- skcomplex/models/computer_science/automata/_group_automata.py +449 -0
- skcomplex/models/computer_science/automata/_groups.py +132 -0
- skcomplex/models/computer_science/automata/_linear_automaton.py +128 -0
- skcomplex/models/computer_science/automata/_noisy_elementary_cell.py +46 -0
- skcomplex/models/computer_science/automata/_pascal_cell.py +41 -0
- skcomplex/models/computer_science/automata/_subshift.py +192 -0
- skcomplex/models/computer_science/automata/_variants.py +292 -0
- skcomplex/models/computer_science/evolutionary_computation/__init__.py +27 -0
- skcomplex/models/computer_science/evolutionary_computation/_annealed_candidate.py +39 -0
- skcomplex/models/computer_science/evolutionary_computation/_bit_string.py +55 -0
- skcomplex/models/computer_science/evolutionary_computation/_bit_string_view.py +13 -0
- skcomplex/models/computer_science/evolutionary_computation/_genetic_algorithms.py +92 -0
- skcomplex/models/computer_science/evolutionary_computation/_landscapes.py +82 -0
- skcomplex/models/computer_science/evolutionary_computation/_optimisers.py +217 -0
- skcomplex/models/computer_science/evolutionary_computation/_reproduction.py +129 -0
- skcomplex/models/computer_science/evolutionary_computation/_room_cleaning.py +170 -0
- skcomplex/models/computer_science/evolutionary_computation/_running_best.py +30 -0
- skcomplex/models/computer_science/evolutionary_computation/_running_best_update.py +58 -0
- skcomplex/models/computer_science/evolutionary_computation/_search_candidate.py +32 -0
- skcomplex/models/computer_science/evolutionary_computation/_strategy.py +54 -0
- skcomplex/models/computer_science/evolutionary_computation/_strategy_view.py +14 -0
- skcomplex/models/computer_science/neural_networks/__init__.py +34 -0
- skcomplex/models/computer_science/neural_networks/_binary_weight.py +32 -0
- skcomplex/models/computer_science/neural_networks/_diluted.py +159 -0
- skcomplex/models/computer_science/neural_networks/_echo_state.py +173 -0
- skcomplex/models/computer_science/neural_networks/_elman.py +160 -0
- skcomplex/models/computer_science/neural_networks/_hidden_unit.py +51 -0
- skcomplex/models/computer_science/neural_networks/_hopfield.py +134 -0
- skcomplex/models/computer_science/neural_networks/_hopfield_update.py +51 -0
- skcomplex/models/computer_science/neural_networks/_input_coupling.py +63 -0
- skcomplex/models/computer_science/neural_networks/_input_unit.py +39 -0
- skcomplex/models/computer_science/neural_networks/_neuron_view.py +14 -0
- skcomplex/models/computer_science/neural_networks/_output_unit.py +51 -0
- skcomplex/models/computer_science/neural_networks/_perceptron.py +72 -0
- skcomplex/models/computer_science/neural_networks/_readout_coupling.py +69 -0
- skcomplex/models/computer_science/neural_networks/_recurrence_coupling.py +66 -0
- skcomplex/models/economics/__init__.py +1 -0
- skcomplex/models/economics/common/__init__.py +3 -0
- skcomplex/models/economics/common/forecasting/__init__.py +7 -0
- skcomplex/models/economics/common/forecasting/_heuristics.py +51 -0
- skcomplex/models/economics/common/resources/__init__.py +7 -0
- skcomplex/models/economics/common/resources/_regrowth.py +70 -0
- skcomplex/models/economics/econophysics/__init__.py +58 -0
- skcomplex/models/economics/econophysics/_crowd_avoidance.py +80 -0
- skcomplex/models/economics/econophysics/_debt_exchange.py +74 -0
- skcomplex/models/economics/econophysics/_diner.py +59 -0
- skcomplex/models/economics/econophysics/_diner_view.py +17 -0
- skcomplex/models/economics/econophysics/_el_farol.py +114 -0
- skcomplex/models/economics/econophysics/_exchange.py +82 -0
- skcomplex/models/economics/econophysics/_game_state_spec.py +26 -0
- skcomplex/models/economics/econophysics/_kinetic.py +80 -0
- skcomplex/models/economics/econophysics/_kolkata.py +87 -0
- skcomplex/models/economics/econophysics/_minority.py +123 -0
- skcomplex/models/economics/econophysics/_minority_game.py +161 -0
- skcomplex/models/economics/econophysics/_minority_player.py +79 -0
- skcomplex/models/economics/econophysics/_minority_player_view.py +22 -0
- skcomplex/models/economics/econophysics/_patron.py +105 -0
- skcomplex/models/economics/econophysics/_patron_view.py +18 -0
- skcomplex/models/economics/econophysics/_predictor_pool.py +181 -0
- skcomplex/models/economics/econophysics/_predictor_pool_view.py +14 -0
- skcomplex/models/economics/econophysics/_restaurants.py +93 -0
- skcomplex/models/economics/econophysics/_saving_exchange.py +73 -0
- skcomplex/models/economics/econophysics/_saving_trader.py +47 -0
- skcomplex/models/economics/econophysics/_saving_trader_view.py +12 -0
- skcomplex/models/economics/econophysics/_wealth_exchange.py +114 -0
- skcomplex/models/economics/econophysics/_welfare.py +210 -0
- skcomplex/models/economics/econophysics/_welfare_policy.py +99 -0
- skcomplex/models/economics/finance/__init__.py +41 -0
- skcomplex/models/economics/finance/_arbitrage.py +139 -0
- skcomplex/models/economics/finance/_asset.py +42 -0
- skcomplex/models/economics/finance/_assets.py +44 -0
- skcomplex/models/economics/finance/_book.py +115 -0
- skcomplex/models/economics/finance/_contagion.py +116 -0
- skcomplex/models/economics/finance/_correlated_assets.py +69 -0
- skcomplex/models/economics/finance/_debt_rank_cascade.py +86 -0
- skcomplex/models/economics/finance/_geometric_brownian_motion.py +89 -0
- skcomplex/models/economics/finance/_gibrat_firm.py +82 -0
- skcomplex/models/economics/finance/_gibrat_firm_view.py +18 -0
- skcomplex/models/economics/finance/_growth_processes.py +195 -0
- skcomplex/models/economics/finance/_interbank.py +76 -0
- skcomplex/models/economics/finance/_interbank_view.py +14 -0
- skcomplex/models/economics/finance/_kesten_firm.py +88 -0
- skcomplex/models/economics/finance/_kesten_firm_view.py +16 -0
- skcomplex/models/economics/finance/_order_book.py +164 -0
- skcomplex/models/economics/finance/_reflecting_floor.py +66 -0
- skcomplex/models/economics/finance/_stock_trader.py +205 -0
- skcomplex/models/economics/finance/_stock_trader_view.py +24 -0
- skcomplex/models/economics/finance/_wealth.py +143 -0
- skcomplex/models/economics/innovation/__init__.py +23 -0
- skcomplex/models/economics/innovation/_adoption.py +233 -0
- skcomplex/models/economics/innovation/_bass.py +124 -0
- skcomplex/models/economics/innovation/_diversity.py +104 -0
- skcomplex/models/economics/innovation/_household_view.py +20 -0
- skcomplex/models/economics/innovation/_invention.py +140 -0
- skcomplex/models/economics/innovation/_part.py +64 -0
- skcomplex/models/economics/innovation/_part_view.py +12 -0
- skcomplex/models/economics/innovation/_redesign.py +88 -0
- skcomplex/models/economics/innovation/_technology.py +203 -0
- skcomplex/models/economics/innovation/_technology_view.py +14 -0
- skcomplex/models/economics/macroeconomics/__init__.py +70 -0
- skcomplex/models/economics/macroeconomics/_banking.py +148 -0
- skcomplex/models/economics/macroeconomics/_business.py +221 -0
- skcomplex/models/economics/macroeconomics/_business_view.py +24 -0
- skcomplex/models/economics/macroeconomics/_capital.py +122 -0
- skcomplex/models/economics/macroeconomics/_central_bank.py +80 -0
- skcomplex/models/economics/macroeconomics/_central_bank_view.py +13 -0
- skcomplex/models/economics/macroeconomics/_circuit.py +93 -0
- skcomplex/models/economics/macroeconomics/_commons.py +77 -0
- skcomplex/models/economics/macroeconomics/_credit.py +219 -0
- skcomplex/models/economics/macroeconomics/_credit_market.py +83 -0
- skcomplex/models/economics/macroeconomics/_depositor.py +114 -0
- skcomplex/models/economics/macroeconomics/_depositor_view.py +19 -0
- skcomplex/models/economics/macroeconomics/_economy.py +42 -0
- skcomplex/models/economics/macroeconomics/_estate.py +88 -0
- skcomplex/models/economics/macroeconomics/_firm.py +184 -0
- skcomplex/models/economics/macroeconomics/_firm_view.py +27 -0
- skcomplex/models/economics/macroeconomics/_firms.py +208 -0
- skcomplex/models/economics/macroeconomics/_firms_element.py +67 -0
- skcomplex/models/economics/macroeconomics/_food_market.py +84 -0
- skcomplex/models/economics/macroeconomics/_growth.py +109 -0
- skcomplex/models/economics/macroeconomics/_households.py +52 -0
- skcomplex/models/economics/macroeconomics/_income.py +59 -0
- skcomplex/models/economics/macroeconomics/_investing_firm_view.py +21 -0
- skcomplex/models/economics/macroeconomics/_labour_market.py +73 -0
- skcomplex/models/economics/macroeconomics/_lender.py +160 -0
- skcomplex/models/economics/macroeconomics/_lender_view.py +18 -0
- skcomplex/models/economics/macroeconomics/_metaphoria.py +257 -0
- skcomplex/models/economics/macroeconomics/_monetary.py +140 -0
- skcomplex/models/economics/macroeconomics/_monetary_bank.py +57 -0
- skcomplex/models/economics/macroeconomics/_optimal_growth.py +173 -0
- skcomplex/models/economics/macroeconomics/_people_spec.py +26 -0
- skcomplex/models/economics/macroeconomics/_plot.py +69 -0
- skcomplex/models/economics/macroeconomics/_plot_view.py +15 -0
- skcomplex/models/economics/macroeconomics/_policy_switch.py +78 -0
- skcomplex/models/economics/macroeconomics/_reserve_bank.py +118 -0
- skcomplex/models/economics/macroeconomics/_reserve_bank_view.py +14 -0
- skcomplex/models/economics/macroeconomics/_settler.py +291 -0
- skcomplex/models/economics/macroeconomics/_settler_view.py +56 -0
- skcomplex/models/economics/macroeconomics/_solow_growth.py +70 -0
- skcomplex/models/economics/macroeconomics/_trade.py +289 -0
- skcomplex/models/economics/markets/__init__.py +128 -0
- skcomplex/models/economics/markets/_auction_ledger.py +81 -0
- skcomplex/models/economics/markets/_barter.py +232 -0
- skcomplex/models/economics/markets/_barter_networks.py +169 -0
- skcomplex/models/economics/markets/_barter_trader.py +136 -0
- skcomplex/models/economics/markets/_barter_trader_view.py +16 -0
- skcomplex/models/economics/markets/_bilateral_barter.py +150 -0
- skcomplex/models/economics/markets/_brewery.py +67 -0
- skcomplex/models/economics/markets/_brock_hommes.py +115 -0
- skcomplex/models/economics/markets/_car.py +75 -0
- skcomplex/models/economics/markets/_car_view.py +14 -0
- skcomplex/models/economics/markets/_car_wash_operation.py +141 -0
- skcomplex/models/economics/markets/_cobweb.py +109 -0
- skcomplex/models/economics/markets/_commodities.py +286 -0
- skcomplex/models/economics/markets/_consumer_view.py +22 -0
- skcomplex/models/economics/markets/_cournot_adjustment.py +65 -0
- skcomplex/models/economics/markets/_cournot_best_response.py +88 -0
- skcomplex/models/economics/markets/_customer.py +147 -0
- skcomplex/models/economics/markets/_customer_view.py +16 -0
- skcomplex/models/economics/markets/_double_auction.py +141 -0
- skcomplex/models/economics/markets/_duopolist.py +54 -0
- skcomplex/models/economics/markets/_duopolist_view.py +13 -0
- skcomplex/models/economics/markets/_duopoly.py +85 -0
- skcomplex/models/economics/markets/_echelon.py +132 -0
- skcomplex/models/economics/markets/_employer.py +102 -0
- skcomplex/models/economics/markets/_employer_view.py +20 -0
- skcomplex/models/economics/markets/_exchange.py +171 -0
- skcomplex/models/economics/markets/_exchange_interaction.py +134 -0
- skcomplex/models/economics/markets/_factory.py +105 -0
- skcomplex/models/economics/markets/_fair_food.py +205 -0
- skcomplex/models/economics/markets/_forager.py +64 -0
- skcomplex/models/economics/markets/_forager_view.py +14 -0
- skcomplex/models/economics/markets/_goods_trader.py +68 -0
- skcomplex/models/economics/markets/_goods_traders.py +139 -0
- skcomplex/models/economics/markets/_heuristic_pricing.py +122 -0
- skcomplex/models/economics/markets/_heuristic_trader.py +108 -0
- skcomplex/models/economics/markets/_heuristic_trader_view.py +14 -0
- skcomplex/models/economics/markets/_inventory.py +212 -0
- skcomplex/models/economics/markets/_jobseeker.py +144 -0
- skcomplex/models/economics/markets/_jobseeker_view.py +26 -0
- skcomplex/models/economics/markets/_labour.py +188 -0
- skcomplex/models/economics/markets/_market.py +39 -0
- skcomplex/models/economics/markets/_market_state_spec.py +25 -0
- skcomplex/models/economics/markets/_oligopoly.py +167 -0
- skcomplex/models/economics/markets/_patch_map_spec.py +22 -0
- skcomplex/models/economics/markets/_perishables.py +150 -0
- skcomplex/models/economics/markets/_price_point.py +95 -0
- skcomplex/models/economics/markets/_prices.py +151 -0
- skcomplex/models/economics/markets/_pricing_firm.py +48 -0
- skcomplex/models/economics/markets/_pricing_firm_view.py +14 -0
- skcomplex/models/economics/markets/_pricing_game_spec.py +81 -0
- skcomplex/models/economics/markets/_produce.py +94 -0
- skcomplex/models/economics/markets/_product.py +97 -0
- skcomplex/models/economics/markets/_product_view.py +13 -0
- skcomplex/models/economics/markets/_queues.py +101 -0
- skcomplex/models/economics/markets/_resident.py +119 -0
- skcomplex/models/economics/markets/_resident_view.py +20 -0
- skcomplex/models/economics/markets/_retail_demand.py +52 -0
- skcomplex/models/economics/markets/_retailer.py +115 -0
- skcomplex/models/economics/markets/_shopper.py +115 -0
- skcomplex/models/economics/markets/_shopper_view.py +15 -0
- skcomplex/models/economics/markets/_shops.py +199 -0
- skcomplex/models/economics/markets/_stall.py +74 -0
- skcomplex/models/economics/markets/_stall_view.py +14 -0
- skcomplex/models/economics/markets/_store.py +171 -0
- skcomplex/models/economics/markets/_store_view.py +27 -0
- skcomplex/models/economics/markets/_sugar_patch.py +61 -0
- skcomplex/models/economics/markets/_sugar_patch_view.py +14 -0
- skcomplex/models/economics/markets/_sugarscape.py +250 -0
- skcomplex/models/economics/markets/_supply_chains.py +217 -0
- skcomplex/models/economics/markets/_supply_link.py +74 -0
- skcomplex/models/economics/markets/_till.py +79 -0
- skcomplex/models/economics/markets/_till_view.py +15 -0
- skcomplex/models/economics/markets/_washer.py +78 -0
- skcomplex/models/economics/markets/_zero_intelligence_buyer.py +99 -0
- skcomplex/models/economics/markets/_zero_intelligence_buyer_view.py +20 -0
- skcomplex/models/economics/markets/_zero_intelligence_seller.py +100 -0
- skcomplex/models/economics/markets/_zero_intelligence_seller_view.py +20 -0
- skcomplex/models/economics/resources/__init__.py +50 -0
- skcomplex/models/economics/resources/_bid_rent.py +104 -0
- skcomplex/models/economics/resources/_commons.py +218 -0
- skcomplex/models/economics/resources/_cow.py +69 -0
- skcomplex/models/economics/resources/_cow_view.py +13 -0
- skcomplex/models/economics/resources/_extraction.py +230 -0
- skcomplex/models/economics/resources/_farmer.py +93 -0
- skcomplex/models/economics/resources/_farmer_view.py +12 -0
- skcomplex/models/economics/resources/_fisheries.py +384 -0
- skcomplex/models/economics/resources/_fishery.py +91 -0
- skcomplex/models/economics/resources/_food.py +370 -0
- skcomplex/models/economics/resources/_grazing.py +148 -0
- skcomplex/models/economics/resources/_harvest.py +69 -0
- skcomplex/models/economics/resources/_harvesting.py +51 -0
- skcomplex/models/economics/resources/_herder.py +78 -0
- skcomplex/models/economics/resources/_herder_view.py +19 -0
- skcomplex/models/economics/resources/_land_cell.py +39 -0
- skcomplex/models/economics/resources/_land_use.py +73 -0
- skcomplex/models/economics/resources/_oil_economy.py +85 -0
- skcomplex/models/economics/resources/_optimal_harvesting.py +180 -0
- skcomplex/models/economics/resources/_pasture.py +98 -0
- skcomplex/models/economics/resources/_pasture_view.py +15 -0
- skcomplex/models/economics/resources/_plantations.py +359 -0
- skcomplex/models/economics/resources/_quota_regulator.py +84 -0
- skcomplex/models/economics/resources/_stock.py +67 -0
- skcomplex/models/engineering/__init__.py +1 -0
- skcomplex/models/engineering/circuits/__init__.py +23 -0
- skcomplex/models/engineering/circuits/_chua_circuit.py +48 -0
- skcomplex/models/engineering/circuits/_circuit.py +47 -0
- skcomplex/models/engineering/circuits/_circuits.py +387 -0
- skcomplex/models/engineering/circuits/_harvesters.py +150 -0
- skcomplex/models/engineering/circuits/_kicked_circuit.py +43 -0
- skcomplex/models/engineering/circuits/_memristor_circuit.py +48 -0
- skcomplex/models/engineering/circuits/_mixed_mode_chua_circuit.py +54 -0
- skcomplex/models/engineering/circuits/_multiscroll_chua_circuit.py +58 -0
- skcomplex/models/engineering/circuits/_tunnel_diode_circuit.py +45 -0
- skcomplex/models/engineering/common/__init__.py +6 -0
- skcomplex/models/engineering/common/mechanics/__init__.py +7 -0
- skcomplex/models/engineering/common/mechanics/_spring_damper.py +121 -0
- skcomplex/models/engineering/control/__init__.py +23 -0
- skcomplex/models/engineering/control/_cart_pendulum.py +119 -0
- skcomplex/models/engineering/control/_control.py +266 -0
- skcomplex/models/engineering/control/_controlled_process.py +72 -0
- skcomplex/models/engineering/control/_driven_oscillator.py +79 -0
- skcomplex/models/engineering/control/_integrator.py +39 -0
- skcomplex/models/engineering/control/_pid.py +106 -0
- skcomplex/models/engineering/control/_regulation.py +170 -0
- skcomplex/models/engineering/control/_room.py +51 -0
- skcomplex/models/engineering/control/_satellite.py +56 -0
- skcomplex/models/engineering/control/_state_feedback.py +82 -0
- skcomplex/models/engineering/control/_swinging_pendulum.py +60 -0
- skcomplex/models/engineering/power_systems/__init__.py +11 -0
- skcomplex/models/engineering/power_systems/_electromechanics.py +224 -0
- skcomplex/models/engineering/power_systems/_faraday_disk.py +93 -0
- skcomplex/models/engineering/power_systems/_grid_node.py +39 -0
- skcomplex/models/engineering/power_systems/_grids.py +89 -0
- skcomplex/models/engineering/power_systems/_rail_segment.py +80 -0
- skcomplex/models/engineering/power_systems/_regenerative_car.py +55 -0
- skcomplex/models/engineering/power_systems/_transmission_line.py +48 -0
- skcomplex/models/engineering/processes/__init__.py +13 -0
- skcomplex/models/engineering/processes/_irrigation_scheme.py +112 -0
- skcomplex/models/engineering/processes/_processes.py +115 -0
- skcomplex/models/engineering/processes/_relief_pipeline.py +79 -0
- skcomplex/models/engineering/processes/_rice_mill.py +112 -0
- skcomplex/models/engineering/processes/_stage.py +34 -0
- skcomplex/models/engineering/processes/_systems.py +316 -0
- skcomplex/models/engineering/processes/_tub.py +42 -0
- skcomplex/models/engineering/processes/_waste_system.py +101 -0
- skcomplex/models/engineering/robotics/__init__.py +12 -0
- skcomplex/models/engineering/robotics/_light_sensitive_robot.py +125 -0
- skcomplex/models/engineering/robotics/_robots.py +177 -0
- skcomplex/models/engineering/robotics/_swarm_robot.py +211 -0
- skcomplex/models/engineering/robotics/_swarm_robot_view.py +23 -0
- skcomplex/models/engineering/traffic/__init__.py +43 -0
- skcomplex/models/engineering/traffic/_arrival.py +117 -0
- skcomplex/models/engineering/traffic/_cab.py +170 -0
- skcomplex/models/engineering/traffic/_cab_view.py +21 -0
- skcomplex/models/engineering/traffic/_car.py +31 -0
- skcomplex/models/engineering/traffic/_car_following.py +245 -0
- skcomplex/models/engineering/traffic/_careless_braking.py +87 -0
- skcomplex/models/engineering/traffic/_continuum.py +429 -0
- skcomplex/models/engineering/traffic/_delayed_following.py +65 -0
- skcomplex/models/engineering/traffic/_driver.py +140 -0
- skcomplex/models/engineering/traffic/_driver_view.py +18 -0
- skcomplex/models/engineering/traffic/_drivers.py +133 -0
- skcomplex/models/engineering/traffic/_gas_kinetic_traffic.py +96 -0
- skcomplex/models/engineering/traffic/_intelligent_driver.py +90 -0
- skcomplex/models/engineering/traffic/_kerner_konhauser.py +42 -0
- skcomplex/models/engineering/traffic/_langevin.py +170 -0
- skcomplex/models/engineering/traffic/_langevin_driving.py +95 -0
- skcomplex/models/engineering/traffic/_lead_car.py +40 -0
- skcomplex/models/engineering/traffic/_lighthill_whitham_richards.py +30 -0
- skcomplex/models/engineering/traffic/_motorist.py +118 -0
- skcomplex/models/engineering/traffic/_motorist_view.py +18 -0
- skcomplex/models/engineering/traffic/_optimal_velocity.py +72 -0
- skcomplex/models/engineering/traffic/_payne.py +38 -0
- skcomplex/models/engineering/traffic/_rider.py +72 -0
- skcomplex/models/engineering/traffic/_rider_view.py +16 -0
- skcomplex/models/engineering/traffic/_ridesharing.py +179 -0
- skcomplex/models/engineering/traffic/_traffic.py +143 -0
- skcomplex/models/engineering/traffic/_traffic_moments.py +57 -0
- skcomplex/models/mathematics/__init__.py +1 -0
- skcomplex/models/mathematics/common/__init__.py +3 -0
- skcomplex/models/mathematics/common/flows/__init__.py +7 -0
- skcomplex/models/mathematics/common/flows/_lorenz.py +90 -0
- skcomplex/models/mathematics/dynamical_systems/__init__.py +90 -0
- skcomplex/models/mathematics/dynamical_systems/_baker_map.py +59 -0
- skcomplex/models/mathematics/dynamical_systems/_blow_up.py +64 -0
- skcomplex/models/mathematics/dynamical_systems/_cat_map.py +44 -0
- skcomplex/models/mathematics/dynamical_systems/_chaotic_ensembles.py +186 -0
- skcomplex/models/mathematics/dynamical_systems/_circle_map.py +49 -0
- skcomplex/models/mathematics/dynamical_systems/_cubic_walk.py +72 -0
- skcomplex/models/mathematics/dynamical_systems/_cusp.py +64 -0
- skcomplex/models/mathematics/dynamical_systems/_doubling_map.py +65 -0
- skcomplex/models/mathematics/dynamical_systems/_driven_flows.py +158 -0
- skcomplex/models/mathematics/dynamical_systems/_flows.py +179 -0
- skcomplex/models/mathematics/dynamical_systems/_henon_map.py +54 -0
- skcomplex/models/mathematics/dynamical_systems/_hopf.py +77 -0
- skcomplex/models/mathematics/dynamical_systems/_intermittency_map.py +44 -0
- skcomplex/models/mathematics/dynamical_systems/_jerk.py +72 -0
- skcomplex/models/mathematics/dynamical_systems/_koopman.py +118 -0
- skcomplex/models/mathematics/dynamical_systems/_logistic_map.py +44 -0
- skcomplex/models/mathematics/dynamical_systems/_maps.py +465 -0
- skcomplex/models/mathematics/dynamical_systems/_newton_map.py +44 -0
- skcomplex/models/mathematics/dynamical_systems/_normal_forms.py +154 -0
- skcomplex/models/mathematics/dynamical_systems/_rossler.py +83 -0
- skcomplex/models/mathematics/dynamical_systems/_saddle_node.py +59 -0
- skcomplex/models/mathematics/dynamical_systems/_skew_tent_map.py +63 -0
- skcomplex/models/mathematics/dynamical_systems/_standard_map.py +52 -0
- skcomplex/models/mathematics/dynamical_systems/_subcritical_forms.py +160 -0
- skcomplex/models/mathematics/dynamical_systems/_takens_bogdanov.py +74 -0
- skcomplex/models/mathematics/dynamical_systems/_tent_map.py +44 -0
- skcomplex/models/mathematics/dynamical_systems/_towel_map.py +59 -0
- skcomplex/models/mathematics/fractals/__init__.py +61 -0
- skcomplex/models/mathematics/fractals/_affine_spec.py +100 -0
- skcomplex/models/mathematics/fractals/_cantor_element.py +92 -0
- skcomplex/models/mathematics/fractals/_chaos_game.py +140 -0
- skcomplex/models/mathematics/fractals/_geometry_spec.py +84 -0
- skcomplex/models/mathematics/fractals/_geometry_visual.py +190 -0
- skcomplex/models/mathematics/fractals/_group_spec.py +24 -0
- skcomplex/models/mathematics/fractals/_koch_element.py +43 -0
- skcomplex/models/mathematics/fractals/_module_spec.py +47 -0
- skcomplex/models/mathematics/fractals/_patch_element.py +89 -0
- skcomplex/models/mathematics/fractals/_patch_kernel.py +200 -0
- skcomplex/models/mathematics/fractals/_patch_structure_spec.py +108 -0
- skcomplex/models/mathematics/fractals/_production_law.py +105 -0
- skcomplex/models/mathematics/fractals/_prototile_spec.py +53 -0
- skcomplex/models/mathematics/fractals/_quadratic.py +191 -0
- skcomplex/models/mathematics/fractals/_random_affine_map.py +100 -0
- skcomplex/models/mathematics/fractals/_rewriting_compiler.py +300 -0
- skcomplex/models/mathematics/fractals/_rewriting_error.py +10 -0
- skcomplex/models/mathematics/fractals/_rewriting_loops.py +180 -0
- skcomplex/models/mathematics/fractals/_rewriting_problem_spec.py +30 -0
- skcomplex/models/mathematics/fractals/_rewriting_solver.py +125 -0
- skcomplex/models/mathematics/fractals/_sierpinski_element.py +110 -0
- skcomplex/models/mathematics/fractals/_substitution.py +130 -0
- skcomplex/models/mathematics/fractals/_substitution_law.py +76 -0
- skcomplex/models/mathematics/fractals/_successor_spec.py +23 -0
- skcomplex/models/mathematics/fractals/_word_element.py +94 -0
- skcomplex/models/mathematics/fractals/_word_kernel.py +526 -0
- skcomplex/models/mathematics/fractals/_word_structure_spec.py +110 -0
- skcomplex/models/mathematics/fractals/_words.py +38 -0
- skcomplex/models/mathematics/fractals/types.py +12 -0
- skcomplex/models/mathematics/fractional_dynamics/__init__.py +29 -0
- skcomplex/models/mathematics/fractional_dynamics/_fractional.py +338 -0
- skcomplex/models/mathematics/fractional_dynamics/_oscillator.py +71 -0
- skcomplex/models/mathematics/fractional_dynamics/_relaxation.py +59 -0
- skcomplex/models/mathematics/fractional_dynamics/_van_der_pol.py +66 -0
- skcomplex/models/mathematics/networks/__init__.py +61 -0
- skcomplex/models/mathematics/networks/_copying_vertex.py +50 -0
- skcomplex/models/mathematics/networks/_ensemble_node.py +48 -0
- skcomplex/models/mathematics/networks/_ensembles.py +195 -0
- skcomplex/models/mathematics/networks/_failing.py +58 -0
- skcomplex/models/mathematics/networks/_giant_component.py +52 -0
- skcomplex/models/mathematics/networks/_growth.py +223 -0
- skcomplex/models/mathematics/networks/_hypergraphs.py +131 -0
- skcomplex/models/mathematics/networks/_link.py +21 -0
- skcomplex/models/mathematics/networks/_network_measures.py +59 -0
- skcomplex/models/mathematics/networks/_network_node.py +86 -0
- skcomplex/models/mathematics/networks/_network_walker.py +49 -0
- skcomplex/models/mathematics/networks/_network_walker_view.py +12 -0
- skcomplex/models/mathematics/networks/_node_content.py +47 -0
- skcomplex/models/mathematics/networks/_node_rank.py +57 -0
- skcomplex/models/mathematics/networks/_processes.py +148 -0
- skcomplex/models/mathematics/networks/_regulated_link.py +47 -0
- skcomplex/models/mathematics/networks/_regulated_node.py +43 -0
- skcomplex/models/mathematics/networks/_simplex.py +46 -0
- skcomplex/models/mathematics/networks/_simplex_ageing.py +46 -0
- skcomplex/models/mathematics/networks/_size_biased_move.py +44 -0
- skcomplex/models/mathematics/networks/_structure.py +170 -0
- skcomplex/models/mathematics/networks/_triad_vertex.py +64 -0
- skcomplex/models/mathematics/networks/_triadic.py +114 -0
- skcomplex/models/mathematics/networks/_triadic_regulation.py +65 -0
- skcomplex/models/mathematics/networks/_vertex.py +52 -0
- skcomplex/models/mathematics/networks/_walker_density.py +51 -0
- skcomplex/models/mathematics/stochastic_processes/__init__.py +62 -0
- skcomplex/models/mathematics/stochastic_processes/_ageing_walker.py +68 -0
- skcomplex/models/mathematics/stochastic_processes/_ageing_walker_view.py +15 -0
- skcomplex/models/mathematics/stochastic_processes/_bernoulli_trial.py +61 -0
- skcomplex/models/mathematics/stochastic_processes/_bernoulli_trial_view.py +14 -0
- skcomplex/models/mathematics/stochastic_processes/_branching.py +103 -0
- skcomplex/models/mathematics/stochastic_processes/_counting.py +88 -0
- skcomplex/models/mathematics/stochastic_processes/_fragment.py +91 -0
- skcomplex/models/mathematics/stochastic_processes/_fragment_view.py +13 -0
- skcomplex/models/mathematics/stochastic_processes/_hidden_markov_source.py +46 -0
- skcomplex/models/mathematics/stochastic_processes/_individual_view.py +13 -0
- skcomplex/models/mathematics/stochastic_processes/_intermittency.py +115 -0
- skcomplex/models/mathematics/stochastic_processes/_markov_source.py +41 -0
- skcomplex/models/mathematics/stochastic_processes/_memory_walker.py +57 -0
- skcomplex/models/mathematics/stochastic_processes/_persistent_walker.py +52 -0
- skcomplex/models/mathematics/stochastic_processes/_poisson_counter.py +47 -0
- skcomplex/models/mathematics/stochastic_processes/_queues.py +117 -0
- skcomplex/models/mathematics/stochastic_processes/_random_walker.py +52 -0
- skcomplex/models/mathematics/stochastic_processes/_reducing.py +104 -0
- skcomplex/models/mathematics/stochastic_processes/_reducing_ball.py +63 -0
- skcomplex/models/mathematics/stochastic_processes/_reducing_ball_view.py +14 -0
- skcomplex/models/mathematics/stochastic_processes/_reducing_jump.py +44 -0
- skcomplex/models/mathematics/stochastic_processes/_sources.py +90 -0
- skcomplex/models/mathematics/stochastic_processes/_urns.py +112 -0
- skcomplex/models/mathematics/stochastic_processes/_walks.py +280 -0
- skcomplex/models/mathematics/stochastic_processes/_weakening_particle.py +57 -0
- skcomplex/models/mathematics/stochastic_processes/types.py +8 -0
- skcomplex/models/physics/__init__.py +1 -0
- skcomplex/models/physics/active_matter/__init__.py +95 -0
- skcomplex/models/physics/active_matter/_active_particle.py +88 -0
- skcomplex/models/physics/active_matter/_alignment.py +192 -0
- skcomplex/models/physics/active_matter/_angular_alignment.py +98 -0
- skcomplex/models/physics/active_matter/_angular_diffusion.py +67 -0
- skcomplex/models/physics/active_matter/_binary_collisions.py +126 -0
- skcomplex/models/physics/active_matter/_chemotaxis.py +173 -0
- skcomplex/models/physics/active_matter/_cohesive_particle.py +132 -0
- skcomplex/models/physics/active_matter/_collective.py +327 -0
- skcomplex/models/physics/active_matter/_collisions.py +127 -0
- skcomplex/models/physics/active_matter/_contractile_gel_site.py +81 -0
- skcomplex/models/physics/active_matter/_cucker_smale_alignment.py +89 -0
- skcomplex/models/physics/active_matter/_depot_particle.py +103 -0
- skcomplex/models/physics/active_matter/_flocker.py +46 -0
- skcomplex/models/physics/active_matter/_flocker_view.py +20 -0
- skcomplex/models/physics/active_matter/_flocks.py +258 -0
- skcomplex/models/physics/active_matter/_gels.py +141 -0
- skcomplex/models/physics/active_matter/_heading_alignment.py +73 -0
- skcomplex/models/physics/active_matter/_kinetic_flocks.py +111 -0
- skcomplex/models/physics/active_matter/_landau_de_gennes_energy.py +107 -0
- skcomplex/models/physics/active_matter/_model_b.py +170 -0
- skcomplex/models/physics/active_matter/_nematic_density_site.py +78 -0
- skcomplex/models/physics/active_matter/_nematic_gel_site.py +115 -0
- skcomplex/models/physics/active_matter/_nematic_particle.py +61 -0
- skcomplex/models/physics/active_matter/_nematics.py +323 -0
- skcomplex/models/physics/active_matter/_nonreciprocal.py +214 -0
- skcomplex/models/physics/active_matter/_ornstein_uhlenbeck_particle.py +87 -0
- skcomplex/models/physics/active_matter/_particles.py +323 -0
- skcomplex/models/physics/active_matter/_phoretic_attraction.py +80 -0
- skcomplex/models/physics/active_matter/_polar_fluid.py +119 -0
- skcomplex/models/physics/active_matter/_polar_gel_site.py +120 -0
- skcomplex/models/physics/active_matter/_propulsion_step.py +64 -0
- skcomplex/models/physics/active_matter/_self_propulsion.py +73 -0
- skcomplex/models/physics/active_matter/_tumbler.py +100 -0
- skcomplex/models/physics/active_matter/_tumbler_view.py +23 -0
- skcomplex/models/physics/active_matter/_vicsek_particle.py +61 -0
- skcomplex/models/physics/celestial_mechanics/__init__.py +19 -0
- skcomplex/models/physics/celestial_mechanics/_dipoles.py +160 -0
- skcomplex/models/physics/celestial_mechanics/_kepler_body.py +76 -0
- skcomplex/models/physics/celestial_mechanics/_orbits.py +332 -0
- skcomplex/models/physics/celestial_mechanics/_rotating_frame_body.py +72 -0
- skcomplex/models/physics/celestial_mechanics/_sitnikov_body.py +54 -0
- skcomplex/models/physics/celestial_mechanics/types.py +6 -0
- skcomplex/models/physics/climate/__init__.py +60 -0
- skcomplex/models/physics/climate/_carbon_cycle.py +169 -0
- skcomplex/models/physics/climate/_climate_anomaly.py +55 -0
- skcomplex/models/physics/climate/_daisyworld.py +158 -0
- skcomplex/models/physics/climate/_delayed_oscillator.py +68 -0
- skcomplex/models/physics/climate/_early_warning.py +102 -0
- skcomplex/models/physics/climate/_energy_balance.py +207 -0
- skcomplex/models/physics/climate/_geodynamo.py +86 -0
- skcomplex/models/physics/climate/_ice_ages.py +179 -0
- skcomplex/models/physics/climate/_ice_albedo_climate.py +100 -0
- skcomplex/models/physics/climate/_latitude_band.py +156 -0
- skcomplex/models/physics/climate/_lorenz84.py +91 -0
- skcomplex/models/physics/climate/_lorenz96.py +67 -0
- skcomplex/models/physics/climate/_low_order.py +162 -0
- skcomplex/models/physics/climate/_net_energy.py +210 -0
- skcomplex/models/physics/climate/_ramped_fold.py +92 -0
- skcomplex/models/physics/climate/_saltzman_maasch.py +123 -0
- skcomplex/models/physics/climate/_soil.py +116 -0
- skcomplex/models/physics/climate/_stochastic_energy_balance.py +124 -0
- skcomplex/models/physics/climate/_tipping.py +141 -0
- skcomplex/models/physics/climate/_tipping_types.py +159 -0
- skcomplex/models/physics/climate/_van_der_pol_ice_ages.py +101 -0
- skcomplex/models/physics/climate/_variability.py +103 -0
- skcomplex/models/physics/common/__init__.py +6 -0
- skcomplex/models/physics/common/fields/__init__.py +14 -0
- skcomplex/models/physics/common/fields/_landau_energy.py +76 -0
- skcomplex/models/physics/common/fields/_phase_field.py +43 -0
- skcomplex/models/physics/common/fields/_swift_hohenberg_energy.py +74 -0
- skcomplex/models/physics/common/fields/_transports.py +119 -0
- skcomplex/models/physics/common/mechanics/__init__.py +5 -0
- skcomplex/models/physics/common/mechanics/_reflection.py +139 -0
- skcomplex/models/physics/common/oscillators/__init__.py +13 -0
- skcomplex/models/physics/common/oscillators/_kuramoto_coupling.py +140 -0
- skcomplex/models/physics/common/oscillators/_phase_oscillator.py +68 -0
- skcomplex/models/physics/common/oscillators/_sited_oscillator.py +55 -0
- skcomplex/models/physics/common/oscillators/_stuart_landau.py +106 -0
- skcomplex/models/physics/common/particles/__init__.py +28 -0
- skcomplex/models/physics/common/particles/_constant_force.py +65 -0
- skcomplex/models/physics/common/particles/_damping.py +72 -0
- skcomplex/models/physics/common/particles/_gravity.py +74 -0
- skcomplex/models/physics/common/particles/_harmonic_potential.py +77 -0
- skcomplex/models/physics/common/particles/_lammps.py +47 -0
- skcomplex/models/physics/common/particles/_langevin_thermostat.py +103 -0
- skcomplex/models/physics/common/particles/_lennard_jones.py +87 -0
- skcomplex/models/physics/common/particles/_mass_point.py +57 -0
- skcomplex/models/physics/common/particles/_potential_energy.py +56 -0
- skcomplex/models/physics/common/particles/_soft_sphere.py +82 -0
- skcomplex/models/physics/common/particles/_spring.py +78 -0
- skcomplex/models/physics/common/particles/_utils.py +25 -0
- skcomplex/models/physics/common/quantum/__init__.py +18 -0
- skcomplex/models/physics/common/quantum/_mode.py +46 -0
- skcomplex/models/physics/common/quantum/_quantum.py +127 -0
- skcomplex/models/physics/common/quantum/_qubit.py +61 -0
- skcomplex/models/physics/common/quantum/_site.py +49 -0
- skcomplex/models/physics/common/quantum/_spin.py +92 -0
- skcomplex/models/physics/common/spins/__init__.py +15 -0
- skcomplex/models/physics/common/spins/_ising_sampling.py +75 -0
- skcomplex/models/physics/common/spins/_potts_sampling.py +73 -0
- skcomplex/models/physics/common/spins/_spin_sampling.py +100 -0
- skcomplex/models/physics/common/spins/_thermal_sampling.py +105 -0
- skcomplex/models/physics/common/spins/_xy_sampling.py +67 -0
- skcomplex/models/physics/cosmology/__init__.py +8 -0
- skcomplex/models/physics/cosmology/_expansion.py +148 -0
- skcomplex/models/physics/criticality/__init__.py +29 -0
- skcomplex/models/physics/criticality/_absorbing.py +210 -0
- skcomplex/models/physics/criticality/_avalanche.py +69 -0
- skcomplex/models/physics/criticality/_crackling_noise.py +129 -0
- skcomplex/models/physics/criticality/_criticality.py +235 -0
- skcomplex/models/physics/criticality/_evolutionary_learning.py +231 -0
- skcomplex/models/physics/criticality/_fire.py +70 -0
- skcomplex/models/physics/criticality/_forest.py +55 -0
- skcomplex/models/physics/criticality/_learning.py +175 -0
- skcomplex/models/physics/criticality/_sandpile_cell.py +47 -0
- skcomplex/models/physics/fluids/__init__.py +49 -0
- skcomplex/models/physics/fluids/_bhatnagar_gross_krook.py +54 -0
- skcomplex/models/physics/fluids/_boussinesq.py +62 -0
- skcomplex/models/physics/fluids/_burgers.py +39 -0
- skcomplex/models/physics/fluids/_carleman_gas.py +61 -0
- skcomplex/models/physics/fluids/_flows.py +436 -0
- skcomplex/models/physics/fluids/_kinetic_equations.py +327 -0
- skcomplex/models/physics/fluids/_kinetics.py +147 -0
- skcomplex/models/physics/fluids/_kuramoto_sivashinsky.py +41 -0
- skcomplex/models/physics/fluids/_lattice_gases.py +217 -0
- skcomplex/models/physics/fluids/_marangoni.py +136 -0
- skcomplex/models/physics/fluids/_shallow_water.py +55 -0
- skcomplex/models/physics/fluids/_vorticity.py +56 -0
- skcomplex/models/physics/fluids/_wave_number.py +50 -0
- skcomplex/models/physics/heat/__init__.py +13 -0
- skcomplex/models/physics/heat/_cooling.py +96 -0
- skcomplex/models/physics/heat/_heat.py +182 -0
- skcomplex/models/physics/mechanics/__init__.py +93 -0
- skcomplex/models/physics/mechanics/_ballistic_pendulum.py +80 -0
- skcomplex/models/physics/mechanics/_bouncing_ball.py +51 -0
- skcomplex/models/physics/mechanics/_cart_pendulum.py +92 -0
- skcomplex/models/physics/mechanics/_cart_pendulum_interaction.py +57 -0
- skcomplex/models/physics/mechanics/_clock_pendulum.py +94 -0
- skcomplex/models/physics/mechanics/_clock_pendulum_interaction.py +60 -0
- skcomplex/models/physics/mechanics/_disc_billiard.py +90 -0
- skcomplex/models/physics/mechanics/_double_pendulum.py +95 -0
- skcomplex/models/physics/mechanics/_double_pendulum_interaction.py +53 -0
- skcomplex/models/physics/mechanics/_elastic_collision.py +78 -0
- skcomplex/models/physics/mechanics/_gyroscope.py +105 -0
- skcomplex/models/physics/mechanics/_gyroscope_interaction.py +57 -0
- skcomplex/models/physics/mechanics/_hanging_ball.py +65 -0
- skcomplex/models/physics/mechanics/_magnet.py +70 -0
- skcomplex/models/physics/mechanics/_mechanics.py +426 -0
- skcomplex/models/physics/mechanics/_parametric_pendulum.py +75 -0
- skcomplex/models/physics/mechanics/_parametric_pendulum_interaction.py +56 -0
- skcomplex/models/physics/mechanics/_pendulum.py +73 -0
- skcomplex/models/physics/mechanics/_pendulum_interaction.py +52 -0
- skcomplex/models/physics/mechanics/_pendulum_spring.py +68 -0
- skcomplex/models/physics/mechanics/_pendulums.py +547 -0
- skcomplex/models/physics/mechanics/_rotating_ball.py +66 -0
- skcomplex/models/physics/mechanics/_rotating_swing.py +100 -0
- skcomplex/models/physics/mechanics/_rotating_swing_interaction.py +70 -0
- skcomplex/models/physics/mechanics/_rotations.py +244 -0
- skcomplex/models/physics/mechanics/_springs.py +176 -0
- skcomplex/models/physics/mechanics/_support_spring.py +65 -0
- skcomplex/models/physics/mechanics/_wells.py +102 -0
- skcomplex/models/physics/nonlinear_oscillators/__init__.py +26 -0
- skcomplex/models/physics/nonlinear_oscillators/_adler_phase.py +73 -0
- skcomplex/models/physics/nonlinear_oscillators/_billiards.py +137 -0
- skcomplex/models/physics/nonlinear_oscillators/_duffing.py +78 -0
- skcomplex/models/physics/nonlinear_oscillators/_henon_heiles.py +57 -0
- skcomplex/models/physics/nonlinear_oscillators/_mushroom_billiard.py +96 -0
- skcomplex/models/physics/nonlinear_oscillators/_oscillators.py +313 -0
- skcomplex/models/physics/nonlinear_oscillators/_sinai_billiard.py +101 -0
- skcomplex/models/physics/nonlinear_oscillators/_van_der_pol.py +92 -0
- skcomplex/models/physics/oceanography/__init__.py +12 -0
- skcomplex/models/physics/oceanography/_gyres.py +145 -0
- skcomplex/models/physics/oceanography/_quasi_geostrophic_site.py +66 -0
- skcomplex/models/physics/oceanography/_thermohaline.py +133 -0
- skcomplex/models/physics/pattern_formation/__init__.py +18 -0
- skcomplex/models/physics/pattern_formation/_conserved.py +168 -0
- skcomplex/models/physics/pattern_formation/_ginzburg_landau.py +83 -0
- skcomplex/models/physics/pattern_formation/_ordering.py +183 -0
- skcomplex/models/physics/pattern_formation/_pattern_field.py +37 -0
- skcomplex/models/physics/pattern_formation/_patterns.py +135 -0
- skcomplex/models/physics/seismology/__init__.py +11 -0
- skcomplex/models/physics/seismology/_faults.py +118 -0
- skcomplex/models/physics/seismology/_spring_blocks.py +175 -0
- skcomplex/models/physics/soft_matter/__init__.py +76 -0
- skcomplex/models/physics/soft_matter/_anomalous.py +331 -0
- skcomplex/models/physics/soft_matter/_brownian.py +137 -0
- skcomplex/models/physics/soft_matter/_brownian_particle.py +58 -0
- skcomplex/models/physics/soft_matter/_colored_noise.py +137 -0
- skcomplex/models/physics/soft_matter/_continuous_time_walker.py +62 -0
- skcomplex/models/physics/soft_matter/_diffusion.py +418 -0
- skcomplex/models/physics/soft_matter/_double_well.py +57 -0
- skcomplex/models/physics/soft_matter/_flashing_sawtooth.py +82 -0
- skcomplex/models/physics/soft_matter/_fractional_walker.py +54 -0
- skcomplex/models/physics/soft_matter/_friction.py +214 -0
- skcomplex/models/physics/soft_matter/_levy_flier.py +54 -0
- skcomplex/models/physics/soft_matter/_levy_walker.py +67 -0
- skcomplex/models/physics/soft_matter/_modulated_particle.py +76 -0
- skcomplex/models/physics/soft_matter/_optical_trap.py +93 -0
- skcomplex/models/physics/soft_matter/_ratchets.py +163 -0
- skcomplex/models/physics/soft_matter/_scaled_walker.py +57 -0
- skcomplex/models/physics/soft_matter/_speckle_field.py +81 -0
- skcomplex/models/physics/soft_matter/_thermal_noise.py +52 -0
- skcomplex/models/physics/soft_matter/_tilted_washboard.py +70 -0
- skcomplex/models/physics/soft_matter/_transient_walker.py +61 -0
- skcomplex/models/physics/soft_matter/_traps.py +166 -0
- skcomplex/models/physics/soft_matter/_wall_particle.py +72 -0
- skcomplex/models/physics/statistical_mechanics/__init__.py +114 -0
- skcomplex/models/physics/statistical_mechanics/_absorbing_processes.py +156 -0
- skcomplex/models/physics/statistical_mechanics/_boltzmann_average.py +44 -0
- skcomplex/models/physics/statistical_mechanics/_boltzmann_sum.py +83 -0
- skcomplex/models/physics/statistical_mechanics/_bond_sampling.py +46 -0
- skcomplex/models/physics/statistical_mechanics/_bond_spin.py +76 -0
- skcomplex/models/physics/statistical_mechanics/_contact_site.py +85 -0
- skcomplex/models/physics/statistical_mechanics/_dephasing.py +59 -0
- skcomplex/models/physics/statistical_mechanics/_disk.py +36 -0
- skcomplex/models/physics/statistical_mechanics/_driven_particles.py +250 -0
- skcomplex/models/physics/statistical_mechanics/_energy_level.py +30 -0
- skcomplex/models/physics/statistical_mechanics/_exclusion_hops.py +76 -0
- skcomplex/models/physics/statistical_mechanics/_exclusion_site.py +61 -0
- skcomplex/models/physics/statistical_mechanics/_fully_connected_spins.py +232 -0
- skcomplex/models/physics/statistical_mechanics/_gases.py +156 -0
- skcomplex/models/physics/statistical_mechanics/_graph_spins.py +93 -0
- skcomplex/models/physics/statistical_mechanics/_ising_spin.py +63 -0
- skcomplex/models/physics/statistical_mechanics/_kinetic_temperature.py +66 -0
- skcomplex/models/physics/statistical_mechanics/_master_equations.py +171 -0
- skcomplex/models/physics/statistical_mechanics/_mattis_spin.py +79 -0
- skcomplex/models/physics/statistical_mechanics/_maxwell_boltzmann.py +96 -0
- skcomplex/models/physics/statistical_mechanics/_microstate.py +102 -0
- skcomplex/models/physics/statistical_mechanics/_order_parameter.py +90 -0
- skcomplex/models/physics/statistical_mechanics/_particle_site.py +41 -0
- skcomplex/models/physics/statistical_mechanics/_percolation.py +60 -0
- skcomplex/models/physics/statistical_mechanics/_percolation_site.py +73 -0
- skcomplex/models/physics/statistical_mechanics/_potts_spin.py +58 -0
- skcomplex/models/physics/statistical_mechanics/_processes.py +355 -0
- skcomplex/models/physics/statistical_mechanics/_q2r_spin.py +51 -0
- skcomplex/models/physics/statistical_mechanics/_quantum_spins.py +153 -0
- skcomplex/models/physics/statistical_mechanics/_random_energy.py +68 -0
- skcomplex/models/physics/statistical_mechanics/_reservoir.py +81 -0
- skcomplex/models/physics/statistical_mechanics/_spin_glasses.py +203 -0
- skcomplex/models/physics/statistical_mechanics/_spins.py +200 -0
- skcomplex/models/physics/statistical_mechanics/_susceptibility.py +112 -0
- skcomplex/models/physics/statistical_mechanics/_traps.py +135 -0
- skcomplex/models/physics/statistical_mechanics/_tree_node.py +48 -0
- skcomplex/models/physics/statistical_mechanics/_urns.py +107 -0
- skcomplex/models/physics/statistical_mechanics/_walker.py +81 -0
- skcomplex/models/physics/statistical_mechanics/_walker_view.py +20 -0
- skcomplex/models/physics/statistical_mechanics/_xxz_exchange.py +67 -0
- skcomplex/models/physics/statistical_mechanics/_xy_spin.py +58 -0
- skcomplex/models/physics/statistical_mechanics/_zeeman_field.py +56 -0
- skcomplex/models/physics/statistical_mechanics/_zero_range_hop.py +86 -0
- skcomplex/models/physics/statistical_mechanics/_zero_range_hops.py +81 -0
- skcomplex/models/physics/statistical_mechanics/_zone.py +78 -0
- skcomplex/models/physics/synchronization/__init__.py +64 -0
- skcomplex/models/physics/synchronization/_aggregate_averaging.py +63 -0
- skcomplex/models/physics/synchronization/_amplitude_death.py +278 -0
- skcomplex/models/physics/synchronization/_chaos.py +152 -0
- skcomplex/models/physics/synchronization/_diffusive_coupling.py +69 -0
- skcomplex/models/physics/synchronization/_edge_coupling.py +50 -0
- skcomplex/models/physics/synchronization/_hypergraphs.py +166 -0
- skcomplex/models/physics/synchronization/_integrate_and_fire_oscillator.py +80 -0
- skcomplex/models/physics/synchronization/_kuramoto.py +423 -0
- skcomplex/models/physics/synchronization/_link.py +46 -0
- skcomplex/models/physics/synchronization/_logistic_coupling.py +78 -0
- skcomplex/models/physics/synchronization/_logistic_node.py +59 -0
- skcomplex/models/physics/synchronization/_logistic_unit.py +43 -0
- skcomplex/models/physics/synchronization/_networks.py +184 -0
- skcomplex/models/physics/synchronization/_pulses.py +138 -0
- skcomplex/models/physics/synchronization/_rossler_oscillator.py +95 -0
- skcomplex/models/physics/synchronization/_swarmalator.py +48 -0
- skcomplex/models/physics/synchronization/_swarmalators.py +182 -0
- skcomplex/models/physics/synchronization/_utils.py +29 -0
- skcomplex/models/physics/synchronization/_winfree_mean_field.py +62 -0
- skcomplex/models/physics/waves/__init__.py +23 -0
- skcomplex/models/physics/waves/_charged.py +203 -0
- skcomplex/models/physics/waves/_driven_anchor.py +63 -0
- skcomplex/models/physics/waves/_lattice_hamiltonian.py +60 -0
- skcomplex/models/physics/waves/_position_dephasing.py +64 -0
- skcomplex/models/physics/waves/_quantum.py +125 -0
- skcomplex/models/physics/waves/_strings.py +169 -0
- skcomplex/models/physics/waves/_wave_function.py +79 -0
- skcomplex/models/physics/waves/_wave_string.py +52 -0
- skcomplex/models/social/__init__.py +1 -0
- skcomplex/models/social/cooperation/__init__.py +34 -0
- skcomplex/models/social/cooperation/_contributor.py +62 -0
- skcomplex/models/social/cooperation/_dilemma.py +56 -0
- skcomplex/models/social/cooperation/_hyperedge_goods.py +54 -0
- skcomplex/models/social/cooperation/_hypergraph_games.py +249 -0
- skcomplex/models/social/cooperation/_prisoner.py +56 -0
- skcomplex/models/social/cooperation/_prisoners_dilemma.py +126 -0
- skcomplex/models/social/cooperation/_public_goods.py +54 -0
- skcomplex/models/social/cooperation/_simplicial_dilemma.py +119 -0
- skcomplex/models/social/cooperation/_spatial_games.py +159 -0
- skcomplex/models/social/cooperation/_strategist.py +57 -0
- skcomplex/models/social/cooperation/_strategist_view.py +14 -0
- skcomplex/models/social/cooperation/_tournament.py +126 -0
- skcomplex/models/social/cooperation/_tournaments.py +87 -0
- skcomplex/models/social/crowds/__init__.py +46 -0
- skcomplex/models/social/crowds/_criminal_contagion.py +108 -0
- skcomplex/models/social/crowds/_criminality.py +223 -0
- skcomplex/models/social/crowds/_crowding.py +115 -0
- skcomplex/models/social/crowds/_deterrence.py +101 -0
- skcomplex/models/social/crowds/_evacuation.py +196 -0
- skcomplex/models/social/crowds/_guidance.py +69 -0
- skcomplex/models/social/crowds/_motivation.py +67 -0
- skcomplex/models/social/crowds/_pedestrians.py +85 -0
- skcomplex/models/social/crowds/_recruitment.py +90 -0
- skcomplex/models/social/crowds/_security_agents.py +48 -0
- skcomplex/models/social/crowds/_social_repulsion.py +86 -0
- skcomplex/models/social/crowds/_walking.py +186 -0
- skcomplex/models/social/crowds/_walls.py +69 -0
- skcomplex/models/social/language/__init__.py +13 -0
- skcomplex/models/social/language/_language.py +30 -0
- skcomplex/models/social/language/_least_effort.py +69 -0
- skcomplex/models/social/language/_word.py +39 -0
- skcomplex/models/social/language/_word_frequencies.py +48 -0
- skcomplex/models/social/opinion_dynamics/__init__.py +142 -0
- skcomplex/models/social/opinion_dynamics/_adopter.py +61 -0
- skcomplex/models/social/opinion_dynamics/_adopter_view.py +14 -0
- skcomplex/models/social/opinion_dynamics/_adoption.py +83 -0
- skcomplex/models/social/opinion_dynamics/_axelrod.py +160 -0
- skcomplex/models/social/opinion_dynamics/_believer.py +71 -0
- skcomplex/models/social/opinion_dynamics/_believer_view.py +16 -0
- skcomplex/models/social/opinion_dynamics/_bounded_confidence.py +126 -0
- skcomplex/models/social/opinion_dynamics/_citizen.py +49 -0
- skcomplex/models/social/opinion_dynamics/_citizen_view.py +12 -0
- skcomplex/models/social/opinion_dynamics/_club_member.py +78 -0
- skcomplex/models/social/opinion_dynamics/_coevolution.py +187 -0
- skcomplex/models/social/opinion_dynamics/_coevolving_voter.py +63 -0
- skcomplex/models/social/opinion_dynamics/_cognition.py +73 -0
- skcomplex/models/social/opinion_dynamics/_complex_agent.py +58 -0
- skcomplex/models/social/opinion_dynamics/_complex_agent_view.py +13 -0
- skcomplex/models/social/opinion_dynamics/_confidence_coupling.py +76 -0
- skcomplex/models/social/opinion_dynamics/_confident.py +50 -0
- skcomplex/models/social/opinion_dynamics/_conventions.py +44 -0
- skcomplex/models/social/opinion_dynamics/_conversations.py +116 -0
- skcomplex/models/social/opinion_dynamics/_cultural_influence.py +93 -0
- skcomplex/models/social/opinion_dynamics/_diffusion.py +205 -0
- skcomplex/models/social/opinion_dynamics/_discussant.py +60 -0
- skcomplex/models/social/opinion_dynamics/_discussant_view.py +14 -0
- skcomplex/models/social/opinion_dynamics/_discussions.py +51 -0
- skcomplex/models/social/opinion_dynamics/_encounters.py +48 -0
- skcomplex/models/social/opinion_dynamics/_hypergraph_consensus.py +106 -0
- skcomplex/models/social/opinion_dynamics/_influencee.py +70 -0
- skcomplex/models/social/opinion_dynamics/_influencee_view.py +16 -0
- skcomplex/models/social/opinion_dynamics/_kinetic_opinion.py +287 -0
- skcomplex/models/social/opinion_dynamics/_majority_voter.py +43 -0
- skcomplex/models/social/opinion_dynamics/_namer.py +53 -0
- skcomplex/models/social/opinion_dynamics/_namer_view.py +13 -0
- skcomplex/models/social/opinion_dynamics/_naming_games.py +68 -0
- skcomplex/models/social/opinion_dynamics/_opinion.py +39 -0
- skcomplex/models/social/opinion_dynamics/_persuader.py +52 -0
- skcomplex/models/social/opinion_dynamics/_persuader_view.py +12 -0
- skcomplex/models/social/opinion_dynamics/_persuasion.py +247 -0
- skcomplex/models/social/opinion_dynamics/_random_pairs.py +53 -0
- skcomplex/models/social/opinion_dynamics/_schedule.py +39 -0
- skcomplex/models/social/opinion_dynamics/_separation.py +71 -0
- skcomplex/models/social/opinion_dynamics/_social_impact.py +60 -0
- skcomplex/models/social/opinion_dynamics/_standardization.py +212 -0
- skcomplex/models/social/opinion_dynamics/_thinker.py +61 -0
- skcomplex/models/social/opinion_dynamics/_thinker_view.py +15 -0
- skcomplex/models/social/opinion_dynamics/_three_body_consensus.py +71 -0
- skcomplex/models/social/opinion_dynamics/_tie.py +21 -0
- skcomplex/models/social/opinion_dynamics/_variant_voter.py +67 -0
- skcomplex/models/social/opinion_dynamics/_variant_voter_view.py +14 -0
- skcomplex/models/social/opinion_dynamics/_variant_voting.py +63 -0
- skcomplex/models/social/opinion_dynamics/_village.py +61 -0
- skcomplex/models/social/opinion_dynamics/_village_view.py +14 -0
- skcomplex/models/social/opinion_dynamics/_voter.py +49 -0
- skcomplex/models/social/opinion_dynamics/_voter_imitation.py +48 -0
- skcomplex/models/social/opinion_dynamics/_voter_view.py +12 -0
- skcomplex/models/social/opinion_dynamics/_voters.py +197 -0
- skcomplex/models/social/organizations/__init__.py +68 -0
- skcomplex/models/social/organizations/_arms_race.py +34 -0
- skcomplex/models/social/organizations/_burden.py +38 -0
- skcomplex/models/social/organizations/_city_resident.py +41 -0
- skcomplex/models/social/organizations/_contender_view.py +14 -0
- skcomplex/models/social/organizations/_contest.py +32 -0
- skcomplex/models/social/organizations/_daily_movements.py +144 -0
- skcomplex/models/social/organizations/_eater.py +282 -0
- skcomplex/models/social/organizations/_eater_view.py +24 -0
- skcomplex/models/social/organizations/_employee.py +173 -0
- skcomplex/models/social/organizations/_employee_view.py +35 -0
- skcomplex/models/social/organizations/_employment.py +127 -0
- skcomplex/models/social/organizations/_execution.py +79 -0
- skcomplex/models/social/organizations/_gravity_contact.py +69 -0
- skcomplex/models/social/organizations/_hierarchies.py +174 -0
- skcomplex/models/social/organizations/_obesity.py +131 -0
- skcomplex/models/social/organizations/_premises.py +75 -0
- skcomplex/models/social/organizations/_premises_view.py +16 -0
- skcomplex/models/social/organizations/_queues.py +52 -0
- skcomplex/models/social/organizations/_restaurant.py +59 -0
- skcomplex/models/social/organizations/_restaurant_view.py +14 -0
- skcomplex/models/social/organizations/_sabotage.py +183 -0
- skcomplex/models/social/organizations/_supervisor.py +25 -0
- skcomplex/models/social/organizations/_task.py +65 -0
- skcomplex/models/social/organizations/_task_view.py +15 -0
- skcomplex/models/social/organizations/_trafficking.py +184 -0
- skcomplex/models/social/organizations/_traps.py +322 -0
- skcomplex/models/social/organizations/_traveller.py +55 -0
- skcomplex/models/social/organizations/_traveller_view.py +13 -0
- skcomplex/models/social/organizations/_urban_scaling.py +72 -0
- skcomplex/models/social/segregation/__init__.py +21 -0
- skcomplex/models/social/segregation/_block_moves.py +127 -0
- skcomplex/models/social/segregation/_blocks.py +111 -0
- skcomplex/models/social/segregation/_dweller.py +70 -0
- skcomplex/models/social/segregation/_dweller_view.py +16 -0
- skcomplex/models/social/segregation/_relocation.py +60 -0
- skcomplex/models/social/segregation/_resident.py +55 -0
- skcomplex/models/social/segregation/_resident_view.py +13 -0
- skcomplex/models/social/segregation/_schelling.py +75 -0
- skcomplex/models/social/spreading/__init__.py +37 -0
- skcomplex/models/social/spreading/_cascades.py +118 -0
- skcomplex/models/social/spreading/_exposure.py +166 -0
- skcomplex/models/social/spreading/_growing_word.py +55 -0
- skcomplex/models/social/spreading/_growing_word_view.py +13 -0
- skcomplex/models/social/spreading/_growth.py +52 -0
- skcomplex/models/social/spreading/_infective.py +55 -0
- skcomplex/models/social/spreading/_listeners.py +41 -0
- skcomplex/models/social/spreading/_participant.py +50 -0
- skcomplex/models/social/spreading/_rumour_contacts.py +81 -0
- skcomplex/models/social/spreading/_rumours.py +57 -0
- skcomplex/models/social/spreading/_simplicial.py +120 -0
- skcomplex/models/social/spreading/_simplicial_infection.py +64 -0
- skcomplex/models/social/spreading/_threshold_activation.py +50 -0
- skcomplex/models/social/spreading/_threshold_node_view.py +13 -0
- skcomplex/models/social/spreading/_writing.py +86 -0
- skcomplex/models/types.py +10 -0
- skcomplex/specs/__init__.py +198 -0
- skcomplex/specs/_accelerated_spec.py +46 -0
- skcomplex/specs/_agent_snapshot_spec.py +34 -0
- skcomplex/specs/_agent_state_spec.py +26 -0
- skcomplex/specs/_arguments_spec.py +60 -0
- skcomplex/specs/_axis_spec.py +59 -0
- skcomplex/specs/_base_record_spec.py +16 -0
- skcomplex/specs/_base_spec.py +73 -0
- skcomplex/specs/_base_structure_spec.py +173 -0
- skcomplex/specs/_batch_matching_spec.py +23 -0
- skcomplex/specs/_breakpoints_spec.py +58 -0
- skcomplex/specs/_call_spec.py +64 -0
- skcomplex/specs/_capacity_rows_spec.py +120 -0
- skcomplex/specs/_cardinality_spec.py +58 -0
- skcomplex/specs/_cascade_record_spec.py +36 -0
- skcomplex/specs/_clamp_spec.py +54 -0
- skcomplex/specs/_clause_spec.py +42 -0
- skcomplex/specs/_compiled_flow_spec.py +20 -0
- skcomplex/specs/_composed_rule_spec.py +33 -0
- skcomplex/specs/_continuous_matching_spec.py +48 -0
- skcomplex/specs/_control_solution_spec.py +54 -0
- skcomplex/specs/_control_spec.py +21 -0
- skcomplex/specs/_covariance_adaptation_spec.py +25 -0
- skcomplex/specs/_dataset_spec.py +85 -0
- skcomplex/specs/_delay_spec.py +27 -0
- skcomplex/specs/_dialect_spec.py +207 -0
- skcomplex/specs/_differential_evolution_spec.py +33 -0
- skcomplex/specs/_direction_spec.py +44 -0
- skcomplex/specs/_draw_spec.py +273 -0
- skcomplex/specs/_entry_spec.py +403 -0
- skcomplex/specs/_event_record_spec.py +37 -0
- skcomplex/specs/_evolution_strategy_spec.py +25 -0
- skcomplex/specs/_extremal_record_spec.py +32 -0
- skcomplex/specs/_fractional_rows_spec.py +33 -0
- skcomplex/specs/_fractional_state_spec.py +30 -0
- skcomplex/specs/_held_reduction_spec.py +29 -0
- skcomplex/specs/_hilbert_spec.py +75 -0
- skcomplex/specs/_hyperedge_reduction_spec.py +38 -0
- skcomplex/specs/_issue_spec.py +52 -0
- skcomplex/specs/_iterative_matching_spec.py +39 -0
- skcomplex/specs/_jump_channels_spec.py +40 -0
- skcomplex/specs/_jump_path_spec.py +29 -0
- skcomplex/specs/_layer_spec.py +47 -0
- skcomplex/specs/_layout_spec.py +158 -0
- skcomplex/specs/_local_operator_spec.py +72 -0
- skcomplex/specs/_lookup_spec.py +33 -0
- skcomplex/specs/_loop_spec.py +17 -0
- skcomplex/specs/_lowered_functions_spec.py +71 -0
- skcomplex/specs/_match_spec.py +37 -0
- skcomplex/specs/_matrix_law_spec.py +31 -0
- skcomplex/specs/_move_spec.py +69 -0
- skcomplex/specs/_neighbor_read_spec.py +83 -0
- skcomplex/specs/_neighbor_reduction_spec.py +39 -0
- skcomplex/specs/_network_rows_spec.py +124 -0
- skcomplex/specs/_network_snapshot_spec.py +61 -0
- skcomplex/specs/_noise_process_spec.py +41 -0
- skcomplex/specs/_objective_spec.py +39 -0
- skcomplex/specs/_observable_spec.py +79 -0
- skcomplex/specs/_operator_spec.py +170 -0
- skcomplex/specs/_orders_spec.py +16 -0
- skcomplex/specs/_outer_totalistic_spec.py +38 -0
- skcomplex/specs/_owners_spec.py +28 -0
- skcomplex/specs/_pair_read_spec.py +38 -0
- skcomplex/specs/_parameter_spec.py +81 -0
- skcomplex/specs/_parameters_spec.py +26 -0
- skcomplex/specs/_particle_swarm_spec.py +33 -0
- skcomplex/specs/_partner_spec.py +98 -0
- skcomplex/specs/_partner_switch_spec.py +39 -0
- skcomplex/specs/_phase_spec.py +61 -0
- skcomplex/specs/_phases_schedule_spec.py +59 -0
- skcomplex/specs/_plan_spec.py +18 -0
- skcomplex/specs/_planned_partition_spec.py +30 -0
- skcomplex/specs/_queue_spec.py +46 -0
- skcomplex/specs/_radius_spec.py +66 -0
- skcomplex/specs/_random_search_spec.py +51 -0
- skcomplex/specs/_read_spec.py +45 -0
- skcomplex/specs/_reduction_spec.py +48 -0
- skcomplex/specs/_renewal_record_spec.py +49 -0
- skcomplex/specs/_requirement_spec.py +32 -0
- skcomplex/specs/_role_spec.py +54 -0
- skcomplex/specs/_run_result_spec.py +52 -0
- skcomplex/specs/_run_state_spec.py +41 -0
- skcomplex/specs/_sampled_draw_spec.py +32 -0
- skcomplex/specs/_sampler_spec.py +57 -0
- skcomplex/specs/_samples_spec.py +29 -0
- skcomplex/specs/_schedule_spec.py +17 -0
- skcomplex/specs/_sector_spec.py +31 -0
- skcomplex/specs/_segment_spec.py +21 -0
- skcomplex/specs/_series_spec.py +29 -0
- skcomplex/specs/_signature_spec.py +55 -0
- skcomplex/specs/_snapshots_spec.py +56 -0
- skcomplex/specs/_stable_matching_spec.py +58 -0
- skcomplex/specs/_state_spec.py +138 -0
- skcomplex/specs/_step_spec.py +39 -0
- skcomplex/specs/_structure_state_spec.py +30 -0
- skcomplex/specs/_support_spec.py +76 -0
- skcomplex/specs/_symmetry_spec.py +59 -0
- skcomplex/specs/_table_spec.py +42 -0
- skcomplex/specs/_table_values_spec.py +36 -0
- skcomplex/specs/_tensor_spec.py +197 -0
- skcomplex/specs/_topology_request_spec.py +97 -0
- skcomplex/specs/_totalistic_spec.py +37 -0
- skcomplex/specs/_unknown_spec.py +22 -0
- skcomplex/specs/_validation_report_spec.py +62 -0
- skcomplex/specs/_variable_spec.py +124 -0
- skcomplex/specs/_visual_spec.py +30 -0
- skcomplex/specs/_weight_spec.py +16 -0
- skcomplex/specs/_wiener_block_spec.py +31 -0
- skcomplex/specs/_wiener_process_spec.py +54 -0
- skcomplex/types.py +140 -0
|
@@ -0,0 +1,1193 @@
|
|
|
1
|
+
"""Lower the reductions and neighbourhood reductions of laws to placeholders, compiled once each."""
|
|
2
|
+
|
|
3
|
+
# Author: Georgios Douzas <gdouzas@icloud.com>
|
|
4
|
+
# License: MIT
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import math
|
|
9
|
+
from collections.abc import Mapping
|
|
10
|
+
from dataclasses import replace
|
|
11
|
+
from typing import cast
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
import scipy.sparse
|
|
15
|
+
from sage.all__sagemath_symbolics import RR, SR, Expression, I
|
|
16
|
+
from sage.modules.free_module_element import FreeModuleElement
|
|
17
|
+
from sage.symbolic.operators import add_vararg, mul_vararg
|
|
18
|
+
|
|
19
|
+
from ....core.laws import BaseLaw, BoundaryLaw, CrossingLaw, JumpLaw, NoiseLaw, RateLaw, UpdateLaw
|
|
20
|
+
from ....core.laws.utils import both, contractions_in, hyperedges_in, maximum, neighborhoods_in, reductions_in
|
|
21
|
+
from ....core.spaces import (
|
|
22
|
+
AdjacencyNeighborhood,
|
|
23
|
+
ConeNeighborhood,
|
|
24
|
+
LatticeNeighborhood,
|
|
25
|
+
MemoryNeighborhood,
|
|
26
|
+
NearestNeighborhood,
|
|
27
|
+
NetworkSpace,
|
|
28
|
+
RadiusNeighborhood,
|
|
29
|
+
)
|
|
30
|
+
from ....errors import PipelineError, RoleError, ValidationError
|
|
31
|
+
from ....specs import (
|
|
32
|
+
CallSpec,
|
|
33
|
+
EntrySpec,
|
|
34
|
+
HyperedgeReductionSpec,
|
|
35
|
+
NeighborReductionSpec,
|
|
36
|
+
PairReadSpec,
|
|
37
|
+
ReadSpec,
|
|
38
|
+
ReductionSpec,
|
|
39
|
+
)
|
|
40
|
+
from ....specs._capacity_rows_spec import ACTIVE_THRESHOLD
|
|
41
|
+
from ....specs._held_reduction_spec import _HeldReductionSpec
|
|
42
|
+
from ....types import Indices, VariableKind
|
|
43
|
+
from ..._utils import declarations_of, domain_of, symbol, symbols_of, vector
|
|
44
|
+
from ...problems import DeclarationsSpec, KernelSpec, ReferenceSpec
|
|
45
|
+
from ...problems._neighborhood_kernel import NeighborhoodKernel
|
|
46
|
+
from ...problems._reduction_kernel import ReductionKernel
|
|
47
|
+
from ...problems._static_search import StaticSearch
|
|
48
|
+
from ...types import ReadKind
|
|
49
|
+
from .._base import BaseLowering, BasePass
|
|
50
|
+
from .._compilation import Compilation
|
|
51
|
+
from .._complex import _modulus_form
|
|
52
|
+
from .._observables import _HeldElement
|
|
53
|
+
from ._hyperedges import HyperedgeTables
|
|
54
|
+
from ._mask_requests import MaskRequestsPass
|
|
55
|
+
from ._specs import SpecsPass
|
|
56
|
+
|
|
57
|
+
PAIRWISE_KINDS = ('sum', 'mean', 'count', 'max', 'min')
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ReductionLowering(BaseLowering[list[tuple[KernelSpec, list[BaseLaw]]]]):
|
|
61
|
+
"""Lowering of the reductions and neighbourhood reductions of laws to placeholders, compiled once each.
|
|
62
|
+
|
|
63
|
+
`prepare(compilation)` reads the layout and the drawn values of the compilation, and `run(laws)` takes the laws of
|
|
64
|
+
every kernel spec and sets them in `lowered_` with every reduction replaced by the placeholder that kernels read,
|
|
65
|
+
collecting the reductions, deduplicated, with their hidden entries. `_apply_references()` then gives every spec the
|
|
66
|
+
references of its placeholders.
|
|
67
|
+
|
|
68
|
+
Attributes:
|
|
69
|
+
declarations_:
|
|
70
|
+
The layout of the compilation, which the hidden entries extend.
|
|
71
|
+
|
|
72
|
+
drawn_:
|
|
73
|
+
The number of drawn values after the parameters.
|
|
74
|
+
|
|
75
|
+
found_:
|
|
76
|
+
The compiled reductions by key.
|
|
77
|
+
|
|
78
|
+
by_symbol_:
|
|
79
|
+
The compiled reductions by placeholder.
|
|
80
|
+
|
|
81
|
+
readers_:
|
|
82
|
+
The group or element that reads every placeholder, or `None`.
|
|
83
|
+
|
|
84
|
+
neighbourhoods_:
|
|
85
|
+
The compiled neighbourhood reductions by key.
|
|
86
|
+
|
|
87
|
+
local_:
|
|
88
|
+
The compiled neighbourhood reductions by placeholder.
|
|
89
|
+
|
|
90
|
+
sequence_:
|
|
91
|
+
The compiled reductions and neighbourhood reductions in the order they are evaluated.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
declarations_: DeclarationsSpec
|
|
95
|
+
drawn_: int
|
|
96
|
+
found_: dict[tuple[object, ...], ReductionKernel]
|
|
97
|
+
by_symbol_: dict[Expression, ReductionKernel]
|
|
98
|
+
readers_: dict[Expression, str | None]
|
|
99
|
+
neighbourhoods_: dict[tuple[object, ...], NeighborhoodKernel]
|
|
100
|
+
local_: dict[Expression, NeighborhoodKernel]
|
|
101
|
+
sequence_: list[ReductionKernel | NeighborhoodKernel]
|
|
102
|
+
|
|
103
|
+
def _prepare(self, context: Compilation | None) -> None:
|
|
104
|
+
"""Read the layout and the drawn values of the compilation, with no reduction collected yet.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
context:
|
|
108
|
+
The compilation.
|
|
109
|
+
"""
|
|
110
|
+
super()._prepare(context)
|
|
111
|
+
draws = self.compilation_.draws
|
|
112
|
+
self.declarations_ = Compilation._required(self.compilation_.layout, 'layout')
|
|
113
|
+
self.drawn_ = draws.size if draws else 0
|
|
114
|
+
self.found_, self.by_symbol_, self.readers_ = {}, {}, {}
|
|
115
|
+
self.neighbourhoods_, self.local_, self.sequence_ = {}, {}, []
|
|
116
|
+
|
|
117
|
+
def _run(self, inputs: list[tuple[KernelSpec, list[BaseLaw]]] | None) -> None:
|
|
118
|
+
"""Set the laws of every kernel spec with every reduction replaced by its placeholder.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
inputs:
|
|
122
|
+
The laws of every kernel spec, crossing laws included.
|
|
123
|
+
|
|
124
|
+
Raises:
|
|
125
|
+
PipelineError:
|
|
126
|
+
No laws are passed.
|
|
127
|
+
"""
|
|
128
|
+
if inputs is None:
|
|
129
|
+
error_msg = 'The reduction lowering runs on the laws of every kernel spec. Pass them to `run`.'
|
|
130
|
+
raise PipelineError(error_msg)
|
|
131
|
+
self.lowered_ = [(spec, [self._lower_law(law, spec) for law in laws]) for spec, laws in inputs]
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def parameters_(self) -> int:
|
|
135
|
+
"""Size of the parameter vector and the drawn values, where the hidden entries of the reductions start."""
|
|
136
|
+
return self.declarations_.ends[False] + self.drawn_
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def extent_(self) -> int:
|
|
140
|
+
"""Size of the extended parameter vector."""
|
|
141
|
+
return max((item.entry.start + item.entry.size for item in self.sequence_), default=self.parameters_)
|
|
142
|
+
|
|
143
|
+
def _lower_law(self, law: BaseLaw, spec: KernelSpec) -> BaseLaw:
|
|
144
|
+
"""Return a law with every reduction in its values, its guard, and its reset replaced by its placeholder."""
|
|
145
|
+
if isinstance(law, CrossingLaw):
|
|
146
|
+
reset = {
|
|
147
|
+
target: value if BaseLaw._is_function(value) else self._lower(SR(value), spec)
|
|
148
|
+
for target, value in (law.reset or {}).items()
|
|
149
|
+
}
|
|
150
|
+
guard = law.guard if BaseLaw._is_function(law.guard) else self._lower(SR(law.guard), spec)
|
|
151
|
+
return BasePass._replaced(law, guard=guard, reset=reset if law.reset is not None else None)
|
|
152
|
+
if isinstance(law, JumpLaw):
|
|
153
|
+
return JumpLaw(self._lower(law.rate, spec), law.changes)
|
|
154
|
+
if not isinstance(law, RateLaw | NoiseLaw | UpdateLaw | BoundaryLaw):
|
|
155
|
+
return law
|
|
156
|
+
value = law.value
|
|
157
|
+
if isinstance(value, CallSpec):
|
|
158
|
+
arguments = None if value.arguments is None else tuple(self._lower(item, spec) for item in value.arguments)
|
|
159
|
+
value = replace(value, arguments=arguments)
|
|
160
|
+
else:
|
|
161
|
+
value = self._lower(value, spec)
|
|
162
|
+
return BasePass._replaced(law, value=value)
|
|
163
|
+
|
|
164
|
+
def _lower(self, value: object, spec: KernelSpec) -> object:
|
|
165
|
+
"""Return a law value with every reduction replaced by the placeholder that kernels read."""
|
|
166
|
+
if isinstance(value, FreeModuleElement):
|
|
167
|
+
return vector(self._lower(item, spec) for item in value)
|
|
168
|
+
if not isinstance(value, Expression):
|
|
169
|
+
return value
|
|
170
|
+
found = reductions_in(value)
|
|
171
|
+
local = neighborhoods_in(value)
|
|
172
|
+
around = hyperedges_in(value)
|
|
173
|
+
contracted = contractions_in(value)
|
|
174
|
+
if not found and not local and not around and not contracted:
|
|
175
|
+
return value
|
|
176
|
+
placeholders = {call: self._contraction(call, spec) for call in contracted}
|
|
177
|
+
placeholders.update({item.call: self._placeholder(item, spec) for item in found})
|
|
178
|
+
placeholders.update({item.call: self._neighborhood(item, spec) for item in local})
|
|
179
|
+
placeholders.update({item.call: self._hyperedges(item, spec) for item in around})
|
|
180
|
+
lowered: Expression = value
|
|
181
|
+
for call in sorted(placeholders, key=lambda item: -len(str(item))):
|
|
182
|
+
lowered = lowered.subs({call: placeholders[call]})
|
|
183
|
+
return _modulus_form(lowered)
|
|
184
|
+
|
|
185
|
+
def _group_of(self, item: Expression, spec: KernelSpec) -> str | None:
|
|
186
|
+
"""Return the group, element set, or element whose members a symbol of a reduction stands for."""
|
|
187
|
+
if item in spec.sets:
|
|
188
|
+
return spec.sets[item].label
|
|
189
|
+
if item in self.by_symbol_ or item in self.local_:
|
|
190
|
+
return self.readers_[item]
|
|
191
|
+
reference = self._reference_of(item, spec)
|
|
192
|
+
if reference is None or reference.source not in {ReadKind.MEMBER, ReadKind.OTHER}:
|
|
193
|
+
return None
|
|
194
|
+
owner = reference.entry.name.rpartition('.')[0]
|
|
195
|
+
return owner if owner in self.declarations_.blocks else None
|
|
196
|
+
|
|
197
|
+
def _group(self, reduction: ReductionSpec, spec: KernelSpec, symbols: set[Expression]) -> str | None:
|
|
198
|
+
"""Return the one group a reduction reduces over, after checking that it reads no second group."""
|
|
199
|
+
groups = {group for item in symbols if (group := self._group_of(item, spec)) is not None}
|
|
200
|
+
over = None
|
|
201
|
+
if reduction.over is not None:
|
|
202
|
+
over = self._group_of(reduction.over, spec)
|
|
203
|
+
reference = self._reference_of(reduction.over, spec)
|
|
204
|
+
if over is None and reference is not None:
|
|
205
|
+
over = reference.entry.name.rpartition('.')[0]
|
|
206
|
+
if over is not None:
|
|
207
|
+
groups.add(over)
|
|
208
|
+
if len(groups) > 1:
|
|
209
|
+
names = ' and '.join(sorted(groups))
|
|
210
|
+
error_msg = (
|
|
211
|
+
f'The reduction {reduction.call} of {spec.owner} reads the groups {names}. A reduction reduces over '
|
|
212
|
+
'one group, so write one reduction per group.'
|
|
213
|
+
)
|
|
214
|
+
raise RoleError(error_msg)
|
|
215
|
+
if groups:
|
|
216
|
+
return next(iter(groups))
|
|
217
|
+
if spec.group is not None:
|
|
218
|
+
return spec.group
|
|
219
|
+
return next((item.label for item in spec.sets.values()), None)
|
|
220
|
+
|
|
221
|
+
def _read(self, item: Expression, spec: KernelSpec, group: str | None, size: int) -> ReadSpec:
|
|
222
|
+
"""Return how the reduction pass reads one symbol of a reduction."""
|
|
223
|
+
if item in spec.sets:
|
|
224
|
+
references = spec.sets[item].references
|
|
225
|
+
indices = np.asarray([reference.entry.start + reference.column for reference in references], dtype=np.intp)
|
|
226
|
+
return ReadSpec(references[0].is_state, indices)
|
|
227
|
+
if item in self.by_symbol_:
|
|
228
|
+
nested = self.by_symbol_[item]
|
|
229
|
+
if nested.weights is None:
|
|
230
|
+
return ReadSpec(False, nested.entry.start, nested.entry)
|
|
231
|
+
if self.readers_[item] != group:
|
|
232
|
+
error_msg = (
|
|
233
|
+
f'A reduction of {spec.owner} over {group} reads the weighted reduction {nested.symbol} of the '
|
|
234
|
+
f'members of {self.readers_[item]}. Read a weighted reduction inside reductions over its readers.'
|
|
235
|
+
)
|
|
236
|
+
raise ValidationError(error_msg)
|
|
237
|
+
return ReadSpec(False, (nested.entry.start + np.arange(nested.entry.size)).astype(np.intp), nested.entry)
|
|
238
|
+
if item in self.local_:
|
|
239
|
+
local = self.local_[item]
|
|
240
|
+
if local.group != group:
|
|
241
|
+
error_msg = (
|
|
242
|
+
f'A reduction of {spec.owner} over {group} reads the neighbourhood reduction {local.symbol} of the '
|
|
243
|
+
f'members of {local.group}. Read a neighbourhood reduction inside reductions over its members.'
|
|
244
|
+
)
|
|
245
|
+
raise ValidationError(error_msg)
|
|
246
|
+
return ReadSpec(False, (local.entry.start + np.arange(local.entry.size)).astype(np.intp), local.entry)
|
|
247
|
+
reference = self._reference_of(item, spec)
|
|
248
|
+
if reference is None or reference.source not in {ReadKind.MEMBER, ReadKind.SINGLE, ReadKind.OTHER}:
|
|
249
|
+
error_msg = (
|
|
250
|
+
f'A reduction of {spec.owner} reads {item}, which is not a state or parameter of an element, a group '
|
|
251
|
+
'member, or another reduction. Reductions read the namespace `s` of the law.'
|
|
252
|
+
)
|
|
253
|
+
raise ValidationError(error_msg)
|
|
254
|
+
entry = reference.entry
|
|
255
|
+
if reference.source in {ReadKind.MEMBER, ReadKind.OTHER} and entry.members is not None:
|
|
256
|
+
indices = entry.start + np.arange(entry.rows) * entry.columns + reference.column
|
|
257
|
+
return ReadSpec(reference.is_state, indices.astype(np.intp), entry, reference.column, entry.columns)
|
|
258
|
+
return ReadSpec(reference.is_state, entry.start + reference.column, entry, reference.column)
|
|
259
|
+
|
|
260
|
+
def _members(self, group: str | None, spec: KernelSpec) -> tuple[int, EntrySpec | None]:
|
|
261
|
+
"""Return the size of a group and an entry that gives its size, or `None` for an element set."""
|
|
262
|
+
if group is None:
|
|
263
|
+
return 1, None
|
|
264
|
+
block = self.declarations_.blocks.get(group)
|
|
265
|
+
if block is not None:
|
|
266
|
+
entry = next(iter(block.entries.values()), None)
|
|
267
|
+
return block.rows, entry
|
|
268
|
+
references = next(item.references for item in spec.sets.values() if item.label == group)
|
|
269
|
+
return len(references), None
|
|
270
|
+
|
|
271
|
+
def _weights(
|
|
272
|
+
self,
|
|
273
|
+
reduction: ReductionSpec,
|
|
274
|
+
spec: KernelSpec,
|
|
275
|
+
group: str | None,
|
|
276
|
+
size: int,
|
|
277
|
+
) -> scipy.sparse.csr_array | ReadSpec | None:
|
|
278
|
+
"""Return the weights of a reduction as a CSR array or the read of a shaped parameter, checking the shape."""
|
|
279
|
+
if reduction.weights is None:
|
|
280
|
+
return None
|
|
281
|
+
readers = len(next(iter(spec.sets.values())).references) if spec.sets else spec.rows
|
|
282
|
+
weights = reduction.weights
|
|
283
|
+
if isinstance(weights, Expression):
|
|
284
|
+
return self._weights_read(reduction, spec, weights, (readers, size))
|
|
285
|
+
if not isinstance(weights, scipy.sparse.sparray | scipy.sparse.spmatrix):
|
|
286
|
+
weights = np.asarray(weights, dtype=float)
|
|
287
|
+
if weights.ndim == 1 and len(weights) == size:
|
|
288
|
+
weights = np.broadcast_to(weights, (readers, size))
|
|
289
|
+
shape = tuple(weights.shape)
|
|
290
|
+
if shape != (readers, size):
|
|
291
|
+
error_msg = (
|
|
292
|
+
f'The weights of the reduction {reduction.call} of {spec.owner} over {group or "no group"} have the '
|
|
293
|
+
f'shape {shape}, but the reduction needs the shape {(readers, size)}, one row per reading member and '
|
|
294
|
+
'one column per reduced member.'
|
|
295
|
+
)
|
|
296
|
+
raise ValidationError(error_msg)
|
|
297
|
+
return scipy.sparse.csr_array(weights, dtype=float)
|
|
298
|
+
|
|
299
|
+
def _weights_read(
|
|
300
|
+
self,
|
|
301
|
+
reduction: ReductionSpec,
|
|
302
|
+
spec: KernelSpec,
|
|
303
|
+
weights: Expression,
|
|
304
|
+
shape: tuple[int, int],
|
|
305
|
+
) -> ReadSpec:
|
|
306
|
+
"""Return the read of the shaped parameter that a reduction takes as weights, after checking its shape."""
|
|
307
|
+
reference = self._reference_of(weights, spec)
|
|
308
|
+
entry = reference.entry if reference is not None else None
|
|
309
|
+
if entry is None or entry.shape != shape:
|
|
310
|
+
given = 'not a shaped parameter' if entry is None else f'of the shape {entry.shape}'
|
|
311
|
+
error_msg = (
|
|
312
|
+
f'The weights {weights} of the reduction {reduction.call} of {spec.owner} are {given}, but the '
|
|
313
|
+
f'reduction needs a shaped parameter of the shape {shape}, one row per reading member and one column '
|
|
314
|
+
'per reduced member.'
|
|
315
|
+
)
|
|
316
|
+
raise ValidationError(error_msg)
|
|
317
|
+
indices = (entry.start + np.arange(entry.size)).astype(np.intp)
|
|
318
|
+
return ReadSpec(reference.is_state if reference is not None else False, indices, entry)
|
|
319
|
+
|
|
320
|
+
@staticmethod
|
|
321
|
+
def _held_reduction(
|
|
322
|
+
reduction: ReductionSpec,
|
|
323
|
+
agents: Mapping[Expression, tuple[str, str]],
|
|
324
|
+
time: Expression,
|
|
325
|
+
owner: str,
|
|
326
|
+
) -> _HeldReductionSpec | None:
|
|
327
|
+
"""Return the held reduction of a reduction of agents, or `None` for a reduction of elements.
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
reduction:
|
|
331
|
+
The reduction a law reads.
|
|
332
|
+
|
|
333
|
+
agents:
|
|
334
|
+
The path of the agent group and the variable of every symbol of agents.
|
|
335
|
+
|
|
336
|
+
time:
|
|
337
|
+
The time symbol.
|
|
338
|
+
|
|
339
|
+
owner:
|
|
340
|
+
The path of the component whose law reads the reduction.
|
|
341
|
+
|
|
342
|
+
Returns:
|
|
343
|
+
held:
|
|
344
|
+
The held reduction, or `None`.
|
|
345
|
+
|
|
346
|
+
Raises:
|
|
347
|
+
RoleError:
|
|
348
|
+
The reduction reads the agents of more than one group.
|
|
349
|
+
|
|
350
|
+
ValidationError:
|
|
351
|
+
The reduction has weights, or reads a symbol that is not a variable of the agents.
|
|
352
|
+
"""
|
|
353
|
+
expressions = [SR(reduction.argument), *([SR(reduction.condition)] if reduction.condition is not None else [])]
|
|
354
|
+
symbols = symbols_of(expressions) - {time}
|
|
355
|
+
read = symbols | ({reduction.over} if reduction.over is not None else set())
|
|
356
|
+
groups = {agents[item][0] for item in read if item in agents}
|
|
357
|
+
if not groups:
|
|
358
|
+
return None
|
|
359
|
+
if len(groups) > 1:
|
|
360
|
+
error_msg = (
|
|
361
|
+
f'The reduction {reduction.call} of {owner} reads the agents of {" and ".join(sorted(groups))}. A '
|
|
362
|
+
'reduction reduces over one group, so write one reduction per group.'
|
|
363
|
+
)
|
|
364
|
+
raise RoleError(error_msg)
|
|
365
|
+
group = next(iter(groups))
|
|
366
|
+
others = sorted(str(item) for item in symbols if item not in agents or agents[item][0] != group)
|
|
367
|
+
if reduction.weights is not None or others:
|
|
368
|
+
error_msg = (
|
|
369
|
+
f'The reduction {reduction.call} of {owner} reduces the agents of {group}, which a co-simulation '
|
|
370
|
+
'computes at its synchronisation points from the scalar states and parameters of the agents alone, '
|
|
371
|
+
f'without weights{", but it reads " + ", ".join(others) if others else ""}. Reduce an expression of '
|
|
372
|
+
'the agents.'
|
|
373
|
+
)
|
|
374
|
+
raise ValidationError(error_msg)
|
|
375
|
+
ordered = tuple(sorted((item for item in symbols if agents[item][1]), key=str))
|
|
376
|
+
return _HeldReductionSpec(
|
|
377
|
+
group,
|
|
378
|
+
reduction.kind,
|
|
379
|
+
tuple(agents[item][1] for item in ordered),
|
|
380
|
+
ordered,
|
|
381
|
+
SR(reduction.argument),
|
|
382
|
+
None if reduction.condition is None else SR(reduction.condition),
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
def _held(self, reduction: ReductionSpec, spec: KernelSpec) -> Expression | None:
|
|
386
|
+
"""Return the state of the element that holds a reduction of agents, or `None` for a reduction of elements."""
|
|
387
|
+
held = self._held_reduction(reduction, self.declarations_.agents, self.declarations_.time, spec.owner)
|
|
388
|
+
if held is None:
|
|
389
|
+
return None
|
|
390
|
+
block = next(
|
|
391
|
+
(
|
|
392
|
+
block
|
|
393
|
+
for block in self.declarations_.blocks.values()
|
|
394
|
+
if isinstance(block.node.component, _HeldElement)
|
|
395
|
+
and block.node.component.reduction is not None
|
|
396
|
+
and block.node.component.reduction.key == held.key
|
|
397
|
+
),
|
|
398
|
+
None,
|
|
399
|
+
)
|
|
400
|
+
if block is None:
|
|
401
|
+
error_msg = (
|
|
402
|
+
f'The reduction {reduction.call} of {spec.owner} reduces the agents of {held.group}, which only a '
|
|
403
|
+
'co-simulation computes, at its synchronisation points. Compile the system with `compile_system`.'
|
|
404
|
+
)
|
|
405
|
+
raise ValidationError(error_msg)
|
|
406
|
+
value = block.symbols['value']
|
|
407
|
+
if not isinstance(value, Expression):
|
|
408
|
+
error_msg = f'The reduction {reduction.call} of {spec.owner} reads a vector of agents, not one value.'
|
|
409
|
+
raise ValidationError(error_msg)
|
|
410
|
+
self._add_reference(spec, value, ReferenceSpec(block.entries['value'], True, 0, ReadKind.SINGLE))
|
|
411
|
+
return value
|
|
412
|
+
|
|
413
|
+
def _placeholder(self, reduction: ReductionSpec, spec: KernelSpec) -> Expression:
|
|
414
|
+
"""Return the placeholder of a reduction, the state that holds a reduction of agents, or its complex parts."""
|
|
415
|
+
held = self._held(reduction, spec)
|
|
416
|
+
if held is not None:
|
|
417
|
+
return held
|
|
418
|
+
if not SR(reduction.argument).has(I):
|
|
419
|
+
return self._compiled(reduction, spec)
|
|
420
|
+
if reduction.kind not in {'sum', 'mean'}:
|
|
421
|
+
error_msg = (
|
|
422
|
+
f'The reduction {reduction.call} of {spec.owner} reduces a complex expression, which only total and '
|
|
423
|
+
'mean reduce. Reduce its real or imaginary part.'
|
|
424
|
+
)
|
|
425
|
+
raise ValidationError(error_msg)
|
|
426
|
+
argument = SR(reduction.argument)
|
|
427
|
+
real = self._compiled(replace(reduction, argument=argument.real_part()), spec)
|
|
428
|
+
imaginary = self._compiled(replace(reduction, argument=argument.imag_part()), spec)
|
|
429
|
+
return real + I * imaginary
|
|
430
|
+
|
|
431
|
+
def _reduced_group(self, reduction: ReductionSpec, spec: KernelSpec, others: set[Expression]) -> str:
|
|
432
|
+
"""Return the one group whose members the symbols of `other` in a reduction stand for."""
|
|
433
|
+
groups = {self._owner_of(item, spec) for item in others}
|
|
434
|
+
if reduction.over is not None:
|
|
435
|
+
groups.add(self._group_of(reduction.over, spec) or self._owner_of(reduction.over, spec))
|
|
436
|
+
if len(groups) != 1 or None in groups:
|
|
437
|
+
names = ' and '.join(sorted(group or 'no group' for group in groups))
|
|
438
|
+
error_msg = (
|
|
439
|
+
f'The reduction {reduction.call} of {spec.owner} reads the other members of {names}. A reduction reads '
|
|
440
|
+
'the other members of the one group it reduces over.'
|
|
441
|
+
)
|
|
442
|
+
raise RoleError(error_msg)
|
|
443
|
+
return str(next(iter(groups)))
|
|
444
|
+
|
|
445
|
+
def _owner_of(self, item: Expression, spec: KernelSpec) -> str | None:
|
|
446
|
+
"""Return the path of the element or group a symbol of a spec reads, or `None` for an unknown symbol."""
|
|
447
|
+
reference = self._reference_of(item, spec)
|
|
448
|
+
return None if reference is None else reference.entry.name.rpartition('.')[0]
|
|
449
|
+
|
|
450
|
+
def _reads_reader(self, item: Expression, spec: KernelSpec) -> bool:
|
|
451
|
+
"""Check whether a symbol of a reduction holds one value per member of a group, the reading member."""
|
|
452
|
+
if item in self.local_ or item in self.by_symbol_:
|
|
453
|
+
return self.readers_[item] is not None
|
|
454
|
+
reference = self._reference_of(item, spec)
|
|
455
|
+
return reference is not None and reference.source is ReadKind.MEMBER
|
|
456
|
+
|
|
457
|
+
def _pairwise_read(self, item: Expression, spec: KernelSpec, readers: str | None) -> PairReadSpec:
|
|
458
|
+
"""Return how a reduction that reads `other` reads one symbol: shared, of the reader, or of the other member."""
|
|
459
|
+
if item in self.local_ or (item in self.by_symbol_ and self.readers_[item] is not None):
|
|
460
|
+
return PairReadSpec(self._read(item, spec, readers, 0), 'reader')
|
|
461
|
+
if item in self.by_symbol_:
|
|
462
|
+
return PairReadSpec(self._read(item, spec, None, 1), 'shared')
|
|
463
|
+
reference = self._reference_of(item, spec)
|
|
464
|
+
if reference is not None and reference.source is ReadKind.SINGLE:
|
|
465
|
+
return PairReadSpec(
|
|
466
|
+
ReadSpec(reference.is_state, reference.index, reference.entry, reference.column),
|
|
467
|
+
'shared',
|
|
468
|
+
)
|
|
469
|
+
owner = self._owner_of(item, spec)
|
|
470
|
+
sides = {ReadKind.OTHER: 'other', ReadKind.MEMBER: 'reader'}
|
|
471
|
+
side = sides.get(reference.source) if reference is not None else None
|
|
472
|
+
if reference is None or side is None or (side == 'reader' and owner != readers):
|
|
473
|
+
error_msg = (
|
|
474
|
+
f'A reduction of {spec.owner} reads {item}, which is not a state or parameter of an element, of the '
|
|
475
|
+
f'reading member of {readers or "no group"}, or of the other member. Reductions read the namespaces '
|
|
476
|
+
'`s` and `s.other` of the law.'
|
|
477
|
+
)
|
|
478
|
+
raise ValidationError(error_msg)
|
|
479
|
+
entry = reference.entry
|
|
480
|
+
indices = (entry.start + np.arange(entry.rows) * entry.columns + reference.column).astype(np.intp)
|
|
481
|
+
return PairReadSpec(ReadSpec(reference.is_state, indices, entry, reference.column, entry.columns), side)
|
|
482
|
+
|
|
483
|
+
def _weighted_pairwise_form(
|
|
484
|
+
self,
|
|
485
|
+
reduction: ReductionSpec,
|
|
486
|
+
spec: KernelSpec,
|
|
487
|
+
argument: Expression,
|
|
488
|
+
selected: Expression,
|
|
489
|
+
condition: Expression | None,
|
|
490
|
+
) -> tuple[str, Expression, Expression]:
|
|
491
|
+
"""Return the kind, the argument, and the weight of every pair of a reduction weighted by a shaped parameter."""
|
|
492
|
+
weights = reduction.weights
|
|
493
|
+
if (
|
|
494
|
+
not isinstance(weights, Expression)
|
|
495
|
+
or reduction.kind not in {'sum', 'mean'}
|
|
496
|
+
or (reduction.kind == 'mean' and condition is not None)
|
|
497
|
+
):
|
|
498
|
+
error_msg = (
|
|
499
|
+
f'The reduction {reduction.call} of {spec.owner} reads `other` with weights, which only a sum, or a '
|
|
500
|
+
'mean that selects no members, reads from a shaped parameter. Give the weights as a shaped parameter, '
|
|
501
|
+
'or write the term so that it factors into a part of the member and a part of the other member.'
|
|
502
|
+
)
|
|
503
|
+
raise ValidationError(error_msg)
|
|
504
|
+
return reduction.kind, argument, selected * weights
|
|
505
|
+
|
|
506
|
+
def _pair_weights_read(
|
|
507
|
+
self,
|
|
508
|
+
reduction: ReductionSpec,
|
|
509
|
+
spec: KernelSpec,
|
|
510
|
+
group: str,
|
|
511
|
+
) -> dict[Expression, PairReadSpec]:
|
|
512
|
+
"""Return the read of the shaped parameter that weights every pair of a reduction, or no read without one."""
|
|
513
|
+
weights = reduction.weights
|
|
514
|
+
if not isinstance(weights, Expression):
|
|
515
|
+
return {}
|
|
516
|
+
readers = self.declarations_.blocks[spec.group].rows if spec.group is not None else 1
|
|
517
|
+
read = self._weights_read(reduction, spec, weights, (readers, self.declarations_.blocks[group].rows))
|
|
518
|
+
return {weights: PairReadSpec(read, 'pair')}
|
|
519
|
+
|
|
520
|
+
def _pairwise_form(
|
|
521
|
+
self,
|
|
522
|
+
reduction: ReductionSpec,
|
|
523
|
+
spec: KernelSpec,
|
|
524
|
+
argument: Expression,
|
|
525
|
+
condition: Expression | None,
|
|
526
|
+
) -> tuple[str, Expression, Expression]:
|
|
527
|
+
"""Return the kind, the argument, and the weight of every pair of a reduction that reads `other`."""
|
|
528
|
+
if reduction.kind not in PAIRWISE_KINDS:
|
|
529
|
+
error_msg = (
|
|
530
|
+
f'The reduction {reduction.call} of {spec.owner} reads `other`, which the reductions '
|
|
531
|
+
f'{", ".join(PAIRWISE_KINDS)} read. Write it as one of them.'
|
|
532
|
+
)
|
|
533
|
+
raise ValidationError(error_msg)
|
|
534
|
+
selected = SR(1) if condition is None else SR(condition)
|
|
535
|
+
if reduction.weights is not None:
|
|
536
|
+
return self._weighted_pairwise_form(reduction, spec, argument, selected, condition)
|
|
537
|
+
if reduction.kind == 'count':
|
|
538
|
+
return 'sum', selected, SR(1)
|
|
539
|
+
if reduction.kind == 'mean' and condition is not None:
|
|
540
|
+
return 'normalized-mean', argument, selected
|
|
541
|
+
if reduction.kind in {'max', 'min'} and condition is not None:
|
|
542
|
+
error_msg = (
|
|
543
|
+
f'The reduction {reduction.call} of {spec.owner} reads `other` and selects members, which the largest '
|
|
544
|
+
'and smallest values of pairs do not. Select the members inside the argument instead.'
|
|
545
|
+
)
|
|
546
|
+
raise ValidationError(error_msg)
|
|
547
|
+
return reduction.kind, argument, selected
|
|
548
|
+
|
|
549
|
+
def _pairwise(
|
|
550
|
+
self,
|
|
551
|
+
reduction: ReductionSpec,
|
|
552
|
+
spec: KernelSpec,
|
|
553
|
+
argument: Expression,
|
|
554
|
+
condition: Expression | None,
|
|
555
|
+
others: set[Expression],
|
|
556
|
+
) -> Expression:
|
|
557
|
+
"""Return the placeholder of a reduction that reads `other`, one value per reading member over every member.
|
|
558
|
+
|
|
559
|
+
The symbols of `other` stand for the reduced member and the other symbols of the reading group for the reading
|
|
560
|
+
member, so the reduction runs over every pair of a reading member and a member of the reduced group.
|
|
561
|
+
"""
|
|
562
|
+
group = self._reduced_group(reduction, spec, others)
|
|
563
|
+
if group in self.declarations_.capacity:
|
|
564
|
+
error_msg = (
|
|
565
|
+
f'The reduction {reduction.call} of {spec.owner} reads `other` over the variable group {group}, whose '
|
|
566
|
+
'members come and go. Reduce over a group of fixed members.'
|
|
567
|
+
)
|
|
568
|
+
raise ValidationError(error_msg)
|
|
569
|
+
kind, argument, weight = self._pairwise_form(reduction, spec, argument, condition)
|
|
570
|
+
weighted = self._pair_weights_read(reduction, spec, group)
|
|
571
|
+
symbols = symbols_of([argument, weight]) - {self.declarations_.time, *weighted}
|
|
572
|
+
readers = spec.group
|
|
573
|
+
rows = self.declarations_.blocks[readers].rows if readers is not None else 1
|
|
574
|
+
size = self.declarations_.blocks[group].rows
|
|
575
|
+
key = ('pairwise', kind, str(argument), str(weight), group, readers)
|
|
576
|
+
if key not in self.neighbourhoods_:
|
|
577
|
+
indptr = (np.arange(rows + 1) * size).astype(np.intp)
|
|
578
|
+
search = StaticSearch(indptr, np.tile(np.arange(size, dtype=np.intp), rows)).check().prepare()
|
|
579
|
+
reads = {item: self._pairwise_read(item, spec, readers) for item in sorted(symbols, key=str)} | weighted
|
|
580
|
+
index = len(self.neighbourhoods_)
|
|
581
|
+
shape, members = ((rows,), rows) if readers is not None else ((), None)
|
|
582
|
+
entry = EntrySpec(f'__neighbours_{index}', self.extent_, shape, RR, members)
|
|
583
|
+
compiled = (
|
|
584
|
+
NeighborhoodKernel(
|
|
585
|
+
symbol(f'_neighbours_{index}'),
|
|
586
|
+
kind,
|
|
587
|
+
argument,
|
|
588
|
+
weight,
|
|
589
|
+
entry,
|
|
590
|
+
group=readers or group,
|
|
591
|
+
search=search,
|
|
592
|
+
reads=reads,
|
|
593
|
+
time=self.declarations_.time,
|
|
594
|
+
)
|
|
595
|
+
.check()
|
|
596
|
+
.prepare()
|
|
597
|
+
)
|
|
598
|
+
self.neighbourhoods_[key] = compiled
|
|
599
|
+
self.sequence_.append(compiled)
|
|
600
|
+
self.local_[compiled.symbol] = compiled
|
|
601
|
+
self.readers_[compiled.symbol] = readers
|
|
602
|
+
compiled = self.neighbourhoods_[key]
|
|
603
|
+
self._add_reference(spec, compiled.symbol, ReferenceSpec(compiled.entry, False, 0, ReadKind.REDUCED))
|
|
604
|
+
return compiled.symbol
|
|
605
|
+
|
|
606
|
+
def _separated(
|
|
607
|
+
self,
|
|
608
|
+
reduction: ReductionSpec,
|
|
609
|
+
spec: KernelSpec,
|
|
610
|
+
argument: Expression,
|
|
611
|
+
others: set[Expression],
|
|
612
|
+
) -> Expression | None:
|
|
613
|
+
"""Return a sum or mean over pairs whose terms factor into a reader part and an other part, else `None`.
|
|
614
|
+
|
|
615
|
+
A sum or mean over the other members `j` of `sum_k a_k(i) b_k(j)`, weighted by `W_ij` or not, is `sum_k a_k(i)`
|
|
616
|
+
times the weighted sum or mean of `b_k(j)`, so it runs as one reduction per `b_k` over the members, at a cost
|
|
617
|
+
linear in their number instead of one value per pair. With at least as many parts `b_k` as members, the pairs
|
|
618
|
+
cost less, and it returns `None`.
|
|
619
|
+
"""
|
|
620
|
+
if reduction.kind not in {'sum', 'mean'}:
|
|
621
|
+
return None
|
|
622
|
+
expanded = argument.expand()
|
|
623
|
+
terms = expanded.operands() if expanded.operator() is add_vararg else [expanded]
|
|
624
|
+
parts: dict[str, tuple[Expression, Expression]] = {}
|
|
625
|
+
for term in terms:
|
|
626
|
+
factors = term.operands() if term.operator() is mul_vararg else [term]
|
|
627
|
+
reader, other = SR(1), SR(1)
|
|
628
|
+
for factor in factors:
|
|
629
|
+
symbols = symbols_of([factor]) - {self.declarations_.time}
|
|
630
|
+
if not symbols & others:
|
|
631
|
+
reader = reader * factor
|
|
632
|
+
elif any(self._reads_reader(item, spec) for item in symbols - others):
|
|
633
|
+
return None
|
|
634
|
+
else:
|
|
635
|
+
other = other * factor
|
|
636
|
+
key = str(other)
|
|
637
|
+
total = parts.get(key, (other, SR(0)))[1]
|
|
638
|
+
parts[key] = (other, total + reader)
|
|
639
|
+
if len(parts) >= self.declarations_.blocks[self._reduced_group(reduction, spec, others)].rows:
|
|
640
|
+
return None
|
|
641
|
+
reduced = [
|
|
642
|
+
reader * self._compiled(replace(reduction, argument=other), spec) for other, reader in parts.values()
|
|
643
|
+
]
|
|
644
|
+
return SR(sum(reduced, SR(0)))
|
|
645
|
+
|
|
646
|
+
def _compiled(self, reduction: ReductionSpec, spec: KernelSpec) -> Expression:
|
|
647
|
+
"""Return the placeholder of a reduction of a real expression, compiling it the first time it is found."""
|
|
648
|
+
argument = SR(self._lower(reduction.argument, spec))
|
|
649
|
+
condition = None if reduction.condition is None else SR(self._lower(reduction.condition, spec))
|
|
650
|
+
symbols = symbols_of([argument, *([condition] if condition is not None else [])]) - {self.declarations_.time}
|
|
651
|
+
others = {
|
|
652
|
+
item
|
|
653
|
+
for item in symbols
|
|
654
|
+
if (reference := self._reference_of(item, spec)) is not None and reference.source is ReadKind.OTHER
|
|
655
|
+
}
|
|
656
|
+
if any(self._reads_reader(item, spec) for item in symbols - others) and others:
|
|
657
|
+
separated = self._separated(reduction, spec, argument, others) if condition is None else None
|
|
658
|
+
if separated is not None:
|
|
659
|
+
return separated
|
|
660
|
+
return self._pairwise(reduction, spec, argument, condition, others)
|
|
661
|
+
group = self._group(reduction, spec, symbols)
|
|
662
|
+
activity = MaskRequestsPass._activity_symbol(spec, group) if group in self.declarations_.capacity else None
|
|
663
|
+
if activity is not None:
|
|
664
|
+
present = SR(activity) > ACTIVE_THRESHOLD
|
|
665
|
+
condition = present if condition is None else both(condition, present)
|
|
666
|
+
symbols.add(activity)
|
|
667
|
+
size, members = self._members(group, spec)
|
|
668
|
+
weights = self._weights(reduction, spec, group, size)
|
|
669
|
+
canonical = {item: spec.sets[item].canonical for item in symbols if item in spec.sets}
|
|
670
|
+
argument_key = argument.subs(canonical) if canonical else argument
|
|
671
|
+
condition_key = condition.subs(canonical) if canonical and condition is not None else condition
|
|
672
|
+
key = (reduction.kind, str(argument_key), str(condition_key), str(reduction.call.operands()[2]), group)
|
|
673
|
+
if key not in self.found_:
|
|
674
|
+
index = len(self.found_)
|
|
675
|
+
readers = (
|
|
676
|
+
(weights.entry.shape[0] if isinstance(weights, ReadSpec) and weights.entry else weights.shape[0])
|
|
677
|
+
if weights is not None
|
|
678
|
+
else None
|
|
679
|
+
)
|
|
680
|
+
shape = (readers,) if readers is not None else ()
|
|
681
|
+
members_of = readers if readers is not None and not spec.sets else None
|
|
682
|
+
entry = EntrySpec(f'__reduced_{index}', self.extent_, shape, RR, members_of)
|
|
683
|
+
placeholder = symbol(f'_reduced_{index}')
|
|
684
|
+
reads = {
|
|
685
|
+
canonical.get(item, item): self._read(item, spec, group, size) for item in sorted(symbols, key=str)
|
|
686
|
+
}
|
|
687
|
+
compiled = (
|
|
688
|
+
ReductionKernel(
|
|
689
|
+
placeholder,
|
|
690
|
+
reduction.kind,
|
|
691
|
+
argument_key,
|
|
692
|
+
condition_key,
|
|
693
|
+
weights,
|
|
694
|
+
entry=entry,
|
|
695
|
+
size=size,
|
|
696
|
+
group=group,
|
|
697
|
+
reads=reads,
|
|
698
|
+
time=self.declarations_.time,
|
|
699
|
+
members=members,
|
|
700
|
+
function=reduction.function,
|
|
701
|
+
)
|
|
702
|
+
.check()
|
|
703
|
+
.prepare()
|
|
704
|
+
)
|
|
705
|
+
self.found_[key] = compiled
|
|
706
|
+
self.sequence_.append(compiled)
|
|
707
|
+
self.by_symbol_[placeholder] = compiled
|
|
708
|
+
reading = spec.group or next((item.label for item in spec.sets.values()), None)
|
|
709
|
+
self.readers_[placeholder] = reading if weights is not None else None
|
|
710
|
+
compiled = self.found_[key]
|
|
711
|
+
column = spec.set_index if compiled.weights is not None and spec.sets else 0
|
|
712
|
+
self._add_reference(spec, compiled.symbol, ReferenceSpec(compiled.entry, False, column, ReadKind.REDUCED))
|
|
713
|
+
return compiled.symbol
|
|
714
|
+
|
|
715
|
+
def _tensor_entry(self, call: Expression, spec: KernelSpec) -> tuple[ReferenceSpec, EntrySpec]:
|
|
716
|
+
"""Return the reference and the entry of the tensor of a contraction, after checking its order and readers."""
|
|
717
|
+
tensor, *factors = call.operands()
|
|
718
|
+
reference = self._reference_of(tensor, spec)
|
|
719
|
+
block = self.declarations_.blocks.get(spec.group) if spec.group is not None else None
|
|
720
|
+
rows = block.rows if block is not None else None
|
|
721
|
+
entry = reference.entry if reference is not None else None
|
|
722
|
+
if entry is None or len(entry.shape) != len(factors) + 1 or entry.shape[0] != rows:
|
|
723
|
+
given = 'not a shaped parameter' if entry is None else f'of the shape {entry.shape}'
|
|
724
|
+
error_msg = (
|
|
725
|
+
f'The tensor {tensor} of the contraction {call} of {spec.owner} is {given}, but the contraction needs '
|
|
726
|
+
f'a shaped parameter of order {len(factors) + 1} whose first index runs over the {rows or "no"} '
|
|
727
|
+
'members of the reading group. Declare it `ParameterSpec(shape=(role,) * k)` on a role bound to a '
|
|
728
|
+
'group.'
|
|
729
|
+
)
|
|
730
|
+
raise ValidationError(error_msg)
|
|
731
|
+
return cast(ReferenceSpec, reference), entry
|
|
732
|
+
|
|
733
|
+
def _axis_reads(
|
|
734
|
+
self,
|
|
735
|
+
factor: Expression,
|
|
736
|
+
axis: int,
|
|
737
|
+
sizes: tuple[int, ...],
|
|
738
|
+
spec: KernelSpec,
|
|
739
|
+
) -> tuple[Expression, dict[Expression, ReadSpec]]:
|
|
740
|
+
"""Return the expression of one index of a contraction over the product of its indices, with its reads.
|
|
741
|
+
|
|
742
|
+
Every symbol of one member reads its value at the member of the index `axis` of every combination of members.
|
|
743
|
+
"""
|
|
744
|
+
symbols = sorted(symbols_of([factor]) - {self.declarations_.time}, key=str)
|
|
745
|
+
group = self._group(ReductionSpec(factor, 'sum', factor, None, None, None), spec, set(symbols))
|
|
746
|
+
if group is not None and group in self.declarations_.capacity:
|
|
747
|
+
error_msg = (
|
|
748
|
+
f'A contraction of {spec.owner} reads the variable group {group}, whose members come and go. '
|
|
749
|
+
'Contract over a group of fixed members.'
|
|
750
|
+
)
|
|
751
|
+
raise ValidationError(error_msg)
|
|
752
|
+
renamed: dict[Expression, Expression] = {}
|
|
753
|
+
reads: dict[Expression, ReadSpec] = {}
|
|
754
|
+
for item in symbols:
|
|
755
|
+
read = self._read(item, spec, group, sizes[axis])
|
|
756
|
+
if read.per_member and len(cast(Indices, read.index)) != sizes[axis]:
|
|
757
|
+
error_msg = (
|
|
758
|
+
f'The expression {factor} of index {axis + 1} of a contraction of {spec.owner} reads '
|
|
759
|
+
f'{len(cast(Indices, read.index))} members, but the tensor has {sizes[axis]} along that index.'
|
|
760
|
+
)
|
|
761
|
+
raise ValidationError(error_msg)
|
|
762
|
+
name = symbol(f'_contracted_{axis}_{item}')
|
|
763
|
+
renamed[item] = name
|
|
764
|
+
if not read.per_member:
|
|
765
|
+
reads[name] = read
|
|
766
|
+
continue
|
|
767
|
+
shape = [1] * len(sizes)
|
|
768
|
+
shape[axis] = sizes[axis]
|
|
769
|
+
index = np.broadcast_to(np.asarray(read.index, dtype=np.intp).reshape(shape), sizes).ravel()
|
|
770
|
+
reads[name] = ReadSpec(read.is_state, np.ascontiguousarray(index))
|
|
771
|
+
return SR(factor).subs(renamed), reads
|
|
772
|
+
|
|
773
|
+
def _contraction(self, call: Expression, spec: KernelSpec) -> Expression:
|
|
774
|
+
"""Return the placeholder of a contraction, a sum over every combination of members weighted by the tensor."""
|
|
775
|
+
reference, entry = self._tensor_entry(call, spec)
|
|
776
|
+
key = ('contraction', str(call), spec.group)
|
|
777
|
+
if key not in self.found_:
|
|
778
|
+
factors = [SR(self._lower(item, spec)) for item in call.operands()[1:]]
|
|
779
|
+
rows, sizes = entry.shape[0], tuple(entry.shape[1:])
|
|
780
|
+
argument, reads = SR(1), dict[Expression, ReadSpec]()
|
|
781
|
+
for axis, factor in enumerate(factors):
|
|
782
|
+
expression, axis_reads = self._axis_reads(factor, axis, sizes, spec)
|
|
783
|
+
argument, reads = argument * expression, reads | axis_reads
|
|
784
|
+
size = math.prod(sizes)
|
|
785
|
+
matrix = replace(entry, shape=(rows, size))
|
|
786
|
+
weights = ReadSpec(reference.is_state, (entry.start + np.arange(entry.size)).astype(np.intp), matrix)
|
|
787
|
+
index = len(self.found_)
|
|
788
|
+
placeholder = symbol(f'_reduced_{index}')
|
|
789
|
+
compiled = (
|
|
790
|
+
ReductionKernel(
|
|
791
|
+
placeholder,
|
|
792
|
+
'sum',
|
|
793
|
+
argument,
|
|
794
|
+
None,
|
|
795
|
+
weights,
|
|
796
|
+
entry=EntrySpec(f'__reduced_{index}', self.extent_, (rows,), RR, rows),
|
|
797
|
+
size=size,
|
|
798
|
+
group=spec.group,
|
|
799
|
+
reads=reads,
|
|
800
|
+
time=self.declarations_.time,
|
|
801
|
+
)
|
|
802
|
+
.check()
|
|
803
|
+
.prepare()
|
|
804
|
+
)
|
|
805
|
+
self.found_[key] = compiled
|
|
806
|
+
self.sequence_.append(compiled)
|
|
807
|
+
self.by_symbol_[placeholder] = compiled
|
|
808
|
+
self.readers_[placeholder] = spec.group
|
|
809
|
+
compiled = self.found_[key]
|
|
810
|
+
self._add_reference(spec, compiled.symbol, ReferenceSpec(compiled.entry, False, 0, ReadKind.REDUCED))
|
|
811
|
+
return compiled.symbol
|
|
812
|
+
|
|
813
|
+
def _neighbor_group(
|
|
814
|
+
self,
|
|
815
|
+
reduction: NeighborReductionSpec | HyperedgeReductionSpec,
|
|
816
|
+
spec: KernelSpec,
|
|
817
|
+
symbols: set[Expression],
|
|
818
|
+
) -> str:
|
|
819
|
+
"""Return the group whose members read a neighbourhood reduction and are each other's neighbours."""
|
|
820
|
+
groups = set()
|
|
821
|
+
for item in symbols:
|
|
822
|
+
reference = self._reference_of(item, spec)
|
|
823
|
+
if item in self.local_:
|
|
824
|
+
groups.add(self.local_[item].group)
|
|
825
|
+
elif item in self.by_symbol_ and self.readers_[item] is not None:
|
|
826
|
+
groups.add(str(self.readers_[item]))
|
|
827
|
+
elif reference is not None and reference.source in {ReadKind.MEMBER, ReadKind.OTHER}:
|
|
828
|
+
groups.add(reference.entry.name.rpartition('.')[0])
|
|
829
|
+
groups = {group for group in groups if group in self.declarations_.groups and not self._on_edges(group)} or (
|
|
830
|
+
{spec.group} if spec.group is not None else set()
|
|
831
|
+
)
|
|
832
|
+
if len(groups) != 1:
|
|
833
|
+
names = ' and '.join(sorted(groups)) or 'no group'
|
|
834
|
+
error_msg = (
|
|
835
|
+
f'The neighbourhood reduction {reduction.call} of {spec.owner} reads {names}. A neighbourhood '
|
|
836
|
+
"reduction runs over the members of one group, which are each other's neighbours."
|
|
837
|
+
)
|
|
838
|
+
raise RoleError(error_msg)
|
|
839
|
+
return next(iter(groups))
|
|
840
|
+
|
|
841
|
+
def _on_edges(self, group: str) -> bool:
|
|
842
|
+
"""Check whether a group lives on the edges of a network."""
|
|
843
|
+
return getattr(self.declarations_.blocks[group].node.component, 'on', None) == 'edges'
|
|
844
|
+
|
|
845
|
+
def _edge_read(self, reference: ReferenceSpec, spec: KernelSpec, group: str, over: object) -> PairReadSpec:
|
|
846
|
+
"""Return how a neighbourhood reduction reads a state of the edge group of its layer, per pair of neighbours."""
|
|
847
|
+
entry = reference.entry
|
|
848
|
+
edges = self.declarations_.blocks[entry.name.rpartition('.')[0]]
|
|
849
|
+
nodes = self.declarations_.blocks[group]
|
|
850
|
+
layer = getattr(over, 'layer', None)
|
|
851
|
+
same = isinstance(over, AdjacencyNeighborhood) and SpecsPass._group_space(edges) is SpecsPass._group_space(
|
|
852
|
+
nodes,
|
|
853
|
+
)
|
|
854
|
+
if not same or getattr(edges.node.component, 'layer', None) != layer:
|
|
855
|
+
error_msg = (
|
|
856
|
+
f'A neighbourhood reduction of {spec.owner} over {over!r} reads {entry.name} of the edge group '
|
|
857
|
+
f'{edges.node.path}, which lives on other edges. Reduce over the layer of the edge group.'
|
|
858
|
+
)
|
|
859
|
+
raise RoleError(error_msg)
|
|
860
|
+
indices = (entry.start + np.arange(entry.rows) * entry.columns + reference.column).astype(np.intp)
|
|
861
|
+
return PairReadSpec(ReadSpec(reference.is_state, indices, entry, reference.column, entry.columns), 'edge')
|
|
862
|
+
|
|
863
|
+
def _pair_read(
|
|
864
|
+
self,
|
|
865
|
+
item: Expression,
|
|
866
|
+
spec: KernelSpec,
|
|
867
|
+
group: str,
|
|
868
|
+
search: object,
|
|
869
|
+
over: object = None,
|
|
870
|
+
) -> PairReadSpec:
|
|
871
|
+
"""Return how a neighbourhood reduction reads one symbol: shared, of the reading member, or of the neighbour."""
|
|
872
|
+
reference = self._reference_of(item, spec)
|
|
873
|
+
if item in self.local_ or (item in self.by_symbol_ and self.readers_[item] is not None):
|
|
874
|
+
return PairReadSpec(self._read(item, spec, group, 0), 'reader')
|
|
875
|
+
if item in self.by_symbol_:
|
|
876
|
+
return PairReadSpec(self._read(item, spec, None, 1), 'shared')
|
|
877
|
+
if reference is None or reference.source not in {ReadKind.MEMBER, ReadKind.SINGLE, ReadKind.OTHER}:
|
|
878
|
+
error_msg = (
|
|
879
|
+
f'A neighbourhood reduction of {spec.owner} reads {item}, which is not a state or parameter of a '
|
|
880
|
+
'member, of its neighbour, or of an element. Neighbourhood reductions read the namespaces `s` and '
|
|
881
|
+
'`s.other` of the law.'
|
|
882
|
+
)
|
|
883
|
+
raise ValidationError(error_msg)
|
|
884
|
+
if reference.source is ReadKind.SINGLE:
|
|
885
|
+
read = ReadSpec(reference.is_state, reference.index, reference.entry, reference.column)
|
|
886
|
+
return PairReadSpec(read, 'shared')
|
|
887
|
+
entry = reference.entry
|
|
888
|
+
owner = entry.name.rpartition('.')[0]
|
|
889
|
+
if owner != group and owner in self.declarations_.blocks and self._on_edges(owner):
|
|
890
|
+
return self._edge_read(reference, spec, group, over)
|
|
891
|
+
if owner != group:
|
|
892
|
+
error_msg = (
|
|
893
|
+
f'A neighbourhood reduction of {spec.owner} over the members of {group} reads {item} of another group. '
|
|
894
|
+
'ReadSpec the other group through a reduction over its members.'
|
|
895
|
+
)
|
|
896
|
+
raise RoleError(error_msg)
|
|
897
|
+
indices = (entry.start + np.arange(entry.rows) * entry.columns + reference.column).astype(np.intp)
|
|
898
|
+
read = ReadSpec(reference.is_state, indices, entry, reference.column, entry.columns)
|
|
899
|
+
if reference.source is ReadKind.MEMBER:
|
|
900
|
+
return PairReadSpec(read, 'reader')
|
|
901
|
+
image = getattr(search, 'periods', None) is not None and entry == getattr(search, 'positions', None)
|
|
902
|
+
return PairReadSpec(read, 'other', image)
|
|
903
|
+
|
|
904
|
+
def _neighborhood(self, reduction: NeighborReductionSpec, spec: KernelSpec) -> Expression:
|
|
905
|
+
"""Return the placeholder of a neighbourhood reduction, compiling it the first time it is found."""
|
|
906
|
+
argument = SR(self._lower(reduction.argument, spec))
|
|
907
|
+
weight = SR(1) if reduction.weight is None else SR(self._lower(reduction.weight, spec))
|
|
908
|
+
if argument.has(I) or weight.has(I):
|
|
909
|
+
error_msg = (
|
|
910
|
+
f'The neighbourhood reduction {reduction.call} of {spec.owner} reduces a complex expression. Reduce '
|
|
911
|
+
'its real and imaginary parts.'
|
|
912
|
+
)
|
|
913
|
+
raise ValidationError(error_msg)
|
|
914
|
+
symbols = symbols_of([argument, weight]) - {self.declarations_.time}
|
|
915
|
+
group = self._neighbor_group(reduction, spec, symbols)
|
|
916
|
+
block = self.declarations_.blocks[group]
|
|
917
|
+
over = (
|
|
918
|
+
reduction.over if reduction.over is not None else NeighborhoodKernel._default_neighborhood(block.node.space)
|
|
919
|
+
)
|
|
920
|
+
if over is None:
|
|
921
|
+
error_msg = (
|
|
922
|
+
f'The neighbourhood reduction {reduction.call} of {group} names no neighbourhood, but the group lives '
|
|
923
|
+
f'on {block.node.space!r}, which has none of its own. Reduce over Radius, Nearest, or Cone.'
|
|
924
|
+
)
|
|
925
|
+
raise ValidationError(error_msg)
|
|
926
|
+
key = ('neighborhood', reduction.kind, str(argument), str(weight), repr(over), group)
|
|
927
|
+
if key not in self.neighbourhoods_:
|
|
928
|
+
states = declarations_of(block.node.component_type, VariableKind.STATE)
|
|
929
|
+
changing = (
|
|
930
|
+
self.declarations_.changing_entries(SpecsPass._group_space(block))
|
|
931
|
+
if block.node.active is not None
|
|
932
|
+
else None
|
|
933
|
+
)
|
|
934
|
+
if not isinstance(
|
|
935
|
+
over,
|
|
936
|
+
AdjacencyNeighborhood
|
|
937
|
+
| LatticeNeighborhood
|
|
938
|
+
| MemoryNeighborhood
|
|
939
|
+
| RadiusNeighborhood
|
|
940
|
+
| NearestNeighborhood
|
|
941
|
+
| ConeNeighborhood,
|
|
942
|
+
):
|
|
943
|
+
error_msg = (
|
|
944
|
+
f'The neighbourhood reduction {reduction.call} of {group} reduces over {over!r}, which is not a '
|
|
945
|
+
'neighbourhood. Reduce over a lattice, network, memory, Radius, Nearest, or Cone neighbourhood.'
|
|
946
|
+
)
|
|
947
|
+
raise ValidationError(error_msg)
|
|
948
|
+
over = over.check()
|
|
949
|
+
search = NeighborhoodKernel._neighbor_search(
|
|
950
|
+
over,
|
|
951
|
+
block.node.space,
|
|
952
|
+
block.rows,
|
|
953
|
+
block.entries,
|
|
954
|
+
states,
|
|
955
|
+
changing=changing,
|
|
956
|
+
)
|
|
957
|
+
reads = {item: self._pair_read(item, spec, group, search, over) for item in sorted(symbols, key=str)}
|
|
958
|
+
index = len(self.neighbourhoods_)
|
|
959
|
+
entry = EntrySpec(f'__neighbours_{index}', self.extent_, (block.rows,), RR, block.rows)
|
|
960
|
+
compiled = (
|
|
961
|
+
NeighborhoodKernel(
|
|
962
|
+
symbol(f'_neighbours_{index}'),
|
|
963
|
+
reduction.kind,
|
|
964
|
+
argument,
|
|
965
|
+
weight,
|
|
966
|
+
entry,
|
|
967
|
+
group=group,
|
|
968
|
+
search=search,
|
|
969
|
+
reads=reads,
|
|
970
|
+
time=self.declarations_.time,
|
|
971
|
+
)
|
|
972
|
+
.check()
|
|
973
|
+
.prepare()
|
|
974
|
+
)
|
|
975
|
+
self.neighbourhoods_[key] = compiled
|
|
976
|
+
self.sequence_.append(compiled)
|
|
977
|
+
self.local_[compiled.symbol] = compiled
|
|
978
|
+
self.readers_[compiled.symbol] = group
|
|
979
|
+
compiled = self.neighbourhoods_[key]
|
|
980
|
+
self._add_reference(spec, compiled.symbol, ReferenceSpec(compiled.entry, False, 0, ReadKind.REDUCED))
|
|
981
|
+
return compiled.symbol
|
|
982
|
+
|
|
983
|
+
def _hyperedges(self, reduction: HyperedgeReductionSpec, spec: KernelSpec) -> Expression:
|
|
984
|
+
"""Return the placeholder of a reduction over the hyperedges around every member, the sum of one per size.
|
|
985
|
+
|
|
986
|
+
Without a size, the reduction runs over the hyperedges of every size of the network: the sum and the count add
|
|
987
|
+
the reductions of every size, and the mean divides their sum by the number of hyperedges around the member.
|
|
988
|
+
|
|
989
|
+
Args:
|
|
990
|
+
reduction:
|
|
991
|
+
The reduction over the hyperedges around every member.
|
|
992
|
+
|
|
993
|
+
spec:
|
|
994
|
+
The kernel the reduction is read in.
|
|
995
|
+
|
|
996
|
+
Returns:
|
|
997
|
+
placeholder:
|
|
998
|
+
The placeholder of the reduction.
|
|
999
|
+
|
|
1000
|
+
Raises:
|
|
1001
|
+
RoleError:
|
|
1002
|
+
The network has no hyperedge of the size of the reduction.
|
|
1003
|
+
|
|
1004
|
+
ValidationError:
|
|
1005
|
+
The members do not live on a network with hyperedges, or a reduction other than the sum, the mean, or
|
|
1006
|
+
the count runs over hyperedges of several sizes.
|
|
1007
|
+
"""
|
|
1008
|
+
argument = SR(reduction.argument)
|
|
1009
|
+
weight = SR(1) if reduction.weight is None else SR(reduction.weight)
|
|
1010
|
+
group = self._neighbor_group(reduction, spec, symbols_of([argument, weight]) - {self.declarations_.time})
|
|
1011
|
+
space = self.declarations_.blocks[group].node.space
|
|
1012
|
+
if not isinstance(space, NetworkSpace) or not space.hyperedges_:
|
|
1013
|
+
error_msg = (
|
|
1014
|
+
f'The hyperedge reduction {reduction.call} of {spec.owner} reads {group}, which lives on {space!r}. '
|
|
1015
|
+
'Give the group a network space with hyperedges.'
|
|
1016
|
+
)
|
|
1017
|
+
raise ValidationError(error_msg)
|
|
1018
|
+
if group in self.declarations_.capacity:
|
|
1019
|
+
error_msg = (
|
|
1020
|
+
f'The hyperedge reduction {reduction.call} of {spec.owner} reads the variable group {group}, whose '
|
|
1021
|
+
'members come and go. Reduce over the hyperedges of a group of fixed members.'
|
|
1022
|
+
)
|
|
1023
|
+
raise ValidationError(error_msg)
|
|
1024
|
+
sizes = sorted({len(item) for item in space.hyperedges_})
|
|
1025
|
+
if reduction.size is not None and reduction.size not in sizes:
|
|
1026
|
+
error_msg = (
|
|
1027
|
+
f'The hyperedge reduction {reduction.call} of {spec.owner} runs on hyperedges of size '
|
|
1028
|
+
f'{reduction.size}, but the hyperedges of the network of {group} have the sizes '
|
|
1029
|
+
f'{", ".join(map(str, sizes))}.'
|
|
1030
|
+
)
|
|
1031
|
+
raise RoleError(error_msg)
|
|
1032
|
+
if reduction.size is not None:
|
|
1033
|
+
sizes = [reduction.size]
|
|
1034
|
+
if len(sizes) == 1:
|
|
1035
|
+
return self._hyperedge_kernel(reduction, spec, group, (reduction.kind, argument, weight), sizes[0])
|
|
1036
|
+
if reduction.kind not in {'sum', 'mean', 'count'}:
|
|
1037
|
+
error_msg = (
|
|
1038
|
+
f'The hyperedge reduction {reduction.call} of {spec.owner} runs on the hyperedges of the sizes '
|
|
1039
|
+
f'{", ".join(map(str, sizes))}, which only the sum, the mean, and the count reduce together. Give a '
|
|
1040
|
+
'size.'
|
|
1041
|
+
)
|
|
1042
|
+
raise ValidationError(error_msg)
|
|
1043
|
+
kind = 'sum' if reduction.kind == 'mean' else reduction.kind
|
|
1044
|
+
parts = [self._hyperedge_kernel(reduction, spec, group, (kind, argument, weight), size) for size in sizes]
|
|
1045
|
+
combined = SR(sum(parts, SR(0)))
|
|
1046
|
+
if reduction.kind != 'mean':
|
|
1047
|
+
return combined
|
|
1048
|
+
numbers = [self._hyperedge_kernel(reduction, spec, group, ('sum', SR(1), SR(1)), size) for size in sizes]
|
|
1049
|
+
return combined / maximum(SR(sum(numbers, SR(0))), 1)
|
|
1050
|
+
|
|
1051
|
+
def _hyperedge_kernel(
|
|
1052
|
+
self,
|
|
1053
|
+
reduction: HyperedgeReductionSpec,
|
|
1054
|
+
spec: KernelSpec,
|
|
1055
|
+
group: str,
|
|
1056
|
+
terms: tuple[str, Expression, Expression],
|
|
1057
|
+
size: int,
|
|
1058
|
+
) -> Expression:
|
|
1059
|
+
"""Return the placeholder of a reduction over the hyperedges of one size, compiled the first time it is found.
|
|
1060
|
+
|
|
1061
|
+
Every row of the reduction is a hyperedge around a member: the symbols of `others` read the other members of
|
|
1062
|
+
the hyperedge through the tables of their positions, and the reductions over `members` are written out over
|
|
1063
|
+
the member and the other members.
|
|
1064
|
+
|
|
1065
|
+
Args:
|
|
1066
|
+
reduction:
|
|
1067
|
+
The reduction over the hyperedges around every member.
|
|
1068
|
+
|
|
1069
|
+
spec:
|
|
1070
|
+
The kernel the reduction is read in.
|
|
1071
|
+
|
|
1072
|
+
group:
|
|
1073
|
+
The path of the group of the members.
|
|
1074
|
+
|
|
1075
|
+
terms:
|
|
1076
|
+
The kind, the argument, and the weight of the reduction.
|
|
1077
|
+
|
|
1078
|
+
size:
|
|
1079
|
+
The size of the hyperedges.
|
|
1080
|
+
|
|
1081
|
+
Returns:
|
|
1082
|
+
placeholder:
|
|
1083
|
+
The placeholder of the reduction over the hyperedges of the size.
|
|
1084
|
+
|
|
1085
|
+
Raises:
|
|
1086
|
+
ValidationError:
|
|
1087
|
+
The reduction reads more other members than a hyperedge of the size has, the members outside a
|
|
1088
|
+
reduction over them, the neighbour `other`, or a complex expression.
|
|
1089
|
+
"""
|
|
1090
|
+
kind, argument, weight = terms
|
|
1091
|
+
columns, positions = HyperedgeTables._around(spec, ReadKind.OTHER)
|
|
1092
|
+
focal = {item: symbol(f'{item}__focal', domain_of(item)) for item in columns}
|
|
1093
|
+
slots = {item: [focal[item], *others[: size - 1]] for item, others in columns.items()}
|
|
1094
|
+
expansions = HyperedgeTables._expansions_over(slots, [argument, weight])
|
|
1095
|
+
argument, weight = SR(argument).subs(expansions), SR(weight).subs(expansions)
|
|
1096
|
+
argument, weight = SR(self._lower(argument, spec)), SR(self._lower(weight, spec))
|
|
1097
|
+
symbols = symbols_of([argument, weight]) - {self.declarations_.time}
|
|
1098
|
+
beyond = sorted(str(item) for item in symbols if positions.get(item, -1) >= size - 1)
|
|
1099
|
+
outside = sorted(str(item) for item in symbols if item in columns)
|
|
1100
|
+
if beyond or outside or argument.has(I) or weight.has(I):
|
|
1101
|
+
error_msg = (
|
|
1102
|
+
f'The hyperedge reduction {reduction.call} of {spec.owner} reads '
|
|
1103
|
+
f'{", ".join([*beyond, *outside]) or "a complex expression"}. A reduction over hyperedges of size '
|
|
1104
|
+
f'{size} reads the {size - 1} other members `others`, and `members` inside reductions over them, of '
|
|
1105
|
+
'real expressions.'
|
|
1106
|
+
)
|
|
1107
|
+
raise ValidationError(error_msg)
|
|
1108
|
+
block = self.declarations_.blocks[group]
|
|
1109
|
+
key = ('hyperedges', kind, str(argument), str(weight), size, group)
|
|
1110
|
+
if key not in self.neighbourhoods_:
|
|
1111
|
+
indptr, tables = HyperedgeTables._incidences(cast(NetworkSpace, block.node.space), size)
|
|
1112
|
+
search = StaticSearch(indptr, np.arange(indptr[-1], dtype=np.intp)).check().prepare()
|
|
1113
|
+
sources = {value: item for item, value in focal.items()}
|
|
1114
|
+
reads = {
|
|
1115
|
+
item: self._hyperedge_read(item, spec, group, search, (sources, positions, tables))
|
|
1116
|
+
for item in sorted(symbols, key=str)
|
|
1117
|
+
}
|
|
1118
|
+
index = len(self.neighbourhoods_)
|
|
1119
|
+
entry = EntrySpec(f'__neighbours_{index}', self.extent_, (block.rows,), RR, block.rows)
|
|
1120
|
+
compiled = (
|
|
1121
|
+
NeighborhoodKernel(
|
|
1122
|
+
symbol(f'_neighbours_{index}'),
|
|
1123
|
+
kind,
|
|
1124
|
+
argument,
|
|
1125
|
+
weight,
|
|
1126
|
+
entry,
|
|
1127
|
+
group=group,
|
|
1128
|
+
search=search,
|
|
1129
|
+
reads=reads,
|
|
1130
|
+
time=self.declarations_.time,
|
|
1131
|
+
)
|
|
1132
|
+
.check()
|
|
1133
|
+
.prepare()
|
|
1134
|
+
)
|
|
1135
|
+
self.neighbourhoods_[key] = compiled
|
|
1136
|
+
self.sequence_.append(compiled)
|
|
1137
|
+
self.local_[compiled.symbol] = compiled
|
|
1138
|
+
self.readers_[compiled.symbol] = group
|
|
1139
|
+
compiled = self.neighbourhoods_[key]
|
|
1140
|
+
self._add_reference(spec, compiled.symbol, ReferenceSpec(compiled.entry, False, 0, ReadKind.REDUCED))
|
|
1141
|
+
return compiled.symbol
|
|
1142
|
+
|
|
1143
|
+
def _hyperedge_read(
|
|
1144
|
+
self,
|
|
1145
|
+
item: Expression,
|
|
1146
|
+
spec: KernelSpec,
|
|
1147
|
+
group: str,
|
|
1148
|
+
search: StaticSearch,
|
|
1149
|
+
slots: tuple[dict[Expression, Expression], dict[Expression, int], list[Indices]],
|
|
1150
|
+
) -> PairReadSpec:
|
|
1151
|
+
"""Return how a reduction over hyperedges reads one symbol: of the member, of another member, or shared.
|
|
1152
|
+
|
|
1153
|
+
Args:
|
|
1154
|
+
item:
|
|
1155
|
+
The symbol the reduction reads.
|
|
1156
|
+
|
|
1157
|
+
spec:
|
|
1158
|
+
The kernel the reduction is read in.
|
|
1159
|
+
|
|
1160
|
+
group:
|
|
1161
|
+
The path of the group of the members.
|
|
1162
|
+
|
|
1163
|
+
search:
|
|
1164
|
+
The search of the symbols of the system.
|
|
1165
|
+
|
|
1166
|
+
slots:
|
|
1167
|
+
The sources of the slots, their positions, and the tables of the positions.
|
|
1168
|
+
|
|
1169
|
+
Returns:
|
|
1170
|
+
read:
|
|
1171
|
+
How the reduction reads the symbol.
|
|
1172
|
+
|
|
1173
|
+
Raises:
|
|
1174
|
+
ValidationError:
|
|
1175
|
+
The symbol is the neighbour `other` of the member, which no hyperedge has.
|
|
1176
|
+
"""
|
|
1177
|
+
sources, positions, tables = slots
|
|
1178
|
+
if item not in sources and item not in positions:
|
|
1179
|
+
reference = self._reference_of(item, spec)
|
|
1180
|
+
if reference is not None and reference.source is ReadKind.OTHER:
|
|
1181
|
+
error_msg = (
|
|
1182
|
+
f'The hyperedge reduction of {spec.owner} reads {item}, the neighbour `other` of the member. Read '
|
|
1183
|
+
'the other members of a hyperedge with `others`.'
|
|
1184
|
+
)
|
|
1185
|
+
raise ValidationError(error_msg)
|
|
1186
|
+
return self._pair_read(item, spec, group, search)
|
|
1187
|
+
reference = spec.references[sources.get(item, item)]
|
|
1188
|
+
entry = reference.entry
|
|
1189
|
+
indices = (entry.start + np.arange(entry.rows) * entry.columns + reference.column).astype(np.intp)
|
|
1190
|
+
read = ReadSpec(reference.is_state, indices, entry, reference.column, entry.columns)
|
|
1191
|
+
if item in sources:
|
|
1192
|
+
return PairReadSpec(read, 'reader')
|
|
1193
|
+
return PairReadSpec(read, 'other', table=tables[positions[item]])
|