Program Listing for File Matrix.h

↰ Return to documentation for file (ADS/numeric/Matrix.h)

/*--------------------------------------------------------------------------*/
/*----------------------------- File Matrix.h ------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_Matrix
 #define __ADS_Matrix
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/Contract.h"

#include <cstddef>
#include <vector>

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

template< class T >
using Matrix = std::vector< std::vector< T > >;

template< class T >
Matrix< T > multiplyNaive( const Matrix< T > & A , const Matrix< T > & B ,
                           long * mults = nullptr );

template< class T >
Matrix< T > multiply( const Matrix< T > & A , const Matrix< T > & B );

template< class T >
Matrix< T > transpose( const Matrix< T > & A );

template< class T >
Matrix< T > scale( Matrix< T > A , const T & s );

namespace detail {

template< class T >
bool hasShape( const Matrix< T > & A , std::size_t r , std::size_t c );

template< class T >
Matrix< T > block( const Matrix< T > & A , std::size_t r , std::size_t c ,
                   std::size_t h );

template< class T >
Matrix< T > plus( const Matrix< T > & A , const Matrix< T > & B , T s = 1 );

template< class T >
Matrix< T > strassenRec( const Matrix< T > & A , const Matrix< T > & B ,
                         std::size_t cutoff , long * mults );

}  // end( namespace detail )

template< class T >
Matrix< T > strassen( const Matrix< T > & A , const Matrix< T > & B ,
                      std::size_t cutoff = 1 , long * mults = nullptr );

/*--------------------------------------------------------------------------*/

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/numeric/impl/Matrix.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* Matrix.h included */

/*--------------------------------------------------------------------------*/
/*--------------------------- End File Matrix.h ----------------------------*/
/*--------------------------------------------------------------------------*/