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