-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linear Algebra API #39
Labels
Comments
Something along these lines: #ifndef TACO_LINALG_H
#define TACO_LINALG_H
#include <string>
#include "taco/tensor.h"
namespace taco {
enum VectorType {
COLUMN,
ROW
};
template <typename C, VectorType T=COLUMN>
class Vector : public Tensor<C> {
public:
Vector(std::string name, std::vector<int> dimensions, Format format);
Vector(std::vector<int> dimensions, Format format);
Vector<C,T> operator*=(C) {
taco_not_supported_yet;
}
Vector<C,T> operator+=(const Vector<C,T>&) {
taco_not_supported_yet;
}
Vector<C,T> operator-=(const Vector<C,T>&) {
taco_not_supported_yet;
}
};
template <typename C>
class Matrix : public Tensor<C> {
public:
Matrix(std::string name, std::vector<int> dimensions, Format format);
Matrix(std::vector<int> dimensions, Format format);
Matrix<C> operator*=(C) {
taco_not_supported_yet;
}
Matrix<C> operator+=(const Matrix<C>&) {
taco_not_supported_yet;
}
Matrix<C> operator-=(const Matrix<C>&) {
taco_not_supported_yet;
}
};
/// Vector Negation
template <typename C, VectorType T>
Vector<C,T> operator-(const Vector<C,T>&) {
taco_not_supported_yet;
}
/// Vector Scale
template <typename C, VectorType T>
Vector<C,T> operator*(const Vector<C,T>&, C) {
taco_not_supported_yet;
}
template <typename C, VectorType T>
Vector<C,T> operator*(C, const Vector<C,T>&) {
taco_not_supported_yet;
}
/// Vector Addition
template <typename C, VectorType T>
Vector<C,T> operator+(const Vector<C,T>&, const Vector<C,T>&) {
taco_not_supported_yet;
}
/// Vector Subtraction
template <typename C, VectorType T>
Vector<C,T> operator-(const Vector<C,T>&, const Vector<C,T>&) {
taco_not_supported_yet;
}
/// Vector inner product.
template <typename T>
T operator*(const Vector<T,ROW>&, const Vector<T>&) {
taco_not_supported_yet;
}
/// Vector outer product.
template <typename T>
Matrix<T> operator*(const Vector<T>&, const Vector<T,ROW>&) {
taco_not_supported_yet;
}
/// Matrix Negation
template <typename C>
Matrix<C> operator-(const Matrix<C>&) {
taco_not_supported_yet;
}
/// Matrix Scale
template <typename T>
Matrix<T> operator*(const Matrix<T>&, T) {
taco_not_supported_yet;
}
template <typename T>
Matrix<T> operator*(T, const Matrix<T>&) {
taco_not_supported_yet;
}
/// Vector-Matrix multiplication.
template <typename T>
Vector<T> operator*(const Vector<T,ROW>&, const Matrix<T>&) {
taco_not_supported_yet;
}
/// Matrix-Vector multiplication.
template <typename T>
Vector<T> operator*(const Matrix<T>&, const Vector<T>&) {
taco_not_supported_yet;
}
/// Matrix Addition
template <typename T>
Matrix<T> operator+(const Matrix<T>&, const Matrix<T>&) {
taco_not_supported_yet;
}
/// Matrix Subtraction
template <typename T>
Matrix<T> operator-(const Matrix<T>&, const Matrix<T>&) {
taco_not_supported_yet;
}
/// Matrix Multiplication.
template <typename T>
Matrix<T> operator*(const Matrix<T>&, const Matrix<T>&) {
taco_not_supported_yet;
}
}
#endif
|
rohany
added a commit
that referenced
this issue
Oct 2, 2021
*: use the mapper to backpressure task executions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The tensor algebra compiler supports tensor index notation. Tensor index notation can be used to do linear algebra, but for convenience we ought to have a linear algebra API as well.
This API (
linalg.h
) can be built on top of the current functionality (tensor.h
). It should define types (Scalar, Vector, Matrix), facilities for converting between these types and tensors, and the usual linear algebra operations (addition, subtraction, multiplication with scalars, vectors and matrices). The goal is to provide something roughly as convenient as Eigen.It should also support blocked linear algebra, where the user can define and compute with blocked vectors and matrices (see also #59).
The text was updated successfully, but these errors were encountered: