nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
vector_ops.hpp
Go to the documentation of this file.
1
3// toolboxes/linalg/include/nk/linalg/vector_ops.hpp
4//
5// Vector-algebra operations: cross product, dot product, Kronecker
6// product. Migrated from toolboxes/builtin/src/language/arrays/matrix.cpp
7// (see commit history). These were always linalg-domain; they lived in
8// toolboxes/builtin only because toolboxes/linalg did not exist yet.
9
10#pragma once
11
12#include <memory_resource>
13#include <nk/value/value.hpp>
14
15namespace nk::linalg {
16
19
20
32Value cross(const Value &a, const Value &b, std::pmr::memory_resource *mr = nullptr);
33
48Value cross(const Value &a, const Value &b, int dim, std::pmr::memory_resource *mr = nullptr);
49
58Value dot(const Value &a, const Value &b, std::pmr::memory_resource *mr = nullptr);
59
75Value dot(const Value &a, const Value &b, int dim, std::pmr::memory_resource *mr = nullptr);
76
87Value kron(const Value &a, const Value &b, std::pmr::memory_resource *mr = nullptr);
88
89
91} // namespace nk::linalg
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
Value dot(const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr)
Dot product of two equal-length vectors.
Value kron(const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr)
Kronecker product (K = kron(A, B)).
Value cross(const Value &a, const Value &b, std::pmr::memory_resource *mr=nullptr)
Cross product of two 3-vectors or 3 × N / N × 3 batches.