Clarify Symbol

release/4.3a0
p-zach 2025-04-16 21:12:10 -04:00
parent 7f34599744
commit ab3243fd58
1 changed files with 11 additions and 11 deletions

View File

@ -43,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 6,
"metadata": {
"id": "symbol_import_code"
},
@ -66,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@ -151,12 +151,12 @@
"source": [
"## Shorthand Functions\n",
"\n",
"GTSAM provides convenient shorthand functions `gtsam.symbol_shorthand.X(j)`, `gtsam.symbol_shorthand.L(j)`, etc., which are equivalent to `gtsam.Symbol('x', j)`, `gtsam.Symbol('l', j)`."
"GTSAM provides convenient shorthand functions `X(j)`, `L(j)`, etc., which are equivalent to `gtsam.Symbol('x', j)`, `gtsam.Symbol('l', j)`. To use these, first import with `from gtsam import symbol_shorthand`, then set up the variables you want to use with statements like `X = symbol_shorthand.X`."
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@ -169,19 +169,19 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Symbol('x', 0).key() == gtsam.symbol_shorthand.X(0): True\n",
"Symbol('l', 1).key() == gtsam.symbol_shorthand.L(1): True\n"
"Symbol('x', 0).key() == X(0): True\n",
"Symbol('l', 1).key() == L(1): True\n"
]
}
],
"source": [
"from gtsam import symbol_shorthand\n",
"\n",
"x0_key = symbol_shorthand.X(0)\n",
"l1_key = symbol_shorthand.L(1)\n",
"X = symbol_shorthand.X\n",
"L = symbol_shorthand.L\n",
"\n",
"print(f\"Symbol('x', 0).key() == gtsam.symbol_shorthand.X(0): {Symbol('x', 0).key() == x0_key}\")\n",
"print(f\"Symbol('l', 1).key() == gtsam.symbol_shorthand.L(1): {Symbol('l', 1).key() == l1_key}\")"
"print(f\"Symbol('x', 0).key() == X(0): {Symbol('x', 0).key() == X(0)}\")\n",
"print(f\"Symbol('l', 1).key() == L(1): {Symbol('l', 1).key() == L(1)}\")"
]
}
],