Skip to content

Commit

Permalink
1. update version 0.2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PeizeLin committed Oct 24, 2024
1 parent 3876b79 commit bea1dfa
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 102 deletions.
2 changes: 1 addition & 1 deletion include/RI/distribute/Divide_Atoms.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Divide_Atoms
// [0,1] [2]
// with all period (period=2)
// [{0,0},{0,1},{1,0},{1,1}] [{2,0},{2,1}]
template<typename TA, typename Tcell, std::size_t Ndim>
template<typename TA, typename Tcell, std::size_t Ndim>
extern std::vector<std::pair<TA,std::array<Tcell,Ndim>>> divide_atoms(
const std::size_t group_rank,
const std::size_t group_size,
Expand Down
2 changes: 1 addition & 1 deletion include/RI/global/Blas_Interface-Contiguous.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace Blas_Interface
default: throw std::invalid_argument("trans cannot be "+std::to_string(trans)+". "+std::string(__FILE__)+" line "+std::to_string(__LINE__));
}
default: throw std::invalid_argument("ordering cannot be "+std::to_string(ordering)+". "+std::string(__FILE__)+" line "+std::to_string(__LINE__));
}
}
}
template<typename T>
inline void imatcopy (const char ordering, const char trans, size_t rows, size_t cols, const T alpha, T * AB)
Expand Down
2 changes: 1 addition & 1 deletion include/RI/global/Lapack-Fortran.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern "C"
void spotri_(const char*const uplo, const int*const n, float*const A, const int*const lda, int*const info);
void dpotri_(const char*const uplo, const int*const n, double*const A, const int*const lda, int*const info);
void cpotri_(const char*const uplo, const int*const n, std::complex<float>*const A, const int*const lda, int*const info);
void zpotri_(const char*const uplo, const int*const n, std::complex<double>*const A, const int*const lda, int*const info);
void zpotri_(const char*const uplo, const int*const n, std::complex<double>*const A, const int*const lda, int*const info);

// solve the eigenproblem Ax=ex, where A is Symmetric
void ssyev_(const char*const jobz, const char*const uplo,
Expand Down
4 changes: 2 additions & 2 deletions include/RI/global/Lapack_Interface-Contiguous.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace Lapack_Interface
{
return potrf(uplo, n, A, n);
}

// potri takes potrf's output to perform matrix inversion
template<typename T>
inline int potri( const char &uplo, const int &n, T*const A )
inline int potri( const char &uplo, const int &n, T*const A )
{
return potri(uplo, n, A, n);
}
Expand Down
24 changes: 12 additions & 12 deletions include/RI/global/Lapack_Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,50 +29,50 @@ namespace Lapack_Interface
const char uplo_changed = Blas_Interface::change_uplo(uplo);
spotrf_( &uplo_changed, &n, A, &lda, &info );
return info;
}
}
inline int potrf( const char &uplo, const int &n, double*const A, const int &lda )
{
int info;
const char uplo_changed = Blas_Interface::change_uplo(uplo);
dpotrf_( &uplo_changed, &n, A, &lda, &info );
return info;
}
}
inline int potrf( const char &uplo, const int &n, std::complex<float>*const A, const int &lda )
{
int info;
const char uplo_changed = Blas_Interface::change_uplo(uplo);
cpotrf_( &uplo_changed, &n, A, &lda, &info );
return info;
}
}
inline int potrf( const char &uplo, const int &n, std::complex<double>*const A, const int &lda )
{
int info;
const char uplo_changed = Blas_Interface::change_uplo(uplo);
zpotrf_( &uplo_changed, &n, A, &lda, &info );
return info;
}
}

// potri takes potrf's output to perform matrix inversion
inline int potri( const char &uplo, const int &n, float*const A, const int &lda )
{
int info;
const char uplo_changed = Blas_Interface::change_uplo(uplo);
spotri_( &uplo_changed, &n, A, &lda, &info);
return info;
}
spotri_( &uplo_changed, &n, A, &lda, &info);
return info;
}
inline int potri( const char &uplo, const int &n, double*const A, const int &lda )
{
int info;
const char uplo_changed = Blas_Interface::change_uplo(uplo);
dpotri_( &uplo_changed, &n, A, &lda, &info);
return info;
dpotri_( &uplo_changed, &n, A, &lda, &info);
return info;
}
inline int potri( const char &uplo, const int &n, std::complex<float>*const A, const int &lda )
{
int info;
const char uplo_changed = Blas_Interface::change_uplo(uplo);
cpotri_( &uplo_changed, &n, A, &lda, &info);
return info;
cpotri_( &uplo_changed, &n, A, &lda, &info);
return info;
}
inline int potri( const char &uplo, const int &n, std::complex<double>*const A, const int &lda )
{
Expand Down Expand Up @@ -149,7 +149,7 @@ namespace Lapack_Interface
const int lwork = std::real(work_tmp);
std::vector<std::complex<T>> WORK(std::max(1,lwork));
return heev(jobz, uplo, n, A, lda, W, WORK.data(), lwork, RWORK.data());
}
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion include/RI/global/MPI_Wrapper-func.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace MPI_Wrapper
inline MPI_Datatype mpi_get_datatype(const bool &v) { return MPI_CXX_BOOL; }
inline MPI_Datatype mpi_get_datatype(const std::complex<float> &v) { return MPI_CXX_FLOAT_COMPLEX; }
inline MPI_Datatype mpi_get_datatype(const std::complex<double> &v) { return MPI_CXX_DOUBLE_COMPLEX; }
inline MPI_Datatype mpi_get_datatype(const std::complex<long double> &v) { return MPI_CXX_LONG_DOUBLE_COMPLEX; }
inline MPI_Datatype mpi_get_datatype(const std::complex<long double> &v) { return MPI_CXX_LONG_DOUBLE_COMPLEX; }

//inline int mpi_get_count(const MPI_Status &status, const MPI_Datatype &datatype)
//{
Expand Down
2 changes: 1 addition & 1 deletion include/RI/global/MPI_Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace MPI_Wrapper
extern inline int mpi_get_size(const MPI_Comm &mpi_comm);

template<typename T> extern inline MPI_Datatype mpi_get_datatype(const T&v);

template<typename T> extern inline void mpi_reduce(T &data, const MPI_Op &op, const int &root, const MPI_Comm &mpi_comm);
template<typename T> extern inline void mpi_allreduce(T &data, const MPI_Op &op, const MPI_Comm &mpi_comm);
template<typename T> extern inline void mpi_reduce(T*const ptr, const int &count, const MPI_Op &op, const int &root, const MPI_Comm &mpi_comm);
Expand Down
4 changes: 2 additions & 2 deletions include/RI/global/Shared_Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Shape_Vector
for(auto ptr_in=v_in.begin(); ptr_in<v_in.end(); )
*(ptr_this++) = *(ptr_in++);
}

const std::size_t* begin() const noexcept { return this->v; }
const std::size_t* end() const noexcept { return this->v+size_; }
std::size_t size() const noexcept { return size_; }
bool empty() const noexcept{ return !size_; }

std::size_t& operator[] (const std::size_t i)
{
assert(i<size_);
Expand Down
2 changes: 1 addition & 1 deletion include/RI/global/Tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace RI
{

template<typename T>
class Tensor
{
Expand Down
4 changes: 2 additions & 2 deletions include/RI/global/Tensor_Algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ namespace Tensor_Algorithm
{
for( std::size_t i0=0; i0!=m.shape[0]; ++i0 )
for( std::size_t i1=0; i1<i0; ++i1 )
m(i0,i1) = m(i1,i0);
m(i0,i1) = m(i1,i0);
}
else if(uplo=='L')
{
for( std::size_t i0=0; i0!=m.shape[0]; ++i0 )
for( std::size_t i1=i0+1; i1<m.shape[1]; ++i1 )
m(i0,i1) = m(i1,i0);
m(i0,i1) = m(i1,i0);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions include/RI/ri/bak_LRI-cal-loop4_1/bak-LRI-cal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ auto LRI<TA,Tcell,Ndim,Tdata>::cal(const std::vector<Label::ab_ab> &labels)
{
if(this->csm.threshold.at(label))
this->csm.set_label_A(label, Aa01, Aa2, Ab01, Ab2, period);

if(this->csm.threshold.at(label))
if(this->csm.filter_4())
continue;
Expand Down Expand Up @@ -373,7 +373,7 @@ auto LRI<TA,Tcell,Ndim,Tdata>::cal(const std::vector<Label::ab_ab> &labels)
tensor3_merge(D_mul3,false),
tensor3_merge(D_b,true));}
);

F_bx2( {Label::ab_ab::a0b0_a1b2, Label::ab_ab::a0b1_a1b2},
// D_mul2(ia1,ia2,ibx) = D_a(ia0,ia1,ia2) * D_ab(ia0,ibx)
[&](){ return
Expand Down Expand Up @@ -465,7 +465,7 @@ auto LRI<TA,Tcell,Ndim,Tdata>::cal(const std::vector<Label::ab_ab> &labels)
tensor3_merge(D_mul3,false),
tensor3_merge(D_bx,false));}
);

F_bx2( {Label::ab_ab::a1b0_a2b2, Label::ab_ab::a1b1_a2b2},
// D_mul2(ia0,ibx,ia2) = D_ab(ia1,ibx) * D_a(ia0,ia1,ia2)
[&](){ return
Expand Down
2 changes: 1 addition & 1 deletion include/RI/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#define __LIBRI_VERSION_MAJOR 2
#define __LIBRI_VERSION_MINOR 1
#define __LIBRI_VERSION_PATCH 0
#define __LIBRI_VERSION_PATCH 1

#define __LIBRI_VERSION ( __LIBRI_VERSION_MAJOR * 10000 \
+ __LIBRI_VERSION_MINOR * 100 \
Expand Down
106 changes: 53 additions & 53 deletions unittests/distribute/Divide_Atoms-test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,61 @@

namespace Divide_Atoms_Test
{
static void test_divide_atoms()
{
const std::size_t group_size = 6;
std::vector<std::size_t> atoms(31);
for(std::size_t i=0; i<atoms.size(); ++i)
atoms[i]=i;
for(std::size_t i=0; i<group_size; ++i)
std::cout<<RI::Divide_Atoms::divide_atoms(i, group_size, atoms)<<std::endl;
}
/*
0| 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|
*/
static void test_divide_atoms()
{
const std::size_t group_size = 6;
std::vector<std::size_t> atoms(31);
for(std::size_t i=0; i<atoms.size(); ++i)
atoms[i]=i;
for(std::size_t i=0; i<group_size; ++i)
std::cout<<RI::Divide_Atoms::divide_atoms(i, group_size, atoms)<<std::endl;
}
/*
0| 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|
*/


static void test_divide_atoms_with_period()
{
const std::size_t group_size = 6;
std::vector<std::size_t> atoms(31);
for(std::size_t i=0; i<atoms.size(); ++i)
atoms[i]=i;
const std::array<std::size_t,1> period = {2};
for(std::size_t i=0; i<group_size; ++i)
std::cout<<RI::Divide_Atoms::divide_atoms(i, group_size, atoms, period)<<std::endl;
}
/*
{ 0, 0 }| { 0, 1 }| { 1, 0 }| { 1, 1 }| { 2, 0 }| { 2, 1 }| { 3, 0 }| { 3, 1 }| { 4, 0 }| { 4, 1 }| { 5, 0 }| { 5, 1 }|
{ 6, 0 }| { 6, 1 }| { 7, 0 }| { 7, 1 }| { 8, 0 }| { 8, 1 }| { 9, 0 }| { 9, 1 }| { 10, 0 }| { 10, 1 }|
{ 11, 0 }| { 11, 1 }| { 12, 0 }| { 12, 1 }| { 13, 0 }| { 13, 1 }| { 14, 0 }| { 14, 1 }| { 15, 0 }| { 15, 1 }|
{ 16, 0 }| { 16, 1 }| { 17, 0 }| { 17, 1 }| { 18, 0 }| { 18, 1 }| { 19, 0 }| { 19, 1 }| { 20, 0 }| { 20, 1 }|
{ 21, 0 }| { 21, 1 }| { 22, 0 }| { 22, 1 }| { 23, 0 }| { 23, 1 }| { 24, 0 }| { 24, 1 }| { 25, 0 }| { 25, 1 }|
{ 26, 0 }| { 26, 1 }| { 27, 0 }| { 27, 1 }| { 28, 0 }| { 28, 1 }| { 29, 0 }| { 29, 1 }| { 30, 0 }| { 30, 1 }|
*/
static void test_divide_atoms_with_period()
{
const std::size_t group_size = 6;
std::vector<std::size_t> atoms(31);
for(std::size_t i=0; i<atoms.size(); ++i)
atoms[i]=i;
const std::array<std::size_t,1> period = {2};
for(std::size_t i=0; i<group_size; ++i)
std::cout<<RI::Divide_Atoms::divide_atoms(i, group_size, atoms, period)<<std::endl;
}
/*
{ 0, 0 }| { 0, 1 }| { 1, 0 }| { 1, 1 }| { 2, 0 }| { 2, 1 }| { 3, 0 }| { 3, 1 }| { 4, 0 }| { 4, 1 }| { 5, 0 }| { 5, 1 }|
{ 6, 0 }| { 6, 1 }| { 7, 0 }| { 7, 1 }| { 8, 0 }| { 8, 1 }| { 9, 0 }| { 9, 1 }| { 10, 0 }| { 10, 1 }|
{ 11, 0 }| { 11, 1 }| { 12, 0 }| { 12, 1 }| { 13, 0 }| { 13, 1 }| { 14, 0 }| { 14, 1 }| { 15, 0 }| { 15, 1 }|
{ 16, 0 }| { 16, 1 }| { 17, 0 }| { 17, 1 }| { 18, 0 }| { 18, 1 }| { 19, 0 }| { 19, 1 }| { 20, 0 }| { 20, 1 }|
{ 21, 0 }| { 21, 1 }| { 22, 0 }| { 22, 1 }| { 23, 0 }| { 23, 1 }| { 24, 0 }| { 24, 1 }| { 25, 0 }| { 25, 1 }|
{ 26, 0 }| { 26, 1 }| { 27, 0 }| { 27, 1 }| { 28, 0 }| { 28, 1 }| { 29, 0 }| { 29, 1 }| { 30, 0 }| { 30, 1 }|
*/


static void test_divide_atoms_periods()
{
const std::size_t group_size = 6;
std::vector<std::size_t> atoms(31);
for(std::size_t i=0; i<atoms.size(); ++i)
atoms[i]=i;
const std::array<std::size_t,1> period = {2};
for(std::size_t i=0; i<group_size; ++i)
std::cout<<RI::Divide_Atoms::divide_atoms_periods(i, group_size, atoms, period)<<std::endl;
}
/*
{ 0, 0 }| { 0, 1 }| { 1, 0 }| { 1, 1 }| { 2, 0 }| { 2, 1 }| { 3, 0 }| { 3, 1 }| { 4, 0 }| { 4, 1 }| { 5, 0 }|
{ 5, 1 }| { 6, 0 }| { 6, 1 }| { 7, 0 }| { 7, 1 }| { 8, 0 }| { 8, 1 }| { 9, 0 }| { 9, 1 }| { 10, 0 }| { 10, 1 }|
{ 11, 0 }| { 11, 1 }| { 12, 0 }| { 12, 1 }| { 13, 0 }| { 13, 1 }| { 14, 0 }| { 14, 1 }| { 15, 0 }| { 15, 1 }|
{ 16, 0 }| { 16, 1 }| { 17, 0 }| { 17, 1 }| { 18, 0 }| { 18, 1 }| { 19, 0 }| { 19, 1 }| { 20, 0 }| { 20, 1 }|
{ 21, 0 }| { 21, 1 }| { 22, 0 }| { 22, 1 }| { 23, 0 }| { 23, 1 }| { 24, 0 }| { 24, 1 }| { 25, 0 }| { 25, 1 }|
{ 26, 0 }| { 26, 1 }| { 27, 0 }| { 27, 1 }| { 28, 0 }| { 28, 1 }| { 29, 0 }| { 29, 1 }| { 30, 0 }| { 30, 1 }|
*/
static void test_divide_atoms_periods()
{
const std::size_t group_size = 6;
std::vector<std::size_t> atoms(31);
for(std::size_t i=0; i<atoms.size(); ++i)
atoms[i]=i;
const std::array<std::size_t,1> period = {2};
for(std::size_t i=0; i<group_size; ++i)
std::cout<<RI::Divide_Atoms::divide_atoms_periods(i, group_size, atoms, period)<<std::endl;
}
/*
{ 0, 0 }| { 0, 1 }| { 1, 0 }| { 1, 1 }| { 2, 0 }| { 2, 1 }| { 3, 0 }| { 3, 1 }| { 4, 0 }| { 4, 1 }| { 5, 0 }|
{ 5, 1 }| { 6, 0 }| { 6, 1 }| { 7, 0 }| { 7, 1 }| { 8, 0 }| { 8, 1 }| { 9, 0 }| { 9, 1 }| { 10, 0 }| { 10, 1 }|
{ 11, 0 }| { 11, 1 }| { 12, 0 }| { 12, 1 }| { 13, 0 }| { 13, 1 }| { 14, 0 }| { 14, 1 }| { 15, 0 }| { 15, 1 }|
{ 16, 0 }| { 16, 1 }| { 17, 0 }| { 17, 1 }| { 18, 0 }| { 18, 1 }| { 19, 0 }| { 19, 1 }| { 20, 0 }| { 20, 1 }|
{ 21, 0 }| { 21, 1 }| { 22, 0 }| { 22, 1 }| { 23, 0 }| { 23, 1 }| { 24, 0 }| { 24, 1 }| { 25, 0 }| { 25, 1 }|
{ 26, 0 }| { 26, 1 }| { 27, 0 }| { 27, 1 }| { 28, 0 }| { 28, 1 }| { 29, 0 }| { 29, 1 }| { 30, 0 }| { 30, 1 }|
*/
}
4 changes: 2 additions & 2 deletions unittests/global/Tensor-test-4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace Tensor_Test
{
int mpi_init_provide;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &mpi_init_provide);

assert(Comm::MPI_Wrapper::mpi_get_size(MPI_COMM_WORLD)>=2);
const int rank_mine = Comm::MPI_Wrapper::mpi_get_rank(MPI_COMM_WORLD);

if(rank_mine==0)
{
const RI::Tensor<double> m = Tensor_Test::init_real_1<double>();
Expand Down
2 changes: 1 addition & 1 deletion unittests/global/Tensor_Algorithm-test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ namespace Tensor_Algorithm_Test
mI: (-0.25, 0.00) ( 0.15, 0.20)
( 0.15,-0.20) (-0.05, 0.00)
*/
}
}
}
Loading

0 comments on commit bea1dfa

Please sign in to comment.