ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
Matrix.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*----------------------------- File Matrix.h ------------------------------*/
3
/*--------------------------------------------------------------------------*/
49
/*--------------------------------------------------------------------------*/
50
/*----------------------------- DEFINITIONS --------------------------------*/
51
/*--------------------------------------------------------------------------*/
52
53
#ifndef __ADS_Matrix
54
#define __ADS_Matrix
55
/* self-identification: #endif constant */
56
57
/*--------------------------------------------------------------------------*/
58
/*------------------------------ INCLUDES ----------------------------------*/
59
/*--------------------------------------------------------------------------*/
60
61
#include "
ADS/Contract.h
"
62
63
#include <cstddef>
64
#include <vector>
65
66
/*--------------------------------------------------------------------------*/
67
/*--------------------------- NAMESPACE ------------------------------------*/
68
/*--------------------------------------------------------------------------*/
69
70
namespace
ADS
71
{
72
73
template
<
class
T >
74
using
Matrix
= std::vector< std::vector< T > >;
75
95
template
<
class
T >
96
Matrix< T >
multiplyNaive
(
const
Matrix< T >
& A ,
const
Matrix< T >
& B ,
97
long
* mults =
nullptr
);
98
115
template
<
class
T >
116
Matrix< T >
multiply
(
const
Matrix< T >
& A ,
const
Matrix< T >
& B );
117
120
template
<
class
T >
121
Matrix< T >
transpose
(
const
Matrix< T >
& A );
122
124
template
<
class
T >
125
Matrix< T >
scale
(
Matrix< T >
A ,
const
T & s );
126
127
namespace
detail
128
{
129
131
template
<
class
T >
132
bool
hasShape(
const
Matrix< T >
& A , std::size_t r , std::size_t c );
133
136
template
<
class
T >
137
Matrix< T >
block(
const
Matrix< T >
& A , std::size_t r , std::size_t c ,
138
std::size_t h );
139
141
template
<
class
T >
142
Matrix< T >
plus(
const
Matrix< T >
& A ,
const
Matrix< T >
& B , T s = 1 );
143
145
template
<
class
T >
146
Matrix< T >
strassenRec(
const
Matrix< T >
& A ,
const
Matrix< T >
& B ,
147
std::size_t cutoff ,
long
* mults );
148
149
}
// end( namespace detail )
150
177
template
<
class
T >
178
Matrix< T >
strassen
(
const
Matrix< T >
& A ,
const
Matrix< T >
& B ,
179
std::size_t cutoff = 1 ,
long
* mults =
nullptr
);
180
181
/*--------------------------------------------------------------------------*/
182
183
}
// end( namespace ADS )
184
185
/*--------------------------------------------------------------------------*/
186
/*-------------------------- IMPLEMENTATION --------------------------------*/
187
/*--------------------------------------------------------------------------*/
188
189
#include "ADS/numeric/impl/Matrix.tpp"
190
191
/*--------------------------------------------------------------------------*/
192
193
#endif
/* Matrix.h included */
194
195
/*--------------------------------------------------------------------------*/
196
/*--------------------------- End File Matrix.h ----------------------------*/
197
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::transpose
ListGraph transpose(const G &g)
the transposed graph, with the edges reversed
ADS::multiply
DenseMatrix< T > multiply(const DenseMatrix< T > &A, const DenseMatrix< T > &B)
the product , a new matrix, by gemm() with and
ADS::multiplyNaive
Matrix< T > multiplyNaive(const Matrix< T > &A, const Matrix< T > &B, long *mults=nullptr)
the product of two matrices by the definition, (the moltiplicaMatrici() of the book); the products...
ADS::strassen
Matrix< T > strassen(const Matrix< T > &A, const Matrix< T > &B, std::size_t cutoff=1, long *mults=nullptr)
the product by the algorithm of Strassen, , the blocks of at most rows by the naive method; the pro...
ADS::scale
Matrix< T > scale(Matrix< T > A, const T &s)
the product of the matrix by a scalar
ADS
Definition
ADT.h:96
ADS::Matrix
std::vector< std::vector< T > > Matrix
by rows
Definition
Matrix.h:74
ADS
numeric
Matrix.h
Generated by
1.17.0