00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _chemistry_qc_intv3_cartitv3_h
00029 #define _chemistry_qc_intv3_cartitv3_h
00030
00031 #include <chemistry/qc/basis/cartiter.h>
00032
00033 namespace sc {
00034
00035 class CartesianIterV3 : public CartesianIter {
00036 public:
00037 CartesianIterV3(int l) : CartesianIter(l) {}
00038
00039 void start() {
00040 bfn_=a_=c_=0;
00041 b_=l_;
00042 }
00043
00044 void next() {
00045 if (c_<l_-a_)
00046 c_++;
00047 else {
00048 c_=0;
00049 a_++;
00050 }
00051 bfn_++;
00052 b_ = l_-a_-c_;
00053 }
00054
00055 operator int() {
00056 return (a_ <= l_);
00057 }
00058 };
00059
00060 class RedundantCartesianIterV3 : public RedundantCartesianIter {
00061 public:
00062 RedundantCartesianIterV3(int l) : RedundantCartesianIter(l) {}
00063
00064 int bfn() {
00065 int i = a();
00066 int j = b();
00067 int am = l();
00068 return (((((((am)+1)<<1)-(i))*((i)+1))>>1)-(j)-1);
00069 }
00070 };
00071
00072 class RedundantCartesianSubIterV3 : public RedundantCartesianSubIter {
00073 public:
00074 RedundantCartesianSubIterV3(int l) : RedundantCartesianSubIter(l) {}
00075
00076 int bfn() {
00077 int i = a();
00078 int j = b();
00079 int am = l();
00080 return (((((((am)+1)<<1)-(i))*((i)+1))>>1)-(j)-1);
00081 }
00082 };
00083
00084 }
00085
00086 #endif
00087
00088
00089
00090
00091