Commit Graph

1325 Commits

Author SHA1 Message Date
Sébastien Crozet 4e3fb80b4c
Merge pull request #662 from Aaron1011/fix/final-offset
Don't call 'offset' on a dangling pointer
2019-11-21 22:11:56 +01:00
Aaron Hill df87769988
Switch to `wrapping_offset` instead of unsafe `offset` 2019-11-19 17:42:45 -05:00
Sébastien Crozet d09aa50a31
Fix Vector::axpy for noncommutative cases (#648)
Fix Vector::axpy for noncommutative cases
2019-11-19 22:06:01 +01:00
Aaron Hill 8dd673d48b
Don't call 'offset' on a dangling pointer
When creating a matrix with only one zero dimension, we end up with a
matrix with a total size of zero, but a non-zero stride for elements.
While such a matrix can never actually have any elements, we need to be
careful with how we use the pointer associated with it.

Since such a pointer will always be dangling, it can never be used with `ptr.offset`,
which requires that the pointer be in-bounds or one passed the end of an
allocation. Violating this results in undefined behavior.

This commit adds in checks before the uses of `ptr.offset`. If we ever
need to offset from a pointer when our actual allocation size is zero,
we skip offsetting, and return the original pointer. This is fine
because any actual use of the original or offsetted pointer would
already be undefined behavior - we shoul never be trying to dereference
the pointer associated with a zero-size matrix.

This issue was caught be running `cargo miri test` on the project.
2019-11-17 13:53:33 -05:00
Sébastien Crozet f5163260cb
Cholupdate (#673)
Cholupdate
2019-11-17 15:17:25 +01:00
Sébastien Crozet 9ed7dba750
Import IsaacRng from rand_isaac instead of rand. (#678)
Import IsaacRng from rand_isaac instead of rand.
2019-11-17 13:49:25 +01:00
Nestor Demeure e848f76aa7
Update cholesky.rs
corrected typo ni doc for `xx_rank_one_update`
2019-11-17 13:40:19 +01:00
sebcrozet 04ebd9254f Add some missing spaces. 2019-11-17 13:24:00 +01:00
sebcrozet 246f72ebc0 Fix Cholesky for no-std platforms. 2019-11-17 13:10:50 +01:00
Avi Weinstock 8bce398653 Import IsaacRng from rand_isaac instead of rand.
The rand crate removed IsaacRng in the 0.5 -> 0.6 transition, so the benchmarks that use it haven't compiled since 9c37c51203.
2019-11-15 14:29:18 -05:00
Sébastien Crozet 31ef5f0ab0
Merge pull request #669 from daingun/patch-2
Use same algorithm to solve 2x2 eigenvalue problem
2019-11-05 23:02:13 +01:00
Andreas Longva f03bd552c2 Generalize From<_> for MatrixSlice(Mut) to allow different strides 2019-11-05 22:52:49 +01:00
Andreas Longva 796db161d8 Implement From<&Matrix> for MatrixSlice 2019-11-05 22:52:49 +01:00
Jakub Konka 9276b1dc64 Add Vector::axcpy method
The added method `Vector::axcpy` generalises `Vector::gemv` to
noncommutative cases since it allows us to write for `gemv`
`self.axcpy(alpha, &col2, val, beta)`, instead the usual
`self.axpy(alpha * val, &col2, beta)`. Hence, `axcpy` preserves the
order of scalar multiplication which is important for applications where
commutativity is not guaranteed (e.g., matrices of quaternions, etc.).

This commmit also removes helpers `array_axpy` and `array_ax`, and
replaces them with `array_axcpy` and `array_axc` respectively, which
like above preserve the order of scalar multiplication.

Finally, `Vector::axpy` is preserved, however, now expressed in terms of
`Vector::axcpy` like so:

```
self.axcpy(alpha * val, &col2, beta)
```
2019-11-04 10:27:57 +01:00
Nestor Demeure 7302defe56 finished cleaning 2019-11-03 21:24:44 +01:00
Nestor Demeure 72834186d8 needs faster matrix initialization 2019-11-03 20:00:15 +01:00
Nestor Demeure 46687b7cde tests pass, needs cleanup 2019-11-03 18:48:04 +01:00
Nestor Demeure e6467c2a3e insert does compile 2019-11-03 18:02:27 +01:00
Nestor Demeure b4c078ca76 insert does not compile yet 2019-11-03 15:43:49 +01:00
Nestor Demeure 6d1a00218f found uneeded storagemut 2019-11-03 15:17:20 +01:00
Nestor Demeure fd5cef6609 remove column is now working 2019-11-03 14:33:35 +01:00
Nestor Demeure ebbfc84e96 added template for remove_column 2019-11-03 13:26:18 +01:00
Nestor Demeure 03730f594b finally got the correct type for insert column 2019-11-03 13:20:56 +01:00
Nestor Demeure cf2286cb36 added assertion 2019-11-03 09:36:03 +01:00
Nestor Demeure 19fce3addc removed useless if 2019-11-02 19:28:46 +01:00
Nestor Demeure d4d3f69429 code cleaned 2019-11-02 19:05:39 +01:00
Nestor Demeure 3123da5529 code cleaned 2019-11-02 19:04:07 +01:00
Nestor Demeure 3ae88127ee rank update passed tests 2019-11-02 18:27:01 +01:00
Nestor Demeure bc7935ac24 updated comment 2019-11-02 16:49:57 +01:00
Nestor Demeure 80d2efcb5d added real constraint on sigma 2019-11-02 16:45:30 +01:00
Nestor Demeure e49ecdc0a1 test is now correct 2019-11-02 16:36:23 +01:00
Nestor Demeure bdccc81874 got test to compile 2019-11-02 15:56:59 +01:00
Nestor Demeure 1fe4ef956b added test for update 2019-11-02 15:11:14 +01:00
Nestor Demeure 2beb09dab2 first version of rank one update 2019-11-02 14:59:07 +01:00
daingun 97374f41b9
Merge pull request #1 from daingun/patch-1
Correct Schur decomposition for 2x2 matrices
2019-11-02 13:38:23 +01:00
Nestor Demeure 90209752e2 used Storage trait for solve
see issue 667
2019-11-02 10:58:24 +01:00
Nestor Demeure 535e9d9ebd used Storage trait for solve method
as per issue 667 https://github.com/rustsim/nalgebra/issues/667
2019-11-02 10:58:24 +01:00
Nestor Demeure 7777ec43ea Used Storage trait for solve method
See issue 667 : https://github.com/rustsim/nalgebra/issues/667
2019-11-02 10:58:24 +01:00
daingun 640b008fa5
Use same algorithm to solve 2x2 eigenvalue problem
The eigenvalue problem is solved in two different method that use different methods
to calculate the discriminant of the solution to the quadratic equation.
Use the method whose computation is considered more stable.
2019-11-01 23:27:08 +01:00
daingun ead2360f8e Correct Schur decomposition for 2x2 matrices
Due to rounding and possible loss of precision the lower left element of the 2x2 matrix
may be different from zero.
2019-11-01 22:50:28 +01:00
daingun c550921bcf
Correct Schur decomposition for 2x2 matrices
Due to rounding and possible loss of precision the lower left element of the 2x2 matrix
may be different from zero.
2019-11-01 22:12:59 +01:00
sebcrozet 286a37364e Release nalgebra 0.19.0. 2019-10-28 13:40:37 +01:00
sebcrozet 59ae79037f Bump dependencies. 2019-10-28 13:36:23 +01:00
Sébastien Crozet ac161e9afb
Create FUNDING.yml 2019-10-27 22:49:43 +01:00
Edoardo Morandi afab84879e Updated rand and quickcheck for nalgebra-lapack 2019-10-15 19:00:37 +02:00
Edoardo Morandi 28b12f5ad5 Rand 0.6 -> 0.7
* Bumped rand version to 0.7
 * Added dependency to rand_distr
 * Bumped quickcheck version to 0.9 (because of rand)
 * Bumped rand_xorshift version to 0.2
2019-10-15 19:00:37 +02:00
thibault 48f8333e00 Corrected typo. 2019-10-01 10:27:59 +02:00
thibault 8d89b02b70 Changed name. Changed argument. Added documentation line. 2019-10-01 10:27:59 +02:00
thibault f475a9bc07 Added function to compute the mean quaternion from a vector of unit quaternions. 2019-10-01 10:27:59 +02:00
Pierre Avital 8d756f47ce Switched fmt implementation to a macro, applied that macro to all formats in std 2019-09-08 20:59:42 +02:00