const number beta = (adding ? 1. : 0.);
const number null = 0.;
+ // use trmv for triangular matrices
+ if ((property == upper_triangular ||
+ property == lower_triangular) &&
+ (mm==nn) &&
+ state == matrix)
+ {
+ Assert (adding == false,
+ ExcNotImplemented());
+
+ AssertDimension(v.size(), this->n_cols());
+ AssertDimension(w.size(), this->n_rows());
+
+ const char diag = 'N';
+ const char trans = 'N';
+ const char uplo = (property == upper_triangular ? LAPACKSupport::U : LAPACKSupport::L);
+
+ w = v;
+
+ const int N = mm;
+ const int lda = N;
+ const int incx = 1;
+
+ trmv (&uplo, &trans, &diag,
+ &N, &this->values[0], &lda,
+ &w[0], &incx);
+
+ return;
+ }
+
switch (state)
{
case matrix:
const number beta = (adding ? 1. : 0.);
const number null = 0.;
+ // use trmv for triangular matrices
+ if ((property == upper_triangular ||
+ property == lower_triangular) &&
+ (mm==nn) &&
+ state == matrix)
+ {
+ Assert (adding == false,
+ ExcNotImplemented());
+
+ AssertDimension(v.size(), this->n_cols());
+ AssertDimension(w.size(), this->n_rows());
+
+ const char diag = 'N';
+ const char trans = 'T';
+ const char uplo = (property == upper_triangular ? LAPACKSupport::U : LAPACKSupport::L);
+
+ w = v;
+
+ const int N = mm;
+ const int lda = N;
+ const int incx = 1;
+
+ trmv (&uplo, &trans, &diag,
+ &N, &this->values[0], &lda,
+ &w[0], &incx);
+
+ return;
+ }
+
+
switch (state)
{
case matrix:
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// test LAPACKFullMatrix::vmult() and Tvmult() for triangular matrices
+
+/* MWE for size=3 in Octave:
+R = [1,2,3; 0, 5, 6; 0, 0, 9]
+x = [2; -7; 1]
+
+> R*x
+ans =
+
+ -9
+ -29
+ 9
+
+R' * x
+ans =
+
+ 2
+ -31
+ -27
+*/
+
+#include "../tests.h"
+#include "create_matrix.h"
+#include <deal.II/lac/lapack_full_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <iostream>
+
+
+template <typename NumberType>
+void
+test()
+{
+ const unsigned int size = 3;
+ LAPACKFullMatrix<NumberType> M(size);
+ M.set_property(LAPACKSupport::upper_triangular);
+
+ M = 0.;
+ unsigned int counter = 1;
+ for (unsigned int i = 0; i < size; ++i)
+ for (unsigned int j = 0; j < size; ++j)
+ {
+ if (j >= i)
+ M(i,j) = counter;
+
+ counter++;
+ }
+
+ Vector<NumberType> x(size), y(size);
+ x[0] = 2;
+ x[1] = -7;
+ x[2] = 1;
+
+ M.vmult(y,x);
+ y.print(deallog.get_file_stream(), 6, false);
+
+ M.Tvmult(y,x);
+ y.print(deallog.get_file_stream(), 6, false);
+
+}
+
+
+int main()
+{
+ const std::string logname = "output";
+ std::ofstream logfile(logname.c_str());
+ logfile.precision(3);
+ deallog.attach(logfile);
+
+ test<double>();
+
+}