stdml / stdtensor

STL style Tensor Template Library
MIT License
9 stars 2 forks source link

tensors of low rank and low dimension #3

Open lgarithm opened 6 years ago

lgarithm commented 6 years ago

Provide tensors with low rank and fixed dimensions, for geometry and graphics. Especially,

shape name alias usages
(2) 2d-vector planer coordinate, planar disposition
(3) 3d-vector spatial coordinate, spatial disposition
(2, 2) 2-by-2 matrix planer linear transformation
(3, 3) 3-by-3 matrix planer affine transformation, spatial linear transformation
(4, 4) 4-by-4 matrix spatial-affine transformation

what's more https://en.wikipedia.org/wiki/Generalized_coordinates

shape name alias usages
(2, n), (n, 2) point in the configuration space of n planer free particles
(3, n), (n, 3) point in the configuration space of n spatial free particles
lgarithm commented 6 years ago

Those tensors should be implemented as


using vec2d = basic_tensor<R, 2, std::integer_sequence<2>>;
using vec3d = basic_tensor<R, 2, std::integer_sequence<3>>;
using pos2d = basic_tensor<R, 2, std::integer_sequence<2>>;
using pos3d = basic_tensor<R, 2, std::integer_sequence<3>>;

using mat2d = basic_tensor<R, 3, std::integer_sequence<2, 2>>;
using mat3d = basic_tensor<R, 3, std::integer_sequence<3, 3>>;
using mat4d = basic_tensor<R, 3, std::integer_sequence<4, 4>>;

without over head.

And they should be able to replace https://github.com/lgarithm/drawings/tree/master/engine/src/rey/linear without losing performance.