Comments (4)
@nileshtrivedi I'm not aware of any libraries in that space (heh)
But you could build upon Nx for that. I read up a bit on Clifford Algebra and this is roughly where you would start for R2:
defmodule Geometric do
defmodule Bivector do
@moduledoc "represents a bivector with basis (e1, e2)"
@derive {Nx.Container, containers: [:scalar]}
defstruct [:scalar]
end
defmodule Multivector do
@moduledoc "represents a multivector with a grade-0 (scalar) part and a grade-2 (bivector) part"
@derive {Nx.Container, containers: [:scalar, :bivector]}
defstruct [:scalar, :bivector]
end
import Nx.Defn
defn wedge_product(%Nx.Tensor{shape: {n}} = v1, %Nx.Tensor{shape: {n}} = v2) do
a = v1[0]
b = v1[1]
c = v2[0]
d = v2[1]
%Bivector{scalar: a * d - b * c}
end
defn geometric_product(%Nx.Tensor{shape: {n}} = v1, %Nx.Tensor{shape: {n}} = v2) do
%MultiVector{scalar: Nx.dot(v1, v2), bivector: wedge_product(v1, v2)}
end
end
Nx.Container allows you to define structs that work inside defn, and then you can compose things accordingly, even defining a custom add
function that works differently based on the different input combinations.
from nx.
This is not currently possible in Nx, nor is planned.
For what it's worth, the example you showed only uses numpy
for getting constants like e
and pi
, while the actual algebra is handled by the clifford
library.
from nx.
@polvalente True. Are you aware of any elixir libraries that I can use in conjunction with Nx to do this kind of work?
from nx.
@polvalente Oh, thank you so much for taking the time to look into this (much more than I was expecting). This helps a lot. :-)
from nx.
Related Issues (20)
- Convert Nx.LinAlg.qr to optional callback HOT 1
- Convert Nx.LinAlg.cholesky to optional callback
- Fix sign of zero values in Nx.ceil and Nx.conjugate HOT 1
- Add executable-level caching to Nx.Defn in EXLA HOT 1
- Nx.LinAlg.solve/2 with Nx.BinaryBackend returns tensor with wrong state HOT 6
- Nx.all_close not working with EXLA HOT 13
- How to Set XLA log level?? HOT 2
- could not compile dependency :exla HOT 3
- Implement Nx.stack as a default callback HOT 1
- Expand docs for the :axes option in Nx.gather/3 HOT 2
- Remove xla compiler_mode
- Use regions when compiling `if` in MLIR HOT 1
- Quantization via MLIR
- Special node acceleration via metadata HOT 6
- Import and export of MLIR modules
- function Torchx.__jit__/5 is undefined or private HOT 2
- Automatically track which variables are inside if/cond/while
- Data Loaders in Nx? HOT 6
- Cannot transform dummy columns to Nx Tensors via Nx.stack HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nx.