Skip to content

Commit

Permalink
Merge branch 'maint16_1' into maint16_2
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/core/dvector.h
#	src/core/dvector.imp
#	src/pygambit/behavmixed.pxi
#	src/pygambit/stratmixed.pxi
  • Loading branch information
tturocy committed Apr 16, 2024
2 parents b19c549 + 9b17656 commit 13e314b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
17 changes: 15 additions & 2 deletions src/core/dvector.h
Expand Up @@ -36,19 +36,32 @@ template <class T> class DVector : public PVector<T> {
Array<int> dvlen, dvidx;

public:
explicit DVector(const PVector<int> &sig);
explicit DVector(const PVector<int> &shape);
DVector(const DVector<T> &v);
~DVector() override;

T &operator()(int a, int b, int c);
const T &operator()(int a, int b, int c) const;

DVector<T> &operator=(T c);
DVector<T> &operator=(const DVector<T> &v)
{
if (this == &v) {
return *this;
}
if (dvlen != v.dvlen || dvidx != v.dvidx) {
throw DimensionException();
}
static_cast<Vector<T> &>(*this) = static_cast<const Vector<T> &>(v);
return *this;
}

DVector<T> &operator=(const Vector<T> &v)
{
static_cast<Vector<T> &>(*this) = v;
return *this;
}

DVector<T> &operator=(const T &c);
};

} // end namespace Gambit
Expand Down
9 changes: 5 additions & 4 deletions src/core/dvector.imp
Expand Up @@ -44,14 +44,15 @@ template <class T> void DVector<T>::setindex()
//--------------------------------------------------------------------------

template <class T>
DVector<T>::DVector(const PVector<int> &sig)
: PVector<T>((Array<int>)sig), dvlen(sig.Lengths().Length()), dvidx(sig.Lengths().Length())
DVector<T>::DVector(const PVector<int> &shape)
: PVector<T>(static_cast<const Array<int> &>(shape)),
dvlen(shape.Lengths().Length()), dvidx(shape.Lengths().Length())
{
dvptr = new T **[dvlen.Length()];
dvptr -= 1;

for (int i = 1; i <= dvlen.Length(); i++) {
dvlen[i] = sig.Lengths()[i];
dvlen[i] = shape.Lengths()[i];
}

setindex();
Expand All @@ -73,7 +74,7 @@ template <class T> DVector<T>::~DVector()
}
}

template <class T> DVector<T> &DVector<T>::operator=(T c)
template <class T> DVector<T> &DVector<T>::operator=(const T &c)
{
PVector<T>::operator=(c);
return *this;
Expand Down

0 comments on commit 13e314b

Please sign in to comment.