18 #ifdef USE_FACTORY_AUTOREGISTER
20 bool init = Fopr_CRS::register_factory();
29 const std::string str_vlevel = params.
get_string(
"verbose_level");
48 const int Nsize = w.
size() / 2;
57 for (
int j = 0; j < Nsize; ++j) {
66 for (
int i = 0; i < Ncolumn; ++i) {
69 double wr = w.
cmp(2 * k);
70 double wi = w.
cmp(2 * k + 1);
85 const int Nsize = w.
size() / 2;
94 for (
int j = 0; j < Nsize; ++j) {
101 double wr = w.
cmp(2 * j);
102 double wi = w.
cmp(2 * j + 1);
104 for (
int i = 0; i < Ncolumn; ++i) {
111 v.
add(2 * k + 1, vi);
134 std::vector<int> index_nz1(
m_Nsize);
135 std::vector<double> elem_nz1(2 *
m_Nsize);
147 for (
int ex = 0; ex <
m_Nex; ++ex) {
149 w.set(in, site, ex, 1.0);
168 for (
int ex = 0; ex <
m_Nex; ++ex) {
170 for (
int site = 0; site <
m_Nvol; ++site) {
171 for (
int in2 = 0; in2 < (
m_Nin / 2); ++in2) {
172 int j = in2 + (
m_Nin / 2) * (site + m_Nvol * ex);
175 w.set(2 * in2, site, ex, 1.0);
178 if (Nnz_tot + Nnz1 >
m_Nnz) {
184 for (
int i = 0; i < Nnz1; ++i) {
186 m_elem_nz[2 * (Nnz_tot + i)] = elem_nz1[2 * i];
187 m_elem_nz[2 * (Nnz_tot + i) + 1] = elem_nz1[2 * i + 1];
202 std::vector<double>& elem_nz,
const Field& v)
207 const int Nsize = v.
size() / 2;
211 for (
int i = 0; i < Nsize; ++i) {
212 if ((v.
cmp(2 * i) != 0.0) || (v.
cmp(2 * i + 1) != 0.0)) {
214 elem_nz[2 * j] = v.
cmp(2 * i);
215 elem_nz[2 * j + 1] = -v.
cmp(2 * i + 1);
230 config.open(fname.c_str(), std::ios::in);
231 if (!config.is_open()) {
232 vout.
crucial(
m_vl,
"Error at %s: Failed to open the next file %s in %s(%d)",
233 class_name.c_str(), fname.c_str(), __FILE__, __LINE__);
249 for (
int j = 0; j <
m_Nsize; ++j) {
254 for (
int j = 0; j <
m_Nnz; ++j) {
259 for (
int j = 0; j <
m_Nnz; ++j) {
261 config >> m_elem_nz[2 * j + 1];
275 config.open(fname.c_str(), std::ios::out);
276 if (!config.is_open()) {
277 vout.
crucial(
m_vl,
"Error at %s: Failed to open the text file %s(%d)\n",
284 config <<
m_Nin << std::endl;
285 config <<
m_Nvol << std::endl;
286 config <<
m_Nex << std::endl;
287 config <<
m_Nsize << std::endl;
288 config <<
m_Nnz << std::endl;
290 for (
int j = 0; j <
m_Nsize; ++j) {
294 for (
int j = 0; j <
m_Nnz; ++j) {
298 config.setf(std::ios_base::scientific, std::ios_base::floatfield);
299 config.precision(14);
301 for (
int j = 0; j <
m_Nnz; ++j) {
303 config <<
m_elem_nz[2 * j + 1] << std::endl;
void set(const int jin, const int site, const int jex, double v)
void general(const char *format,...)
Container of Field-type object.
double cmp(const int jin, const int site, const int jex) const
void Ddag(Field &, const Field &)
void set_matrix_1row(int &, std::vector< int > &, std::vector< double > &, const Field &)
virtual int field_nin()=0
returns the on-site d.o.f. for which the fermion operator is defined.
Bridge::VerboseLevel m_vl
virtual int field_nex()=0
returns the external d.o.f. for which the fermion operator is defined.
std::vector< int > m_rowidx_nz
void set_parameters(const Parameters &)
static const std::string class_name
void crucial(const char *format,...)
std::vector< double > m_elem_nz
void add(const int jin, const int site, const int jex, double v)
void DdagD(Field &, const Field &)
void write_matrix(const std::string)
std::vector< int > m_column_nz
void D(Field &, const Field &)
virtual void mult_dag(Field &, const Field &)
hermitian conjugate of mult(Field&, const Field&).
string get_string(const string &key) const
virtual int field_nvol()=0
returns the volume for which the fermion operator is defined.
static VerboseLevel set_verbose_level(const std::string &str)