Giter VIP home page Giter VIP logo

jtensors's Introduction

jtensors

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.jtensors

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

jtensors

The jtensors package package implements a set of vector and matrix types, intended for use in computer graphics software.

Features

  • 2D, 3D, and 4D immutable vector types in float and double versions.
  • 2D, 3D, and 4D immutable vector types in int and long versions.
  • 4D immutable quaternion types in float and double versions.
  • 2x2, 3x3, and 4x4 mutable matrix types in float and double versions.
  • Phantom-typed variants of all types for statically distinguishing between semantically different but otherwise type-compatible vectors and matrices.
  • Fully documented (Javadoc).
  • Massive battery of tests for checking the behaviour of matrix/vector implementations.
  • 100% automated unit test coverage.
  • OSGi-ready
  • JPMS-ready
  • ISC license.

Usage

See the documentation.

jtensors's People

Contributors

io7m avatar dependabot[bot] avatar

Stargazers

Thierry Uriot avatar vad babushkin avatar John avatar lyrachord avatar  avatar nobody avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

herike

jtensors's Issues

Rename MatrixM* types to MatrixDirectM* to indicate direct memory

With the recent changes switching everything to operating via interfaces, it'll be possible to have a range of matrix types that share the same code. The current matrix types should therefore be renamed to indicate the fact that they're backed by direct memory (and some non-direct types should be provided).

Investigate flyweight/buffered vectors/matrices for 7.0.0

These would be vector and matrix instances that contain a reference to a ByteBuffer and a byte offset. All operations would then effectively take place on a vector or matrix instance packed into the buffer.

The implementation is very easy, but the API needs to be designed and made consistent with the rest of the package.

Direct matrix performance issue

Recent benchmarks are showing that heap-backed matrices significantly outperform direct memory backed matrices. In single threaded code, the MatrixHeapArrayM4x4F type sustains about ~18 million multiplications per second, where as the MatrixDirectM4x4F type sustains only ~5 million.

Performing the multiplication with heap-backed matrices and saving the result to a direct-memory backed matrix maintains the ~18 million operations per second, so it's not clear exactly where the bottleneck is.

Implement element-wise multiply

This was never implemented as it tends not to be that useful in geometric terms. It is useful, however, for working in color spaces.

Vector4D multiply(Vector4D v0, Vector4D v1)
{
  return Vector4D.of(
    v0.x() * v1.x(),
    v0.y() * v1.y(),
    v0.z() * v1.z(),
    v0.w() * v1.w(),
  );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.