Coder Social home page Coder Social logo

godot-linalg's Introduction

godot-linalg

Linear Algebra library in GDScript for Godot Engine

All methods are optimised for maximum speed. They take arrays and assume the right dimension for them. If the inputs aren't right they'll crash. Third input is used for the answer, preallocated. There are no conditional branchings. Just use the method appropriate to the situation. The names are coded to reflect that. s = scalar, v = vector and m = matrix. So for example

dot_vm(v, M)

is a dot product between vector and matrix (in that order). Wherever the in_place argument is provided, it is possible to perform the operation on the object itself instead of instantiating a new one (this too optimises performance). So for example

transpose(M, true)

will turn M into its own transpose by reference, whereas

 MT = transpose(M)

will leave M unaltered.

Most method names are self-explanatory. The less intuitive are:

godot-linalg's People

Contributors

higgs-bosoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

godot-linalg's Issues

Transpose function not working for m x n Matrix when m != n

Hey, great library but your transpose logic only works for square matrices, you could try something like this instead:

Transpose

static func transpose(M: Array)->Array:
var ans = []
var m = len(M)
var n = len(M[0])
ans.resize(n)

for i in range(n):
	ans[i] = []
	for j in range(m):
		ans[i].append(M[j][i])

return ans

Cheers

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.