Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
55a1fdb
Use two IMFs in ALP Vector to allow for a better 1D-2D mapping
Jul 27, 2022
35c1b72
Implement row/column/diagonal views over a matrix
Aug 5, 2022
467a494
Update the naming of AMF factory classes
Aug 10, 2022
4464b19
Add a method to create AMFs for original matrix when used as a vector
Aug 10, 2022
03f3999
Move definition of FromPolynomial after Compose as the first uses the…
Aug 10, 2022
61a8a88
Fix the order of IMFs when creating a IMF composition
Aug 10, 2022
e1f753b
Simplify IMF composition type trait specializations
Aug 10, 2022
0a34b71
Add Zero IMF and use it as a default column IMF for vector
Aug 10, 2022
107b017
Add type trait to determine storage mapping polynomial based on matri…
Aug 10, 2022
49caf96
Make IMF constructors explicit
Aug 11, 2022
d50847c
Use poly calcuation in the determine_amf_type
Aug 11, 2022
0713b10
Provide IMF do AMF factory instead of size
Aug 11, 2022
983ebd4
Add mapping polynomial specific to Vectors
Aug 11, 2022
e17796f
Implement gather views over vectors
Aug 12, 2022
66d46fe
Expand testing of vector views
Aug 10, 2022
1a55e83
Update doxygen and improve code style
Aug 12, 2022
94226d3
Add backend as an input parameter to polynomial selection logic
Aug 15, 2022
e715bae
Rename type trait for selecting polynomial type
Aug 15, 2022
c5b0d51
Access AMF-internal types directly and do not expose them through matrix
Aug 15, 2022
cfacb57
Re-enable previously disabled lines in unit test for type traits
Aug 15, 2022
d9c7aa9
Improve doxygen
Aug 15, 2022
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
10 changes: 9 additions & 1 deletion include/alp/base/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,15 @@ namespace alp {
}; // class Vector
} // namespace internal

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

}
Expand Down
43 changes: 36 additions & 7 deletions include/alp/imf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,20 @@ namespace alp {

public:

Id( const size_t n ) : Strided( n, n, 0, 1 ) {}
explicit Id( const size_t n ) : Strided( n, n, 0, 1 ) {}
};

/**
* The zero IMF.
* \f$I_n = [0, n)\f$
* \f$Zero = I_n \rightarrow I_1; i \mapsto 0\f$
*/

class Zero: public Strided {

public:

explicit Zero( const size_t n ) : Strided( n, 1, 0, 0 ) {}
};

class Select: public IMF {
Expand Down Expand Up @@ -204,21 +217,31 @@ namespace alp {
typedef Strided type;
};

template<>
struct composed_type< Id, Strided > {
typedef Strided type;
template< typename RightImf >
struct composed_type< Id, RightImf > {
typedef RightImf type;
};

template<>
struct composed_type< Strided, Id > {
typedef Strided type;
template< typename LeftImf >
struct composed_type< LeftImf, Id > {
typedef LeftImf type;
};

template<>
struct composed_type< Id, Id > {
typedef Id type;
};

template<>
struct composed_type< Zero, Id > {
typedef Zero type;
};

template<>
struct composed_type< Id, Zero > {
typedef Zero type;
};

/**
* Creates the composed IMF from two provided input IMFs.
* Depending on the input IMF types, the factory may
Expand Down Expand Up @@ -258,6 +281,12 @@ namespace alp {
return Id( g.n );
}

template<>
Zero ComposedFactory::create( const Id &f, const Zero &g ) {
(void)f;
return Zero( g.n );
}

template<>
Composed< Strided, Select > ComposedFactory::create( const Strided &f1, const Select &f2 ) {
return Composed< Strided, Select >( f1, f2 );
Expand Down
748 changes: 374 additions & 374 deletions include/alp/reference/blas1.hpp

Large diffs are not rendered by default.

154 changes: 77 additions & 77 deletions include/alp/reference/blas2.hpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions include/alp/reference/blas3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,13 +1050,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 InputImf1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImf2,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImfR1, typename InputImfC1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2,
class Operator
>
RC outer( Matrix< OutputType, OutputStructure, Density::Dense, OutputView, OutputImfR, OutputImfC, reference > & A,
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, InputImf1, reference > & u,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, InputImf2, reference > & v,
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, InputImfR1, InputImfC1, reference > & u,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, InputImfR2, InputImfC2, 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 @@ -1125,8 +1125,8 @@ namespace alp {
* The structure of this matrix is General.
*/
template< Descriptor descr = descriptors::no_operation,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImf1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImf2,
typename InputType1, typename InputStructure1, typename InputView1, typename InputImfR1, typename InputImfC1,
typename InputType2, typename InputStructure2, typename InputView2, typename InputImfR2, typename InputImfC2,
class Operator
>
Matrix< typename Operator::D3, structures::General, Density::Dense,
Expand All @@ -1135,8 +1135,8 @@ namespace alp {
reference
>
outer(
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, InputImf1, reference > &x,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, InputImf2, reference > &y,
const Vector< InputType1, InputStructure1, Density::Dense, InputView1, InputImfR1, InputImfC1, reference > &x,
const Vector< InputType2, InputStructure2, Density::Dense, InputView2, InputImfR2, InputImfC2, 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 @@ -1183,7 +1183,7 @@ namespace alp {
* which results in a symmetric matrix.
*/
template< Descriptor descr = descriptors::no_operation,
typename InputType, typename InputStructure, typename InputView, typename InputImf,
typename InputType, typename InputStructure, typename InputView, typename InputImfR, typename InputImfC,
class Operator
>
Matrix< typename Operator::D3, structures::Symmetric, Density::Dense,
Expand All @@ -1192,7 +1192,7 @@ namespace alp {
reference
>
outer(
const Vector< InputType, InputStructure, Density::Dense, InputView, InputImf, reference > &x,
const Vector< InputType, InputStructure, Density::Dense, InputView, InputImfR, InputImfC, reference > &x,
const Operator &mul = Operator(),
const typename std::enable_if< alp::is_operator< Operator >::value &&
! alp::is_object< InputType >::value,
Expand Down
4 changes: 2 additions & 2 deletions include/alp/reference/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ namespace alp {
* @brief \a buildVector version.
*
*/
template< typename InputType, typename Structure, typename View, typename Imf, typename fwd_iterator >
template< typename InputType, typename Structure, typename View, typename ImfR, typename ImfC, typename fwd_iterator >
RC buildVector(
Vector< InputType, Structure, Density::Dense, View, Imf, reference > &v,
Vector< InputType, Structure, Density::Dense, View, ImfR, ImfC, reference > &v,
const fwd_iterator &start,
const fwd_iterator &end
) noexcept {
Expand Down
Loading