Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/alp/base/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ namespace alp {
}; // class Vector
} // namespace internal

template< typename T, typename Structure, enum Density density, typename View, enum Backend backend >
template< typename T, typename Structure, enum Density density, typename View, typename Imf, enum Backend backend >
class Vector { };

}
Expand Down
1,180 changes: 653 additions & 527 deletions include/alp/reference/blas1.hpp

Large diffs are not rendered by default.

246 changes: 133 additions & 113 deletions include/alp/reference/blas2.hpp

Large diffs are not rendered by default.

75 changes: 44 additions & 31 deletions include/alp/reference/blas3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ namespace alp {
* @param phase The execution phase.
*/
template< Descriptor descr = descriptors::no_operation,
typename OutputType, typename InputType1, typename InputType2,
class Semiring >
typename OutputType, typename InputType1, typename InputType2,
class Semiring
>
RC mxm( internal::Matrix< OutputType, reference > & C,
const internal::Matrix< InputType1, reference > & A,
const internal::Matrix< InputType2, reference > & B,
Expand Down Expand Up @@ -318,10 +319,11 @@ namespace alp {
* @param phase The execution phase.
*/
template< Descriptor descr = descriptors::no_operation,
typename OutputStructMatT,
typename InputStructMatT1,
typename InputStructMatT2,
class Semiring>
typename OutputStructMatT,
typename InputStructMatT1,
typename InputStructMatT2,
class Semiring
>
RC mxm( OutputStructMatT & C,
const InputStructMatT1 & A,
const InputStructMatT2 & B,
Expand All @@ -339,9 +341,10 @@ namespace alp {
* Version with additive monoid and multiplicative operator
*/
template< typename OutputStructMatT,
typename InputStructMatT1,
typename InputStructMatT2,
class Operator, class Monoid >
typename InputStructMatT1,
typename InputStructMatT2,
class Operator, class Monoid
>
RC mxm( OutputStructMatT & C,
const InputStructMatT1 & A,
const InputStructMatT2 & B,
Expand Down Expand Up @@ -479,7 +482,8 @@ namespace alp {
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImfR1, typename InputImfC1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2,
class MulMonoid >
class MulMonoid
>
RC eWiseApply( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const Matrix< InputType1, InputStructure1, Density::Dense, InputView1, InputImfR1, InputImfC1, reference > &A,
const Matrix< InputType2, InputStructure2, Density::Dense, InputView2, InputImfR2, InputImfC2, reference > &B,
Expand Down Expand Up @@ -531,7 +535,8 @@ namespace alp {
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2,
class MulMonoid >
class MulMonoid
>
RC eWiseApply( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const InputType1 &alpha,
const Matrix< InputType2, InputStructure2, Density::Dense, InputView2, InputImfR2, InputImfC2, reference > &B,
Expand Down Expand Up @@ -588,7 +593,8 @@ namespace alp {
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImfR1, typename InputImfC1,
typename InputType2,
class MulMonoid >
class MulMonoid
>
RC eWiseApply( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const Matrix< InputType1, InputStructure1, Density::Dense, InputView1, InputImfR1, InputImfC1, reference > &A,
const InputType2 &beta,
Expand Down Expand Up @@ -702,7 +708,8 @@ namespace alp {
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImfR1, typename InputImfC1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2,
typename Ring>
typename Ring
>
RC eWiseAdd( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const Matrix< InputType1, InputStructure1, Density::Dense, InputView1, InputImfR1, InputImfC1, reference > &A,
const Matrix< InputType2, InputStructure2, Density::Dense, InputView2, InputImfR2, InputImfC2, reference > &B,
Expand Down Expand Up @@ -811,7 +818,8 @@ namespace alp {
template< Descriptor descr = descriptors::no_operation, class Ring,
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImfR1, typename InputImfC1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2 >
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2
>
RC eWiseMul( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const Matrix< InputType1, InputStructure1, Density::Dense, InputView1, InputImfR1, InputImfC1, reference > &A,
const Matrix< InputType2, InputStructure2, Density::Dense, InputView2, InputImfR2, InputImfC2, reference > &B,
Expand Down Expand Up @@ -902,12 +910,13 @@ namespace alp {
*/
template< Descriptor descr = descriptors::no_operation,
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType1, typename InputStructure1, typename InputView1,
typename InputType2, typename InputStructure2, typename InputView2,
class Operator >
typename InputType1, typename InputStructure1, typename InputView1, typename InputImf1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImf2,
class Operator
>
RC outer( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > & A,
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, reference > & u,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, reference > & v,
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, InputImf1, reference > & u,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, InputImf2, reference > & v,
const Operator & mul = Operator(),
const typename std::enable_if< alp::is_operator< Operator >::value && ! alp::is_object< InputType1 >::value && ! alp::is_object< InputType2 >::value && ! alp::is_object< OutputType >::value,
void >::type * const = NULL ) {
Expand Down Expand Up @@ -976,17 +985,18 @@ namespace alp {
* The structure of this matrix is General.
*/
template< Descriptor descr = descriptors::no_operation,
typename InputType1, typename InputStructure1, typename InputView1,
typename InputType2, typename InputStructure2, typename InputView2,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImf1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImf2,
class Operator
>
>
Matrix< typename Operator::D3, structures::General, Density::Dense,
view::Functor< std::function< void( InputType1 &, const size_t &, const size_t & ) > >,
imf::Id, imf::Id,
reference >
reference
>
outer(
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, reference > &x,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, reference > &y,
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, InputImf1, reference > &x,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, InputImf2, reference > &y,
const Operator &mul = Operator(),
const typename std::enable_if< alp::is_operator< Operator >::value &&
! alp::is_object< InputType1 >::value &&
Expand Down Expand Up @@ -1028,15 +1038,16 @@ namespace alp {
* which results in a symmetric matrix.
*/
template< Descriptor descr = descriptors::no_operation,
typename InputType, typename InputStructure, typename InputView,
typename InputType, typename InputStructure, typename InputView, typename InputImf,
class Operator
>
>
Matrix< typename Operator::D3, structures::Symmetric, Density::Dense,
view::Functor< std::function< void( typename Operator::D3 &, const size_t &, const size_t & ) > >,
imf::Id, imf::Id,
reference >
reference
>
outer(
const Vector< InputType, InputStructure, Density::Dense, InputView, reference > &x,
const Vector< InputType, InputStructure, Density::Dense, InputView, InputImf, reference > &x,
const Operator &mul = Operator(),
const typename std::enable_if< alp::is_operator< Operator >::value &&
! alp::is_object< InputType >::value,
Expand Down Expand Up @@ -1087,7 +1098,8 @@ namespace alp {
*/
template< Descriptor descr = descriptors::no_operation,
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType, typename InputStructure, typename InputView, typename InputImfR, typename InputImfC >
typename InputType, typename InputStructure, typename InputView, typename InputImfR, typename InputImfC
>
RC set( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const Matrix< InputType, InputStructure, Density::Dense, InputView, InputImfR, InputImfC, reference > &A ) noexcept {
(void)C;
Expand Down Expand Up @@ -1122,7 +1134,8 @@ namespace alp {
*/
template< Descriptor descr = descriptors::no_operation,
typename OutputType, typename OutputStructure, typename OutputView, typename OutputImfR, typename OutputImfC,
typename InputType, typename InputStructure >
typename InputType, typename InputStructure
>
RC set( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > &C,
const Scalar< InputType, InputStructure, reference > &val ) noexcept {
(void)C;
Expand Down
21 changes: 12 additions & 9 deletions include/alp/reference/matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ namespace alp {
class Matrix< T, structures::General, Density::Dense, View, ImfR, ImfC, reference > :
public internal::MatrixContainer< T, ImfR, ImfC, storage::polynomials::Full_type, std::is_same< typename View::applied_to, void >::value > {

private:
protected:
typedef Matrix< T, structures::General, Density::Dense, View, ImfR, ImfC, reference > self_type;
typedef typename View::applied_to target_type;

Expand Down Expand Up @@ -786,7 +786,7 @@ namespace alp {

template < bool d >
struct view_type< view::diagonal, d > {
using type = Vector< T, structures::General, Density::Dense, view::Diagonal< self_type >, reference >;
using type = Vector< T, structures::General, Density::Dense, view::Diagonal< self_type >, imf::Id, reference >;
};

/**
Expand Down Expand Up @@ -1399,14 +1399,14 @@ namespace alp {
*/
template<
typename T, typename Structure, enum Density density, typename View, typename ImfR, typename ImfC, enum Backend backend >
Vector< T, structures::General, density, view::Original< Matrix< T, Structure, density, View, ImfR, ImfC, backend > >, backend >
Vector< T, structures::General, density, view::Original< Matrix< T, Structure, density, View, ImfR, ImfC, backend > >, imf::Id, backend >
get_view( Matrix< T, Structure, density, View, ImfR, ImfC, backend > &source,
const size_t &sel_r, const utils::range &rng_c ) {

// auto imf_c = std::make_shared< imf::Strided >( rng_c.count(), ncols(source), rng_c.start, rng_c.stride );

// return internal::get_view<Structure, T, Structure, density, View, backend >( source, sel_r, imf_c );
return Vector< T, structures::General, density, View, backend >();
return Vector< T, structures::General, density, View, imf::Id, backend >();
}

/**
Expand Down Expand Up @@ -1438,14 +1438,14 @@ namespace alp {
*/
template<
typename T, typename Structure, enum Density density, typename View, typename ImfR, typename ImfC, enum Backend backend >
Vector< T, structures::General, density, view::Original< Matrix< T, Structure, density, View, ImfR, ImfC, backend > >, backend >
Vector< T, structures::General, density, view::Original< Matrix< T, Structure, density, View, ImfR, ImfC, backend > >, imf::Id, backend >
get_view( Matrix< T, Structure, density, View, ImfR, ImfC, backend > &source,
const utils::range &rng_r, const size_t &sel_c ) {

// auto imf_r = std::make_shared< imf::Strided >( rng_r.count(), nrows(source), rng_r.start, rng_r.stride );

// return internal::get_view<Structure, T, Structure, density, View, backend >( source, imf_r, sel_c );
return Vector< T, structures::General, density, View, backend >();
return Vector< T, structures::General, density, View, imf::Id, backend >();
}

/**
Expand All @@ -1471,8 +1471,10 @@ namespace alp {
*/
template<
typename TargetStructure,
typename IndexType, typename IndexStructure, typename IndexView,
typename T, typename Structure, enum Density density, typename View, typename ImfR, typename ImfC, enum Backend backend >
typename IndexType, typename IndexStructure, typename IndexView, typename IndexImf,
typename T, typename Structure, enum Density density, typename View, typename ImfR, typename ImfC,
enum Backend backend
>
alp::Matrix<
T,
TargetStructure,
Expand All @@ -1483,7 +1485,8 @@ namespace alp {
backend
>
get_view( alp::Matrix< T, Structure, density, View, ImfR, ImfC, backend > &source,
const Vector< IndexType, IndexStructure, density, IndexView, backend > & sel_r, const Vector< IndexType, IndexStructure, density, IndexView, backend > & sel_c ) {
const Vector< IndexType, IndexStructure, density, IndexView, IndexImf, backend > & sel_r,
const Vector< IndexType, IndexStructure, density, IndexView, IndexImf, backend > & sel_c ) {

imf::Select imf_r( nrows(source), sel_r );
imf::Select imf_c( ncols(source), sel_c );
Expand Down
Loading