in

.NET Opensource

Community for opensource projects by Christoph Rüegg

Linerar Algebra: Vector class?

Last post 04-28-2007 23:29 by MovGP0. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-19-2006 14:23

    Linerar Algebra: Vector class?

    Someone asked me lately why Iridium doesn't have a vector class in addition to the matrix class. Here some thoughts.

    Contra:

    • A vector is a matrix, and representable as a matrix
    • There would exist two ways to represent a vector, as you could still create a one-row/column matrix instead
    • There exist both column and row vetcors. Would we have to design two seperate classes? Note that the result of multiplying two vectors depends highly on their direction (but all results can be represented as matrices, as it is implemented right now)
    • Would we also have to define special structures for triangular or tridiagonal matrices? Ok, we already have structures for sparse matrices, so it could make sense - but we'd need some abstraction
    • Double algorithm implementations
    • Sometimes conversion needed between matrices and vectors

    Pro:

    • Vectors have additional properties and operations not applicatble to matrices (and vice versa)
    • To better distinguish between vetcors and matrices in the code. Better understanding of the code, less error-prone.
    • Matrix data structures may be suboptimal (performance, memory) when you only use them as vectors
    • Might be easier to work with a specialized vector class
    • Some algorithms could probably be implemented simpler and more efficient.

    Let me know what you think!

    Shall we introduce additional linear algebra data structures?

    • no, only Matrix (as right now) (0%)
    • Matrix and Vector (80%)
    • Matrix and Horizontal & Vertical Vector (0%)
    • Matrix, Vector and special matrices (Triangular, Tridiagonal) (20%)
    • Total Votes: 5
     

  • 09-19-2006 18:28 In reply to

    Re: Linerar Algebra: Vector class?

    This is now tracked as IRID-59.

    Filed under: ,
  • 09-27-2006 23:48 In reply to

    • MovGP0
    • Top 10 Contributor
      Male
    • Joined on 11-21-2005
    • Austria
    • Posts 49

    Re: Linerar Algebra: Vector class?

    A separate Vector-Class makes sense to me. Horizontal vs. Vertical should get setable using a "Align"-Property.

    Special kinds of Matrices are possible using special Constructors.

    Anyway, keep in Mind that a Vector is not simply a special kind of a Matrix. Instead Skalars, Vectors, and Matrices are special Kinds of Tensors.

  • 04-25-2007 14:58 In reply to

    Re: Linerar Algebra: Vector class?

    a vector class has lots of different properties relative to the matrix class. another vector class module is very important. Expect new vector class.

  • 04-28-2007 23:29 In reply to

    • MovGP0
    • Top 10 Contributor
      Male
    • Joined on 11-21-2005
    • Austria
    • Posts 49

    Re: Linerar Algebra: Vector class?

    Whishes for Matrix:  

    There need to be a function to transform/attach a Vector into/onto a Matrix (ie. to built a coefficient-matrix).

    Also there should be a enumerator that returns one row of a Matrix after another. The rows can get represented as Vector.

    The only special Matrix that makes really sense might be the Identity-Matrix. There should be a static function to greate one.

    Functions of a Matrix:
    Examples of functions a Matrix should support
    (neither complete nor fully correct translated; just for overview): 

    • IsInversible()
    • Transpose()
    • IsOrthogonal()
    • Orthogonalize()
    • IsUnitary()
    • IsIdempotent() or IsProjectionMatrix()
    • IsNilpotent()
    • IsSymmetric()
    • IsHermitian()
    • IsPositiveDefinit()
    • IsSkewSymmetric()
    • Adjungate()*
    • Konjunction()*
    • Adjunction
    • Komplementary
    • Determinant()
    • RotateMatrix( Angle, Angle, Angle, ... )

    * = for complex Matrizes; Matrizes should be either real or complex, or best using a Type-Template (T).

    Important Functions:

    • Rank()
    • Dimension()
    • Core()
    • Norm()
    • Function for returning Cramer's Matrix
    • Function to calculate Cramer's rule
    • Function that returns the Determinant of a Cramer's Matrix (used ie. for the Cross-Product of n-Vectors)
    • Test if Matrix is a Base of a given Vector; Functions specific to Base-Definitions
    • Algorithms to transform Matrix to a specific form
    • Eigenvalue()
    • Eigenvector()

    Form of a Matrix:

    Special types of Matrices (Triangular, Tridiagonal, etc.) should be able to get tested using a Property. ( bool IsTriangular() or Type-get )

    Matrices can have the following forms:

    • diagonal form (only diagonal is not zero)
    • stage form, stair form, relay form (diagonal consists of 2x2 matrices; all other 0)
    • triangle form (unsorted; upper triangle; lower triangle)
    • trapezoid form, half-diagonal form (nxm Matrix; all below the nxn-Diagonal is 0)
    • reduced stair form, row-reduced form (diagonal is 1; all below is 0; all over the diagonal can have any value)
    • Jordan-form; Jordan-normal-form
    therefore we need to be able to test each of them.

    other whishes:

    • Drawing of Vector-Fields from 2x2 and 3x3 Matrices - maybe also with a flow-diagramming (color gives speed of a Particle in given Coordinates; the way of the particle is drawn as line). 
    • Support of int, double, complex, and other Datatypes
    see also: Matrix on english Wikipedia

    Whishes for Vectors:

    • Cross-Product of n-Vectors
    • Conversion of 3-Vectors to DirectX compatible Vectors (if DirectX-Flag is set)
Page 1 of 1 (5 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems