Back

BaseMatrix

The `BaseMatrix` class is an abstract interface in SOFA's linear algebra framework, providing a generic matrix API that allows for operations independently of the underlying linear algebra library. This abstraction ensures that matrices can be used uniformly across different numerical backends and implementations within SOFA. ### Role and Purpose `BaseMatrix` serves as a foundational component for handling matrix operations in SOFA simulations. It defines methods for accessing, modifying, and querying elements of a matrix without concerning itself with the internal representation or storage mechanism. This decoupling enables the use of various efficient matrix representations (e.g., sparse matrices) while maintaining consistent interfaces. ### Interactions with Other Components `BaseMatrix` interacts primarily through method calls and data passing, particularly with other linear algebra classes like `BaseVector`, as well as various solvers and numerical routines. It provides methods for resizing, clearing values, and accessing matrix elements via row and column indices. The class also supports more complex operations such as matrix-vector multiplication (`opMulV`) and transposition (`opMulTV`). Additionally, it includes iterators to facilitate traversing the matrix blocks. ### Practical Usage Guidance `BaseMatrix` is intended for generic usage within SOFA algorithms that require linear algebra operations but do not need to be tied to a specific implementation. It is recommended primarily when genericity outweighs performance concerns. Direct access and modification of individual elements should generally avoid frequent calls due to potential inefficiencies. ### Data Fields and Methods - **Methods**: Includes pure virtual methods for row/col size (`rowSize`, `colSize`), element accessors (`element`, `operator()`), resizing (`resize`), clearing matrix values (`clear`), setting individual elements (`set`), adding to existing elements (`add`). - **Operations**: Supports addition, multiplication with vectors/matrices, and operations like transpose. - **Iterators**: Provides iterators for navigating through blocks of the matrix (e.g., `ColBlockConstIterator`, `RowBlockConstIterator`).

abstract
`BaseMatrix` is an abstract interface in SOFA's linear algebra framework that provides methods for generic matrix operations independently of the underlying storage mechanism.
sheet
# BaseMatrix ## Overview `BaseMatrix` is a foundational component in SOFA's linear algebra framework, providing an abstract interface for handling matrices. It supports various operations such as resizing, clearing values, setting individual elements, and performing basic linear algebra operations like matrix-vector multiplication. ## Parameters and Data The `BaseMatrix` class does not expose any significant data fields or parameters directly through its API. Its functionality is primarily accessed via method calls for matrix manipulation. ## Dependencies and Connections `BaseMatrix` interacts with other components in the SOFA framework, particularly those that require linear algebra operations such as solvers and numerical routines. It provides a uniform interface for these components to interact with matrices without being tied to specific implementations.
description
The `BaseMatrix` class is an abstract interface in SOFA's linear algebra framework, providing a generic matrix API that allows for operations independently of the underlying linear algebra library. This abstraction ensures that matrices can be used uniformly across different numerical backends and implementations within SOFA. ### Role and Purpose `BaseMatrix` serves as a foundational component for handling matrix operations in SOFA simulations. It defines methods for accessing, modifying, and querying elements of a matrix without concerning itself with the internal representation or storage mechanism. This decoupling enables the use of various efficient matrix representations (e.g., sparse matrices) while maintaining consistent interfaces. ### Interactions with Other Components `BaseMatrix` interacts primarily through method calls and data passing, particularly with other linear algebra classes like `BaseVector`, as well as various solvers and numerical routines. It provides methods for resizing, clearing values, and accessing matrix elements via row and column indices. The class also supports more complex operations such as matrix-vector multiplication (`opMulV`) and transposition (`opMulTV`). Additionally, it includes iterators to facilitate traversing the matrix blocks. ### Practical Usage Guidance `BaseMatrix` is intended for generic usage within SOFA algorithms that require linear algebra operations but do not need to be tied to a specific implementation. It is recommended primarily when genericity outweighs performance concerns. Direct access and modification of individual elements should generally avoid frequent calls due to potential inefficiencies. ### Data Fields and Methods - **Methods**: Includes pure virtual methods for row/col size (`rowSize`, `colSize`), element accessors (`element`, `operator()`), resizing (`resize`), clearing matrix values (`clear`), setting individual elements (`set`), adding to existing elements (`add`). - **Operations**: Supports addition, multiplication with vectors/matrices, and operations like transpose. - **Iterators**: Provides iterators for navigating through blocks of the matrix (e.g., `ColBlockConstIterator`, `RowBlockConstIterator`).
maths
# Mathematical and Physical Description of `BaseMatrix` Component in SOFA ## Introduction The `BaseMatrix` class is an abstract interface for representing matrices within the Simulation Open Framework Architecture (SOFA). It serves as a foundational element for matrix operations used across various linear algebra routines, solvers, and numerical methods. This component abstracts away the specifics of internal storage and implementation details to provide a uniform API for matrix manipulation. ## Mathematical Description ### Basic Matrix Operations `BaseMatrix` supports several fundamental mathematical operations on matrices: - **Element Access**: Methods such as `element(y,x)` allow access to individual elements by row (`y`) and column (`x`). This is equivalent to standard matrix indexing notation where the element at the i-th row and j-th column of a matrix A would be denoted as $A_{ij}$. - **Resizing**: The method `resize(nrows, ncols)` changes the dimensions of the matrix without preserving existing elements. If resizing increases the size, new elements are typically initialized to zero or another default value. - **Clearing and Setting Elements**: Methods like `clear()` set all matrix entries to zero, while `set(y,x,val)` assigns a specific value to an element at a given position. - **Addition of Values**: The method `add(y,x,val)` adds a specified value to the existing element at (y,x). ### Matrix Operations `BaseMatrix` supports various operations that are fundamental in linear algebra: - **Matrix-Vector Multiplication**: Methods such as `opMulV(vector, result)` perform matrix-vector multiplication. Given a matrix $A$ and a vector $\mathbf{v}$, the product is another vector $\mathbf{w} = A \cdot \mathbf{v}$. This operation involves taking the dot product of each row of $A$ with $\mathbf{v}$. - **Transpose Operations**: Methods like `opMulTV(vector, result)` perform multiplication involving the transpose of a matrix. If $A^T$ is the transpose of matrix $A$, then this operation computes $A^T \cdot \mathbf{v}$. ### Matrix Representation and Storage `BaseMatrix` abstracts away details about how matrices are stored internally, allowing for flexibility in choosing efficient representations (e.g., dense, sparse). This abstraction is crucial because different matrix types may require optimized algorithms or storage schemes to ensure efficiency and performance. ## Physical Description In the context of SOFA simulations, `BaseMatrix` plays a critical role in numerical methods and solvers that model physical systems. Matrices are central to representing linear relationships between variables such as forces, displacements, velocities, and other quantities that govern the dynamics of physical entities within the simulation. ### Applications in Physics-Based Simulation - **Rigid Body Dynamics**: Matrices can represent transformation matrices for rigid body rotations and translations. The `BaseMatrix` interface allows for the efficient manipulation of these transformations during simulations. - **Finite Element Analysis (FEA)**: In FEA, stiffness matrices are used to describe how forces distribute across a system. Operations like matrix-vector multiplication enable the solution of systems of linear equations that determine displacements and internal stresses within deformable bodies. - **Contact Handling**: Contact constraints in simulations often involve solving large systems of linear equations where matrices represent contact forces and their effects on the overall dynamics. ### Performance Considerations Efficient implementations of `BaseMatrix` are crucial for performance, especially in real-time or high-fidelity simulation scenarios. Sparse matrix representations can significantly reduce memory usage and computation time by avoiding storage and operations on zero elements. Iterators provided by `BaseMatrix`, such as `ColBlockConstIterator` and `RowBlockConstIterator`, enable efficient traversal of matrix blocks, which is important for performance-critical routines. ## Conclusion The `BaseMatrix` component in SOFA provides a flexible and abstract interface for linear algebra operations. This abstraction facilitates the development of generic numerical methods and solvers while allowing for optimized implementations based on specific storage schemes and algorithms. The mathematical and physical descriptions highlight how these matrices are used to model and solve complex systems in physics-based simulations.
{
  "name": "BaseMatrix",
  "main": {
    "name": "BaseMatrix",
    "namespace": "sofa::linearalgebra",
    "module": "Sofa.framework.LinearAlgebra",
    "include": "sofa/linearalgebra/BaseMatrix.h",
    "doc": "Generic matrix API, allowing to fill and use a matrix independently of the linear algebra library in use.\nNote that accessing values using this class is rather slow and should only be used in codes where the\nprovided genericity is necessary.",
    "inherits": [],
    "templates": [],
    "data_fields": [],
    "links": [],
    "methods": [
      {
        "name": "rowSize",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "colSize",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "rows",
        "return_type": "Index",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "cols",
        "return_type": "Index",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "element",
        "return_type": "SReal",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "operator()",
        "return_type": "SReal",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "resize",
        "return_type": "void",
        "params": [
          {
            "name": "nbRow",
            "type": "Index"
          },
          {
            "name": "nbCol",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clear",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "set",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "_M",
            "type": "const type::Mat3x3d &"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "_M",
            "type": "const type::Mat3x3f &"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "_M",
            "type": "const type::Mat2x2d &"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "_M",
            "type": "const type::Mat2x2f &"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "_M",
            "type": "const type::Mat6x6d &"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "_M",
            "type": "const type::Mat6x6f &"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clear",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clearRow",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clearRows",
        "return_type": "void",
        "params": [
          {
            "name": "imin",
            "type": "Index"
          },
          {
            "name": "imax",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clearCol",
        "return_type": "void",
        "params": [
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clearCols",
        "return_type": "void",
        "params": [
          {
            "name": "imin",
            "type": "Index"
          },
          {
            "name": "imax",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clearRowCol",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clearRowsCols",
        "return_type": "void",
        "params": [
          {
            "name": "imin",
            "type": "Index"
          },
          {
            "name": "imax",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "compress",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getElementType",
        "return_type": "ElementType",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getElementSize",
        "return_type": "int",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getCategory",
        "return_type": "MatrixCategory",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getBlockRows",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getBlockCols",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bRowSize",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bColSize",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getBandWidth",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "isDiagonal",
        "return_type": "bool",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "isBlockDiagonal",
        "return_type": "bool",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "isBand",
        "return_type": "bool",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "isSparse",
        "return_type": "bool",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bAccessorDelete",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "const InternalBlockAccessor *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorCopy",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "InternalBlockAccessor *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorElement",
        "return_type": "SReal",
        "params": [
          {
            "name": "b",
            "type": "const InternalBlockAccessor *"
          },
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorSet",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorElementsDefaultImpl",
        "return_type": "const T *",
        "params": [
          {
            "name": "b",
            "type": "const InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorElements",
        "return_type": "const float *",
        "params": [
          {
            "name": "b",
            "type": "const InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorElements",
        "return_type": "const double *",
        "params": [
          {
            "name": "b",
            "type": "const InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorElements",
        "return_type": "const int *",
        "params": [
          {
            "name": "b",
            "type": "const InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "int *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorSetDefaultImpl",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorSet",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorSet",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorSet",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const int *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorAddDefaultImpl",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const int *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorPrepareAddDefaultImpl",
        "return_type": "T *",
        "params": [
          {
            "name": "",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorPrepareAdd",
        "return_type": "float *",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorPrepareAdd",
        "return_type": "double *",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorPrepareAdd",
        "return_type": "int *",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "int *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorFinishAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorFinishAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bAccessorFinishAdd",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "InternalBlockAccessor *"
          },
          {
            "name": "buffer",
            "type": "const int *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createBlockAccessor",
        "return_type": "BlockAccessor",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "internalPtr",
            "type": "void *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createBlockAccessor",
        "return_type": "BlockAccessor",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "internalData",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createBlockConstAccessor",
        "return_type": "BlockConstAccessor",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "internalPtr",
            "type": "void *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createBlockConstAccessor",
        "return_type": "BlockConstAccessor",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "col",
            "type": "Index"
          },
          {
            "name": "internalData",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "setMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "BlockAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "setMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "b",
            "type": "BlockConstAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "getInternal",
        "return_type": "InternalBlockAccessor *",
        "params": [
          {
            "name": "b",
            "type": "BlockConstAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "getInternal",
        "return_type": "const InternalBlockAccessor *",
        "params": [
          {
            "name": "b",
            "type": "const BlockConstAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "getInternal",
        "return_type": "InternalBlockAccessor *",
        "params": [
          {
            "name": "b",
            "type": "BlockAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "getInternal",
        "return_type": "const InternalBlockAccessor *",
        "params": [
          {
            "name": "b",
            "type": "const BlockAccessor *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "blocGet",
        "return_type": "BlockConstAccessor",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "blocGetW",
        "return_type": "BlockAccessor",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "blocCreate",
        "return_type": "BlockAccessor",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "blocElements",
        "return_type": "const T *",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          },
          {
            "name": "buffer",
            "type": "T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "blocSet",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          },
          {
            "name": "buffer",
            "type": "const T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "blocAdd",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "j",
            "type": "Index"
          },
          {
            "name": "buffer",
            "type": "const T *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getInternal",
        "return_type": "InternalColBlockIterator *",
        "params": [
          {
            "name": "b",
            "type": "ColBlockConstIterator *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "getInternal",
        "return_type": "const InternalColBlockIterator *",
        "params": [
          {
            "name": "b",
            "type": "const ColBlockConstIterator *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "itCopyColBlock",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "InternalColBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itDeleteColBlock",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "const InternalColBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itAccessColBlock",
        "return_type": "void",
        "params": [
          {
            "name": "it",
            "type": "InternalColBlockIterator *"
          },
          {
            "name": "b",
            "type": "BlockConstAccessor *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itIncColBlock",
        "return_type": "void",
        "params": [
          {
            "name": "it",
            "type": "InternalColBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itDecColBlock",
        "return_type": "void",
        "params": [
          {
            "name": "it",
            "type": "InternalColBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itEqColBlock",
        "return_type": "bool",
        "params": [
          {
            "name": "it",
            "type": "const InternalColBlockIterator *"
          },
          {
            "name": "it2",
            "type": "const InternalColBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itLessColBlock",
        "return_type": "bool",
        "params": [
          {
            "name": "it",
            "type": "const InternalColBlockIterator *"
          },
          {
            "name": "it2",
            "type": "const InternalColBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createColBlockConstIterator",
        "return_type": "ColBlockConstIterator",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "internalPtr",
            "type": "void *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createColBlockConstIterator",
        "return_type": "ColBlockConstIterator",
        "params": [
          {
            "name": "row",
            "type": "Index"
          },
          {
            "name": "internalData",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bRowBegin",
        "return_type": "ColBlockConstIterator",
        "params": [
          {
            "name": "ib",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bRowEnd",
        "return_type": "ColBlockConstIterator",
        "params": [
          {
            "name": "ib",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bRowRange",
        "return_type": "int",
        "params": [
          {
            "name": "ib",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getInternal",
        "return_type": "InternalRowBlockIterator *",
        "params": [
          {
            "name": "b",
            "type": "RowBlockConstIterator *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "getInternal",
        "return_type": "const InternalRowBlockIterator *",
        "params": [
          {
            "name": "b",
            "type": "const RowBlockConstIterator *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "protected"
      },
      {
        "name": "itCopyRowBlock",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itDeleteRowBlock",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "const InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itAccessRowBlock",
        "return_type": "Index",
        "params": [
          {
            "name": "it",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itBeginRowBlock",
        "return_type": "ColBlockConstIterator",
        "params": [
          {
            "name": "it",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itEndRowBlock",
        "return_type": "ColBlockConstIterator",
        "params": [
          {
            "name": "it",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itRangeRowBlock",
        "return_type": "int",
        "params": [
          {
            "name": "it",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itIncRowBlock",
        "return_type": "void",
        "params": [
          {
            "name": "it",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itDecRowBlock",
        "return_type": "void",
        "params": [
          {
            "name": "it",
            "type": "InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itEqRowBlock",
        "return_type": "bool",
        "params": [
          {
            "name": "it",
            "type": "const InternalRowBlockIterator *"
          },
          {
            "name": "it2",
            "type": "const InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "itLessRowBlock",
        "return_type": "bool",
        "params": [
          {
            "name": "it",
            "type": "const InternalRowBlockIterator *"
          },
          {
            "name": "it2",
            "type": "const InternalRowBlockIterator *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createRowBlockConstIterator",
        "return_type": "RowBlockConstIterator",
        "params": [
          {
            "name": "internalPtr",
            "type": "void *"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "createRowBlockConstIterator",
        "return_type": "RowBlockConstIterator",
        "params": [
          {
            "name": "internalData0",
            "type": "Index"
          },
          {
            "name": "internalData1",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      },
      {
        "name": "bRowsBegin",
        "return_type": "RowBlockConstIterator",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bRowsEnd",
        "return_type": "RowBlockConstIterator",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bRowsRange",
        "return_type": "int",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "linearalgebra::BaseVector *"
          },
          {
            "name": "v",
            "type": "const linearalgebra::BaseVector *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "float *"
          },
          {
            "name": "v",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "double *"
          },
          {
            "name": "v",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opPMulV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "linearalgebra::BaseVector *"
          },
          {
            "name": "v",
            "type": "const linearalgebra::BaseVector *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opPMulV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "float *"
          },
          {
            "name": "v",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opPMulV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "double *"
          },
          {
            "name": "v",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulTV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "linearalgebra::BaseVector *"
          },
          {
            "name": "v",
            "type": "const linearalgebra::BaseVector *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulTV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "float *"
          },
          {
            "name": "v",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulTV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "double *"
          },
          {
            "name": "v",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opPMulTV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "linearalgebra::BaseVector *"
          },
          {
            "name": "v",
            "type": "const linearalgebra::BaseVector *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opPMulTV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "float *"
          },
          {
            "name": "v",
            "type": "const float *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opPMulTV",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "double *"
          },
          {
            "name": "v",
            "type": "const double *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opMulTM",
        "return_type": "void",
        "params": [
          {
            "name": "result",
            "type": "BaseMatrix *"
          },
          {
            "name": "m",
            "type": "BaseMatrix *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opAddM",
        "return_type": "void",
        "params": [
          {
            "name": "m",
            "type": "linearalgebra::BaseMatrix *"
          },
          {
            "name": "fact",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "opAddMT",
        "return_type": "void",
        "params": [
          {
            "name": "m",
            "type": "linearalgebra::BaseMatrix *"
          },
          {
            "name": "fact",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      }
    ]
  },
  "desc": {
    "description": "The `BaseMatrix` class is an abstract interface in SOFA's linear algebra framework, providing a generic matrix API that allows for operations independently of the underlying linear algebra library. This abstraction ensures that matrices can be used uniformly across different numerical backends and implementations within SOFA.\n\n### Role and Purpose\n`BaseMatrix` serves as a foundational component for handling matrix operations in SOFA simulations. It defines methods for accessing, modifying, and querying elements of a matrix without concerning itself with the internal representation or storage mechanism. This decoupling enables the use of various efficient matrix representations (e.g., sparse matrices) while maintaining consistent interfaces.\n\n### Interactions with Other Components\n`BaseMatrix` interacts primarily through method calls and data passing, particularly with other linear algebra classes like `BaseVector`, as well as various solvers and numerical routines. It provides methods for resizing, clearing values, and accessing matrix elements via row and column indices.\n\nThe class also supports more complex operations such as matrix-vector multiplication (`opMulV`) and transposition (`opMulTV`). Additionally, it includes iterators to facilitate traversing the matrix blocks.\n\n### Practical Usage Guidance\n`BaseMatrix` is intended for generic usage within SOFA algorithms that require linear algebra operations but do not need to be tied to a specific implementation. It is recommended primarily when genericity outweighs performance concerns. Direct access and modification of individual elements should generally avoid frequent calls due to potential inefficiencies.\n\n### Data Fields and Methods\n- **Methods**: Includes pure virtual methods for row/col size (`rowSize`, `colSize`), element accessors (`element`, `operator()`), resizing (`resize`), clearing matrix values (`clear`), setting individual elements (`set`), adding to existing elements (`add`).\n- **Operations**: Supports addition, multiplication with vectors/matrices, and operations like transpose.\n- **Iterators**: Provides iterators for navigating through blocks of the matrix (e.g., `ColBlockConstIterator`, `RowBlockConstIterator`)."
  },
  "maths": {
    "maths": "# Mathematical and Physical Description of `BaseMatrix` Component in SOFA\n\n## Introduction\nThe `BaseMatrix` class is an abstract interface for representing matrices within the Simulation Open Framework Architecture (SOFA). It serves as a foundational element for matrix operations used across various linear algebra routines, solvers, and numerical methods. This component abstracts away the specifics of internal storage and implementation details to provide a uniform API for matrix manipulation.\n\n## Mathematical Description\n\n### Basic Matrix Operations\n`BaseMatrix` supports several fundamental mathematical operations on matrices:\n\n- **Element Access**: Methods such as `element(y,x)` allow access to individual elements by row (`y`) and column (`x`). This is equivalent to standard matrix indexing notation where the element at the i-th row and j-th column of a matrix A would be denoted as $A_{ij}$.\n\n- **Resizing**: The method `resize(nrows, ncols)` changes the dimensions of the matrix without preserving existing elements. If resizing increases the size, new elements are typically initialized to zero or another default value.\n\n- **Clearing and Setting Elements**: Methods like `clear()` set all matrix entries to zero, while `set(y,x,val)` assigns a specific value to an element at a given position.\n\n- **Addition of Values**: The method `add(y,x,val)` adds a specified value to the existing element at (y,x).\n\n### Matrix Operations\n`BaseMatrix` supports various operations that are fundamental in linear algebra:\n\n- **Matrix-Vector Multiplication**: Methods such as `opMulV(vector, result)` perform matrix-vector multiplication. Given a matrix $A$ and a vector $\\mathbf{v}$, the product is another vector $\\mathbf{w} = A \\cdot \\mathbf{v}$. This operation involves taking the dot product of each row of $A$ with $\\mathbf{v}$.\n\n- **Transpose Operations**: Methods like `opMulTV(vector, result)` perform multiplication involving the transpose of a matrix. If $A^T$ is the transpose of matrix $A$, then this operation computes $A^T \\cdot \\mathbf{v}$.\n\n### Matrix Representation and Storage\n`BaseMatrix` abstracts away details about how matrices are stored internally, allowing for flexibility in choosing efficient representations (e.g., dense, sparse). This abstraction is crucial because different matrix types may require optimized algorithms or storage schemes to ensure efficiency and performance.\n\n## Physical Description\nIn the context of SOFA simulations, `BaseMatrix` plays a critical role in numerical methods and solvers that model physical systems. Matrices are central to representing linear relationships between variables such as forces, displacements, velocities, and other quantities that govern the dynamics of physical entities within the simulation.\n\n### Applications in Physics-Based Simulation\n- **Rigid Body Dynamics**: Matrices can represent transformation matrices for rigid body rotations and translations. The `BaseMatrix` interface allows for the efficient manipulation of these transformations during simulations.\n\n- **Finite Element Analysis (FEA)**: In FEA, stiffness matrices are used to describe how forces distribute across a system. Operations like matrix-vector multiplication enable the solution of systems of linear equations that determine displacements and internal stresses within deformable bodies.\n\n- **Contact Handling**: Contact constraints in simulations often involve solving large systems of linear equations where matrices represent contact forces and their effects on the overall dynamics.\n\n### Performance Considerations\nEfficient implementations of `BaseMatrix` are crucial for performance, especially in real-time or high-fidelity simulation scenarios. Sparse matrix representations can significantly reduce memory usage and computation time by avoiding storage and operations on zero elements. Iterators provided by `BaseMatrix`, such as `ColBlockConstIterator` and `RowBlockConstIterator`, enable efficient traversal of matrix blocks, which is important for performance-critical routines.\n\n## Conclusion\nThe `BaseMatrix` component in SOFA provides a flexible and abstract interface for linear algebra operations. This abstraction facilitates the development of generic numerical methods and solvers while allowing for optimized implementations based on specific storage schemes and algorithms. The mathematical and physical descriptions highlight how these matrices are used to model and solve complex systems in physics-based simulations."
  },
  "summary": {
    "abstract": "`BaseMatrix` is an abstract interface in SOFA's linear algebra framework that provides methods for generic matrix operations independently of the underlying storage mechanism.",
    "sheet": "# BaseMatrix\n\n## Overview\n`BaseMatrix` is a foundational component in SOFA's linear algebra framework, providing an abstract interface for handling matrices. It supports various operations such as resizing, clearing values, setting individual elements, and performing basic linear algebra operations like matrix-vector multiplication.\n\n## Parameters and Data\nThe `BaseMatrix` class does not expose any significant data fields or parameters directly through its API. Its functionality is primarily accessed via method calls for matrix manipulation.\n\n## Dependencies and Connections\n`BaseMatrix` interacts with other components in the SOFA framework, particularly those that require linear algebra operations such as solvers and numerical routines. It provides a uniform interface for these components to interact with matrices without being tied to specific implementations."
  }
}