Feel free to create as many branches as needed, both in your private repository and on the current origin. Ideally, tend to prefer feature branches rather than long-living personal branches, but this is up to you.
Note that rebasing is strongly discouraged, but there is no reason not to merge as often and as happily as you like with other branches of yours (or master into one of your branches). If you feel that your work on a particular feature is finished, make sure that it compiles and runs with all currently-supported compilers and let me know that you would like to have something merged. Note that only generic tools and tensor network geometries should live on the master branch, individual lattice files are better kept in individual feature branches (unless they're useful as an example or to test a generic feature).
The following is a random list of things I’d like to keep observed in the code. MUST/SHALL etc. according to RFC 2119.
.cppfile).
filedirective.
init-shelland use its provided
log()and
plog()functions for output.
test/.
sytennamespace. The only exception is the entry function
mainfor binaries. Within that function, you may choose to either prefix all necessary calls by
syten::or directly call a helper function in the syten namespace (the latter is currently more popular).
lat/
*.cppand
bin/
*.cpp)
--cache(use the HDD as cache when possible).
--help(print a help message) and
--quiet(print as little information as reasonable).
x.hMUST be defined inline in that file.
x.hMUST be defined in a file
x.cpp.
Translation units (.cpp files) associated to a header file MAY include toolkit-internal header files apart from the header file with which they are associated.
void f(T1, T2, T3)MUST be declared either in the namespace that also directly contains
T1or in the namespace that also directly contains
T2or in the namespace that also directly contains
T3. This is necessary for ADL overload resolution to work correctly.
C++17 and supported parts of C++20 may be used.
autoand
if constexpr.
newand
deleteMUST NOT be used outside of container classes ensuring appropriate cleanup in their destructors.
l_malloc()and
l_free()SHOULD be used, especially if the contained type is trivially constructible and trivially destructable. If necessary,
placement newMAY be used on the returned pointer. See syten::DynArray for an example.
std::vector<double>or
std::array<std::vector<double>, 2>) and which are not intended as temporary calculation helpers (e.g. functors) MUST provide a
MemoryUsage::MemorySize allocSize() constmember function which returns the sum of the return values of
MemoryUsage::allocSize()called on these member objects. For examples, see
DenseTensor::allocSize()or
TensorBlock::allocSize()etc.
mainMUST be either
int main()or
int main(int argc, char** argv). In the second case, the argument names MUST be
argcand
argv.
Classes MUST be versioned for serialisation. For simple, non-template classes, versioning MAY follow this example:
If the class is templated, but the valid template arguments are not templated again (e.g.
Tensor<Rank rank>), you MAY follow the example above but use the BOOST_TEMPLATE_CLASS_VERSION macro.
If the class is templated and valid template arguments may also be templates, the versioning MUST follow this example:
The key elements are: a) a single point where the version is declared (
boost_version_MyClass), b) derivation from
boost::serialization::traits with the version as the fourth template argument and c) the standard check in
serialize.
Scalar types: syten::SDef MUST be used as the default scalar type. Reasonable care SHOULD be taken not to rely on the specific type used, especially not whether the type is defined as
double or
std::complex<double>. Member functions MUST NOT be called on variables of this type, use free-standing functions instead. Code relying on complex scalar values MUST check the preprocessor macro SYTEN_COMPLEX_SCALAR and provide reasonable errors, ideally exiting with error code SYTEN_EC_COMPLEX_SCALAR_REQUIRED .
syten::Index MUST be used as the index type for dense tensors (i.e. when a tuple of them is required as coordinates, dimensions etc.). For flat arrays, use syten::Size as the index type.
_r,
_cand (with complex installations)
_iare available to generate
SRDef,
SDefand (potentially) imaginary
SDefeasily.
Value and reference types MUST be of the form
Value[ const][&]. Specifically, for any type
T, write the reference to
T as
T& and the const reference to
T as
T const&.
const Value&and
Value const&are the same, this is a strict requirement.
Functions MUST be written as
TYPE func([Args]); where
TYPE conforms to the rule for types above.
Tis
T& f(), not
T &f().
The content of each opened block MUST be indentend by two spaces starting (inclusively) at the line following the opening
{ and ending (inclusively) at the last line with non-whitespace content apart from the closing
} at or before that closing
}.