test_reference_dptable

DPTable Feature Test

This file exercises DPTable-specific features: 1D with transition arrows, traceback via foreach + reannotate, and 2D interval DP with compute.

Part A — Longest Increasing Subsequence (1D DPTable)

Given sequence a=[3,1,8,2,5,4,7,6]a = [3, 1, 8, 2, 5, 4, 7, 6] of length n=8n = 8.

dp[i]=1+maxj<i,  a[j]<a[i]dp[j]dp[i] = 1 + \max_{j < i,\; a[j] < a[i]} dp[j]

Step 1 / 19

Part B — Matrix Chain Multiplication (2D DPTable)

Given n=5n = 5 matrices with dimensions p=[30,35,15,5,10,20]p = [30, 35, 15, 5, 10, 20].

dp[i][j]=minik<j(dp[i][k]+dp[k+1][j]+pipk+1pj+1)dp[i][j] = \min_{i \leq k < j} \left( dp[i][k] + dp[k+1][j] + p_i \cdot p_{k+1} \cdot p_{j+1} \right)

Step 1 / 17