Algebra¶
flapjax.algebra ¶
array_utils ¶
ArrayList ¶
ArrayList(arrs: Sequence[Array])
Class to hold a sequence of arrays, with overloaded arithmetic operations. This allows for more elegant handling of non-uniform arrays in various calculations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arrs
|
Sequence[Array]
|
Sequence of arrays to hold. |
required |
Source code in src/flapjax/algebra/array_utils.py
148 149 | |
shape
property
¶
shape: ArrayListShape
Get the shapes of the arrays in the ArrayList.
Returns:
| Type | Description |
|---|---|
ArrayListShape
|
ArrayListShape containing the shapes of the arrays in the ArrayList. |
to_list ¶
to_list() -> list[Array]
Convert the ArrayList to a standard Python list of arrays.
Returns:
| Type | Description |
|---|---|
list[Array]
|
List of arrays. |
Source code in src/flapjax/algebra/array_utils.py
200 201 202 203 204 205 | |
at ¶
at(idx: int) -> Array
Get the array at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx
|
int
|
Index of the array to get. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Array at the given index. |
Source code in src/flapjax/algebra/array_utils.py
207 208 209 210 211 212 213 | |
ravel ¶
ravel() -> Array
Flatten the sequence of arrays into a single 1D array.
Returns:
| Type | Description |
|---|---|
Array
|
Flattened 1D array. |
Source code in src/flapjax/algebra/array_utils.py
221 222 223 224 225 226 | |
from_vector
classmethod
¶
from_vector(
vect: Array, shapes: ArrayListShape
) -> ArrayList
Unravel a 1D vector into a sequence of arrays with the given shapes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vect
|
Array
|
Input 1D vector to unravel. |
required |
shapes
|
ArrayListShape
|
ArrayListShape containing the shapes of the arrays to unravel into. |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
ArrayList containing the unravelled arrays. |
Source code in src/flapjax/algebra/array_utils.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
index_all ¶
index_all(
*idx: EllipsisType | int | slice | Array | None,
) -> ArrayList
Get the value of all arrays at the given index. This is equivalent to self[i][idx] for i in range(varphi).
Source code in src/flapjax/algebra/array_utils.py
251 252 253 254 255 256 257 258 | |
einsum
staticmethod
¶
einsum(subscript: str, *operands: ArrayList) -> ArrayList
Perform Einstein summation on sequences of arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subscript
|
str
|
Subscript for Einstein summation. This does not include the indices for the sequence dimension. |
required |
operands
|
ArrayList
|
Sequences of arrays to perform Einstein summation on. |
()
|
Returns:
| Type | Description |
|---|---|
ArrayList
|
Sequence of arrays resulting from Einstein summation. |
Source code in src/flapjax/algebra/array_utils.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
zeros_like
staticmethod
¶
zeros_like(arr: ArrayList) -> ArrayList
Create a new ArrayList with the same shape as the input_, but filled with zeros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
ArrayList
|
Input ArrayList to create zeros like. |
required |
Returns:
| Type | Description |
|---|---|
ArrayList
|
New ArrayList filled with zeros. |
Source code in src/flapjax/algebra/array_utils.py
280 281 282 283 284 285 286 287 | |
ArrayListShape ¶
ArrayListShape(shapes: Sequence[tuple[int, ...]])
Class to hold the shapes of the arrays in an ArrayList. This is used for indexing and reshaping operations.
Source code in src/flapjax/algebra/array_utils.py
307 308 309 310 | |
total_size ¶
total_size() -> int
Get the total number of entries in the ArrayList.
Source code in src/flapjax/algebra/array_utils.py
324 325 326 327 328 | |
check_arr_shape ¶
check_arr_shape(
arr: Array,
expected_shape: tuple[int | None, ...],
name: str | None,
) -> None
Asserts that the shape of the given array matches the expected shape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Input array to check. |
required |
expected_shape
|
tuple[int | None, ...]
|
Expected shape of the array, as a tuple of integers, with None used for dimensions that can be of any size. |
required |
name
|
str | None
|
Name of the input array. This is used to provide more informative error messages. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the shape of the array does not match the expected shape. |
Source code in src/flapjax/algebra/array_utils.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
check_arr_ndim ¶
check_arr_ndim(
arr: Array, expected_ndim: int, name: str | None
) -> None
Asserts that the number of dimensions of the given array matches the expected number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Input array to check. |
required |
expected_ndim
|
int
|
Expected number of dimensions of the array. |
required |
name
|
str | None
|
Name of the input array. This is used to provide more informative error messages. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the number of dimensions of the array does not match the expected value. |
Source code in src/flapjax/algebra/array_utils.py
43 44 45 46 47 48 49 50 51 52 53 54 55 | |
check_arr_dtype ¶
check_arr_dtype(
arr: Array, expected_dtype: type, name: str | None
) -> None
Asserts that the data type of the given array matches the expected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Input array to check. |
required |
expected_dtype
|
type
|
Expected underlying data type of the array. |
required |
name
|
str | None
|
Name of the input array. This is used to provide more informative error messages. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the data type of the array does not match the expected type. |
Source code in src/flapjax/algebra/array_utils.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
flatten_to_1d ¶
flatten_to_1d(arrs: Sequence[Array]) -> Array
Convert a list of ND arrays into a single 1D vector by flattening and concatenating
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arrs
|
Sequence[Array]
|
List of arrays to flatten and concatenate |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Single 1D vector |
Source code in src/flapjax/algebra/array_utils.py
81 82 83 84 85 86 87 | |
block_axis ¶
block_axis(
arrs: Sequence[Sequence[Array]], axes: Sequence[int]
) -> Array
Form a block matrix along two given axes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arrs
|
Sequence[Sequence[Array]]
|
Double nested sequence of arrays |
required |
axes
|
Sequence[int]
|
Axes along which to concatenate the arrays |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Block matrix, |
Source code in src/flapjax/algebra/array_utils.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
neighbour_average ¶
neighbour_average(
arr: Array, axes: int | Sequence[int]
) -> Array
Find the pairwise average of the array along the specified axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Input array to average. |
required |
axes
|
int | Sequence[int]
|
Axis or axes along which to average. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Averaged array. |
Source code in src/flapjax/algebra/array_utils.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
split_to_vertex ¶
split_to_vertex(
arr: Array, axes: int | Sequence[int]
) -> Array
Split the array into its vertex components along the specified axes. This corresponds to the process of splitting the forcing generated by a panel into its four corners.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
Array
|
Input array to split, or equivalent ArrayList. |
required |
axes
|
int | Sequence[int]
|
Axis or axes along which to split. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Array with vertex components. |
Source code in src/flapjax/algebra/array_utils.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
vect_to_arrs ¶
vect_to_arrs(
vect: Array,
shapes: OrderedDict[
str, tuple[int, ...] | ArrayListShape | None
],
) -> OrderedDict[str, Array | ArrayList | None]
Reconstruct a dictionary with a combination of key-Array and key-ArrayList pairs. The shapes of the arrays and array lists are specified in the shapes argument, which is an ordered dictionary mapping
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vect
|
Array
|
Data vector. |
required |
shapes
|
OrderedDict[str, tuple[int, ...] | ArrayListShape | None]
|
Shapes for unflattened data. |
required |
Returns:
| Type | Description |
|---|---|
OrderedDict[str, Array | ArrayList | None]
|
Ordered dictionary of unflattened data. |
Source code in src/flapjax/algebra/array_utils.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
construct_named_block_jacobian ¶
construct_named_block_jacobian(
entries: tuple[dict, ...],
keys: Sequence[str],
widths: Sequence[int],
heights: Sequence[int],
) -> Array
Assemble a block Jacobian matrix from named partial derivatives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
tuple[dict, ...]
|
One dict per residual, mapping variable names to Jacobians. |
required |
keys
|
Sequence[str]
|
Variable names that define the column blocks. |
required |
widths
|
Sequence[int]
|
Widths of the blocks. |
required |
heights
|
Sequence[int]
|
Heights of the blocks. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Dense 2-D Jacobian assembled from the blocks. |
Source code in src/flapjax/algebra/array_utils.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
base ¶
matrix2 ¶
matrix2(mat: Array) -> Array
Computes the square of a matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mat
|
Array
|
Matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Matrix squared, |
Source code in src/flapjax/algebra/base.py
27 28 29 30 31 32 33 | |
clip_to_pi ¶
clip_to_pi(val: float | Array)
Clips an angle value to be within [-pi, pi].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
val
|
float | Array
|
Scalar to bound. |
required |
Returns:
| Type | Description |
|---|---|
|
Bounded scalar within |
Source code in src/flapjax/algebra/base.py
36 37 38 39 40 41 42 | |
chi ¶
chi(rmat: Array) -> Array
Converts a 3x3 rotation matrix to a 6x6 matrix used in spatial transformations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rmat
|
Array
|
Rotation matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Block matrix with diagonal rotation matrices, |
Source code in src/flapjax/algebra/base.py
45 46 47 48 49 50 51 | |
finite_difference ¶
finite_difference(
i_: int,
data: Array,
delta: Array,
axis: int,
order: int = 1,
) -> Array
Compute the finite difference of the data at a given time step. This assumes that data[:i_+1] is available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_
|
int
|
Index of derivative to obtain. |
required |
data
|
Array
|
Data to compute the finite difference on, (...). |
required |
delta
|
Array
|
Small perturbation value for finite difference, which divides the difference. |
required |
axis
|
int
|
Axis along which to compute the finite difference. |
required |
order
|
int
|
Order of the finite difference (1 or 2). |
1
|
Returns:
| Type | Description |
|---|---|
Array
|
Finite difference of the data at the specified time step. |
Source code in src/flapjax/algebra/base.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
exp_sum ¶
exp_sum(
a: Array, order: int = BASE_SUMMATION_ORDER
) -> Array
Computes the matrix exponential using truncated summation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
Array
|
Algebra matrix to exponentiate, |
required |
order
|
int
|
Order of summation. |
BASE_SUMMATION_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Exponential of matrix, |
Source code in src/flapjax/algebra/base.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
log_sum ¶
log_sum(
g: Array, order: int = BASE_SUMMATION_ORDER
) -> Array
Computes the matrix logarithm using truncated summation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
g
|
Array
|
Group matrix to exponentiate, |
required |
order
|
int
|
Order of summation. |
BASE_SUMMATION_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Logarithm of matrix, |
Source code in src/flapjax/algebra/base.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
t_sum ¶
t_sum(a: Array, order: int = BASE_SUMMATION_ORDER) -> Array
Computes the tangent operator truncated summation. This is used to validate other implementations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
Array
|
Adjoint action matrix, |
required |
order
|
int
|
Order of summation. |
BASE_SUMMATION_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Tangent operator, |
Source code in src/flapjax/algebra/base.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
t_inv_sum ¶
t_inv_sum(
a: Array, order: int = BASE_SUMMATION_ORDER
) -> Array
Computes the inverse tangent operator truncated summation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
Array
|
Adjoint action matrix, |
required |
order
|
int
|
Order of summation. |
BASE_SUMMATION_ORDER
|
Returns:
| Type | Description |
|---|---|
Array
|
Inverse tangent operator, |
Source code in src/flapjax/algebra/base.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
jacrev_kwargs ¶
jacrev_kwargs(
func: Callable[..., Array],
argnames: str | Sequence[str],
allow_int: bool = True,
) -> Callable[..., dict[str, Any]]
Custom reverse Jacobian routine which allows for keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Array]
|
Function for which to obtain Jacobians. Must be callable with the keyword arguments later passed to the returned function. |
required |
argnames
|
str | Sequence[str]
|
Argument names of variables for which to obtain Jacobians. These must be a subset of the keyword argument names provided to the returned function. |
required |
allow_int
|
bool
|
As |
True
|
Returns:
| Type | Description |
|---|---|
Callable[..., dict[str, Any]]
|
Function that accepts keyword arguments and returns a dictionary of argname: Jacobian pairs. |
Source code in src/flapjax/algebra/base.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
jacfwd_kwargs ¶
jacfwd_kwargs(
func: Callable[..., Array],
argnames: str | Sequence[str],
) -> Callable[..., dict[str, Any]]
Forward-mode counterpart of :func:jacrev_kwargs. Prefer this when the input dimension for the selected
arguments is smaller than the output dimension of func, which happens for design-variable Jacobians and for
dynamic-adjoint residual blocks whose input state size is smaller than the residual dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Array]
|
Function for which to obtain Jacobians. |
required |
argnames
|
str | Sequence[str]
|
Argument names of variables for which to obtain Jacobians. |
required |
Returns:
| Type | Description |
|---|---|
Callable[..., dict[str, Any]]
|
Function that accepts keyword arguments and returns a dictionary of argname: Jacobian pairs. |
Source code in src/flapjax/algebra/base.py
190 191 192 193 194 195 196 197 198 199 200 201 202 | |
jacrev_custom ¶
jacrev_custom(
func: Callable[..., Array],
jac_options: dict[
str, Callable[[dict[str, Any]], Array] | None
],
n_profile_loops: int | None,
func_name: str,
static_argnames: Sequence[str] = (),
mode: ADMode = "reverse",
map_batch_size: int | None = None,
) -> Callable[
...,
tuple[
dict[str, Any],
dict[str, float] | None,
dict[str, float] | None,
],
]
Obtain the Jacobians of the function func with respect to a chosen set of arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Array]
|
Function for which to obtain the Jacobians. |
required |
jac_options
|
dict[str, Callable[[dict[str, Any]], Array] | None]
|
Dictionary with variable names as keys, with values being a tuple of the argument number in
|
required |
n_profile_loops
|
int | None
|
Number of profile loops. If None, no profiling is done. |
required |
func_name
|
str
|
Name of the function to be called, used for console prints during profiling. |
required |
static_argnames
|
Sequence[str]
|
Argument names to treat as static when JIT-compiling the AD Jacobian. Needed so the profile loop hits a cached jaxpr instead of re-tracing on every call. |
()
|
mode
|
ADMode
|
|
'reverse'
|
map_batch_size
|
int | None
|
When set, batch passes to obtain Jacobian rather than vmapping, reducing memory at the expense of computation time. |
None
|
Returns:
| Type | Description |
|---|---|
Callable[..., tuple[dict[str, Any], dict[str, float] | None, dict[str, float] | None]]
|
Function to obtain Jacobians, as well as respective compile and run times for
Jacobians if |
Source code in src/flapjax/algebra/base.py
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |
jacobian_approximation ¶
jacobian_approximation(
func: Callable[..., Any],
args: Any,
approx_type: Literal[
"zero",
"constant",
"identity",
"dense_linear",
"lazy_linear",
]
| None,
jacobian_argname: str,
hessian_argnames: str | Sequence[str],
) -> Callable[..., Any] | None
Compute approximations of Jacobians. The following options for approximation are available:
None - No approximation is computed.
zero - Assume that the Jacobian is zero.
identity - Assume that the Jacobian is the identity matrix. Valid only for 2D square entries.
constant - Assume that the Jacobian is constant across all time steps.
Alongside these, options are also available to compute the Jacobians by a linear approximation by using a
Hessian-vector product, where the Hessian is constant. This introduces additional options:
dense_linear - The dense Hessian is explicitly computed, which increases memory cost but reduces computation cost.
lazy_linear - Uses the JAX linearise routine, which avoids explicitly computing the dense Hessian, which reduces
memory cost at the expense of increased computation cost.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Any]
|
Function for which Jacobians are to be computed. |
required |
args
|
Any
|
Arguments for |
required |
approx_type
|
Literal['zero', 'constant', 'identity', 'dense_linear', 'lazy_linear'] | None
|
Type of approximation to be used to compute Jacobians. Options are "constant", "dense_linear" or "lazy_linear". If None, no approximation is computed. |
required |
jacobian_argname
|
str
|
Argument which the function Jacobian is to be computed with respect to. |
required |
hessian_argnames
|
str | Sequence[str]
|
Argument names which the Jacobian is linearised with respect to for computing Hessian-vector products. |
required |
Returns:
| Type | Description |
|---|---|
Callable[..., Any] | None
|
Function which approximates the Jacobian which takes the same arguments as |
Source code in src/flapjax/algebra/base.py
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
integration ¶
gauss_lobatto ¶
gauss_lobatto(
f: Callable[[Array], Array],
bounds: Array,
f_bounds: Array,
int_order: Literal[3, 4, 5],
) -> Array
Integrate using quadrature with Gauss-Lobatto points. Makes use of function values at the bounds. See https://en.wikipedia.org/wiki/Gaussian_quadrature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
Callable[[Array], Array]
|
Function to integrate (must support vector mapping), () -> (...). |
required |
bounds
|
Array
|
Scalar bounds of integration in function space, |
required |
f_bounds
|
Array
|
values of function at the bounds, |
required |
int_order
|
Literal[3, 4, 5]
|
Order of integration, 3, 4, or 5. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Integrated value, (...). |
Source code in src/flapjax/algebra/integration.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
gauss_legendre ¶
gauss_legendre(
f: Callable[[Array], Array],
bounds: Array,
int_order: Literal[1, 2, 3],
) -> Array
Integrate using quadrature with Gauss-Legendre points. See https://en.wikipedia.org/wiki/Gaussian_quadrature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
Callable[[Array], Array]
|
Function to integrate (must support vector mapping), () -> (...). |
required |
bounds
|
Array
|
Scalar bounds of integration in function space, |
required |
int_order
|
Literal[1, 2, 3]
|
Order of integration. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Integrated value, (...). |
Source code in src/flapjax/algebra/integration.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
se3 ¶
bracket_se3 ¶
bracket_se3(a_vec: Array, b_vec: Array) -> Array
Computes the Lie bracket of two se(3) elements, :math:\tilde{a}\tilde{b} - \tilde{b}\tilde{a}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a_vec
|
Array
|
Lie algebra vector in se(3), |
required |
b_vec
|
Array
|
Lie algebra vector in se(3), |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Lie bracket, |
Source code in src/flapjax/algebra/se3.py
21 22 23 24 25 26 27 28 29 30 31 | |
bracket_neg_se3 ¶
bracket_neg_se3(a_vec: Array, b_vec: Array) -> Array
Computes the negative Lie bracket of two se(3) elements, :math:\tilde{a}\tilde{b} + \tilde{b}\tilde{a}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a_vec
|
Array
|
Lie algebra vector in se(3), |
required |
b_vec
|
Array
|
Lie algebra vector in se(3), |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Negative lie bracket, |
Source code in src/flapjax/algebra/se3.py
34 35 36 37 38 39 40 41 42 43 44 | |
t_u_omega_plus ¶
t_u_omega_plus(ha: Array) -> Array
Computes the :math:\mathbf{T}_{U \omega+} matrix, used for computing the tangent application for SE(3). Formulation
from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.12
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
Vector in se(3), |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Operator, |
Source code in src/flapjax/algebra/se3.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
t_u_omega_minus ¶
t_u_omega_minus(ha: Array) -> Array
Computes the :math:\mathbf{T}_{U \omega-} matrix, used for computing the inverse tangent application for se(3).
Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by
Sonneville et al., 2013, Eq A.14. This can be represented in terms of :math:\mathbf{T}_{U \omega+} and the
inverse of the SO(3) tangent operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
Vector in se(3), |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Operator, |
Source code in src/flapjax/algebra/se3.py
85 86 87 88 89 90 91 92 93 94 95 96 | |
t_se3 ¶
t_se3(ha: Array) -> Array
Computes the tangent operator for se(3). Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.11.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
se(3) vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent operator, |
Source code in src/flapjax/algebra/se3.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
t_inv_se3 ¶
t_inv_se3(ha: Array) -> Array
Computes the inverse tangent operator for se(3). Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.13.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
se(3) algebra vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Inverse angent operator, |
Source code in src/flapjax/algebra/se3.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
log_se3 ¶
log_se3(hg: Array) -> Array
Computes the logarithm map from SE(3) to se(3). Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.15.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
SE(3) group element, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) algebra vector, |
Source code in src/flapjax/algebra/se3.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
exp_se3 ¶
exp_se3(ha: Array) -> Array
Computes the exponential map from se(3) to SE(3). Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.10.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
se(3) algebra vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
SE(3) group element, |
Source code in src/flapjax/algebra/se3.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
x_rmat_to_hg ¶
x_rmat_to_hg(x: Array, rmat: Array) -> Array
Combines a translation vector and rotation matrix into an element of the SE(3) group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Translation vector, |
required |
rmat
|
Array
|
Rotation matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
SE(3) group element, |
Source code in src/flapjax/algebra/se3.py
180 181 182 183 184 185 186 187 | |
x_rmat_to_ha ¶
x_rmat_to_ha(x: Array, rmat: Array) -> Array
Combines a translation vector and rotation matrix into an element of the se(3) algebra.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Translation vector, |
required |
rmat
|
Array
|
Rotation matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) algebra vector, |
Source code in src/flapjax/algebra/se3.py
190 191 192 193 194 195 196 197 | |
hg_to_x_rmat ¶
hg_to_x_rmat(hg: Array) -> tuple[Array, Array]
Decomposes an SE(3) group element into a translation vector and rotation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
SE(3) group element, |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Translation vector, |
Source code in src/flapjax/algebra/se3.py
200 201 202 203 204 205 206 | |
vect_product ¶
vect_product(hg: Array, x: Array) -> Array
Computes the resulting vector of an SE(3) group element and a 3D translation vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
SE(3) group element, |
required |
x
|
Array
|
Translation vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Resulting translation vector, |
Source code in src/flapjax/algebra/se3.py
209 210 211 212 213 214 215 216 | |
hg_inv ¶
hg_inv(hg: Array) -> Array
Computes the inverse of an SE(3) group element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
SE(3) group element, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Inverse SE(3) group element, |
Source code in src/flapjax/algebra/se3.py
219 220 221 222 223 224 225 226 227 228 | |
ha_to_ha_tilde ¶
ha_to_ha_tilde(ha: Array) -> Array
Converts a se(3) vector into its matrix representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
se(3) algebra vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) algebra element in matrix form, |
Source code in src/flapjax/algebra/se3.py
231 232 233 234 235 236 237 | |
ha_tilde_to_ha ¶
ha_tilde_to_ha(ha_tilde: Array) -> Array
Converts a se(3) element matrix into its vector representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_tilde
|
Array
|
se(3) algebra element in matrix form, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) algebra vector, |
Source code in src/flapjax/algebra/se3.py
240 241 242 243 244 245 246 247 248 | |
ha_to_ha_hat ¶
ha_to_ha_hat(ha: Array) -> Array
Converts a se(3) vector into its hat matrix representation. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 15.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
se(3) algebra vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Hat matrix representation, |
Source code in src/flapjax/algebra/se3.py
251 252 253 254 255 256 257 258 259 260 261 262 263 | |
rmat_to_ha_hat ¶
rmat_to_ha_hat(rmat: Array) -> Array
Converts a rotation matrix into its hat matrix representation in se(3) with zero translation. Formulation from "A geometric local frame approach for flexible multibody systems", by Sonneville, 2015, Eq 1.50, p. 15.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rmat
|
Array
|
Rotation matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Hat matrix representation, |
Source code in src/flapjax/algebra/se3.py
266 267 268 269 270 271 272 273 | |
ha_hat_to_ha ¶
ha_hat_to_ha(ha_hat: Array) -> Array
Converts a se(3) hat matrix representation into se(3) vector. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 15.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_hat
|
Array
|
Hat matrix representation, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) vector, |
Source code in src/flapjax/algebra/se3.py
276 277 278 279 280 281 282 283 284 285 | |
ha_to_ha_check ¶
ha_to_ha_check(ha: Array) -> Array
Converts a se(3) vector into its check matrix representation. Formulation from "Geometrically exact beam finite element formulated on the special Euclidean group SE(3)", by Sonneville, 2014, Eq 16.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha
|
Array
|
se(3) algebra vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Check matrix representation, |
Source code in src/flapjax/algebra/se3.py
288 289 290 291 292 293 294 295 296 297 298 299 300 | |
hg_to_ha_hat ¶
hg_to_ha_hat(hg: Array) -> Array
Converts an SE(3) group element into its se(3) hat matrix representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
SE(3) group element, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) hat matrix representation, |
Source code in src/flapjax/algebra/se3.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
hg_to_d ¶
hg_to_d(hg1: Array, hg2: Array) -> Array
Obtains the relative configuration vector between two SE(3) group elements. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 56.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg1
|
Array
|
Base SE(3) group element at s=0, |
required |
hg2
|
Array
|
Tip SE(3) group element at s=L, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
se(3) relative configuration vector, |
Source code in src/flapjax/algebra/se3.py
320 321 322 323 324 325 326 327 328 | |
p ¶
p(d: Array, ad_inv: Array) -> Array
Computes the :math:\mathbf{P}(\mathbf{d}) = \frac{d \mathbf{d}}{d \mathbf{h}_{AB}} matrix. Formulation
from "A geometric local frame approach for flexible multibody systems", by Sonneville, 2015, Eq 6.141, p. 90.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Relative se(3) configuration vector, |
required |
ad_inv
|
Array
|
Adjoint action for rotation, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Matrix, |
Source code in src/flapjax/algebra/se3.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
t_star ¶
t_star(s_l: Array, d: Array) -> Array
Matrix which described perturbations in the algebra element along an element with respect to the algebra elements at
both ends of the element, :math:T^*(s, \mathbf{d}) = \frac{d \mathbf{h}(s)}{d \mathbf{h}_A} or
:math:\frac{d \mathbf{h}(s)}{d \mathbf{h}_B}. Formulation from Geometrically exact beam finite element
formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq 70.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_l
|
Array
|
Relative position along the element :math: |
required |
d
|
Array
|
Relative se(3) configuration vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
:math: |
Source code in src/flapjax/algebra/se3.py
349 350 351 352 353 354 355 356 357 358 359 | |
q ¶
q(s_l: Array, d: Array, ad_inv: Array) -> Array
Matrix which described perturbations in the algebra element along an element with respect to the algebra elements at
both ends of the element, :math:Q(s, \mathbf{d}) = [\mathbf{I}_{6 \times 6} - T^*(s, \mathbf{d}) &
T^*(s, \mathbf{d})]. Formulation from "A geometric local frame approach for flexible multibody systems",
by Sonneville, 2015, Eq 6.145, p. 90.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_l
|
Array
|
Relative position along the element :math: |
required |
d
|
Array
|
Relative se(3) configuration vector, |
required |
ad_inv
|
Array
|
Adjoint action for base rotation, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
:math: |
Source code in src/flapjax/algebra/se3.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
q_dot ¶
q_dot(
s_l: Array, d: Array, d_dot: Array, ad_inv: Array
) -> Array
Time derivative of the matrix which described perturbations in the algebra element along an element with respect to
the algebra elements at both ends of the element, :math:\dot{Q}(s, \mathbf{d}).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s_l
|
Array
|
Relative position along the element :math: |
required |
d
|
Array
|
Relative se(3) configuration vector, |
required |
d_dot
|
Array
|
Time derivative of relative se(3) configuration vector, |
required |
ad_inv
|
Array
|
Adjoint action for base rotation, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Time derivative of :math: |
Source code in src/flapjax/algebra/se3.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
so3 ¶
vec_to_skew ¶
vec_to_skew(vec: Array) -> Array
Converts a 3D vector to a skew-symmetric matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec
|
Array
|
3D vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Skew-symmetric matrix, |
Source code in src/flapjax/algebra/so3.py
9 10 11 12 13 14 15 16 17 | |
skew_to_vec ¶
skew_to_vec(mat: Array) -> Array
Converts a skew-symmetric matrix to a 3D vector. Note this refers to both skew symmetric entries for consistent gradients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mat
|
Array
|
Skew-symmetric matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
3D vector, |
Source code in src/flapjax/algebra/so3.py
20 21 22 23 24 25 26 27 28 29 30 31 | |
alpha ¶
alpha(b: Array) -> Array
Computes the alpha function for SO(3) operations. This includes a small angle approximation as b approaches zero. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.4
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
Array
|
Input vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Alpha value, (). |
Source code in src/flapjax/algebra/so3.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
beta ¶
beta(b: Array) -> Array
Computes the beta function for SO(3) operations. This includes a small angle approximation as b approaches zero. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.4.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
Array
|
Input vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Beta value, () |
Source code in src/flapjax/algebra/so3.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
bound_h_omega ¶
bound_h_omega(h_omega: Array) -> Array
Bounds the angle of a rotation vector to be within [-pi, pi].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h_omega
|
Array
|
Cartesian rotation vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Bounded Cartesian rotation vector, |
Source code in src/flapjax/algebra/so3.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
bracket_so3 ¶
bracket_so3(vec1: Array, vec2: Array) -> Array
Computes the Lie bracket of two so(3) elements represented as vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec1
|
Array
|
Vector 1, |
required |
vec2
|
Array
|
Vector 2, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Lie bracket, |
Source code in src/flapjax/algebra/so3.py
92 93 94 95 96 97 98 99 100 101 102 | |
bracket_neg_so3 ¶
bracket_neg_so3(vec1: Array, vec2: Array) -> Array
Computes the negative Lie bracket of two so(3) elements represented as vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec1
|
Array
|
Vector 1, |
required |
vec2
|
Array
|
Vector 2, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Negative Lie bracket, |
Source code in src/flapjax/algebra/so3.py
105 106 107 108 109 110 111 112 113 114 115 | |
t_so3 ¶
t_so3(ha_omega: Array) -> Array
Computes the tangent operator for SO(3) given a rotation vector. Includes a small angle approximation as the rotation approaches zero. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_omega
|
Array
|
Rotation vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tangent operator, |
Source code in src/flapjax/algebra/so3.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
t_inv_so3 ¶
t_inv_so3(ha_omega: Array) -> Array
Computes the inverse tangent operator for SO(3) given a rotation vector. Includes a small angle approximation as the rotation approaches zero. Formulation from Geometrically exact beam finite element formulated on the special Euclidean group SE(3), by Sonneville et al., 2013, Eq A.7
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_omega
|
Array
|
Rotation vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Inverse tangent operator, |
Source code in src/flapjax/algebra/so3.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
exp_so3 ¶
exp_so3(ha_omega: Array) -> Array
Computes the exponential map from so(3) to SO(3) given a rotation vector. Includes a small angle approximation as the angle approaches zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_omega
|
Array
|
Rotation vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Rotation matrix, |
Source code in src/flapjax/algebra/so3.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
log_so3 ¶
log_so3(rmat: Array) -> Array
Computes the logarithmic map from SO(3) to so(3) given a rotation matrix. Includes a small angle approximation as the angle approaches zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rmat
|
Array
|
Rotation matrix, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Rotation vector, |
Source code in src/flapjax/algebra/so3.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
test_routines ¶
check_if_so3_g ¶
check_if_so3_g(
rmat: Array, raise_if_false: bool = True
) -> bool
Check if rotation matrix is a valid SO3 group element
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rmat
|
Array
|
Rotation matrix, |
required |
raise_if_false
|
bool
|
If the check fails, raise ValueError |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if matrix is SO3 |
Source code in src/flapjax/algebra/test_routines.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
check_if_so3_a ¶
check_if_so3_a(
h_tilde: Array, raise_if_false: bool = True
) -> bool
Check if rotation matrix is a valid so3 algebra element
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h_tilde
|
Array
|
Algebra matrix, |
required |
raise_if_false
|
bool
|
If the check fails, raise ValueError |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if matrix is so3 |
Source code in src/flapjax/algebra/test_routines.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
check_if_se3_g ¶
check_if_se3_g(
hg: Array, raise_if_false: bool = True
) -> bool
Check if matrix is a valid SE3 group element
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hg
|
Array
|
SE(3) matrix, |
required |
raise_if_false
|
bool
|
If the check fails, raise ValueError |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if matrix is SE(3) |
Source code in src/flapjax/algebra/test_routines.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
check_if_all_se3_g ¶
check_if_all_se3_g(
hgs: Array, raise_if_false: bool = True
) -> bool
Check if array of matrices are valid SE3 group elements
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hgs
|
Array
|
SE(3) matrices, |
required |
raise_if_false
|
bool
|
If the check fails, raise ValueError |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if all matrices are SE(3) |
Source code in src/flapjax/algebra/test_routines.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
check_if_se3_a ¶
check_if_se3_a(
h_tilde: Array, raise_if_false: bool = True
) -> bool
Check if matrix is a valid se(3) group element
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h_tilde
|
Array
|
se(3) matrix, |
required |
raise_if_false
|
bool
|
If the check fails, raise ValueError |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if matrix is se(3) |
Source code in src/flapjax/algebra/test_routines.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
check_if_all_se3_a ¶
check_if_all_se3_a(
h_tildes: Array, raise_if_false: bool = True
) -> bool
Check if array of matrices are valid se(3) algebra elements
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h_tildes
|
Array
|
se(3) matrices, |
required |
raise_if_false
|
bool
|
If the check fails, raise ValueError |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean indicating if all matrices are se(3) |
Source code in src/flapjax/algebra/test_routines.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
k_t_expected ¶
k_t_expected(
coeffs: Array | Sequence[float], length: Array | float
) -> Array
Compute expected two-node beam undeformed element stiffness matrix given coefficients and length
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeffs
|
Array | Sequence[float]
|
Stiffness coefficients which make up the diagonal of the local stiffness matrix, |
required |
length
|
Array | float
|
Beam length, () |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Beam tangent stiffness matrix, |
Source code in src/flapjax/algebra/test_routines.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
const_curvature_beam ¶
const_curvature_beam(
kappa: float | Array,
s: float | Array,
direction: Literal["y", "z"],
) -> Array
For a beam with constant curvature, with base node at the origin and curvature in the positive z direction (i.e., existing in the x_target-y plane with z=0), obtain the coordinates along the beam length for
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kappa
|
float | Array
|
Curvature of the element, |
required |
s
|
float | Array
|
Position along the beam length, |
required |
direction
|
Literal['y', 'z']
|
Direction of moment applied, either |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Coordinate of point along the beam, |
Source code in src/flapjax/algebra/test_routines.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
get_curvature ¶
get_curvature(d: Array) -> Array
Obtain curvature from relative configuration vector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Relative configuration vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Curvature of neutral axis, () |
Source code in src/flapjax/algebra/test_routines.py
265 266 267 268 269 270 271 | |
get_torsion ¶
get_torsion(d: Array) -> Array
Obtain torsion from relative configuration vector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
Array
|
Relative configuration vector, |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Torsion of neutral axis, () |
Source code in src/flapjax/algebra/test_routines.py
274 275 276 277 278 279 280 | |