Commit c19d63ca authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

correction in linear shape

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2090
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 3676cf7f
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: README.changelog,v 1.57 2005-07-05 15:18:36 tforb Exp $
* $Id: README.changelog,v 1.58 2006-04-27 07:21:37 tforb Exp $
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
......@@ -21,12 +21,18 @@
/*! \page page_changelog ChangeLog (AFF)
$Id: README.changelog,v 1.57 2005-07-05 15:18:36 tforb Exp $
$Id: README.changelog,v 1.58 2006-04-27 07:21:37 tforb Exp $
\sa \ref page_project_status
Major changes in the interface of the library are marked by \b !!.
- \b 27/04/2006 (thof)
- Constructor of aff::LinearShape (shape class for aff::Series)
was asserting last index > first index, which is to strict.
One-element arrays will have last=first, which is perfectly reasonable.
Assertion is now: last >= first
- \b 05/07/2005 (thof)
- track down design decision for const container data modification
(04/07/2005) to operators
......@@ -233,7 +239,7 @@
/*! \page page_project_status Project status (AFF)
$Id: README.changelog,v 1.57 2005-07-05 15:18:36 tforb Exp $
$Id: README.changelog,v 1.58 2006-04-27 07:21:37 tforb Exp $
\sa \ref page_changelog
......@@ -325,7 +331,7 @@
<TD> </TD><TD> </TD><TD> </TD><TD>removed 10/02/2004</TD>
</TR>
<TR><TD>libaff/lib/linearshape.h</TD>
<TD>23/12/2003</TD><TD> </TD><TD>23/12/2003 </TD><TD> </TD>
<TD>23/12/2003</TD><TD>27/04/2006</TD><TD>23/12/2003 </TD><TD> </TD>
</TR>
<TR><TD>libaff/lib/operators.h</TD>
<TD>10/02/2004</TD><TD> </TD><TD>10/02/2004 </TD><TD> </TD>
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: linearshape.h,v 1.6 2006-03-28 16:03:07 tforb Exp $
* $Id: linearshape.h,v 1.7 2006-04-27 07:21:38 tforb Exp $
* \author Thomas Forbriger
* \date 23/12/2003
*
......@@ -35,6 +35,8 @@
* - renamed reshaping functions to match the class
* Strided
* - 05/07/2005 V1.3 provide index shifting
* - 27/04/2006 V1.4 assert: last >= first
* was: last > first which is too strict
*
* ============================================================================
*/
......@@ -43,9 +45,9 @@
#ifndef AFF_LINEARSHAPE_H_VERSION
#define AFF_LINEARSHAPE_H_VERSION \
"AFF_LINEARSHAPE_H V1.2 "
"AFF_LINEARSHAPE_H V1.4"
#define AFF_LINEARSHAPE_H_CVSID \
"$Id: linearshape.h,v 1.6 2006-03-28 16:03:07 tforb Exp $"
"$Id: linearshape.h,v 1.7 2006-04-27 07:21:38 tforb Exp $"
namespace aff {
......@@ -86,25 +88,36 @@ namespace aff {
* Some parts of the code rely on \c Mmax_dimen>=2. This condition is
* intrinsically violated here.
*/
//! the linear shape is used to address one-dimensional arrays
static const Tdim Mmax_dimen=1;
//! stepper class for LinearShape (useid through Series by Iterator e.g.)
typedef aff::util::SeriesStepper Tstepper;
//! default constructor defines range of size 1
LinearShape(): Mfirst(0), Mlast(0), Mbase(0) { }
//! constructor to use for full definition
LinearShape(const Tsubscript& first,
const Tsubscript& last,
const Tsubscript& firstinrepr):
Mfirst(first), Mlast(last), Mbase(first-firstinrepr)
{
AFF_assert((Mlast>Mfirst),
AFF_assert((Mlast>=Mfirst),
"ERROR (LinearShape): inconsistent constructor arguments");
}
//! return first legal index
const Tsubscript& first() const { return(Mfirst); }
//! return last legal index
const Tsubscript& last() const { return(Mlast); }
//! return offset in representation for indes \p i
Tsubscript offset(const Tsubscript& i) const { return(i-Mbase); }
//! return base for access to representation
const Tsize& base() const { return(Mbase); }
//! by size we mean the size defined by the shape
Tsize size() const
{ return(static_cast<Tsize>(Mlast-Mfirst+1)); }
//! return size of addressed memory
Tsize memory_size() const { return(this->size()); }
//! set index range [ \p first , \p last ] for dimension \p i
//! (used by aff::util::Subarray)
LinearShape& shrink(const Tdim& i,
const Tsubscript& first, const Tsubscript& last)
{
......@@ -112,6 +125,8 @@ namespace aff {
this->setindexrange(first, last);
return(*this);
}
//! set last index of dimension \p i to \p last
//! (used by aff::util::Subarray)
LinearShape& shrink(const Tdim& i,
const Tsubscript& last)
{
......@@ -119,6 +134,7 @@ namespace aff {
this->setlastindex(last);
return(*this);
}
//! set index range [ \p first , \p last ]
void setindexrange(const Tsubscript& first,
const Tsubscript last)
{
......@@ -127,12 +143,14 @@ namespace aff {
setfirstindex(first);
setlastindex(last);
}
//! set first index to \p first
void setfirstindex(const Tsubscript& first)
{
AFF_assert(((first>=Mfirst)&&(first<=Mlast)),
"ERROR (LinearShape::setfirstindex): index value out of range");
Mfirst=first;
}
//! set last index to \p last
void setlastindex(const Tsubscript& last)
{
AFF_assert(((last>=Mfirst)&&(last<=Mlast)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment