All Projects → achirkin → Easytensor

achirkin / Easytensor

Licence: bsd-3-clause
Many-dimensional type-safe numeric ops

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Easytensor

Aardvark.base
Aardvark is an open-source platform for visual computing, real-time graphics and visualization. This repository is the basis for most platform libraries and provides basic functionality such as data-structures, math and much more.
Stars: ✭ 117 (+234.29%)
Mutual labels:  linear-algebra, matrices, tensors
Linear Algebra
Linear algebra for Nim
Stars: ✭ 132 (+277.14%)
Mutual labels:  linear-algebra, matrices
Abacus
Advanced Combinatorics and Algebraic Number Theory Symbolic Computation library for JavaScript, Python
Stars: ✭ 16 (-54.29%)
Mutual labels:  matrices, tensors
Tiramisu
A polyhedral compiler for expressing fast and portable data parallel algorithms
Stars: ✭ 685 (+1857.14%)
Mutual labels:  linear-algebra, tensors
Phpsci Carray
PHP library for scientific computing powered by C
Stars: ✭ 176 (+402.86%)
Mutual labels:  linear-algebra, matrices
Neo
A matrix library
Stars: ✭ 181 (+417.14%)
Mutual labels:  linear-algebra, matrices
Fmatvec
A fast vector/matrix library
Stars: ✭ 5 (-85.71%)
Mutual labels:  linear-algebra, matrices
mathcore
Advanced .NET math library (.NET Standard).
Stars: ✭ 24 (-31.43%)
Mutual labels:  linear-algebra, matrices
vec-la
Tiny linear algebra library specifically for 2d
Stars: ✭ 41 (+17.14%)
Mutual labels:  linear-algebra, matrices
Vectorious
Linear algebra in TypeScript.
Stars: ✭ 616 (+1660%)
Mutual labels:  linear-algebra
Owl
Owl - OCaml Scientific and Engineering Computing @ http://ocaml.xyz
Stars: ✭ 919 (+2525.71%)
Mutual labels:  linear-algebra
Swix
Swift Matrix Library
Stars: ✭ 581 (+1560%)
Mutual labels:  linear-algebra
Matrix
Matrix laboratory
Stars: ✭ 23 (-34.29%)
Mutual labels:  linear-algebra
Smile
Statistical Machine Intelligence & Learning Engine
Stars: ✭ 5,412 (+15362.86%)
Mutual labels:  linear-algebra
Okalgo
Idiomatic Kotlin extensions for ojAlgo
Stars: ✭ 20 (-42.86%)
Mutual labels:  linear-algebra
Cudamat
Python module for performing basic dense linear algebra computations on the GPU using CUDA.
Stars: ✭ 554 (+1482.86%)
Mutual labels:  linear-algebra
Jblas
Linear Algebra for Java
Stars: ✭ 529 (+1411.43%)
Mutual labels:  linear-algebra
Nasoq
NASOQ:Numerically Accurate Sparsity Oriented QP Solver
Stars: ✭ 30 (-14.29%)
Mutual labels:  linear-algebra
Notecalc3
NoteCalc is a handy calculator trying to bring the advantages of Soulver to the web.
Stars: ✭ 879 (+2411.43%)
Mutual labels:  linear-algebra
Liblaml
A stand-alone pure C++ library for linear algebra and machine learning
Stars: ✭ 7 (-80%)
Mutual labels:  linear-algebra

Easytensor: many-dimensional type-safe numeric ops

Build Status

The project consists of two parts:

  • dimensions is a library to support type-level operations on lists of dimensions;
  • easytensor wraps low-level operations on primitive byte arrays in a type-safe data type indexed over an element type and a list of dimensions.

dimensions Hackage

Data.Type.List and Data.Type.Lits provide type-level operations on lists, Nats, and Symbolss.

Numeric.TypedList is the core module providing a typelist-indexed type that is, in fact, just a newtype wrapper on a plain haskell list. The TypedList (f :: k -> Type) (xs :: [k]) represents a lot of things; by changing type parameter f, I use TypedList as a flexible (yet typesafe) tuple, a finite dimensions list, or an index over such a list.

Numeric.Dimensions provides:

  • promoted type XNat = N Nat | XN similar to type Maybe; kind XNat is used for type variables when some of dimensions in a type-level list are not known at compile time;
  • data type Dims (ds :: [k]), where k is either Nat or XNat, together with class Dimensions ds it allows lots of type-level operations on type-level dimensionality;
  • data type Idxs (ds :: [k]) is used to index over many-dimensional space defined by Dims ds.

easytensor Hackage

This library aims at providing fast, simple, and useful geometry types for use in computer graphics and low-dimensional physics modelling.

All geometry types implement standard Prelude numerical classes, such as Num, Fractional, Floating, lexicographical Ord favouring element-wise operations: functions like +, *, / are all element-wise. Common matrix and vector operations are provided separately.

Data type DataFrame is presented in two versions:

  • DataFrame t (ds :: [Nat]) - dimensionality of a dataframe is totally known at compile time.
  • DataFrame t (ds :: [XNat] - some dimensions may be known at runtime only.

Parameter t of a DataFrame can be arbitrary type that has an instance of PrimBytes. PrimBytes typeclass can be automatically derived using Generics. This mechanics allows creating interleaved arrays, e.g. DataFrame (Double, Float, Float) ds.

Parameter t of a DataFrame can also be a list of PrimBytes types: this way, DataFrame consists of several "columns" or "variables" of different types and same dimensionality.

Behind the scenes all data types are implemented as primitive values or primitive byte arrays, aiming at maximum performance. Tricky layers of newtypes and closed type families (which are not exposed to a user) allow some kind of ad-hoc polymorphism: for example, Vector t n implemented as ByteArray# is overloaded by a specialized FloatX2 Float# Float# in case of Vector Float 2.

Supported GHC versions

The packages are tested on GHC 8.4+. dimensions may work on GHC 8.2, but the corresponding tests were dropped. Support of easytensor on GHC 8.2 was dropped due to:

What have changed since version 1

Everything! In general, v2 of easytensor is meant to show an expectable behavior:

  • All Show and Read instances look like automatically-generated instances for algebraic data types.
  • 0-based indexing instead of 1-based indexing makes conversion between offsets, indices, and Enum more intuitive.
  • Order of dimensions in Dims list is reversed (the first dimension is "the most significant"), thus making Ord instances of Dims and Idxs coincide with conventional Haskell lexicographic ordering. The implication of this is the next two points.
  • DataFrame Ord instances are now proper total lexicographic ordering.
  • DataFrame layout now is row-first instead of column-first. Therefore, to keep low-level SIMD optimizations of 3D geometry possible, I've had to transpose all matrices in HomTransform4 class.
  • Nat-indexed Dims, Idxs, and DataFrame now have Generic and Data instances that make these datatypes look like ordinary algebraic data types.
  • More obvious ways to construct DataFrames from pieces.
  • Removed all declarations and modules that may look controversial or do not belong here.
  • Just added more tests and focused on the core functionality and correctness :)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].