#include <gmf.h>
Information Predicates | |
bool | is_zero () const |
bool | is_submatrixview () const |
bool | has_unitstride () const |
bool | equal_to (const matrix_type &mat) const |
Expensive access functions | |
matrix_type | repmat (int M, int N) const |
value_type | trace () const |
matrix_type | diag () const |
Matrix type conversions | |
LaGenMatComplex | to_LaGenMatComplex () const |
LaGenMatDouble | to_LaGenMatDouble () const |
LaGenMatInt | to_LaGenMatInt () const |
LaGenMatLongInt | to_LaGenMatLongInt () const |
Constructors for elementary matrices | |
static matrix_type | zeros (int N, int M=0) |
static matrix_type | ones (int N, int M=0) |
static matrix_type | eye (int N, int M=0) |
static matrix_type | rand (int N, int M, value_type low=0, value_type high=1) |
static matrix_type | from_diag (const matrix_type &vect) |
static matrix_type | linspace (value_type start, value_type end, int nr_points) |
Public Types | |
typedef float | value_type |
typedef LaGenMatFloat | matrix_type |
typedef VectorFloat | vec_type |
Public Member Functions | |
LaGenMatFloat () | |
LaGenMatFloat (int, int) | |
LaGenMatFloat (float *v, int m, int n, bool row_ordering=false) | |
LaGenMatFloat (const LaGenMatFloat &) | |
virtual | ~LaGenMatFloat () |
int | size (int d) const |
int | cols () const |
int | rows () const |
int | inc (int d) const |
int | gdim (int d) const |
int | start (int d) const |
int | end (int d) const |
LaIndex | index (int d) const |
int | ref_count () const |
LaGenMatFloat & | shallow_assign () |
float * | addr () const |
float & | operator() (int i, int j) |
float & | operator() (int i, int j) const |
LaGenMatFloat | operator() (const LaIndex &I, const LaIndex &J) |
LaGenMatFloat | operator() (const LaIndex &I, const LaIndex &J) const |
LaGenMatFloat | row (int k) |
LaGenMatFloat | row (int k) const |
LaGenMatFloat | col (int k) |
LaGenMatFloat | col (int k) const |
LaGenMatFloat & | operator= (float s) |
LaGenMatFloat & | operator= (const LaGenMatFloat &s) |
LaGenMatFloat & | operator+= (float s) |
LaGenMatFloat & | add (float s) |
LaGenMatFloat & | resize (int m, int n) |
LaGenMatFloat & | resize (const LaGenMatFloat &s) |
LaGenMatFloat & | ref (const LaGenMatFloat &s) |
LaGenMatFloat & | inject (const LaGenMatFloat &s) |
LaGenMatFloat & | copy (const LaGenMatFloat &s) |
LaGenMatFloat | copy () const |
int | shallow () const |
int | debug () const |
int | debug (int d) |
const LaGenMatFloat & | info () const |
std::ostream & | Info (std::ostream &s) const |
Friends | |
std::ostream & | operator<< (std::ostream &, const LaGenMatFloat &) |
typedef float LaGenMatFloat::value_type |
The type of the value elements.
Convenience typedef of this class to itself to make common function definitions easier. (New in lapackpp-2.4.5)
typedef VectorFloat LaGenMatFloat::vec_type |
Internal wrapper type; don't use that in an application.
LaGenMatFloat::LaGenMatFloat | ( | ) |
LaGenMatFloat::LaGenMatFloat | ( | int | , | |
int | ||||
) |
LaGenMatFloat::LaGenMatFloat | ( | float * | v, | |
int | m, | |||
int | n, | |||
bool | row_ordering = false | |||
) |
Constructs an matrix by using the values from the one-dimensional C array v
of length m*n
.
row_ordering
is false
, then the data will not be copied but instead the C array will be shared (shallow copy). In that case, you must not delete the C array as long as you use this newly created matrix. Also, if you need a copy (deep copy), construct one matrix A
by this constructor, and then copy this content into a second matrix by B.copy(A)
. On the other hand, if row_ordering
is true
, then the data will be copied immediately (deep copy).v | The one-dimensional C array of size m*n whose data should be used. If row_ordering is false , then the data will not be copied but shared (shallow copy). If row_ordering is true , then the data will be copied (deep copy). | |
m | The number of rows in the new matrix. | |
n | The number of columns in the new matrix. | |
row_ordering | If false , then the C array is used in column-order, i.e. the first m elements of v are used as the first column of the matrix, the next m elements are the second column and so on. (This is the default and this is also the internal storage format in order to be compatible with the underlying Fortran subroutines.) If this is true , then the C array is used in row-order, i.e. the first n elements of v are used as the first row of the matrix, the next n elements are the second row and so on. (Internally, this is achieved by allocating a new copy of the array and copying the array into the internal ordering.) |
LaGenMatFloat::LaGenMatFloat | ( | const LaGenMatFloat & | ) |
Create a new matrix from an existing one by copying.
Watch out! Due to the C++ "named return value optimization" you cannot use this as an alias for copy() when declaring a variable if the right-side is a return value of operator(). More precisely, you cannot write the following:
LaGenMatFloat x( y(LaIndex(),LaIndex()) ); // erroneous reference copy!
Instead, if the initialization should create a new copy of the right-side matrix, you have to write it this way:
LaGenMatFloat x( y(LaIndex(),LaIndex()).copy() ); // correct deep-copy
Or this way:
LaGenMatFloat x; x = y(LaIndex(),LaIndex()); // correct deep-copy
virtual LaGenMatFloat::~LaGenMatFloat | ( | ) | [virtual] |
bool LaGenMatFloat::is_zero | ( | ) | const |
Returns true if this is an all-zero matrix. (New in lapackpp-2.4.5)
bool LaGenMatFloat::is_submatrixview | ( | ) | const [inline] |
Returns true if this matrix is only a submatrix view of another (larger) matrix. (New in lapackpp-2.4.4)
bool LaGenMatFloat::has_unitstride | ( | ) | const [inline] |
Returns true if this matrix has unit stride.
This is a necessary condition for not being a submatrix view, but it's not sufficient. (New in lapackpp-2.4.4)
bool LaGenMatFloat::equal_to | ( | const matrix_type & | mat | ) | const |
Returns true if the given matrix mat
is exactly equal to this object. (New in lapackpp-2.4.5)
int LaGenMatFloat::size | ( | int | d | ) | const [inline] |
int LaGenMatFloat::cols | ( | ) | const [inline] |
Returns the number of columns, i.e. for a M x N matrix this returns N. New in lapackpp-2.4.4.
int LaGenMatFloat::rows | ( | ) | const [inline] |
Returns the number of rows, i.e. for a M x N matrix this returns M. New in lapackpp-2.4.4.
int LaGenMatFloat::inc | ( | int | d | ) | const [inline] |
int LaGenMatFloat::gdim | ( | int | d | ) | const [inline] |
int LaGenMatFloat::start | ( | int | d | ) | const [inline] |
int LaGenMatFloat::end | ( | int | d | ) | const [inline] |
LaIndex LaGenMatFloat::index | ( | int | d | ) | const [inline] |
int LaGenMatFloat::ref_count | ( | ) | const [inline] |
LaGenMatFloat & LaGenMatFloat::shallow_assign | ( | ) | [inline] |
float * LaGenMatFloat::addr | ( | ) | const [inline] |
float & LaGenMatFloat::operator() | ( | int | i, | |
int | j | |||
) | [inline] |
float & LaGenMatFloat::operator() | ( | int | i, | |
int | j | |||
) | const [inline] |
LaGenMatFloat LaGenMatFloat::operator() | ( | const LaIndex & | I, | |
const LaIndex & | J | |||
) |
LaGenMatFloat LaGenMatFloat::operator() | ( | const LaIndex & | I, | |
const LaIndex & | J | |||
) | const |
LaGenMatFloat LaGenMatFloat::row | ( | int | k | ) |
Returns a submatrix view for the specified row k
of this matrix.
The returned object references still the same memory as this object, so if you modify elements, they will appear modified in both objects. (New in lapackpp-2.4.6)
LaGenMatFloat LaGenMatFloat::row | ( | int | k | ) | const |
Returns a submatrix view for the specified row k
of this matrix.
The returned object references still the same memory as this object, so if you modify elements, they will appear modified in both objects. (New in lapackpp-2.4.6)
LaGenMatFloat LaGenMatFloat::col | ( | int | k | ) |
Returns a submatrix view for the specified column k
of this matrix.
The returned object references still the same memory as this object, so if you modify elements, they will appear modified in both objects. (New in lapackpp-2.4.6)
LaGenMatFloat LaGenMatFloat::col | ( | int | k | ) | const |
Returns a submatrix view for the specified column k
of this matrix.
The returned object references still the same memory as this object, so if you modify elements, they will appear modified in both objects. (New in lapackpp-2.4.6)
LaGenMatFloat& LaGenMatFloat::operator= | ( | float | s | ) |
LaGenMatFloat& LaGenMatFloat::operator= | ( | const LaGenMatFloat & | s | ) |
Release left-hand side (reclaiming memory space if possible) and copy elements of elements of s
. Unline inject()
, it does not require conformity, and previous references of left-hand side are unaffected.
This is an alias for copy().
Watch out! Due to the C++ "named return value optimization" you cannot use this as an alias for copy() when declaring a variable if the right-side is a return value of operator(). More precisely, you cannot write the following:
LaGenMatFloat x = y(LaIndex(),LaIndex()); // erroneous reference copy!
Instead, if the initialization should create a new copy of the right-side matrix, you have to write it this way:
LaGenMatFloat x = y(LaIndex(),LaIndex()).copy(); // correct deep-copy
Or this way:
LaGenMatFloat x; x = y(LaIndex(),LaIndex()); // correct deep-copy
Note: The manual for lapack++-1.1 claimed that this operator would be an alias for ref(), not for copy(), i.e. this operator creates a reference instead of a deep copy. However, since that confused many people, the behaviour was changed so that B=A will now create B as a deep copy instead of a reference. If you want a reference, please write B.ref(A) explicitly.
LaGenMatFloat& LaGenMatFloat::operator+= | ( | float | s | ) |
LaGenMatFloat& LaGenMatFloat::add | ( | float | s | ) |
LaGenMatFloat& LaGenMatFloat::resize | ( | int | m, | |
int | n | |||
) |
LaGenMatFloat& LaGenMatFloat::resize | ( | const LaGenMatFloat & | s | ) |
LaGenMatFloat& LaGenMatFloat::ref | ( | const LaGenMatFloat & | s | ) |
LaGenMatFloat& LaGenMatFloat::inject | ( | const LaGenMatFloat & | s | ) |
LaGenMatFloat& LaGenMatFloat::copy | ( | const LaGenMatFloat & | s | ) |
LaGenMatFloat LaGenMatFloat::copy | ( | ) | const |
Returns a newly allocated matrix that is an element-by-element copy of this matrix.
New in lapackpp-2.5.2
matrix_type LaGenMatFloat::repmat | ( | int | M, | |
int | N | |||
) | const |
Returns a newly allocated large matrix that consists of M-by-N
copies of the given matrix. (New in lapackpp-2.4.5.)
value_type LaGenMatFloat::trace | ( | ) | const |
Returns the trace, i.e. the sum of all diagonal elements of the matrix. (New in lapackpp-2.4.5)
matrix_type LaGenMatFloat::diag | ( | ) | const |
Returns a newly allocated column vector of dimension Nx1
that contains the diagonal of the given matrix. (New in lapackpp-2.4.5)
int LaGenMatFloat::shallow | ( | ) | const [inline] |
int LaGenMatFloat::debug | ( | ) | const [inline] |
int LaGenMatFloat::debug | ( | int | d | ) | [inline] |
const LaGenMatFloat& LaGenMatFloat::info | ( | ) | const [inline] |
std::ostream& LaGenMatFloat::Info | ( | std::ostream & | s | ) | const [inline] |
LaGenMatComplex LaGenMatFloat::to_LaGenMatComplex | ( | ) | const |
Convert this matrix to a complex matrix with imaginary part zero.
LaGenMatDouble LaGenMatFloat::to_LaGenMatDouble | ( | ) | const |
Convert this matrix to a double (floating-point double precision) matrix.
LaGenMatInt LaGenMatFloat::to_LaGenMatInt | ( | ) | const |
Convert this matrix to an int matrix.
LaGenMatLongInt LaGenMatFloat::to_LaGenMatLongInt | ( | ) | const |
Convert this matrix to a long int matrix.
static matrix_type LaGenMatFloat::zeros | ( | int | N, | |
int | M = 0 | |||
) | [static] |
Returns a newly allocated all-zero matrix of dimension NxN
, if M
is not given, or NxM
if M
is given. (New in lapackpp-2.4.5)
static matrix_type LaGenMatFloat::ones | ( | int | N, | |
int | M = 0 | |||
) | [static] |
Returns a newly allocated all-one matrix of dimension NxN
, if M
is not given, or NxM
if M
is given. (New in lapackpp-2.4.5)
static matrix_type LaGenMatFloat::eye | ( | int | N, | |
int | M = 0 | |||
) | [static] |
Returns a newly allocated identity matrix of dimension NxN
, if M
is not given, or a rectangular matrix NxM
if M
is given. (New in lapackpp-2.4.5)
static matrix_type LaGenMatFloat::rand | ( | int | N, | |
int | M, | |||
value_type | low = 0 , |
|||
value_type | high = 1 | |||
) | [static] |
Returns a newly allocated matrix of dimension NxM
with pseudo-random values. The values are uniformly distributed in the interval (0,1) or, if specified,
(low,high). (New in lapackpp-2.4.5)
Note: Since this uses the system's rand()
call, the randomness of the values might be questionable -- don't use this if you need really strong random numbers.
static matrix_type LaGenMatFloat::from_diag | ( | const matrix_type & | vect | ) | [static] |
Returns a newly allocated diagonal matrix of dimension NxN
that has the vector vect
of length N
on the diagonal. (New in lapackpp-2.4.5)
static matrix_type LaGenMatFloat::linspace | ( | value_type | start, | |
value_type | end, | |||
int | nr_points | |||
) | [static] |
Returns a newly allocated linarly spaced column vector with nr_points
elements, between and including start
and end
. (New in lapackpp-2.4.5.)
std::ostream& operator<< | ( | std::ostream & | , | |
const LaGenMatFloat & | ||||
) | [friend] |
Print the matrix to the given output stream. If the matrix info flag is set, then this prints only the matrix info, see LaGenMatDouble::info(). Otherwise all matrix elements are printed.