/usr/include/linbox/blackbox/bb.h is in liblinbox-dev 1.4.2-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef LB_BB_H
#define LB_BB_H
/* linbox/blackbox/bb.h
* Copyright (C) 2015 bds for LinBox Team. See linbox/COPYING.LESSER for License info.
*
* Written by bds
*
* Blackbox base class for support of separate compilation
*/
/* blackbox base class
*
* Algorithms may take BB<Field> parameters and be separately compiled.
*
* Non-template functions of BB are pure virtual. Code bloat is avoided.
* Template functions may be called by select on the BBType tag. This
* introduces some code bloat.
*/
#include <iostream>
#include "linbox/util/error.h"
#include "linbox/matrix/dense-matrix.h"
#include "linbox/matrix/matrix-domain.h"
namespace LinBox {
// for now, only the FIBB tags.
enum BBType {diagonal, permutation, triangular, product, lqup, pluq, other};
template <class Ring>
struct BB
{
typedef Ring Field;
typedef DenseMatrix<Field> ResizableMatrix;
//typedef DenseMatrix<Field, std::vector<typename Ring::Element> > ResizableMatrix;
typedef DenseMatrix<Field> Matrix;
virtual ~BB(){}
virtual BBType bbTag() const
= 0;
virtual size_t rowdim() const
= 0;
virtual size_t coldim() const
= 0;
virtual const Field& field() const
= 0;
virtual std::ostream& write(std::ostream& os) const
= 0;
virtual std::istream& read(std::istream& os)
= 0;
virtual Matrix& applyLeft(Matrix& Y, const Matrix& X) const
= 0;
virtual Matrix& applyRight(Matrix& Y, const Matrix& X) const
= 0;
template<class OutVector, class InVector>
OutVector& apply(OutVector& y, const InVector& x) const
{ switch (bbTag())
{ //case BBx_tag: static_cast<BBx<Field>*>(this)->apply(y,x); break;
//case permutation: static_cast<Permutation<Field>*>(this)->apply(y, x)
default: throw LinboxError("indirect call to apply not supported for BBType " /* bbTag*/);
}
return y;
}
template<class OutVector, class InVector>
OutVector& applyTranspose(OutVector& y, const InVector& x) const
{ switch (bbTag())
{ //case BBxtag: static_cast<BBx<Field>*>(this)->applyTranspose(y,x); break;
default: throw LinboxError("indirect call to applyTranspose not supported for BBType " /* bbTag*/);
}
return y;
}
template<typename BB2>
void map(BB2& A)
{ switch (bbTag())
{ //case bbxtag: static_cast<bbx<Field>*>(this)->map(A); break;
// using it's struct rebind;
default: throw LinboxError("indirect call to map not supported for BBType " /* bbTag*/);
}
return A;
}
}; // class BB
} // LinBox
#endif // LB_BB_H
|