Merge pull request #2100 from borglab/docs-minor-updates

Docs minor updates
release/4.3a0
Frank Dellaert 2025-04-17 12:35:06 -04:00 committed by GitHub
commit d4f5f37a1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 674 additions and 684 deletions

View File

@ -39,7 +39,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -30,7 +30,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -1,45 +1,31 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"source": [
"# Rot2"
],
"metadata": {
"id": "-3NPWeM5nKTz"
}
},
"source": [
"# Rot2"
]
},
{
"cell_type": "markdown",
"source": [
"A `gtsam.Rot2` represents rotation in 2D space. It models a 2D rotation in the Special Orthogonal Group $\\text{SO}(2)$."
],
"metadata": {
"id": "zKQLwRQWvRAW"
}
},
"source": [
"A `gtsam.Rot2` represents rotation in 2D space. It models a 2D rotation in the Special Orthogonal Group $\\text{SO}(2)$."
]
},
{
"cell_type": "markdown",
"source": [
"<a href=\"https://colab.research.google.com/github/borglab/gtsam/blob/develop/gtsam/geometry/doc/Rot2.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
],
"metadata": {
"id": "1MUA6xip5fG4"
}
},
"source": [
"<a href=\"https://colab.research.google.com/github/borglab/gtsam/blob/develop/gtsam/geometry/doc/Rot2.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
@ -49,41 +35,70 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{
"cell_type": "code",
"source": [
"from gtsam import Rot2, Point2\n",
"import numpy as np"
],
"execution_count": 6,
"metadata": {
"id": "-dp28DoR7WsD"
},
"execution_count": 6,
"outputs": []
"outputs": [],
"source": [
"from gtsam import Rot2, Point2\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"source": [
"## Initialization and properties"
],
"metadata": {
"id": "gZRXZTrJ7mqJ"
}
},
"source": [
"## Initialization and properties"
]
},
{
"cell_type": "markdown",
"source": [
"A `Rot2` can be initialized with no arguments, which yields the identity rotation, or it can be constructed from an angle in radians, degrees, cos-sin form, or the bearing or arctangent of a 2D point. `Rot2` uses radians to communicate angle by default."
],
"metadata": {
"id": "PK-HWTDm7sU4"
}
},
"source": [
"A `Rot2` can be initialized with no arguments, which yields the identity rotation, or it can be constructed from an angle in radians, degrees, cos-sin form, or the bearing or arctangent of a 2D point. `Rot2` uses radians to communicate angle by default."
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "oIakIOAB9afi",
"outputId": "c2cb005d-056f-4a4f-b5ff-2226be1ba3e7"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Identities:\n",
"0.0\n",
"0.0\n",
"Radians:\n",
"1.5707963267948966\n",
"1.5707963267948966\n",
"Degrees:\n",
"1.5707963267948966\n",
"Cos-Sin:\n",
"0.5235987755982988\n",
"Bearing:\n",
"0.7853981633974483\n",
"0.7853981633974483\n"
]
}
],
"source": [
"# The identity rotation has theta = 0.\n",
"identity = Rot2()\n",
@ -118,39 +133,13 @@
"# Or with atan2(y, x), which accomplishes the same thing.\n",
"atan = Rot2.atan2(p[1], p[0])\n",
"print(atan.theta())"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "oIakIOAB9afi",
"outputId": "c2cb005d-056f-4a4f-b5ff-2226be1ba3e7"
},
"execution_count": 58,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Identities:\n",
"0.0\n",
"0.0\n",
"Radians:\n",
"1.5707963267948966\n",
"1.5707963267948966\n",
"Degrees:\n",
"1.5707963267948966\n",
"Cos-Sin:\n",
"0.5235987755982988\n",
"Bearing:\n",
"0.7853981633974483\n",
"0.7853981633974483\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "rHovUXbUys5r"
},
"source": [
"The following properties are available from the standard interface:\n",
"- `theta()` (in radians)\n",
@ -161,25 +150,11 @@
"\\cos\\theta & -\\sin\\theta \\\\\n",
"\\sin\\theta & \\cos\\theta\n",
"\\end{bmatrix}$)"
],
"metadata": {
"id": "rHovUXbUys5r"
}
]
},
{
"cell_type": "code",
"source": [
"example_rot = Rot2(3 * np.pi / 4)\n",
"\n",
"# The default print statement includes 'theta: ' and a newline at the end.\n",
"print(example_rot)\n",
"\n",
"print(f\"Radians: {example_rot.theta()}\")\n",
"print(f\"Degrees: {example_rot.degrees()}\")\n",
"print(f\"Cosine: {example_rot.c()}\")\n",
"print(f\"Sine: {example_rot.s()}\")\n",
"print(f\"Matrix:\\n{example_rot.matrix()}\")\n"
],
"execution_count": 18,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@ -187,11 +162,10 @@
"id": "P5OXTjFu2DeX",
"outputId": "70848419-c055-44bc-de11-08e8f93fe3bf"
},
"execution_count": 18,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"theta: 2.35619\n",
"\n",
@ -204,28 +178,59 @@
" [ 0.70710678 -0.70710678]]\n"
]
}
],
"source": [
"example_rot = Rot2(3 * np.pi / 4)\n",
"\n",
"# The default print statement includes 'theta: ' and a newline at the end.\n",
"print(example_rot)\n",
"\n",
"print(f\"Radians: {example_rot.theta()}\")\n",
"print(f\"Degrees: {example_rot.degrees()}\")\n",
"print(f\"Cosine: {example_rot.c()}\")\n",
"print(f\"Sine: {example_rot.s()}\")\n",
"print(f\"Matrix:\\n{example_rot.matrix()}\")\n"
]
},
{
"cell_type": "markdown",
"source": [
"## Basic operations"
],
"metadata": {
"id": "PpqHUDnl5rTW"
}
},
"source": [
"## Basic operations"
]
},
{
"cell_type": "markdown",
"source": [
"For basic use, a `Rot2` can rotate and unrotate a point."
],
"metadata": {
"id": "sa4qx58n5tG9"
}
},
"source": [
"For basic use, a `Rot2` can rotate and unrotate a point."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "yaBKjGn05_-c",
"outputId": "fb89fe09-b2b8-496d-e835-f379d197a4eb"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rotated: [-2.82842712e+00 2.22044605e-16]\n",
"Unrotated: [-2. 2.]\n",
"Unrotated again: [-2.22044605e-16 2.82842712e+00]\n"
]
}
],
"source": [
"rot = Rot2.fromDegrees(45)\n",
"p = Point2(-2, 2)\n",
@ -237,38 +242,37 @@
"print(f\"Unrotated: {rot.unrotate(rotated)}\")\n",
"# Of course, unrotating a point you didn't rotate just rotates it backwards.\n",
"print(f\"Unrotated again: {rot.unrotate(p)}\")"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "yaBKjGn05_-c",
"outputId": "fb89fe09-b2b8-496d-e835-f379d197a4eb"
},
"execution_count": 25,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Rotated: [-2.82842712e+00 2.22044605e-16]\n",
"Unrotated: [-2. 2.]\n",
"Unrotated again: [-2.22044605e-16 2.82842712e+00]\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"Also, the `equals()` function allows for comparison of two `Rot2` objects with a tolerance."
],
"metadata": {
"id": "RVFCoBpW6Bvh"
}
},
"source": [
"Also, the `equals()` function allows for comparison of two `Rot2` objects with a tolerance."
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "m74YbK5h6CPU",
"outputId": "1b16695e-cdfe-4348-875f-c41d8b4a3b26"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n",
"False\n"
]
}
],
"source": [
"eq_rads = Rot2(np.pi / 4)\n",
"eq_degs = Rot2.fromDegrees(45)\n",
@ -277,48 +281,60 @@
"\n",
"# Direct comparison does not work for Rot2.\n",
"print(eq_rads == eq_degs)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "m74YbK5h6CPU",
"outputId": "1b16695e-cdfe-4348-875f-c41d8b4a3b26"
},
"execution_count": 31,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"True\n",
"False\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"## Lie group $\\text{SO}(2)$"
],
"metadata": {
"id": "ko9KSZgd4bCp"
}
},
"source": [
"## Lie group $\\text{SO}(2)$"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "76D2KkX241zX"
},
"source": [
"### Group operations\n",
"\n",
"`Rot2` implements the group operations `inverse`, `compose`, `between` and `identity`. For more information on groups and their use here, see [GTSAM concepts](https://gtsam.org/notes/GTSAM-Concepts.html)."
],
"metadata": {
"id": "76D2KkX241zX"
}
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "QZ_NTeXK87Wq",
"outputId": "12af920d-8f86-473d-88ab-ee57d316cb72"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Inverse:\n",
"theta: -0.523599\n",
"\n",
"Compose:\n",
"theta: 1.5708\n",
"\n",
"theta: 1.5708\n",
"\n",
"Between:\n",
"theta: 0.523599\n",
"\n",
"Identity:\n",
"theta: 0\n",
"\n"
]
}
],
"source": [
"a = Rot2(np.pi / 6)\n",
"b = Rot2(np.pi / 3)\n",
@ -340,51 +356,44 @@
"# The identity is theta = 0, as above.\n",
"print(\"Identity:\")\n",
"print(Rot2.Identity())"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "QZ_NTeXK87Wq",
"outputId": "12af920d-8f86-473d-88ab-ee57d316cb72"
},
"execution_count": 57,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Inverse:\n",
"theta: -0.523599\n",
"\n",
"Compose:\n",
"theta: 1.5708\n",
"\n",
"theta: 1.5708\n",
"\n",
"Between:\n",
"theta: 0.523599\n",
"\n",
"Identity:\n",
"theta: 0\n",
"\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "YfiYuVpL-cgq"
},
"source": [
"## Lie group operations\n",
"\n",
"`Rot2` implements the Lie group operations for exponential mapping and log mapping. For more information on Lie groups and their use here, see [GTSAM concepts](https://gtsam.org/notes/GTSAM-Concepts.html)."
],
"metadata": {
"id": "YfiYuVpL-cgq"
}
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "4JiDEGqG-van",
"outputId": "56047f8d-3349-4ee6-e73c-cd2fa1efb95d"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"theta: 1.5708\n",
"\n",
"theta: 3.14159\n",
"\n",
"[1.57079633]\n",
"[-0.78539816]\n",
"[-0.78539816]\n"
]
}
],
"source": [
"r = Rot2(np.pi / 2)\n",
"w = Rot2(np.pi / 4)\n",
@ -405,30 +414,21 @@
"# logmap is the same as calculating the coordinate of the second Rot2 in the\n",
"# local frame of the first, which localCoordinates (inherited from LieGroup) does.\n",
"print(r.localCoordinates(w))\n"
]
}
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
"provenance": []
},
"id": "4JiDEGqG-van",
"outputId": "56047f8d-3349-4ee6-e73c-cd2fa1efb95d"
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"execution_count": 54,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"theta: 1.5708\n",
"\n",
"theta: 3.14159\n",
"\n",
"[1.57079633]\n",
"[-0.78539816]\n",
"[-0.78539816]\n"
]
"language_info": {
"name": "python"
}
]
}
]
},
"nbformat": 4,
"nbformat_minor": 0
}

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -52,7 +52,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -63,7 +63,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -40,7 +40,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -38,7 +38,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -44,7 +44,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -51,7 +51,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -53,7 +53,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -42,7 +42,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -44,7 +44,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -38,7 +38,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -38,7 +38,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -17,7 +17,7 @@
"source": [
"An `Ordering` specifies the order in which variables are eliminated during inference (e.g., Gaussian elimination, multifrontal QR). The choice of ordering significantly impacts the computational cost and fill-in (sparsity) of the resulting Bayes net or Bayes tree.\n",
"\n",
"GTSAM provides several algorithms to compute good orderings automatically, such as COLAMD and METIS (if available), or allows you to specify a custom ordering."
"GTSAM provides several algorithms to compute good orderings automatically, such as COLAMD and METIS, or allows you to specify a custom ordering."
]
},
{
@ -40,7 +40,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{
@ -139,7 +139,7 @@
"GTSAM provides algorithms to automatically compute an elimination ordering from a factor graph. Two common algorithms are:\n",
"\n",
"1. **COLAMD (Column Approximate Minimum Degree):** A greedy algorithm that aims to minimize *fill-in* at each elimination step. It typically produces orderings that are good for sparse direct methods executed sequentially.\n",
"2. **METIS:** A graph partitioning algorithm (requires METIS library to be installed when compiling GTSAM). It aims to find orderings that partition the graph well, often leading to more balanced elimination trees which can be beneficial for parallel computation and sometimes reduce overall fill-in compared to purely local greedy methods like COLAMD, especially on large, structured problems.\n",
"2. **METIS:** A graph partitioning algorithm. It aims to find orderings that partition the graph well, often leading to more balanced elimination trees which can be beneficial for parallel computation and sometimes reduce overall fill-in compared to purely local greedy methods like COLAMD, especially on large, structured problems.\n",
"\n",
"Let's illustrate the difference using a 2D grid factor graph."
]
@ -391,7 +391,7 @@
"source": [
"### COLAMD Ordering and Resulting Bayes Net\n",
"\n",
"Now, we compute the COLAMD ordering and eliminate the variables according to this order. We then visualize the resulting Symbolic Bayes Net. The structure of the Bayes Net (specifically, the cliques formed by the conditional dependencies) reflects the structure of the elimination tree (or Bayes Tree)."
"Now, we compute the COLAMD ordering and eliminate the variables according to this order."
]
},
{

View File

@ -38,7 +38,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -40,7 +40,7 @@
},
"outputs": [],
"source": [
"%pip install gtsam-develop"
"%pip install --quiet gtsam-develop"
]
},
{

View File

@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "5ccb48e4",
"metadata": {
"tags": [
@ -28,17 +28,7 @@
"languageId": "markdown"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[31mERROR: Could not find a version that satisfies the requirement gtsam-develop (from versions: none)\u001b[0m\u001b[31m\n",
"\u001b[0m\u001b[31mERROR: No matching distribution found for gtsam-develop\u001b[0m\u001b[31m\n",
"\u001b[0mNote: you may need to restart the kernel to use updated packages.\n"
]
}
],
"outputs": [],
"source": [
"%pip install --quiet gtsam-develop"
]