/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ // vim:sts=4:sw=4:ts=4:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s /* * Copyright (C) FFLAS-FFPACK * Written by Pascal Giorgi * This file is Free Software and part of FFLAS-FFPACK. * * ========LICENCE======== * This file is part of the library FFLAS-FFPACK. * * FFLAS-FFPACK is free software: you can 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. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ========LICENCE======== *. */ #define __FFLASFFPACK_SEQUENTIAL #define ENABLE_ALL_CHECKINGS 1 #include "fflas-ffpack/fflas-ffpack-config.h" #include #include #include #include "fflas-ffpack/utils/timer.h" #include "fflas-ffpack/fflas/fflas.h" #include "fflas-ffpack/utils/args-parser.h" #include "test-utils.h" #include #include using namespace std; using namespace FFPACK; using Givaro::Modular; using Givaro::ModularBalanced; template void write_matrix(Givaro::Integer p, size_t m, size_t n, T* C, size_t ldc){ size_t www=(p.bitsize()*log(2.))/log(10.); for (size_t i=0;i bool check_ftrsm (const Field &F, size_t m, size_t n, const typename Field::Element &alpha, FFLAS::FFLAS_SIDE side, FFLAS::FFLAS_UPLO uplo, FFLAS::FFLAS_TRANSPOSE trans, FFLAS::FFLAS_DIAG diag, RandIter& Rand){ typedef typename Field::Element Element; Element * A, *B, *B2, *C, tmp; size_t k = (side==FFLAS::FflasLeft?m:n); size_t lda,ldb,ldc; lda=k+13; ldb=n+14; ldc=n+15; A = FFLAS::fflas_new(F,k,lda); B = FFLAS::fflas_new(F,m,ldb); B2 = FFLAS::fflas_new(F,m,ldb); C = FFLAS::fflas_new(F,m,ldc); RandomTriangularMatrix (F, k, k, uplo, diag, true, A, lda, Rand); RandomMatrix (F, m, n, B, ldb, Rand); FFLAS::fassign (F, m, n, B, ldb, B2, ldb); string ss=string((uplo == FFLAS::FflasLower)?"Lower_":"Upper_")+string((side == FFLAS::FflasLeft)?"Left_":"Right_")+string((trans == FFLAS::FflasTrans)?"Trans_":"NoTrans_")+string((diag == FFLAS::FflasUnit)?"Unit":"NonUnit"); cout< bool run_with_field (Givaro::Integer q, size_t b, size_t m, size_t n, uint64_t a, size_t iters, uint64_t seed){ bool ok = true ; int nbit=(int)iters; while (ok && nbit){ //typedef typename Field::Element Element ; // choose Field Field* F= chooseField(q,b); typename Field::RandIter G(*F,0,seed); if (F==nullptr) return true; typename Field::Element alpha; F->init (alpha, (typename Field::Element)a); cout<<"Checking with ";F->write(cout)< >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,b,m,n,a,iters,seed); ok &= run_with_field >(q,5,m/4+1,n/4+1,a,iters,seed); ok &= run_with_field >(q,(b?b:512),m/4+1,n/4+1,a,iters,seed); } while (loop && ok); return !ok ; }