added operator() to change values
parent
6073bdb679
commit
8bf8e4dc1f
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
namespace tensors {
|
||||
|
||||
/** Rank 2 Tensor */
|
||||
template<int N1, int N2>
|
||||
class Tensor2 {
|
||||
protected:
|
||||
/** Rank 2 Tensor */
|
||||
template<int N1, int N2>
|
||||
class Tensor2 {
|
||||
protected:
|
||||
Tensor1<N1> T[N2];
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
/** default constructor */
|
||||
Tensor2() {
|
||||
|
|
@ -35,7 +35,11 @@ namespace tensors {
|
|||
T[j] = a(j);
|
||||
}
|
||||
|
||||
double operator()(int i, int j) const {
|
||||
const double & operator()(int i, int j) const {
|
||||
return T[j](i);
|
||||
}
|
||||
|
||||
double & operator()(int i, int j) {
|
||||
return T[j](i);
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +48,7 @@ namespace tensors {
|
|||
N2, J> > operator()(Index<N1, I> i, Index<N2, J> j) const {
|
||||
return Tensor2Expression<Tensor2, Index<N1, I> , Index<N2, J> > (*this);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace tensors
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue