24 Fopr *create_object_with_fopr(
Fopr *fopr)
30 Fopr *create_object_with_filename(
const std::string& fname)
36 bool init1 = Fopr::Factory_fopr::Register(
"CRS", create_object_with_fopr);
37 bool init2 = Fopr::Factory_string::Register(
"CRS", create_object_with_filename);
46 const string str_vlevel = params.
get_string(
"verbose_level");
65 int Nsize = w.
size() / 2;
72 for (
int j = 0; j < Nsize; ++j) {
81 for (
int i = 0; i < Ncolumn; ++i) {
84 double wr = w.
cmp(2 * k);
85 double wi = w.
cmp(2 * k + 1);
98 int Nsize = w.
size() / 2;
106 for (
int j = 0; j < Nsize; ++j) {
107 if (j == Nsize - 1) {
113 double wr = w.
cmp(2 * j);
114 double wi = w.
cmp(2 * j + 1);
116 for (
int i = 0; i < Ncolumn; ++i) {
122 v.
add(2 * k + 1, vi);
145 std::vector<int> index_nz1(
m_Nsize);
146 std::vector<double> elem_nz1(2 *
m_Nsize);
158 for (
int ex = 0; ex <
m_Nex; ++ex) {
160 w.set(in, site, ex, 1.0);
179 for (
int ex = 0; ex <
m_Nex; ++ex) {
181 for (
int site = 0; site <
m_Nvol; ++site) {
182 for (
int in2 = 0; in2 < (
m_Nin / 2); ++in2) {
183 int j = in2 + (
m_Nin / 2) * (site + m_Nvol * ex);
186 w.set(2 * in2, site, ex, 1.0);
189 if (Nnz_tot + Nnz1 >
m_Nnz) {
195 for (
int i = 0; i < Nnz1; ++i) {
197 m_elem_nz[2 * (Nnz_tot + i)] = elem_nz1[2 * i];
198 m_elem_nz[2 * (Nnz_tot + i) + 1] = elem_nz1[2 * i + 1];
213 std::vector<double>& elem_nz,
Field& v)
218 int Nsize = v.
size() / 2;
222 for (
int i = 0; i < Nsize; ++i) {
223 if ((v.
cmp(2 * i) != 0.0) || (v.
cmp(2 * i + 1) != 0.0)) {
225 elem_nz[2 * j] = v.
cmp(2 * i);
226 elem_nz[2 * j + 1] = -v.
cmp(2 * i + 1);
239 config.open(fname.c_str(), std::ios::in);
240 if (!config.is_open()) {
241 vout.
crucial(
m_vl,
"Error at %s: Failed to open the next file %s in %s(%d)",
242 class_name.c_str(), fname.c_str(), __FILE__, __LINE__);
258 for (
int j = 0; j <
m_Nsize; ++j) {
263 for (
int j = 0; j <
m_Nnz; ++j) {
268 for (
int j = 0; j <
m_Nnz; ++j) {
270 config >> m_elem_nz[2 * j + 1];
284 config.open(fname.c_str(), std::ios::out);
285 if (!config.is_open()) {
286 vout.
crucial(
m_vl,
"Error at %s: Failed to open the text file %s(%d)\n",
293 config << m_Nin << std::endl;
294 config << m_Nvol << std::endl;
295 config << m_Nex << std::endl;
296 config << m_Nsize << std::endl;
297 config << m_Nnz << std::endl;
299 for (
int j = 0; j <
m_Nsize; ++j) {
303 for (
int j = 0; j <
m_Nnz; ++j) {
307 config.setf(std::ios_base::scientific, std::ios_base::floatfield);
308 config.precision(14);
310 for (
int j = 0; j <
m_Nnz; ++j) {
312 config <<
m_elem_nz[2 * j + 1] << std::endl;
void set(const int jin, const int site, const int jex, double v)
void set_matrix_1row(int &, std::vector< int > &, std::vector< double > &, Field &)
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 &)
virtual int field_nin()=0
returns the on-site d.o.f. for which the fermion operator is defined.
Bridge::VerboseLevel m_vl
void write_matrix(std::string)
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 &)
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&).
Base class of fermion operator family.
string get_string(const string &key) const
virtual int field_nvol()=0
returns the volume for which the fermion operator is defined.
Fermion operator with CRS matrix format.
static VerboseLevel set_verbose_level(const std::string &str)