Back

EigenVector

The `EigenVector` component is part of the SOFA framework's LinearAlgebra module, providing a container for Eigen library vectors. It inherits from `BaseVector`, offering methods to manipulate vector elements and blocks. The main role of `EigenVector` is to encapsulate and provide an interface to Eigen's dynamic matrix operations within the SOFA simulation context. ### Interactions with Other Components: - **Inheritance**: `EigenVector` extends `BaseVector`, thus it must comply with methods defined in this base class, including size management (`size`, `resize`), element access (`element`), and modification (`set`, `add`, `clear`). - **Integration**: It is used in SOFA's linear algebra operations where Eigen's vector capabilities are required. ### Practical Usage Guidance: - Use this component for efficient handling of numerical vectors in simulations that require dynamic resizing or block-wise manipulation. - The template parameter allows flexibility in specifying the real number type (`float` or `double`). - Methods like `resize`, `setBlock`, and `clear` facilitate vector management, ensuring consistency with Eigen's internal representation.

abstract
`EigenVector` encapsulates Eigen library vectors for dynamic numerical vector management within SOFA simulations, inheriting from `BaseVector` to provide essential vector manipulation methods.
sheet
# EigenVector ## Overview The `EigenVector` component provides a container for Eigen library vectors, enabling efficient handling of dynamic numerical vectors in SOFA simulations. It inherits from the `BaseVector` class, ensuring compatibility with other linear algebra operations within the framework. ## Parameters and Data - **No significant data fields**: The component does not expose any specific data fields beyond those inherited from `BaseVector`. Methods like `resize`, `setBlock`, and `clear` facilitate vector management but do not require additional configuration parameters. ## Dependencies and Connections The `EigenVector` interacts with other SOFA components by providing a consistent interface for numerical vector manipulation. It inherits methods from the `BaseVector` class, ensuring interoperability within the framework.
description
The `EigenVector` component is part of the SOFA framework's LinearAlgebra module, providing a container for Eigen library vectors. It inherits from `BaseVector`, offering methods to manipulate vector elements and blocks. The main role of `EigenVector` is to encapsulate and provide an interface to Eigen's dynamic matrix operations within the SOFA simulation context. ### Interactions with Other Components: - **Inheritance**: `EigenVector` extends `BaseVector`, thus it must comply with methods defined in this base class, including size management (`size`, `resize`), element access (`element`), and modification (`set`, `add`, `clear`). - **Integration**: It is used in SOFA's linear algebra operations where Eigen's vector capabilities are required. ### Practical Usage Guidance: - Use this component for efficient handling of numerical vectors in simulations that require dynamic resizing or block-wise manipulation. - The template parameter allows flexibility in specifying the real number type (`float` or `double`). - Methods like `resize`, `setBlock`, and `clear` facilitate vector management, ensuring consistency with Eigen's internal representation.
maths
The `EigenVector` component is a container for Eigen library vectors, providing an interface to handle dynamic numerical vectors within the SOFA simulation framework. It inherits from `BaseVector`, which defines essential methods and operations on vector elements. ### Mathematical Description: - **Vector Representation**: The vector is represented using Eigen's `Matrix<Real, Dynamic, 1>`, where `Real` can be either `float` or `double`. This allows for dynamic resizing of the vector as needed during runtime. - **Element Access and Modification**: - `element(i)`: Retrieves the element at index `i` from the vector. Formally, if \( v = [v_0, v_1, ..., v_{n-1}] \), then \( v[i] \) returns the value of the i-th element. - `set(i, v)`: Sets the element at index `i` to the value `v`. Formally, \( v[i] = v \). - `add(i, v)`: Adds the value `v` to the element at index `i`. Formally, \( v[i] += v \). - **Block-wise Operations**: - `setBlock(i, v)`: Sets a block of elements starting from index `i` with the values in vector `v`, where `v` is of type `type::Vec<Nin, Real>`. Formally, if \( v = [v_0, v_1, ..., v_{Nin-1}] \), then for each element in the block: - \( orall l ext{ from } 0 ext{ to } Nin-1: eigenVector[i*Nin + l] = v[l] \). - **Resizing**: - `resize(nbRow)`: Resizes the vector to have `nbRow` elements. The vector is reset to zero after resizing. - `resizeBlocks(nbBlocks)`: Resizes the vector based on block size (`Nin`) and number of blocks (`nbBlocks`). Formally, if \( N_{blocks} = nbBlocks \), then \( ext{new size} = N_{blocks} * Nin \). - **Clearing**: - `clear(i)`: Sets the element at index `i` to zero. - `clear()`: Clears all elements by resizing the vector to zero and then back to its original size, effectively setting all elements to zero. ### Physical Context in SOFA Framework: The `EigenVector` is used as a fundamental building block for various linear algebra operations within simulations. It encapsulates dynamic numerical vectors that can be resized and manipulated efficiently using Eigen's optimized vector operations. This component is essential for managing state variables, such as displacements, velocities, or forces, which are often represented as vectors in computational mechanics. ### Interaction with Other Components: The `EigenVector` interacts with other SOFA components by providing a consistent interface to manipulate numerical vectors used in linear algebra computations. Its methods comply with the `BaseVector` class, ensuring compatibility and interoperability within the SOFA framework.
{
  "name": "EigenVector",
  "main": {
    "name": "EigenVector",
    "namespace": "sofa::linearalgebra",
    "module": "Sofa.framework.LinearAlgebra",
    "include": "sofa/linearalgebra/EigenVector.h",
    "doc": "Container of a vector of the Eigen library. Not an eigenvector of a matrix.",
    "inherits": [
      "BaseVector"
    ],
    "templates": [],
    "data_fields": [],
    "links": [],
    "methods": [
      {
        "name": "getVectorEigen",
        "return_type": "VectorEigen &",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "size",
        "return_type": "Index",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "resize",
        "return_type": "void",
        "params": [
          {
            "name": "nbRow",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "resizeBlocks",
        "return_type": "void",
        "params": [
          {
            "name": "nbBlocks",
            "type": "Index"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "element",
        "return_type": "SReal",
        "params": [
          {
            "name": "i",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "set",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "SReal"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setBlock",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "const Block &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "add",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          },
          {
            "name": "v",
            "type": "SReal"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clear",
        "return_type": "void",
        "params": [
          {
            "name": "i",
            "type": "Index"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "clear",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "Name",
        "return_type": "const int",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": true,
        "access": "public"
      }
    ]
  },
  "desc": {
    "description": "The `EigenVector` component is part of the SOFA framework's LinearAlgebra module, providing a container for Eigen library vectors. It inherits from `BaseVector`, offering methods to manipulate vector elements and blocks. The main role of `EigenVector` is to encapsulate and provide an interface to Eigen's dynamic matrix operations within the SOFA simulation context.\n\n### Interactions with Other Components:\n- **Inheritance**: `EigenVector` extends `BaseVector`, thus it must comply with methods defined in this base class, including size management (`size`, `resize`), element access (`element`), and modification (`set`, `add`, `clear`).\n- **Integration**: It is used in SOFA's linear algebra operations where Eigen's vector capabilities are required.\n\n### Practical Usage Guidance:\n- Use this component for efficient handling of numerical vectors in simulations that require dynamic resizing or block-wise manipulation.\n- The template parameter allows flexibility in specifying the real number type (`float` or `double`).\n- Methods like `resize`, `setBlock`, and `clear` facilitate vector management, ensuring consistency with Eigen's internal representation."
  },
  "maths": {
    "maths": "The `EigenVector` component is a container for Eigen library vectors, providing an interface to handle dynamic numerical vectors within the SOFA simulation framework. It inherits from `BaseVector`, which defines essential methods and operations on vector elements.\n\n### Mathematical Description:\n- **Vector Representation**: The vector is represented using Eigen's `Matrix<Real, Dynamic, 1>`, where `Real` can be either `float` or `double`. This allows for dynamic resizing of the vector as needed during runtime.\n\n- **Element Access and Modification**:\n  - `element(i)`: Retrieves the element at index `i` from the vector. Formally, if \\( v = [v_0, v_1, ..., v_{n-1}] \\), then \\( v[i] \\) returns the value of the i-th element.\n  - `set(i, v)`: Sets the element at index `i` to the value `v`. Formally, \\( v[i] = v \\).\n  - `add(i, v)`: Adds the value `v` to the element at index `i`. Formally, \\( v[i] += v \\).\n\n- **Block-wise Operations**:\n  - `setBlock(i, v)`: Sets a block of elements starting from index `i` with the values in vector `v`, where `v` is of type `type::Vec<Nin, Real>`. Formally, if \\( v = [v_0, v_1, ..., v_{Nin-1}] \\), then for each element in the block:\n    - \\( \forall l \text{ from } 0 \text{ to } Nin-1: eigenVector[i*Nin + l] = v[l] \\).\n\n- **Resizing**:\n  - `resize(nbRow)`: Resizes the vector to have `nbRow` elements. The vector is reset to zero after resizing.\n  - `resizeBlocks(nbBlocks)`: Resizes the vector based on block size (`Nin`) and number of blocks (`nbBlocks`). Formally, if \\( N_{blocks} = nbBlocks \\), then \\( \text{new size} = N_{blocks} * Nin \\).\n\n- **Clearing**:\n  - `clear(i)`: Sets the element at index `i` to zero.\n  - `clear()`: Clears all elements by resizing the vector to zero and then back to its original size, effectively setting all elements to zero.\n\n### Physical Context in SOFA Framework:\nThe `EigenVector` is used as a fundamental building block for various linear algebra operations within simulations. It encapsulates dynamic numerical vectors that can be resized and manipulated efficiently using Eigen's optimized vector operations. This component is essential for managing state variables, such as displacements, velocities, or forces, which are often represented as vectors in computational mechanics.\n\n### Interaction with Other Components:\nThe `EigenVector` interacts with other SOFA components by providing a consistent interface to manipulate numerical vectors used in linear algebra computations. Its methods comply with the `BaseVector` class, ensuring compatibility and interoperability within the SOFA framework."
  },
  "summary": {
    "abstract": "`EigenVector` encapsulates Eigen library vectors for dynamic numerical vector management within SOFA simulations, inheriting from `BaseVector` to provide essential vector manipulation methods.",
    "sheet": "# EigenVector\n\n## Overview\nThe `EigenVector` component provides a container for Eigen library vectors, enabling efficient handling of dynamic numerical vectors in SOFA simulations. It inherits from the `BaseVector` class, ensuring compatibility with other linear algebra operations within the framework.\n\n## Parameters and Data\n- **No significant data fields**: The component does not expose any specific data fields beyond those inherited from `BaseVector`. Methods like `resize`, `setBlock`, and `clear` facilitate vector management but do not require additional configuration parameters.\n\n## Dependencies and Connections\nThe `EigenVector` interacts with other SOFA components by providing a consistent interface for numerical vector manipulation. It inherits methods from the `BaseVector` class, ensuring interoperability within the framework."
  }
}