File: triangular.h

package info (click to toggle)
libm4ri 20200125-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,560 kB
  • sloc: ansic: 12,633; sh: 4,304; makefile: 137
file content (165 lines) | stat: -rw-r--r-- 5,063 bytes parent folder | download | duplicates (2)
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
28
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**
 * \file triangular.h
 *
 * \brief Triangular system solving with Matrix routines.
 *
 * \author Clement Pernet <clement.pernet@gmail.com>
 */

#ifndef M4RI_TRSM_H
#define M4RI_TRSM_H

/*******************************************************************
*
*                 M4RI: Linear Algebra over GF(2)
*
*    Copyright (C) 2008 Clement Pernet <clement.pernet@gmail.com>
*
*  Distributed under the terms of the GNU General Public License (GPL)
*  version 2 or higher.
*
*    This code 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
*    General Public License for more details.
*
*  The full text of the GPL is available at:
*
*                  http://www.gnu.org/licenses/
*
********************************************************************/

#include <m4ri/mzd.h>

/**
 * \brief Solves X U = B with X and B matrices and U upper triangular.
 *
 * X is stored inplace on B.
 * 
 * \attention Note, that the 'right' variants of TRSM are slower than
 * the 'left' variants.
 *
 * This is the wrapper function including bounds checks. See
 * _mzd_trsm_upper_right() for implementation details.
 * 
 * \param U Input upper triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */

void mzd_trsm_upper_right(mzd_t const *U, mzd_t *B, const int cutoff);

/**
 * \brief Solves X U = B with X and B matrices and U upper triangular.
 *
 * X is stored inplace on B.
 * 
 * \attention Note, that the 'right' variants of TRSM are slower than
 * the 'left' variants.
 *
 * \param U Input upper triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */
void _mzd_trsm_upper_right(mzd_t const *U, mzd_t *B, const int cutoff);

/**
 * \brief Solves X L = B with X and B matrices and L lower triangular.
 *
 * X is stored inplace on B.
 * 
 * This is the wrapper function including bounds checks. See
 * _mzd_trsm_upper_right() for implementation details.
 *
 * \attention Note, that the 'right' variants of TRSM are slower than the 'left'
 * variants.
 *
 * \param L Input upper triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */

void mzd_trsm_lower_right(mzd_t const *L, mzd_t *B, const int cutoff);

/**
 * \brief Solves X L = B with X and B with matrices and L lower
 * triangular.
 * 
 * This version assumes that the matrices are at an even position on
 * the m4ri_radix grid and that their dimension is a multiple of m4ri_radix.
 * X is stored inplace on B.
 *
 * \attention Note, that the 'right' variants of TRSM are slower than
 * the 'left' variants.
 *
 * \param L Input lower triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 *
 */
void _mzd_trsm_lower_right(mzd_t const *L, mzd_t *B, const int cutoff);

/**
 * \brief Solves L X = B with X and B matrices and L lower triangular.
 * 
 * X is stored inplace on B.
 *  
 * This is the wrapper function including bounds checks. See
 * _mzd_trsm_lower_left() for implementation details.
 *
 * \param L Input lower triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */

void mzd_trsm_lower_left(mzd_t const *L, mzd_t *B, const int cutoff);

/**
 * \brief Solves L X = B with X and B matrices and L lower triangular.
 * 
 * X is stored inplace on B.
 *
 * \param L Input lower triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */

void _mzd_trsm_lower_left(mzd_t const *L, mzd_t *B, const int cutoff);

/**
 * \brief Solves U X = B with X and B matrices and U upper triangular.
 *
 * X is stored inplace on B.
 *  
 * This is the wrapper function including bounds checks. See
 * _mzd_trsm_upper_left() for implementation details.
 *
 * \param U Input upper triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */

void mzd_trsm_upper_left(mzd_t const *U, mzd_t *B, const int cutoff);

/**
 * \brief Solves U X = B with X and B matrices and U upper triangular.
 *
 * X is stored inplace on B.
 *
 * \param U Input upper triangular matrix.
 * \param B Input matrix, being overwritten by the solution matrix X
 * \param cutoff Minimal dimension for Strassen recursion.
 */
void _mzd_trsm_upper_left (mzd_t const *U, mzd_t *B, const int cutoff);

/**
 * \brief Invert the upper triangular matrix A by reduction to matrix multiplication.
 *
 * \param A Matrix to be inverted (overwritten).
 *
 * \return Inverse of A or throws an error
 */

mzd_t *mzd_trtri_upper(mzd_t *A);

#endif // M4RI_TRSM_H