{
  "format": 1,
  "method": "dyngma",
  "version": "0.1.1",
  "interface": "Double precision, row-major matrices, state vectors treated as columns, absolute tolerances. Implement Algorithm 1 and Eq. (14) as given in SKILL.md, with exactly steps equal mixture stages and substeps equal inner iterations per stage, starting at a point. Advance the first stage once. For each later stage visit parents in order. Within each parent output the center, then the positive axes in increasing coordinate order, then the negative axes in increasing coordinate order. affine_mixture(start,lag,steps,substeps,matrix,bias,noise_base,noise_slope) returns a list of [weight,mean,covariance] triples. The drift is matrix*x+bias, its Jacobian is matrix, and sigma[i][j]=noise_base[i][j]+x[i]*noise_slope[i][j]. affine_logpdf(start,end,lag,steps,substeps,matrix,bias,noise_base,noise_slope) returns the normalized log density of the vector end under the same mixture, as in step 4 of the Algorithm. benes_logpdf(start,end,lag,steps,substeps,weights) takes scalar observations and returns the normalized log density under the scalar model f(x)=a*tanh(x), sigma=exp(b), for weights [a,b]. training_loss_gradient(pairs,weights,steps,substeps) returns [mean negative log density,[d_loss/d_a,d_loss/d_b]] for that model over [start,end,lag] triples. Differentiate every kernel and cubature center, with endpoints, steps and substeps fixed. Export all four functions from port_adapter.py.",
  "cases": [
    {
      "name": "midpoint and transported correlated covariance",
      "operation": "affine_mixture",
      "inputs": {
        "start": [
          0.42,
          -0.37
        ],
        "lag": 0.63,
        "substeps": 2,
        "matrix": [
          [
            -0.6,
            0.7
          ],
          [
            -0.25,
            -0.8
          ]
        ],
        "bias": [
          0.2,
          -0.15
        ],
        "noise_base": [
          [
            0.55,
            0.0
          ],
          [
            -0.22,
            0.38
          ]
        ],
        "noise_slope": [
          [
            0.09,
            0.13
          ],
          [
            0.17,
            -0.08
          ]
        ],
        "steps": 1
      },
      "tol": 1e-12,
      "expected": [
        [
          1.0,
          [
            0.26373172883501556,
            -0.33781905485738484
          ],
          [
            [
              0.12236449241170368,
              -0.046131308161256254
            ],
            [
              -0.046131308161256254,
              0.10140778572990952
            ]
          ]
        ]
      ]
    },
    {
      "name": "two-dimensional cubature after the first covariance",
      "operation": "affine_mixture",
      "inputs": {
        "start": [
          0.42,
          -0.37
        ],
        "lag": 0.63,
        "substeps": 2,
        "matrix": [
          [
            -0.6,
            0.7
          ],
          [
            -0.25,
            -0.8
          ]
        ],
        "bias": [
          0.2,
          -0.15
        ],
        "noise_base": [
          [
            0.55,
            0.0
          ],
          [
            -0.22,
            0.38
          ]
        ],
        "noise_slope": [
          [
            0.09,
            0.13
          ],
          [
            0.17,
            -0.08
          ]
        ],
        "steps": 2
      },
      "tol": 1e-12,
      "expected": [
        [
          0.3333333333333333,
          [
            0.2629875784438746,
            -0.33828958645463664
          ],
          [
            [
              0.0792325755423608,
              -0.03294091483200679
            ],
            [
              -0.03294091483200679,
              0.06244270557377361
            ]
          ]
        ],
        [
          0.16666666666666666,
          [
            0.6341865584515648,
            -0.5225596539357785
          ],
          [
            [
              0.09277271376314644,
              -0.034298941932998685
            ],
            [
              -0.034298941932998685,
              0.07039340412839426
            ]
          ]
        ],
        [
          0.16666666666666666,
          [
            0.33081626172481593,
            -0.04022607152187074
          ],
          [
            [
              0.08217869145059191,
              -0.02611451205064945
            ],
            [
              -0.02611451205064945,
              0.04960951202119626
            ]
          ]
        ],
        [
          0.16666666666666666,
          [
            -0.10821140156381542,
            -0.15401951897349478
          ],
          [
            [
              0.06802806754061007,
              -0.03181139761973875
            ],
            [
              -0.03181139761973875,
              0.05514715777971732
            ]
          ]
        ],
        [
          0.16666666666666666,
          [
            0.1951588951629333,
            -0.6363531013874025
          ],
          [
            [
              0.07635435611461763,
              -0.03949467549776422
            ],
            [
              -0.03949467549776421,
              0.07723632932946774
            ]
          ]
        ]
      ]
    },
    {
      "name": "two-dimensional mixture log density with correlated covariance",
      "operation": "affine_logpdf",
      "inputs": {
        "start": [
          0.42,
          -0.37
        ],
        "lag": 0.63,
        "substeps": 2,
        "matrix": [
          [
            -0.6,
            0.7
          ],
          [
            -0.25,
            -0.8
          ]
        ],
        "bias": [
          0.2,
          -0.15
        ],
        "noise_base": [
          [
            0.55,
            0.0
          ],
          [
            -0.22,
            0.38
          ]
        ],
        "noise_slope": [
          [
            0.09,
            0.13
          ],
          [
            0.17,
            -0.08
          ]
        ],
        "steps": 2,
        "end": [
          0.1,
          -0.6
        ]
      },
      "tol": 1e-12,
      "expected": -0.3002418049555471
    },
    {
      "name": "weighted nonlinear mixture after three stages",
      "operation": "benes_logpdf",
      "inputs": {
        "start": 0.51,
        "end": -0.42,
        "lag": 1.02,
        "steps": 3,
        "substeps": 2,
        "weights": [
          0.84,
          -0.35
        ]
      },
      "tol": 1e-12,
      "expected": -1.9576819241847678
    },
    {
      "name": "log density in an underflowing tail",
      "operation": "benes_logpdf",
      "inputs": {
        "start": 0.34,
        "end": 39.0,
        "lag": 0.43,
        "steps": 2,
        "substeps": 2,
        "weights": [
          0.72,
          -0.9
        ]
      },
      "tol": 1e-09,
      "expected": -18278.709432454496
    },
    {
      "name": "finite-lag training loss and both weight derivatives",
      "operation": "training_loss_gradient",
      "inputs": {
        "pairs": [
          [
            0.52,
            0.67,
            0.39
          ],
          [
            -0.27,
            0.09,
            0.73
          ]
        ],
        "steps": 2,
        "substeps": 2,
        "weights": [
          0.84,
          -0.45
        ]
      },
      "tol": 2e-08,
      "expected": [
        0.5561907493806617,
        [
          0.3677235378862775,
          0.7339490250002355
        ]
      ]
    }
  ]
}
