tensor: shares_index implemented
This commit is contained in:
@@ -2485,6 +2485,13 @@ for(int i=0; i<I.size(); ++i) if(zero_in_index(I[i])) return true;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool shares_index(const FLATINDEX &I, const FLATINDEX &J)
|
||||||
|
{
|
||||||
|
for(int i=0; i<I.size(); ++i) for(int j=0; j<J.size(); ++j)
|
||||||
|
if(I[i]==J[j]) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template class Tensor<double>;
|
template class Tensor<double>;
|
||||||
template class Tensor<std::complex<double> >;
|
template class Tensor<std::complex<double> >;
|
||||||
|
|||||||
3
tensor.h
3
tensor.h
@@ -231,11 +231,14 @@ int flatposition(int group, int index, const NRVec<INDEXGROUP> &shape);
|
|||||||
int flatposition(const INDEX &i, const NRVec<INDEXGROUP> &shape); //position of that index in FLATINDEX
|
int flatposition(const INDEX &i, const NRVec<INDEXGROUP> &shape); //position of that index in FLATINDEX
|
||||||
INDEX indexposition(int flatindex, const NRVec<INDEXGROUP> &shape); //inverse to flatposition
|
INDEX indexposition(int flatindex, const NRVec<INDEXGROUP> &shape); //inverse to flatposition
|
||||||
|
|
||||||
|
|
||||||
//useful for negative offsets and 0 index excluded
|
//useful for negative offsets and 0 index excluded
|
||||||
bool zero_in_index(const FLATINDEX &);
|
bool zero_in_index(const FLATINDEX &);
|
||||||
bool zero_in_index(const SUPERINDEX &);
|
bool zero_in_index(const SUPERINDEX &);
|
||||||
bool zero_in_index(const INDEXMATRIX &, const LA_largeindex row);
|
bool zero_in_index(const INDEXMATRIX &, const LA_largeindex row);
|
||||||
|
|
||||||
|
bool shares_index(const FLATINDEX &I, const FLATINDEX &J);
|
||||||
|
|
||||||
FLATINDEX superindex2flat(const SUPERINDEX &I);
|
FLATINDEX superindex2flat(const SUPERINDEX &I);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
Reference in New Issue
Block a user