Cytnx v1.0.0
Loading...
Searching...
No Matches
Generator.hpp
Go to the documentation of this file.
1#ifndef CYTNX_GENERATOR_H_
2#define CYTNX_GENERATOR_H_
3
4#include "Type.hpp"
5#include "Device.hpp"
6#include "cytnx_error.hpp"
7#include "Tensor.hpp"
8#include <vector>
9#include <initializer_list>
10
11namespace cytnx {
12
14
26 Tensor zeros(const std::vector<cytnx_uint64> &shape, unsigned int dtype = Type.Double,
27 int device = Device.cpu);
28 Tensor zeros(std::initializer_list<cytnx_uint64> shape, unsigned int dtype = Type.Double,
29 int device = Device.cpu);
31
45 Tensor identity(cytnx_uint64 Dim, unsigned int dtype = Type.Double, int device = Device.cpu);
46
63 Tensor eye(cytnx_uint64 Dim, unsigned int dtype = Type.Double, int device = Device.cpu);
64
66
78 Tensor ones(const std::vector<cytnx_uint64> &shape, unsigned int dtype = Type.Double,
79 int device = Device.cpu);
80 Tensor ones(std::initializer_list<cytnx_uint64> shape, unsigned int dtype = Type.Double,
81 int device = Device.cpu);
83
85
92 Tensor arange(cytnx_int64 Nelem);
110 Tensor arange(cytnx_double start, cytnx_double end, cytnx_double step = 1,
111 unsigned int dtype = Type.Double, int device = Device.cpu);
113
114 Tensor linspace(cytnx_double start, cytnx_double end, cytnx_uint64 Nelem, bool endpoint = true,
115 unsigned int dtype = Type.Double, int device = Device.cpu);
116
117 // Tensor rand(const std::vector<cytnx_uint64> &size);
118 // Tensor randn(const std::vector<cytnx_uint64> &size);
119 // Tensor normal(const cytnx_double &mean, cytnx_double &std);
120
121} // namespace cytnx
122
123#endif // CYTNX_GENERATOR_H_
constexpr Type_class Type
data type
Definition Type.hpp:553
an tensor (multi-dimensional array)
Definition Tensor.hpp:33
Definition Accessor.hpp:12
Device_class Device
data on which devices.
Tensor eye(cytnx_uint64 Dim, unsigned int dtype=Type.Double, int device=Device.cpu)
Create a square rank-2 Tensor with the diagonal initialized to one and all other elements set to zero...
Tensor zeros(const std::vector< cytnx_uint64 > &shape, unsigned int dtype=Type.Double, int device=Device.cpu)
Create a Tensor with all elements initialized to zero.
Tensor linspace(cytnx_double start, cytnx_double end, cytnx_uint64 Nelem, bool endpoint=true, unsigned int dtype=Type.Double, int device=Device.cpu)
Tensor ones(const std::vector< cytnx_uint64 > &shape, unsigned int dtype=Type.Double, int device=Device.cpu)
Create a Tensor with all elements initialized to one.
Tensor arange(cytnx_int64 Nelem)
Create a rank-1 Tensor with incremental unsigned integer elements in the range [0,...
Tensor identity(cytnx_uint64 Dim, unsigned int dtype=Type.Double, int device=Device.cpu)
Create a square rank-2 Tensor with the diagonal initialized to one and all other elements set to zero...