JuliaPhysics / JuliaPhysics/Unitful.jl

Unitful linear algebra

Open
#46 19 comments 3 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
675
Forks
124
Avg merge
3h 38m
Merged PRs (30d)
1

Description

Some linear algebra operations like `\` have a hard time with unitful numbers. Take the following case:

```julia
a = [1.0u"N" 2.0u"N"
3.0u"N" 1.0u"N"]
b = [1.0u"N";3.0u"N"]
```

If you try `\` it gives a dimension error. If you try `*` then it uses the generic `*` fallback and not BLAS. The same is true if you use:

```julia
A = rand(100,100)u"N"
b = rand(100)u"N"
```

I suggest trying something like, performing a dimensional analysis, strip the units, use the general `*` or `\`, and then re-apply units.

To do this properly, you might need a `UnitfulArray` instead of an array of Unitful values. I am not sure if stripping the units on an array of Unitful numbers can be done without making a temporary.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.