Arcane  v4.1.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
TestSkylineLU.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/*---------------------------------------------------------------------------*/
9/*
10 * This file is based on the work on AMGCL library (version march 2026)
11 * which can be found at https://github.com/ddemidov/amgcl.
12 *
13 * Copyright (c) 2012-2022 Denis Demidov <dennis.demidov@gmail.com>
14 * SPDX-License-Identifier: MIT
15 */
16/*---------------------------------------------------------------------------*/
17/*---------------------------------------------------------------------------*/
18
19#include <gtest/gtest.h>
20
21#include "arccore/alina/Adapters.h"
22#include "arccore/alina/SkylineLUSolver.h"
23#include "arccore/alina/BuiltinBackend.h"
24#include "arccore/alina/Profiler.h"
25#include "SampleProblemCommon.h"
26
27namespace
28{
30}
31
32using namespace Arcane;
33
34TEST(alina_test_skyline_lu, skyline_lu)
35{
36 std::vector<ptrdiff_t> ptr;
37 std::vector<ptrdiff_t> col;
38 std::vector<double> val;
39 std::vector<double> rhs;
40
41 size_t n = sample_problem(16, val, col, ptr, rhs);
42
43 auto A = Alina::adapter::zero_copy(n, ptr.data(), col.data(), val.data());
44
46
47 std::vector<double> x(n);
48 std::vector<double> r(n);
49
50 solve(rhs, x);
51
52 Alina::backend::residual(rhs, *A, x, r);
53
54 ASSERT_NEAR(sqrt(Alina::backend::inner_product(r, r)), 0.0, 1e-8);
55}
Profiler class.
Definition Profiler.h:50
Direct solver that uses Skyline LU factorization.
__host__ __device__ double sqrt(double v)
Racine carrée de v.
Definition Math.h:135
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-