Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with num-traits-0.2.15 #129

Closed
dorohovGeorge opened this issue May 5, 2022 · 3 comments · Fixed by #130
Closed

Conflict with num-traits-0.2.15 #129

dorohovGeorge opened this issue May 5, 2022 · 3 comments · Fixed by #130

Comments

@dorohovGeorge
Copy link

dorohovGeorge commented May 5, 2022

I wanted to run the code from the website (such as this ), but when I ran it, I found a conflict with num-trait-0.2.15. I'll attach the error below.
`--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/evd.rs:474:35
|
474 | z = p + z.copysign(p);
| ^^^^^^^^ multiple copysign found
|
note: candidate #1 is defined in the trait num_traits::Float
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/float.rs:1887:5
|
1887 | fn copysign(self, sign: Self) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait RealNumber
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/math/num.rs:27:5
|
27 | fn copysign(self, sign: Self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
474 | z = p + num_traits::Float::copysign(z, p);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
474 | z = p + RealNumber::copysign(z, p);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/evd.rs:573:64
|
573 | let s = (p * p + q * q + r * r).sqrt().copysign(p);
| ^^^^^^^^ multiple copysign found
|
note: candidate #1 is defined in the trait num_traits::Float
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/float.rs:1887:5
|
1887 | fn copysign(self, sign: Self) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait RealNumber
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/math/num.rs:27:5
|
27 | fn copysign(self, sign: Self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
573 | let s = num_traits::Float::copysign((p * p + q * q + r * r).sqrt(), p);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
573 | let s = RealNumber::copysign((p * p + q * q + r * r).sqrt(), p);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0283]: type annotations needed
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/evd.rs:524:29
|
524 | y = T::from(0.75).unwrap() * s;
| ^^^^^^^ cannot infer type for type {float}
|
= note: multiple impls satisfying {float}: ToPrimitive found in the num_traits crate:
- impl ToPrimitive for f32;
- impl ToPrimitive for f64;
note: required by a bound in num_traits::NumCast::from
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/cast.rs:704:16
|
704 | fn from<T: ToPrimitive>(n: T) -> Option;
| ^^^^^^^^^^^ required by this bound in num_traits::NumCast::from
help: consider specifying the type argument in the function call
|
524 | y = T::from::(0.75).unwrap() * s;
| +++++

error[E0283]: type annotations needed
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/evd.rs:525:29
|
525 | x = T::from(0.75).unwrap() * s;
| ^^^^^^^ cannot infer type for type {float}
|
= note: multiple impls satisfying {float}: ToPrimitive found in the num_traits crate:
- impl ToPrimitive for f32;
- impl ToPrimitive for f64;
note: required by a bound in num_traits::NumCast::from
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/cast.rs:704:16
|
704 | fn from<T: ToPrimitive>(n: T) -> Option;
| ^^^^^^^^^^^ required by this bound in num_traits::NumCast::from
help: consider specifying the type argument in the function call
|
525 | x = T::from::(0.75).unwrap() * s;
| +++++

error[E0283]: type annotations needed
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/evd.rs:526:29
|
526 | w = T::from(-0.4375).unwrap() * s * s;
| ^^^^^^^ cannot infer type for type {float}
|
= note: multiple impls satisfying {float}: ToPrimitive found in the num_traits crate:
- impl ToPrimitive for f32;
- impl ToPrimitive for f64;
note: required by a bound in num_traits::NumCast::from
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/cast.rs:704:16
|
704 | fn from<T: ToPrimitive>(n: T) -> Option;
| ^^^^^^^^^^^ required by this bound in num_traits::NumCast::from
help: consider specifying the type argument in the function call
|
526 | w = T::from::(-0.4375).unwrap() * s * s;
| +++++

error[E0034]: multiple applicable items in scope
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/svd.rs:119:35
|
119 | g = -s.sqrt().copysign(f);
| ^^^^^^^^ multiple copysign found
|
note: candidate #1 is defined in the trait num_traits::Float
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/float.rs:1887:5
|
1887 | fn copysign(self, sign: Self) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait RealNumber
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/math/num.rs:27:5
|
27 | fn copysign(self, sign: Self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
119 | g = -num_traits::Float::copysign(s.sqrt(), f);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
119 | g = -RealNumber::copysign(s.sqrt(), f);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/svd.rs:155:35
|
155 | g = -s.sqrt().copysign(f);
| ^^^^^^^^ multiple copysign found
|
note: candidate #1 is defined in the trait num_traits::Float
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/float.rs:1887:5
|
1887 | fn copysign(self, sign: Self) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait RealNumber
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/math/num.rs:27:5
|
27 | fn copysign(self, sign: Self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
155 | g = -num_traits::Float::copysign(s.sqrt(), f);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
155 | g = -RealNumber::copysign(s.sqrt(), f);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/linalg/svd.rs:302:59
|
302 | f = ((x - z) * (x + z) + h * ((y / (f + g.copysign(f))) - h)) / x;
| ^^^^^^^^ multiple copysign found
|
note: candidate #1 is defined in the trait num_traits::Float
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num-traits-0.2.15/src/float.rs:1887:5
|
1887 | fn copysign(self, sign: Self) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait RealNumber
--> /Users/user/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/smartcore-0.2.0/src/math/num.rs:27:5
|
27 | fn copysign(self, sign: Self) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
302 | f = ((x - z) * (x + z) + h * ((y / (f + num_traits::Float::copysign(g, f))) - h)) / x;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
302 | f = ((x - z) * (x + z) + h * ((y / (f + RealNumber::copysign(g, f))) - h)) / x;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~‰`

@morenol
Copy link
Collaborator

morenol commented May 5, 2022

Thanks for reporting this, I just created this PR #130 that should solve that conflict, you may need to install directly from github to get the fix

@liborty
Copy link

liborty commented May 8, 2022

I suddenly get the same conflicts, with other crates. Could you please release a new version (0.2.1) with this fix in place, so it can be installed directly by cargo? Thank you.

@morenol
Copy link
Collaborator

morenol commented May 12, 2022

@liborty @dorohovGeorge

smartcode 0.2.1 was released with that fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants