Skip to content

Commit

Permalink
Merge pull request #550 from Cytnx-dev/haoti/pre-releasev1.0.0
Browse files Browse the repository at this point in the history
Pre release v1.0.0
  • Loading branch information
hunghaoti authored Jan 2, 2025
2 parents f7368fe + 8370a59 commit 80cf598
Show file tree
Hide file tree
Showing 14 changed files with 615 additions and 502 deletions.
392 changes: 186 additions & 206 deletions Readme.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs.doxygen
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Cytnx"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "v0.9.7"
PROJECT_NUMBER = "v1.0.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand All @@ -51,7 +51,7 @@ PROJECT_BRIEF =
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.

PROJECT_LOGO = "./Icon_small.png"
PROJECT_LOGO = "./Icons/Icon_small.png"


# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
Expand Down Expand Up @@ -793,7 +793,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = "./python_doc" "./dox.md" "./include" "./include/tn_algo" "./include/linalg.hpp" "./include/utils/utils.hpp" "./include/UniTensor.hpp" "./misc_doc" #"./src/linalg" "./src/utils"
INPUT = "./python_doc" "./dox.md" "./include" "./misc_doc"

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -877,7 +877,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE = "./include/Gncon.hpp"
EXCLUDE = "./include/Gncon.hpp" "./include/contraction_tree" "./include/search_tree.hpp""./include/stat.hpp" "./include/sp.py"

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
300 changes: 188 additions & 112 deletions dox.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/TDVP/tdvp1_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ def Local_meas(A, B, Op, site):
def prepare_rand_init_MPS(Nsites, chi, d):
lbls = []
A = [None for i in range(Nsites)]
A[0] = cytnx.UniTensor(cytnx.random.normal([1, d, min(chi, d)], 0., 1.), rowrank = 2)
A[0] = cytnx.UniTensor(cytnx.random.normal([1, d, min(chi, d)], 0., 1., seed=0), rowrank = 2)
A[0].relabels_(["0","1","2"])
lbls.append(["0","1","2"]) # store the labels for later convinience.

for k in range(1,Nsites):
dim1 = A[k-1].shape()[2]; dim2 = d
dim3 = min(min(chi, A[k-1].shape()[2] * d), d ** (Nsites - k - 1))
A[k] = cytnx.UniTensor(cytnx.random.normal([dim1, dim2, dim3],0.,1.), rowrank = 2)
A[k] = cytnx.UniTensor(cytnx.random.normal([dim1, dim2, dim3],0.,1., seed=0), rowrank = 2)

lbl = [str(2*k),str(2*k+1),str(2*k+2)]
A[k].relabels_(lbl)
Expand Down
12 changes: 6 additions & 6 deletions example/Tensor/at.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
using namespace cytnx;
using namespace std;
int main() {
Tensor A = arange(30, Type.Float).reshape(2, 3, 5);
Tensor A = arange(30).reshape(2, 3, 5);
cout << A << endl;

// note that type resolver should be consist with the dtype
cout << A.at<cytnx_float>(0, 0, 2) << endl;
cout << A.at<cytnx_double>(0, 0, 2) << endl;

// the return is a ref., can be modify directly.
A.at<cytnx_float>(0, 0, 2) = 999;
A.at<cytnx_double>(0, 0, 2) = 999;

cout << A.at<cytnx_float>(0, 0, 2) << endl;
cout << A.at<cytnx_double>(0, 0, 2) << endl;

// [Note] there are two way to give argument:
// Method 1: more like 'c++' way:
// (alternatively, you can also simply give a std::vector)
A.at<cytnx_float>({0, 0, 2}); // note the braket{}
A.at<cytnx_double>({0, 0, 2}); // note the braket{}

// Method 2: more like 'python' way:
A.at<cytnx_float>(0, 0, 2);
A.at<cytnx_double>(0, 0, 2);

return 0;
}
14 changes: 14 additions & 0 deletions example/Tensor/at.cpp.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Total elem: 30
type : Double (Float64)
cytnx device: CPU
Shape : (2,3,5)
[[[0.00000e+00 1.00000e+00 2.00000e+00 3.00000e+00 4.00000e+00 ]
[5.00000e+00 6.00000e+00 7.00000e+00 8.00000e+00 9.00000e+00 ]
[1.00000e+01 1.10000e+01 1.20000e+01 1.30000e+01 1.40000e+01 ]]
[[1.50000e+01 1.60000e+01 1.70000e+01 1.80000e+01 1.90000e+01 ]
[2.00000e+01 2.10000e+01 2.20000e+01 2.30000e+01 2.40000e+01 ]
[2.50000e+01 2.60000e+01 2.70000e+01 2.80000e+01 2.90000e+01 ]]]


2
999
2 changes: 2 additions & 0 deletions example/Tensor/to.cpp.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cytnx device: CUDA/GPU-id:0
cytnx device: CPU
1 change: 1 addition & 0 deletions example/Tensor/to_.cpp.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cytnx device: CUDA/GPU-id:0
4 changes: 0 additions & 4 deletions include/LinOp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ namespace cytnx {
examples for how to use them.
## Example:
### c++ API:
\include example/LinOp/init.cpp
#### output>
\verbinclude example/LinOp/init.cpp.out
### python API:
\include example/LinOp/init.py
#### output>
Expand Down
8 changes: 4 additions & 4 deletions include/Network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ namespace cytnx {
Currently, only Regular Network is support!
##note:
@note
1. each network file cannot have more than 1024 lines.
##detail:
@details
Format of a network file:
- each line defines a UniTensor, that takes the format '[name] : [Labels]'
Expand Down Expand Up @@ -336,10 +336,10 @@ namespace cytnx {
Currently, only Regular Network is support!
##note:
@note
1. contents cannot have more than 1024 lines/strings.
##detail:
@details
Format of each string follows the same policy as Fromfile.
Expand Down
3 changes: 3 additions & 0 deletions include/Tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ namespace cytnx {

// This mechanism is to remove the 'void' type from Type_list. Taking advantage of it
// appearing first ...

/// @cond
struct internal {
template <typename Variant>
struct exclude_first;
Expand All @@ -504,6 +506,7 @@ namespace cytnx {
using type = std::variant<Rest...>;
};
}; // internal
/// @endcond

// std::variant of pointers to Type_list, without void ....
using pointer_types =
Expand Down
Loading

0 comments on commit 80cf598

Please sign in to comment.