C3E: Complex Compute Core Engine v1.0
An engine for handling complex computational tasks
Loading...
Searching...
No Matches
vector.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
26#ifndef C3E_VECTOR_H
27#define C3E_VECTOR_H
28
29#include <c3e/commons.h>
30
31#include <stdlib.h>
32
42
57
66
77
85c3e_number c3e_vector_get(c3e_vector* vector, size_t index);
86
94void c3e_vector_set(c3e_vector* vector, size_t index, c3e_number value);
95
103
112
121
130
139
147
156
164
172
181
192
201
210
220c3e_number c3e_vector_dot_cols(c3e_matrix* matrix, int col1, c3e_matrix* subject, int col2);
221
229
238
246
254
262
271
279c3e_vector* c3e_vector_random(size_t size, int seed);
280
290c3e_vector* c3e_vector_random_bound(size_t size, int seed, c3e_number min, c3e_number max);
291
302
313
324
335
346
357
368
379
390
401
412
423
434
445
456
467
478
489
500
512
523
534
535#endif /* C3E_VECTOR_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 mathematical vector.
Definition commons.h:62
c3e_number c3e_vector_angle(c3e_vector *vector, c3e_vector *subject)
Calculates the angle between two vectors.
c3e_vector * c3e_vector_init(size_t size)
Initializes a vector with a specified size.
c3e_vector * c3e_vector_random(size_t size, int seed)
Creates a vector with random values.
c3e_vector * c3e_vector_arc_sinh(c3e_vector *vector)
Computes the arc hyperbolic sine of each element in the vector.
c3e_vector * c3e_vector_exp(c3e_vector *vector)
Computes the element-wise exponential of a vector.
c3e_vector * c3e_vector_zeros(size_t size)
Creates a vector of zeros.
c3e_vector * c3e_vector_fill(size_t size, c3e_number values)
Creates a vector filled with a specific value.
c3e_vector * c3e_vector_add(c3e_vector *vector, c3e_vector *subject)
Adds two vectors element-wise.
c3e_vector * c3e_vector_sin(c3e_vector *vector)
Computes the sine of each element in the vector.
c3e_vector * c3e_vector_log(c3e_vector *vector)
Computes the natural logarithm of each element in the vector.
c3e_number c3e_vector_get(c3e_vector *vector, size_t index)
Retrieves an element from the vector at a specified index.
bool c3e_vector_equals(c3e_vector *vector, c3e_vector *subject)
Compares two vectors for equality.
c3e_vector * c3e_vector_ones(size_t size)
Creates a vector of ones.
c3e_vector * c3e_vector_scale(c3e_vector *vector, int x)
Scales the elements of a vector by a specified factor.
c3e_number c3e_vector_norm(c3e_vector *vector)
Computes the Euclidean norm (magnitude) of a vector.
c3e_vector * c3e_vector_div(c3e_vector *vector, c3e_vector *subject)
Divides one vector by another element-wise.
c3e_vector * c3e_vector_random_bound(size_t size, int seed, c3e_number min, c3e_number max)
Creates a vector with random values within a specified range.
c3e_vector * c3e_vector_log1p(c3e_vector *vector)
Computes the natural logarithm of (1 + each element in the vector).
c3e_number c3e_vector_sum(c3e_vector *vector)
Computes the sum of all elements in a vector.
c3e_vector * c3e_vector_mul(c3e_vector *vector, c3e_vector *subject)
Multiplies two vectors element-wise.
c3e_vector * c3e_vector_arc_cos(c3e_vector *vector)
Computes the arc cosine of each element in the vector.
c3e_number c3e_vector_dot(c3e_vector *vector, c3e_vector *subject)
Computes the dot product of two vectors.
c3e_vector * c3e_vector_create(size_t size, c3e_number *data)
Creates a new c3e_vector instance with the specified size and data.
bool c3e_vector_all_close(c3e_vector *vector, c3e_vector *subject)
Checks if all elements of one vector are close to another vector's elements within a tolerance.
void c3e_vector_free(c3e_vector *vector)
Frees the memory allocated for a vector.
c3e_number c3e_vector_cross(c3e_vector *vector, c3e_vector *subject)
Computes the cross product of two vectors.
c3e_vector * c3e_vector_sqrt(c3e_vector *vector)
Computes the square root of each element in the vector.
c3e_vector * c3e_vector_cos(c3e_vector *vector)
Computes the cosine of each element in the vector.
c3e_vector * c3e_vector_normalize(c3e_vector *vector)
Normalizes a vector to unit length.
c3e_vector * c3e_vector_log2(c3e_vector *vector)
Computes the base-2 logarithm of each element in the vector.
c3e_number c3e_vector_length(c3e_matrix *matrix, int col)
Computes the length of a column vector extracted from a matrix.
c3e_vector * c3e_vector_sub(c3e_vector *vector, c3e_vector *subject)
Subtracts one vector from another element-wise.
c3e_vector * c3e_vector_arc_sin(c3e_vector *vector)
Computes the arc sine of each element in the vector.
c3e_vector * c3e_vector_tanh(c3e_vector *vector)
Computes the hyperbolic tangent of each element in the vector.
c3e_vector * c3e_vector_transform(c3e_vector *vector, c3e_matrix *matrix)
Transforms a vector by multiplying it with a matrix.
c3e_vector * c3e_vector_copy(c3e_vector *vector)
Creates a copy of a vector.
c3e_number c3e_vector_dot_cols(c3e_matrix *matrix, int col1, c3e_matrix *subject, int col2)
Computes the dot product of two columns in matrices.
c3e_vector * c3e_vector_rsqrt(c3e_vector *vector)
Computes the reciprocal square root of each element in the vector.
c3e_number c3e_vector_projection(c3e_vector *vector, c3e_vector *subject)
Computes the projection of one vector onto another.
c3e_vector * c3e_vector_abs(c3e_vector *vector)
Computes the absolute value of each element in the vector.
c3e_vector * c3e_vector_arc_tan(c3e_vector *vector)
Computes the arc tangent of each element in the vector.
void c3e_vector_set(c3e_vector *vector, size_t index, c3e_number value)
Sets the value of an element in the vector at a specified index.
c3e_vector * c3e_vector_sinh(c3e_vector *vector)
Computes the hyperbolic sine of each element in the vector.
c3e_vector * c3e_vector_arc_cosh(c3e_vector *vector)
Computes the arc hyperbolic cosine of each element in the vector.
c3e_vector * c3e_vector_pow(c3e_vector *vector, c3e_number exp)
Computes each element of the vector raised to the given power.
c3e_vector * c3e_vector_tan(c3e_vector *vector)
Computes the tangent of each element in the vector.
void c3e_vector_set_elements(c3e_vector *vector, c3e_number *values)
Sets multiple elements in the vector with specified values.
c3e_vector * c3e_vector_arc_tanh(c3e_vector *vector)
Computes the arc hyperbolic tangent of each element in the vector.
c3e_vector * c3e_vector_cosh(c3e_vector *vector)
Computes the hyperbolic cosine of each element in the vector.
c3e_vector * c3e_vector_log10(c3e_vector *vector)
Computes the base-10 logarithm of each element in the vector.