MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

MatrixOperations.hxx 5.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//
//  MatrixTOperations.hxx
//  HappyHeart
//
//  Created by Sebastien Gilles on 30/10/15.
//  Copyright © 2015 Inria. All rights reserved.
//

#ifndef HAPPY_HEART_x_THIRD_PARTY_x_WRAPPERS_x_PETSC_x_MATRIX_x_MATRIX_OPERATIONS_HXX_
# define HAPPY_HEART_x_THIRD_PARTY_x_WRAPPERS_x_PETSC_x_MATRIX_x_MATRIX_OPERATIONS_HXX_


namespace HappyHeart
{

        
    namespace Wrappers
    {
        
        
        namespace Petsc
        {
            
            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            MatMultTranspose(const MatrixT& matrix, const Vector& v1, Vector& v2,
28
                             const char* invoking_file, int invoking_line)
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
            {
                int error_code = ::MatMultTranspose(matrix.Internal(), v1.Internal(), v2.Internal());
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatMultTranspose", invoking_file, invoking_line);
            }
            
            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            MatMultTransposeAdd(const MatrixT& matrix, const Vector& v1, const Vector& v2, Vector& v3,
                                     const char* invoking_file, int invoking_line)
            {
                int error_code = ::MatMultTransposeAdd(matrix.Internal(), v1.Internal(), v2.Internal(), v3.Internal());
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatMultTransposeAdd", invoking_file, invoking_line);
            }
            
            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            MatMatMult(const MatrixT& matrix1,
                            const MatrixT& matrix2,
                            MatrixT& matrix3,
                            const char* invoking_file, int invoking_line)
            {
                Mat result;
                
                int error_code = ::MatMatMult(matrix1.Internal(),
                                              matrix2.Internal(),
                                              MAT_INITIAL_MATRIX,
                                              PETSC_DEFAULT,
                                              &result);
                
                matrix3.SetFromPetscMat(result);
                
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatMatMult", invoking_file, invoking_line);
            }
            
            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            MatMatMatMult(const MatrixT& matrix1,
                               const MatrixT& matrix2,
                               const MatrixT& matrix3,
                               MatrixT& matrix4,
                               const char* invoking_file, int invoking_line)
            {
                Mat result;
                
                int error_code = ::MatMatMatMult(matrix1.Internal(),
                                                 matrix2.Internal(),
                                                 matrix3.Internal(),
                                                 MAT_INITIAL_MATRIX,
                                                 PETSC_DEFAULT,
                                                 &result);
                
                matrix4.SetFromPetscMat(result);
                
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatMatMatMult", invoking_file, invoking_line);
            }
            

            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            AXPY(PetscScalar a, const MatrixT& X, MatrixT& Y, const char* invoking_file,
                      int invoking_line, const MatStructure& structure)
            {
                int error_code = ::MatAXPY(Y.Internal(), a, X.Internal(), structure);
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatAXPY", invoking_file, invoking_line);
            }
            
            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            MatMult(const MatrixT& matrix, const Vector& v1, Vector& v2, const char* invoking_file, int invoking_line)
            {
                int error_code = ::MatMult(matrix.Internal(), v1.Internal(), v2.Internal());
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatMult", invoking_file, invoking_line);
            }
            
            
            template<class MatrixT>
            std::enable_if_t<std::is_base_of<Private::BaseMatrix, MatrixT>::value, void>
            MatMultAdd(const MatrixT& matrix, const Vector& v1,
                            const Vector& v2,
                            Vector& v3, const char* invoking_file, int invoking_line)
            {
                int error_code = ::MatMultAdd(matrix.Internal(), v1.Internal(), v2.Internal(), v3.Internal());
                if (error_code)
                    throw ExceptionNS::Exception(error_code, "MatMultAdd", invoking_file, invoking_line);
            }

            
        } //namespace Petsc
        
        
    } //namespace Wrappers


} // namespace HappyHeart


#endif // HAPPY_HEART_x_THIRD_PARTY_x_WRAPPERS_x_PETSC_x_MATRIX_x_MATRIX_OPERATIONS_HXX_