Cytnx v0.9.1
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
24 Tensor zeros(const cytnx_uint64 &Nelem, const unsigned int &dtype = Type.Double,
25 const int &device = Device.cpu);
38 Tensor zeros(const std::vector<cytnx_uint64> &Nelem, const unsigned int &dtype = Type.Double,
39 const int &device = Device.cpu);
41
54 Tensor identity(const cytnx_uint64 &Dim, const unsigned int &dtype = Type.Double,
55 const int &device = Device.cpu);
56
72 Tensor eye(const cytnx_uint64 &Dim, const unsigned int &dtype = Type.Double,
73 const int &device = Device.cpu);
74
76
88 Tensor ones(const cytnx_uint64 &Nelem, const unsigned int &dtype = Type.Double,
89 const int &device = Device.cpu);
102 Tensor ones(const std::vector<cytnx_uint64> &Nelem, const unsigned int &dtype = Type.Double,
103 const int &device = Device.cpu);
105
107
115 Tensor arange(const cytnx_int64 &Nelem);
130 Tensor arange(const cytnx_double &start, const cytnx_double &end, const cytnx_double &step = 1,
131 const unsigned int &dtype = Type.Double, const int &device = Device.cpu);
133
134 Tensor linspace(const cytnx_double &start, const cytnx_double &end, const cytnx_uint64 &Nelem,
135 const bool &endpoint = true, const unsigned int &dtype = Type.Double,
136 const int &device = Device.cpu);
137
138 // Tensor rand(const std::vector<cytnx_uint64> &size);
139 // Tensor randn(const std::vector<cytnx_uint64> &size);
140 // Tensor normal(const cytnx_double &mean, cytnx_double &std);
141
142} // namespace cytnx
143
144#endif
an tensor (multi-dimensional array)
Definition Tensor.hpp:345
Definition Accessor.hpp:12
Device_class Device
data on which devices.
double cytnx_double
Definition Type.hpp:43
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)
Tensor arange(const cytnx_int64 &Nelem)
create an rank-1 Tensor with incremental unsigned integer elements start with [0,Nelem)
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.
uint64_t cytnx_uint64
Definition Type.hpp:45
int64_t cytnx_int64
Definition Type.hpp:48
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.
Type_class Type
data type
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.
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.