Skip to content
Snippets Groups Projects
Commit 98c6c455 authored by Oliver Sander's avatar Oliver Sander
Browse files

K1Vector and K11Matrix are gone for good

[[Imported from SVN: r2059]]
parent 21a24dec
No related branches found
No related tags found
No related merge requests found
......@@ -986,244 +986,6 @@ namespace Dune {
return HelpMat::determinantMatrix(*this);
}
#ifdef USE_DEPRECATED_K1
/** \brief Special type for 1x1 matrices
*/
template<class K>
class K11Matrix
{
public:
// standard constructor and everything is sufficient ...
//===== type definitions and constants
//! export the type representing the field
typedef K field_type;
//! export the type representing the components
typedef K block_type;
//! We are at the leaf of the block recursion
enum {
//! The number of block levels we contain.
//! This is always one for this type.
blocklevel = 1
};
//! export size
enum {
//! \brief The number of rows.
//! This is always one for this type.
rows = 1,
//! \brief The number of columns.
//! This is always one for this type.
cols = 1
};
//===== assignment from scalar
K11Matrix& operator= (const K& k)
{
a = k;
return *this;
}
//===== vector space arithmetic
//! vector space addition
K11Matrix& operator+= (const K& y)
{
a += y;
return *this;
}
//! vector space subtraction
K11Matrix& operator-= (const K& y)
{
a -= y;
return *this;
}
//! vector space multiplication with scalar
K11Matrix& operator*= (const K& k)
{
a *= k;
return *this;
}
//! vector space division by scalar
K11Matrix& operator/= (const K& k)
{
a /= k;
return *this;
}
//===== linear maps
//! y += A x
void umv (const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p += a * x.p;
}
//! y += A^T x
void umtv (const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p += a * x.p;
}
//! y += A^H x
void umhv (const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p += fm_ck(a) * x.p;
}
//! y -= A x
void mmv (const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p -= a * x.p;
}
//! y -= A^T x
void mmtv (const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p -= a * x.p;
}
//! y -= A^H x
void mmhv (const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p -= fm_ck(a) * x.p;
}
//! y += alpha A x
void usmv (const K& alpha, const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p += alpha * a * x.p;
}
//! y += alpha A^T x
void usmtv (const K& alpha, const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p += alpha * a * x.p;
}
//! y += alpha A^H x
void usmhv (const K& alpha, const K1Vector<K>& x, K1Vector<K>& y) const
{
y.p += alpha * fm_ck(a) * x.p;
}
//===== norms
//! frobenius norm: sqrt(sum over squared values of entries)
double frobenius_norm () const
{
return sqrt(fvmeta_abs2(a));
}
//! square of frobenius norm, need for block recursion
double frobenius_norm2 () const
{
return fvmeta_abs2(a);
}
//! infinity norm (row sum norm, how to generalize for blocks?)
double infinity_norm () const
{
return fvmeta_abs(a);
}
//! simplified infinity norm (uses Manhattan norm for complex values)
double infinity_norm_real () const
{
return fvmeta_abs_real(a);
}
//===== solve
//! Solve system A x = b
void solve (K1Vector<K>& x, const K1Vector<K>& b) const
{
x.p = b.p/a;
}
//! compute inverse
void invert ()
{
a = 1/a;
}
//! left multiplication
K11Matrix& leftmultiply (const K11Matrix<K>& M)
{
a *= M.a;
return *this;
}
//! left multiplication
K11Matrix& rightmultiply (const K11Matrix<K>& M)
{
a *= M.a;
return *this;
}
//===== sizes
//! number of blocks in row direction
int N () const
{
return 1;
}
//! number of blocks in column direction
int M () const
{
return 1;
}
//! row dimension of block r
int rowdim (int r) const
{
return 1;
}
//! col dimension of block c
int coldim (int c) const
{
return 1;
}
//! dimension of the destination vector space
int rowdim () const
{
return 1;
}
//! dimension of the source vector space
int coldim () const
{
return 1;
}
//===== query
//! return true when (i,j) is in pattern
bool exists (int i, int j) const
{
return i==0 && j==0;
}
//===== conversion operator
operator K () const {return a;}
private:
// the data, just a single scalar
K a;
};
#endif // USE_DEPRECATED_K1
/** \brief Special type for 1x1 matrices
*/
......
......@@ -4,9 +4,6 @@
#ifndef DUNE_FVECTOR_HH
#define DUNE_FVECTOR_HH
// this for backwards compatiblity
#define USE_DEPRECATED_K1
#include <math.h>
#include <complex>
......@@ -732,186 +729,6 @@ namespace Dune {
return s;
}
#ifdef USE_DEPRECATED_K1
// forward declarations
template<class K> class K11Matrix;
/**! \brief Vectors containing only one component
*/
template<class K>
class K1Vector
{
public:
friend class K11Matrix<K>;
//===== type definitions and constants
//! export the type representing the field
typedef K field_type;
//! export the type representing the components
typedef K block_type;
//! We are at the leaf of the block recursion
enum {
//! The number of block levels we contain.
// This is always one for this type.
blocklevel = 1
};
//! export size
enum {
//! The size of this vector.
// This is always one for this type.
size = 1
};
//===== construction
/** \brief Default constructor */
K1Vector ()
{ }
/** \brief Constructor with a given scalar */
K1Vector (const K& k)
{
p = k;
}
/** \brief Assignment from the base type */
K1Vector& operator= (const K& k)
{
p = k;
return *this;
}
//===== vector space arithmetic
//! vector space addition
K1Vector& operator+= (const K1Vector& y)
{
p += y.p;
return *this;
}
//! vector space subtraction
K1Vector& operator-= (const K1Vector& y)
{
p -= y.p;
return *this;
}
//! vector space add scalar to each comp
K1Vector& operator+= (const K& k)
{
p += k;
return *this;
}
//! vector space subtract scalar from each comp
K1Vector& operator-= (const K& k)
{
p -= k;
return *this;
}
//! vector space multiplication with scalar
K1Vector& operator*= (const K& k)
{
p *= k;
return *this;
}
//! vector space division by scalar
K1Vector& operator/= (const K& k)
{
p /= k;
return *this;
}
//! vector space axpy operation
K1Vector& axpy (const K& a, const K1Vector& y)
{
p += a*y.p;
return *this;
}
//===== Euclidean scalar product
//! scalar product
const K operator* (const K1Vector& y) const
{
return p*y.p;
}
//===== norms
//! one norm (sum over absolute values of entries)
double one_norm () const
{
return fvmeta_abs(p);
}
//! simplified one norm (uses Manhattan norm for complex values)
double one_norm_real () const
{
return fvmeta_abs_real(p);
}
//! two norm sqrt(sum over squared values of entries)
double two_norm () const
{
return sqrt(fvmeta_abs2(p));
}
//! square of two norm (sum over squared values of entries), need for block recursion
double two_norm2 () const
{
return fvmeta_abs2(p);
}
//! infinity norm (maximum of absolute values of entries)
double infinity_norm () const
{
return fvmeta_abs(p);
}
//! simplified infinity norm (uses Manhattan norm for complex values)
double infinity_norm_real () const
{
return fvmeta_abs_real(p);
}
//===== sizes
//! number of blocks in the vector (are of size 1 here)
int N () const
{
return 1;
}
//! dimension of the vector space (==1)
int dim () const
{
return 1;
}
//===== conversion operator
/** \brief Conversion operator */
operator K () {return p;}
/** \brief Const conversion operator */
operator K () const {return p;}
private:
// the data
K p;
};
#endif // USE_DEPRECATED_K1
// forward declarations
template<class K, int n, int m> class FieldMatrix;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment