linbox  1
Functions
linbox/solutions

Functions

template<class Blackbox , class MyMethod >
Blackbox::Field::Element & lif_cra_det (typename Blackbox::Field::Element &d, const Blackbox &A, const RingCategories::IntegerTag &tag, const MyMethod &M)
 Compute the determinant of A over the integers.
template<class Blackbox , class DetMethod , class DomainCategory >
Blackbox::Field::Element & det (typename Blackbox::Field::Element &d, const Blackbox &A, const DomainCategory &tag, const DetMethod &M)
 Compute the determinant of A.
template<class Field >
Field::Element & detin (typename Field::Element &d, BlasBlackbox< Field > &A)
 A will be modified.
template<class Blackbox , class Method , class DomainCategory >
unsigned long & rank (unsigned long &r, const Blackbox &A, const DomainCategory &tag, const Method &M)
template<class Blackbox >
unsigned long & rank (unsigned long &r, const Blackbox &A)
template<class Blackbox , class Method >
unsigned long & rank (unsigned long &r, const Blackbox &A, const Method &M)
template<class Output , class Blackbox , class MyMethod >
Output & smithForm (Output &S, const Blackbox &A, const MyMethod &M)
template<class Vector , class Blackbox , class SolveMethod >
Vector & solve (Vector &x, const Blackbox &A, const Vector &b, const SolveMethod &M)
 Solve Ax = b, for x.
template<class Blackbox , class MyMethod >
Blackbox::Field::Element & valence (typename Blackbox::Field::Element &v, const Blackbox &A, const MyMethod &M)
 Compute the valence of A.

Detailed Description

These are problem oriented drivers providing simple interfaces to the linear algebra algorithms. The arguments to each are discussed in detail in the documentation of each function. The optional method parameter is discussed in general terms just below the list.

The algorithms are actively under development, and there is an algorithm choice to be made for each function. The choice is determined by an optional argument to the function which is a method object. The class of the method object determines the approach used and data in the object may help determine algorithm variants at run time. This makes it easy to try out and compare several approaches for a given matrix.

The first method classes to consider are the Blackbox, Elimination, and Hybrid classes. Blackbox and Elimination methods may be used for virtually every solution function.

The Elimination class provides access to algorithms based on dense or sparse elimination and the algorithms take advantage of the numeric BLAS routines when the underlying field or ring is the integers or a prime field of appropriate cardinality.

The Blackbox class provides functions which are space efficient and are particularly effective for very large and very sparse systems. They are also fast and useful for structured systems such as Toeplitz, Hankel, Vandermonde, etc. Currently in LinBox the superfast methods for structured matrices are not implemented.

The Hybrid class chooses Blackbox, Elimination, or a mix of them based on matrix properties checked at runtime. It is the default method. Thus for each problem (e.g. rank) the function call without a method, rank(r, A), is equivalent to a call using the default Hybrid object, rank(r, A, Method::Hybrid()).

Hybrid algorithms are under development and not in final form. The method used under the Hybrid designation may be a sophisticated hybrid algorithm, a very basic one, or simply our guess of the most widely useful of the available algorithms. The basic hybrid method is to use the elimination approach if the matrix is small or in a dense representation, and a blackbox method otherwise. A dense representation is one which inherits from DenseMatrix or BlasMatrix. Small means both row and column dimensions are less than 103. The threshold values can be changed in the hybrid method object. For instance Hybrid h; h.setSmallThreshold(5000); rank(r, A, h).

Additional method classes exist to focus in greater detail on the method. For instance, in the Blackbox situation there are the Wiedemann, BlockWiedemann, Lanczos, and BlockLanczos approaches, to name a few. Actually, For each solution function, the Blackbox class simply chooses from among these the best one as currently implemented. They may be used specifically to override that default. Thus rank(r, A, Blackbox()) uses the Wiedemann method. But rank(r, A, BlockLanczos()) could be called as well.

Todo:
this may soon be reversed, in fact.

Also choice of preconditioner may be possible either at runtime by putting an indicator in the method object or at compile time by using a more special class of method such as BlockWiedemannButterfly.

Other method classes focus on algorithms attuned to specific matrix properties. For instance, there may be HybridSymmetric, EliminationSymmetric, and BlackboxSymmetric. Using these method choices, several functions are about twice as fast as those where the symmetry is unspecified. To get the same effect as a runtime choice, objects of the basic method classes may contain an indicator of symmetry, Method::Elimination e; e.setSymmetric(); rank(r, A, e).

Not every implemented algorithm is available through solution functions and their methods, but this is a good starting point. See linbox/algorithms for the other possibilities.

If the status parameter is given, it is used for output of side information. For instance the solve function will set it's isConsistent() property indicating whether or not the system was found to be consistent. Also an upper bound on the probability of error is given by errorBound(). In the future, it may even provide consistency certificates and cofactors for normal forms.


Function Documentation

Blackbox::Field::Element& LinBox::lif_cra_det ( typename Blackbox::Field::Element &  d,
const Blackbox &  A,
const RingCategories::IntegerTag &  tag,
const MyMethod &  M 
)

Compute the determinant of A over the integers.

The determinant of a linear operator A, represented as a black box, is computed over the integers.

This variant is a hybrid between Last Invariant Factor and Chinese Remaindering It performs several determinants mod primes Then switches to the LIF method, producing a factor of det. It then comes back to the CRA if necessary to compute the remaining (usually small) factor of the determinant.

Parameters:
dField element into which to store the result
ABlack box of which to compute the determinant
tagexplicit over the integers
Mmay be a Method::BlasElimination (default) or a Method::Wiedemann.
Blackbox::Field::Element& LinBox::det ( typename Blackbox::Field::Element &  d,
const Blackbox &  A,
const DomainCategory &  tag,
const DetMethod &  M 
)

Compute the determinant of A.

The determinant of a linear operator A, represented as a black box, is computed over the ring or field of A.

Parameters:
d- Field element into which to store the result
A- Black box of which to compute the determinant
tag- optional tag. Specifies Integer, Rational or modular ring/field
M- optional method. The default is Method::Hybrid(), Other options include Blackbox, Elimination, Wiedemann, BlasElimination and SparseElimination. Sometimes it helps to indicate properties of the matrix in the method object (for instance symmetry). See class Method for details.
Field::Element& LinBox::detin ( typename Field::Element &  d,
BlasBlackbox< Field > &  A 
)

A will be modified.

Returns:
d determinant of A.
Parameters:
Athis BlasBlackbox matrix will be modified in place in the process.
unsigned long& LinBox::rank ( unsigned long &  r,
const Blackbox &  A,
const DomainCategory &  tag,
const Method &  M 
)

Compute the rank of a linear transform A over a field by selected method. For very large and/or very sparse matrices the Wiedemann method will be faster (and is memory efficient). For some sparse matrices SparseElimination may outperform Wiedemann. For small or dense matrices BlasElimination will be faster.

Parameters:
r- output rank of A.
-input A linear transform, member of any blackbox class.
-input M may be a Method::Wiedemann (the default), a Method::BlasElimination, or a Method::SparseElimination..
Returns:
reference to r.
unsigned long& LinBox::rank ( unsigned long &  r,
const Blackbox &  A 
)

Compute the rank of a linear transform A over a field.

The default method is Wiedemann(), using diagonal preconditioning and the minpoly. For small or dense matrices BlasElimination will be faster.

Returns:
r rank of A.
Parameters:
Alinear transform, member of any blackbox class.
unsigned long& LinBox::rank ( unsigned long &  r,
const Blackbox &  A,
const Method &  M 
)

Compute the rank of a linear transform A over a field.

The default method is Wiedemann(), using diagonal preconditioning and the minpoly. For small or dense matrices BlasElimination will be faster.

Returns:
r rank of A.
Parameters:
Alinear transform, member of any blackbox class.
Output& LinBox::smithForm ( Output &  S,
const Blackbox &  A,
const MyMethod &  M 
)

Compute the Smith form of A

The Smith form of a linear operator A, represented as a black box, is computed over a representation of Z or Z_m.

Parameters:
OutputS, a list of invariant/repcount pairs.
AMatrix of which to compute the Smith form
Mmay be a Method::Hybrid (default), which uses the algorithms/smith-form-adaptive. Other methods will be provided later. For now see the examples/smith.C for ways to call other smith form algorithms.
Vector& LinBox::solve ( Vector &  x,
const Blackbox &  A,
const Vector &  b,
const SolveMethod &  M 
)

Solve Ax = b, for x.

Vector x such that Ax = b is returned. In the case of a singular matrix A, if the system is consistent, a random solution is returned by default. The method parameter may contain an indication that an arbitrary element of the solution space is acceptable, which can be faster to compute. If the system is inconsistent the zero vector is returned.

Blackbox::Field::Element& LinBox::valence ( typename Blackbox::Field::Element &  v,
const Blackbox &  A,
const MyMethod &  M 
)

Compute the valence of A.

The valence of a linear operator A, represented as a black box, is computed over the ring or field of A.

Parameters:
vField element into which to store the result
ABlack box of which to compute the determinant
Mmay is a Method.