<ol>
- <li> <p> New:<code class="class">FullMatrix</code> has a new function add,
+ <li> <p> New:<code class="class">FullMatrix</code> has new functions <code
+ class="member">add</code> and ,<code
+ class="member">Tadd</code>
allowing to add to a selected block of the matrix.
<br>
- (GK 2004/02/09)
+ (GK 2004/02/12)
</p>
<li> <p> Improved: Initialization routines of class <code
void Tadd (const number s,
const FullMatrix<number2> &B);
+ /**
+ * Add transose of a rectangular block.
+ *
+ * A rectangular block of the
+ * matrix <tt>src</tt> is
+ * transposed and addedadded to
+ * <tt>this</tt>. The upper left
+ * corner of the block being
+ * copied is
+ * <tt>(src_offset_i,src_offset_j)</tt>
+ * in the coordinates of the
+ * <b>non</b>-transposed matrix.
+ * The upper left corner of the
+ * copied block is
+ * <tt>(dst_offset_i,dst_offset_j)</tt>.
+ * The size of the rectangular
+ * block being copied is the
+ * maximum size possible,
+ * determined either by the size
+ * of <tt>this</tt> or
+ * <tt>src</tt>.
+ */
+ template<typename number2>
+ void Tadd (const FullMatrix<number2> &src,
+ const double factor,
+ const unsigned int dst_offset_i = 0,
+ const unsigned int dst_offset_j = 0,
+ const unsigned int src_offset_i = 0,
+ const unsigned int src_offset_j = 0);
+
/**
* Matrix-matrix-multiplication.
*
+template <typename number>
+template <typename number2>
+void FullMatrix<number>::Tadd (const FullMatrix<number2> &src,
+ const double factor,
+ const unsigned int dst_offset_i,
+ const unsigned int dst_offset_j,
+ const unsigned int src_offset_i,
+ const unsigned int src_offset_j)
+{
+ // Compute maximal size of copied block
+ const unsigned int rows = (m() - dst_offset_i >= src.n() - src_offset_i)
+ ? src.n()
+ : m();
+ const unsigned int cols = (n() - dst_offset_j >= src.m() - src_offset_j)
+ ? src.m()
+ : n();
+
+ for (unsigned int i=0; i<rows ; ++i)
+ for (unsigned int j=0; j<cols ; ++j)
+ this->el(dst_offset_i+i,dst_offset_j+j)
+ += factor * src.el(src_offset_i+j,src_offset_j+i);
+}
+
+
+
template <typename number>
template <typename number2>
void
template void FullMatrix<TYPEMAT>::add<TYPEMAT2> (
const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
+template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (
+ const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
template void FullMatrix<TYPEMAT>::mmult<TYPEMAT2> (FullMatrix<TYPEMAT2>&, const FullMatrix<TYPEMAT2>&, const bool) const;
template void FullMatrix<TYPEMAT>::Tmmult<TYPEMAT2> (FullMatrix<TYPEMAT2>&, const FullMatrix<TYPEMAT2>&, const bool) const;
template void FullMatrix<TYPEMAT>::add_diag<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
template void FullMatrix<TYPEMAT>::add<TYPEMAT2> (
const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);
+template void FullMatrix<TYPEMAT>::Tadd<TYPEMAT2> (
+ const FullMatrix<TYPEMAT2>&, double, unsigned, unsigned, unsigned, unsigned);
template void FullMatrix<TYPEMAT>::mmult<TYPEMAT2> (FullMatrix<TYPEMAT2>&, const FullMatrix<TYPEMAT2>&, const bool) const;
template void FullMatrix<TYPEMAT>::Tmmult<TYPEMAT2> (FullMatrix<TYPEMAT2>&, const FullMatrix<TYPEMAT2>&, const bool) const;
template void FullMatrix<TYPEMAT>::add_diag<TYPEMAT2> (const TYPEMAT, const FullMatrix<TYPEMAT2>&);