Cytnx v0.7.4
Loading...
Searching...
No Matches
Generator.hpp
Go to the documentation of this file.
1#ifndef _Generator_H_
2#define _Generator_H_
3#include "Type.hpp"
4#include "Device.hpp"
5#include "cytnx_error.hpp"
6#include "Tensor.hpp"
7#include <vector>
8#include <initializer_list>
9namespace cytnx{
10
12
22 Tensor zeros(const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
33 Tensor zeros(const std::vector<cytnx_uint64> &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
35
46 Tensor identity(const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
47
61 Tensor eye(const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
62
64
74 Tensor ones(const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
85 Tensor ones(const std::vector<cytnx_uint64> &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
87
88
90
98 Tensor arange(const cytnx_int64 &Nelem);
111 Tensor arange(const cytnx_double &start, const cytnx_double &end, const cytnx_double &step=1,const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
113
114
115 Tensor linspace(const cytnx_double &start, const cytnx_double &end, const cytnx_uint64 &Nelem, const bool &endpoint=true, const unsigned int &dtype=Type.Double, const int &device=Device.cpu);
116
117
118
119 //Tensor rand(const std::vector<cytnx_uint64> &size);
120 //Tensor randn(const std::vector<cytnx_uint64> &size);
121 //Tensor normal(const cytnx_double &mean, cytnx_double &std);
122
123
124}
125
126#endif
Definition Accessor.hpp:12
Device_class Device
Definition Device.cpp:105
double cytnx_double
Definition Type.hpp:20
Tensor linspace(const cytnx_double &start, const cytnx_double &end, const cytnx_uint64 &Nelem, const bool &endpoint=true, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
Definition Generator.cpp:73
Tensor arange(const cytnx_int64 &Nelem)
create an rank-1 Tensor with incremental unsigned integer elements start with [0,Nelem)
Definition Generator.cpp:68
Tensor ones(const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
create an rank-1 Tensor with all the elements are initialized with one.
Definition Generator.cpp:23
uint64_t cytnx_uint64
Definition Type.hpp:22
int64_t cytnx_int64
Definition Type.hpp:25
Tensor zeros(const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
create an rank-1 Tensor with all the elements are initialized with zero.
Definition Generator.cpp:10
Type_class Type
Definition Type.cpp:137
Tensor identity(const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
create an square rank-2 Tensor with all diagonal to be one.
Definition Generator.cpp:34
Tensor eye(const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
create an square rank-2 Tensor with all diagonal to be one.
Definition Generator.cpp:38