"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ginac/matrix.h" between
ginac-1.7.11.tar.bz2 and ginac-1.8.0.tar.bz2

About: GiNaC (GiNaC is Not a CAS (Computer Algebra System)) is a C++ library for symbolic calculations.

matrix.h  (ginac-1.7.11.tar.bz2):matrix.h  (ginac-1.8.0.tar.bz2)
skipping to change at line 36 skipping to change at line 36
#include "basic.h" #include "basic.h"
#include "ex.h" #include "ex.h"
#include "archive.h" #include "archive.h"
#include "compiler.h" #include "compiler.h"
#include <string> #include <string>
#include <vector> #include <vector>
namespace GiNaC { namespace GiNaC {
/** Helper template to allow initialization of matrices via an overloaded
* comma operator (idea stolen from Blitz++). */
template <typename T, typename It>
class matrix_init {
public:
matrix_init(It i) : iter(i) {}
matrix_init<T, It> operator,(const T & x)
{
*iter = x;
return matrix_init<T, It>(++iter);
}
// The following specializations produce much tighter code than the
// general case above
matrix_init<T, It> operator,(int x)
{
*iter = T(x);
return matrix_init<T, It>(++iter);
}
matrix_init<T, It> operator,(unsigned int x)
{
*iter = T(x);
return matrix_init<T, It>(++iter);
}
matrix_init<T, It> operator,(long x)
{
*iter = T(x);
return matrix_init<T, It>(++iter);
}
matrix_init<T, It> operator,(unsigned long x)
{
*iter = T(x);
return matrix_init<T, It>(++iter);
}
matrix_init<T, It> operator,(double x)
{
*iter = T(x);
return matrix_init<T, It>(++iter);
}
matrix_init<T, It> operator,(const symbol & x)
{
*iter = T(x);
return matrix_init<T, It>(++iter);
}
private:
matrix_init();
It iter;
};
/** Symbolic matrices. */ /** Symbolic matrices. */
class matrix : public basic class matrix : public basic
{ {
GINAC_DECLARE_REGISTERED_CLASS(matrix, basic) GINAC_DECLARE_REGISTERED_CLASS(matrix, basic)
// other constructors // other constructors
public: public:
matrix(unsigned r, unsigned c); matrix(unsigned r, unsigned c);
matrix(unsigned r, unsigned c, const lst & l); matrix(unsigned r, unsigned c, const lst & l);
matrix(std::initializer_list<std::initializer_list<ex>> l); matrix(std::initializer_list<std::initializer_list<ex>> l);
matrix_init<ex, exvector::iterator> operator=(const ex & x) attribute_dep recated;
protected: protected:
matrix(unsigned r, unsigned c, const exvector & m2); matrix(unsigned r, unsigned c, const exvector & m2);
matrix(unsigned r, unsigned c, exvector && m2); matrix(unsigned r, unsigned c, exvector && m2);
// functions overriding virtual functions from base classes // functions overriding virtual functions from base classes
public: public:
size_t nops() const override; size_t nops() const override;
ex op(size_t i) const override; ex op(size_t i) const override;
ex & let_op(size_t i) override; ex & let_op(size_t i) override;
ex evalm() const override {return *this;} ex evalm() const override {return *this;}
ex subs(const exmap & m, unsigned options = 0) const override; ex subs(const exmap & m, unsigned options = 0) const override;
skipping to change at line 179 skipping to change at line 121
void do_print_python_repr(const print_python_repr & c, unsigned level) co nst; void do_print_python_repr(const print_python_repr & c, unsigned level) co nst;
// member variables // member variables
protected: protected:
unsigned row; ///< number of rows unsigned row; ///< number of rows
unsigned col; ///< number of columns unsigned col; ///< number of columns
exvector m; ///< representation (cols indexed first) exvector m; ///< representation (cols indexed first)
}; };
GINAC_DECLARE_UNARCHIVER(matrix); GINAC_DECLARE_UNARCHIVER(matrix);
// First step of initialization of matrix with a comma-separated sequence
// of expressions. Subsequent steps are handled by matrix_init<>::operator,().
inline matrix_init<ex, exvector::iterator> matrix::operator=(const ex & x)
{
m[0] = x;
return matrix_init<ex, exvector::iterator>(++m.begin());
}
// wrapper functions around member functions // wrapper functions around member functions
inline size_t nops(const matrix & m) inline size_t nops(const matrix & m)
{ return m.nops(); } { return m.nops(); }
inline ex expand(const matrix & m, unsigned options = 0) inline ex expand(const matrix & m, unsigned options = 0)
{ return m.expand(options); } { return m.expand(options); }
inline ex evalf(const matrix & m) inline ex evalf(const matrix & m)
{ return m.evalf(); } { return m.evalf(); }
 End of changes. 3 change blocks. 
66 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)