Loading src/Engine/SymmetryLocal.h +14 −16 Original line number Diff line number Diff line Loading @@ -26,30 +26,25 @@ public: io.read(qOne_,"qOne"); int total = 0; SizeType total = 0; io.readline(total, "SymmTensors="); if (total < 1) throw PsimagLite::RuntimeError("SymmetryLocal: reading SymmTensors failed\n"); nameId_.resize(total); int maxLegs = 0; SizeType maxLegs = 0; io.readline(maxLegs, "MaxLegs="); if (maxLegs < 1) throw PsimagLite::RuntimeError("SymmetryLocal: reading maxLegs failed\n"); matrix_.setTo(0); matrix_.setTo(nullptr); matrix_.resize(total, maxLegs); for (int i = 0; i < total; ++i) { for (SizeType i = 0; i < total; ++i) { PsimagLite::String tmp; io.readline(tmp, "SymmForTensor="); nameId_[i] = tmp; int x = 0; SizeType x = 0; io.readline(x, "Total="); if (x < 1) throw PsimagLite::RuntimeError("SymmetryLocal: reading file failed\n"); for (int j = 0; j < x; ++j) { for (SizeType j = 0; j < x; ++j) { VectorSizeType* v = new VectorSizeType; io.read(*v, "Leg" + ttos(j)); matrix_(i,j) = v; Loading @@ -62,7 +57,7 @@ public: { for (SizeType i = 0; i < garbage_.size(); ++i) { delete garbage_[i]; garbage_[i] = 0; garbage_[i] = nullptr; } } Loading @@ -79,7 +74,10 @@ public: PsimagLite::String str(""); SizeType count = 0; for (SizeType j = 0; j < m; ++j) { if (matrix_(i,j) == 0) continue; if (matrix_(i,j) == nullptr) { continue; } const VectorSizeType& v = *(matrix_(i,j)); if (v.size() == 0) continue; str += "Leg" + ttos(j) + " "; Loading Loading @@ -149,7 +147,7 @@ public: void addIdentity(SizeType id, SizeType dim) { VectorVectorSizeType q(2, static_cast<VectorSizeType*>(0)); VectorVectorSizeType q(2, static_cast<VectorSizeType*>(nullptr)); VectorSizeType* qq = new VectorSizeType(dim, 0); PsimagLite::String str("i"); str += ttos(id); Loading Loading @@ -213,7 +211,7 @@ private: for (SizeType i = 0; i < n; ++i) { SizeType count = 0; for (SizeType j = 0; j < m; ++j) { if (matrix_(i,j) == 0) continue; if (matrix_(i,j) == nullptr) continue; const VectorSizeType& v = *(matrix_(i,j)); if (v.size() == 0) continue; ++count; Loading src/configure.pl +3 −4 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ sub createMakefile my ($drivers, $args) = @_; unlink("Makefile.dep"); NewMake::backupMakefile(); $args->{"additional3"} = "operator"; my $fh; open($fh, ">", "Makefile") or die "Cannot open Makefile for writing: $!\n"; Loading @@ -69,10 +68,10 @@ sub createMakefile local *FH = $fh; print FH<<EOF; #.PHONY: GitRevision.h .PHONY: GitRevision.h #GitRevision.h: # ./createGitRevision.pl GitRevision.h GitRevision.h: ./createGitRevision.pl GitRevision.h EOF Loading src/createGitRevision.pl 0 → 100755 +73 −0 Original line number Diff line number Diff line #!/usr/bin/perl use strict; use warnings; my ($file) = @ARGV; defined($file) or exit(1); my $hashPsimagLite = getGitHash("../../PsimagLite"); my $hashDmrgpp = getGitHash(".."); my $microArch = getMicroArch(); open(FOUT, ">", $file) or exit(2); print FOUT "// DO NOT EDIT. It will be overwritten\n"; print FOUT "// Created by $0\n"; print FOUT "#define PSIMAGLITE_GIT_REV \"$hashPsimagLite\"\n"; print FOUT "#define DMRGPP_GIT_REV \"$hashDmrgpp\"\n"; print FOUT "#define MICRO_ARCH \"$microArch\"\n"; print FOUT "\n"; close(FOUT); sub getGitHash { my ($dir) = @_; my $file = "$dir/.git/HEAD"; open(FILE, "<", $file) or return "E0"; my $value = <FILE>; close(FILE); ($value) or return "E1"; chomp($value); if ($value =~ /^ref\: (.+$)/) { $file = "$dir/.git/$1"; } else { return "E2"; } open(FILE, "<", $file) or return "E3"; $value = <FILE>; close(FILE); ($value) or return "E4"; chomp($value); my $code = system("cd $dir; git diff --quiet"); ($code) or $code = 0; $code >>= 8; $value .= " +M" if ($code != 0); return $value; } sub getMicroArch { my $file = "/proc/cpuinfo"; open(FILE, "<", $file) or return "E0"; my $vendorId; while (<FILE>) { next unless (/vendor_id/); chomp; $vendorId = $_; } close(FILE); ($vendorId) or return "E1"; return "Intel" if ($vendorId =~ /intel/i); return "AMD" if ($vendorId =~ /AMD/); $vendorId =~ s/vendor_id[ \t] *:[ \t]*//; return $vendorId; } Loading
src/Engine/SymmetryLocal.h +14 −16 Original line number Diff line number Diff line Loading @@ -26,30 +26,25 @@ public: io.read(qOne_,"qOne"); int total = 0; SizeType total = 0; io.readline(total, "SymmTensors="); if (total < 1) throw PsimagLite::RuntimeError("SymmetryLocal: reading SymmTensors failed\n"); nameId_.resize(total); int maxLegs = 0; SizeType maxLegs = 0; io.readline(maxLegs, "MaxLegs="); if (maxLegs < 1) throw PsimagLite::RuntimeError("SymmetryLocal: reading maxLegs failed\n"); matrix_.setTo(0); matrix_.setTo(nullptr); matrix_.resize(total, maxLegs); for (int i = 0; i < total; ++i) { for (SizeType i = 0; i < total; ++i) { PsimagLite::String tmp; io.readline(tmp, "SymmForTensor="); nameId_[i] = tmp; int x = 0; SizeType x = 0; io.readline(x, "Total="); if (x < 1) throw PsimagLite::RuntimeError("SymmetryLocal: reading file failed\n"); for (int j = 0; j < x; ++j) { for (SizeType j = 0; j < x; ++j) { VectorSizeType* v = new VectorSizeType; io.read(*v, "Leg" + ttos(j)); matrix_(i,j) = v; Loading @@ -62,7 +57,7 @@ public: { for (SizeType i = 0; i < garbage_.size(); ++i) { delete garbage_[i]; garbage_[i] = 0; garbage_[i] = nullptr; } } Loading @@ -79,7 +74,10 @@ public: PsimagLite::String str(""); SizeType count = 0; for (SizeType j = 0; j < m; ++j) { if (matrix_(i,j) == 0) continue; if (matrix_(i,j) == nullptr) { continue; } const VectorSizeType& v = *(matrix_(i,j)); if (v.size() == 0) continue; str += "Leg" + ttos(j) + " "; Loading Loading @@ -149,7 +147,7 @@ public: void addIdentity(SizeType id, SizeType dim) { VectorVectorSizeType q(2, static_cast<VectorSizeType*>(0)); VectorVectorSizeType q(2, static_cast<VectorSizeType*>(nullptr)); VectorSizeType* qq = new VectorSizeType(dim, 0); PsimagLite::String str("i"); str += ttos(id); Loading Loading @@ -213,7 +211,7 @@ private: for (SizeType i = 0; i < n; ++i) { SizeType count = 0; for (SizeType j = 0; j < m; ++j) { if (matrix_(i,j) == 0) continue; if (matrix_(i,j) == nullptr) continue; const VectorSizeType& v = *(matrix_(i,j)); if (v.size() == 0) continue; ++count; Loading
src/configure.pl +3 −4 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ sub createMakefile my ($drivers, $args) = @_; unlink("Makefile.dep"); NewMake::backupMakefile(); $args->{"additional3"} = "operator"; my $fh; open($fh, ">", "Makefile") or die "Cannot open Makefile for writing: $!\n"; Loading @@ -69,10 +68,10 @@ sub createMakefile local *FH = $fh; print FH<<EOF; #.PHONY: GitRevision.h .PHONY: GitRevision.h #GitRevision.h: # ./createGitRevision.pl GitRevision.h GitRevision.h: ./createGitRevision.pl GitRevision.h EOF Loading
src/createGitRevision.pl 0 → 100755 +73 −0 Original line number Diff line number Diff line #!/usr/bin/perl use strict; use warnings; my ($file) = @ARGV; defined($file) or exit(1); my $hashPsimagLite = getGitHash("../../PsimagLite"); my $hashDmrgpp = getGitHash(".."); my $microArch = getMicroArch(); open(FOUT, ">", $file) or exit(2); print FOUT "// DO NOT EDIT. It will be overwritten\n"; print FOUT "// Created by $0\n"; print FOUT "#define PSIMAGLITE_GIT_REV \"$hashPsimagLite\"\n"; print FOUT "#define DMRGPP_GIT_REV \"$hashDmrgpp\"\n"; print FOUT "#define MICRO_ARCH \"$microArch\"\n"; print FOUT "\n"; close(FOUT); sub getGitHash { my ($dir) = @_; my $file = "$dir/.git/HEAD"; open(FILE, "<", $file) or return "E0"; my $value = <FILE>; close(FILE); ($value) or return "E1"; chomp($value); if ($value =~ /^ref\: (.+$)/) { $file = "$dir/.git/$1"; } else { return "E2"; } open(FILE, "<", $file) or return "E3"; $value = <FILE>; close(FILE); ($value) or return "E4"; chomp($value); my $code = system("cd $dir; git diff --quiet"); ($code) or $code = 0; $code >>= 8; $value .= " +M" if ($code != 0); return $value; } sub getMicroArch { my $file = "/proc/cpuinfo"; open(FILE, "<", $file) or return "E0"; my $vendorId; while (<FILE>) { next unless (/vendor_id/); chomp; $vendorId = $_; } close(FILE); ($vendorId) or return "E1"; return "Intel" if ($vendorId =~ /intel/i); return "AMD" if ($vendorId =~ /AMD/); $vendorId =~ s/vendor_id[ \t] *:[ \t]*//; return $vendorId; }