C3E: Complex Compute Core Engine v1.0
An engine for handling complex computational tasks
Loading...
Searching...
No Matches
tensor.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 Nathanne Isip
3 *
4 * Redistribution and use in source and binary forms,
5 * with or without modification, are permitted provided
6 * that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the
9 * above copyright notice, this list of conditions
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the
13 * above copyright notice, this list of conditions
14 * and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 */
17
27#ifndef C3E_TENSOR_H
28#define C3E_TENSOR_H
29
30#include <c3e/commons.h>
31
44c3e_tensor* c3e_tensor_init(size_t dsize, uint32_t dims, c3e_matrix** matrices, c3e_vector* data);
45
55
66
77
88
99
110
120
130
140
152c3e_tensor* c3e_tensor_zeros(size_t dsize, uint32_t dims, int rows, int cols);
153
165c3e_tensor* c3e_tensor_ones(size_t dsize, uint32_t dims, int rows, int cols);
166
179c3e_tensor* c3e_tensor_fill(size_t dsize, uint32_t dims, int rows, int cols, c3e_number value);
180
195c3e_tensor* c3e_tensor_random(size_t dsize, uint32_t dims, int rows, int cols, int seed);
196
211c3e_tensor* c3e_tensor_random_bound(size_t dsize, uint32_t dims, int rows, int cols, int seed, c3e_number min, c3e_number max);
212
223
234
235#endif /* C3E_TENSOR_H */
Common data structures and type definitions for the C3E library.
double c3e_number
A type representing a numerical value in C3E. Defaults to double precision.
Definition commons.h:50
Represents a mathematical matrix.
Definition commons.h:74
Represents a tensor, a multi-dimensional array of numerical values.
Definition commons.h:111
Represents a mathematical vector.
Definition commons.h:62
c3e_tensor * c3e_tensor_normalize(c3e_tensor *tensor)
Normalizes the elements of a tensor.
c3e_tensor * c3e_tensor_add(c3e_tensor *left, c3e_tensor *right)
Adds two tensors element-wise.
c3e_tensor * c3e_tensor_random(size_t dsize, uint32_t dims, int rows, int cols, int seed)
Creates a tensor with random values within a range.
c3e_tensor * c3e_tensor_random_bound(size_t dsize, uint32_t dims, int rows, int cols, int seed, c3e_number min, c3e_number max)
Creates a tensor with random values within a specified range.
void c3e_tensor_free(c3e_tensor *tensor)
Frees the resources associated with a tensor.
c3e_tensor * c3e_tensor_fill(size_t dsize, uint32_t dims, int rows, int cols, c3e_number value)
Creates a tensor filled with a specific value.
bool c3e_tensor_all_close(c3e_tensor *tensor, c3e_tensor *subject)
Checks if two tensors are element-wise close within a tolerance.
c3e_tensor * c3e_tensor_init(size_t dsize, uint32_t dims, c3e_matrix **matrices, c3e_vector *data)
Initializes a tensor with given data and dimensions.
c3e_tensor * c3e_tensor_sub(c3e_tensor *left, c3e_tensor *right)
Subtracts one tensor from another element-wise.
c3e_tensor * c3e_tensor_exp(c3e_tensor *tensor)
Applies the exponential function to each element of a tensor.
c3e_tensor * c3e_tensor_mul(c3e_tensor *left, c3e_tensor *right)
Multiplies two tensors element-wise.
c3e_tensor * c3e_tensor_copy(c3e_tensor *tensor)
Creates a copy of a tensor.
c3e_tensor * c3e_tensor_scale(c3e_tensor *tensor, int x)
Scales the elements of a tensor by a scalar value.
bool c3e_tensor_equals(c3e_tensor *tensor, c3e_tensor *subject)
Checks if two tensors are equal.
c3e_tensor * c3e_tensor_div(c3e_tensor *left, c3e_tensor *right)
Divides one tensor by another element-wise.
c3e_tensor * c3e_tensor_zeros(size_t dsize, uint32_t dims, int rows, int cols)
Creates a tensor filled with zeros.
c3e_tensor * c3e_tensor_ones(size_t dsize, uint32_t dims, int rows, int cols)
Creates a tensor filled with ones.