Package org.jscience.mathematics.vector
Provides support for linear algebra
in the form of matrices
and
vectors
.
With the Matrix
class,
you should be able to resolve linear systems of equations
involving any kind of elements such as
Rational
,
ModuloInteger
(modulo operations),
Complex
,
RationalFunction
, etc.
The main requirement being that your element class implements the mathematical
Field
interface.
Most numbers
and even invertible matrices
themselves may implement this interface. Non-commutative multiplication is supported which
allows for the resolution of systems of equations with invertible matrix coefficients (matrices of matrices).
For classes embedding automatic error calculation (e.g.
Real
or Amount
),
the error on the solution obtained tells you if can trust that solution or not
(e.g. system close to singularity). The following example illustrates this point.
Let's say you have a simple electric circuit composed of 2 resistors in series
with a battery. You want to know the voltage (U1, U2) at the nodes of the
resistors and the current (I) traversing the circuit.[code]
import static org.jscience.physics.units.SI.*;
AmountAmount
class guarantees
the accuracy/precision of its calculations. As long as the input resistances, voltage
stay within their specification range then the current is guaranteed
to be (70.0 ± 7.3E-1) mA
. When the inputs have no error specified,
the error on the result corresponds to calculations numeric errors only
(which might increase significantly if the matrix is close to singularity).
-
ClassDescriptionDenseMatrix<F extends Field<F>>This class represents a matrix made of
dense vectors
(as rows).DenseVector<F extends Field<F>>This class represents a dense vector.Signals that an operation is performed upon vectors or matrices whose dimensions disagree.This class represents an optimizedmatrix
implementation for64 bits floating-point
numbers.This class represents an optimizedvector
implementation for 64 bits floating point elements.LUDecomposition<F extends Field<F>>This class represents the decomposition of amatrix
A
into a product of alower
andupper
triangular matrices,L
andU
respectively, such asA = P·L·U
with
P
a
permutation
matrix.This class represents a rectangular table of elements of a ring-like algebraic structure.SparseMatrix<F extends Field<F>>This class represents a matrix made ofsparse vectors
(as rows).SparseVector<F extends Field<F>>This class represents a sparse vector.This class represents an immutable element of a vector space.