Go to the documentation of this file.00001
00005 #ifndef arrays_hh
00006 #define arrays_hh
00007
00008 #include "toolbox/array.hh"
00009
00010 namespace concepts {
00011
00012
00013
00018 template <class F, int dim>
00019 class ArrayDeterminant : public Array<F> {
00020 public:
00021 ArrayDeterminant(const concepts::Array<concepts::Mapping<F,dim> >* array) :
00022 Array<F>(array ? array->size() : 0) {
00023 if (array) {
00024 F* foo = data_;
00025 const concepts::Mapping<F,dim>* matrix =
00026 (const concepts::Mapping<F,dim>*)*array;
00027 for(uint i = array->size(); i--;)
00028 *foo++ = matrix++->determinant();
00029 }
00030 }
00031 };
00032
00033
00034
00039 template <class F, int dim>
00040 class ArrayMatrixInverse : public Array<concepts::Mapping<F,dim> > {
00041 public:
00042 ArrayMatrixInverse
00043 (const concepts::Array<concepts::Mapping<F,dim> >* array) :
00044 Array<concepts::Mapping<F,dim> >(array ? array->size() : 0) {
00045 if (array) {
00046 concepts::Mapping<F,dim>* foo = data_;
00047 const concepts::Mapping<F,dim>* matrix =
00048 (const concepts::Mapping<F,dim>*)*array;
00049 for(uint i = array->size(); i--;)
00050 *foo++ = matrix++->inverse();
00051 }
00052 }
00053 };
00054
00055
00056
00062 template <class F, int dim>
00063 class ArrayMatrixTranspose : public Array<concepts::Mapping<F, dim> > {
00064 public:
00065 ArrayMatrixTranspose
00066 (const concepts::Array<concepts::Mapping<F,dim> >* array) :
00067 Array<concepts::Mapping<F,dim> >(array ? array->size() : 0) {
00068 if (array) {
00069 concepts::Mapping<F,dim>* foo = data_;
00070 const concepts::Mapping<F,dim>* matrix =
00071 (const concepts::Mapping<F,dim>*)*array;
00072 for(uint i = array->size(); i--;)
00073 *foo++ = matrix++->transpose();
00074 }
00075 }
00076 };
00077
00078
00079
00084 template <class F>
00085 class ArrayReciprocal : public Array<F> {
00086 public:
00087 ArrayReciprocal(const concepts::Array<F>* array) :
00088 Array<F>(array ? array->size() : 0) {
00089 if (array) {
00090 F* foo = data_; const F* a = *array;
00091 for(uint i = array->size(); i--;)
00092 *foo++ = 1.0 / *a++;
00093 }
00094 }
00095 };
00096
00097
00098
00104 template <class F, int dim>
00105 class ArrayGramMatrix : public Array<concepts::Mapping<F,dim> > {
00106 public:
00107 ArrayGramMatrix(const concepts::Array<concepts::Mapping<F,dim> >& array) :
00108 Array<concepts::Mapping<F,dim> >(array.size()) {
00109 concepts::Mapping<F,dim>* foo = data_, *matrix = *array;
00110 for(uint i = array.size(); i--;)
00111 *foo++ = *matrix * matrix++->transpose();
00112 }
00113 };
00114
00115 }
00116
00117 #endif