/* Copyright 2016 The Science and Technology Facilities Council (STFC) * * Authors: Jonathan Hogg (STFC) * * Licence: BSD licence, see LICENCE file for details * */ #include "framework.hxx" #include #include #include #include #include #include /** Generates a random dense positive definte matrix. Off diagonal entries are * Unif[-1,1]. Each diagonal entry a_ii = Unif[0.1,1.1] + sum_{i!=j} |a_ij|. * Only lower triangle is used, rest is filled with NaNs. */ void gen_posdef(int n, double* a, int lda) { /* Get general sym indef matrix */ gen_sym_indef(n, a, lda); /* Make diagonally dominant */ for(int i=0; i::signaling_NaN(); } /** Generate one or more right-hand sides corresponding to soln x = 1.0. */ void gen_rhs(int n, double const* a, int lda, double* rhs) { memset(rhs, 0, n*sizeof(double)); for(int j=0; j