* Implementation of symbolic matrices */
/*
- * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return matrix(row, col, m2).subs_one_level(mp, options);
}
+/** Complex conjugate every matrix entry. */
+ex matrix::conjugate() const
+{
+ exvector * ev = 0;
+ for (exvector::const_iterator i=m.begin(); i!=m.end(); ++i) {
+ ex x = i->conjugate();
+ if (ev) {
+ ev->push_back(x);
+ continue;
+ }
+ if (are_ex_trivially_equal(x, *i)) {
+ continue;
+ }
+ ev = new exvector;
+ ev->reserve(m.size());
+ for (exvector::const_iterator j=m.begin(); j!=i; ++j) {
+ ev->push_back(*j);
+ }
+ ev->push_back(x);
+ }
+ if (ev) {
+ ex result = matrix(row, col, *ev);
+ delete ev;
+ return result;
+ }
+ return *this;
+}
+
// protected
int matrix::compare_same_type(const basic & other) const
unsigned sparse_count = 0; // counts non-zero elements
exvector::const_iterator r = m.begin(), rend = m.end();
while (r != rend) {
- lst srl; // symbol replacement list
+ exmap srl; // symbol replacement list
ex rtest = r->to_rational(srl);
if (!rtest.is_zero())
++sparse_count;
*
* @param vars n x p matrix, all elements must be symbols
* @param rhs m x p matrix
+ * @param algo selects the solving algorithm
* @return n x p solution matrix
* @exception logic_error (incompatible matrices)
* @exception invalid_argument (1st argument must be matrix of symbols)
// makes things more complicated than they need to be.
matrix tmp_n(*this);
matrix tmp_d(m,n); // for denominators, if needed
- lst srl; // symbol replacement list
+ exmap srl; // symbol replacement list
exvector::const_iterator cit = this->m.begin(), citend = this->m.end();
exvector::iterator tmp_n_it = tmp_n.m.begin(), tmp_d_it = tmp_d.m.begin();
while (cit != citend) {