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

cauchy 0.3.0, num-complex 0.3.1, rand 0.7.3 #260

Merged
merged 3 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ intel-mkl-system = ["intel-mkl-src/mkl-dynamic-lp64-seq"]

[dependencies]
thiserror = "1.0"
cauchy = "0.2.0"
cauchy = "0.3.0"
num-traits = "0.2"
lapack = "0.16.0"
lapack = { version = "0.17.0", git = "http://github.com/blas-lapack-rs/lapack" }

[dependencies.intel-mkl-src]
version = "0.6.0"
Expand Down
6 changes: 3 additions & 3 deletions ndarray-linalg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ intel-mkl-static = ["lax/intel-mkl-static"]
intel-mkl-system = ["lax/intel-mkl-system"]

[dependencies]
cauchy = "0.2.2"
num-complex = "0.2.4"
cauchy = "0.3.0"
num-complex = "0.3.1"
num-traits = "0.2.11"
rand = "0.5"
rand = "0.7.3"
thiserror = "1.0.20"

[dependencies.ndarray]
Expand Down
8 changes: 4 additions & 4 deletions ndarray-linalg/src/cholesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ where
type Output = <A as Scalar>::Real;

fn detc(&self) -> Self::Output {
self.ln_detc().exp()
Float::exp(self.ln_detc())
}

fn ln_detc(&self) -> Self::Output {
self.factor
.diag()
.iter()
.map(|elem| elem.square().ln())
.map(|elem| Float::ln(elem.square()))
.sum::<Self::Output>()
}
}
Expand Down Expand Up @@ -443,7 +443,7 @@ where
type Output = Result<<A as Scalar>::Real>;

fn detc(&self) -> Self::Output {
Ok(self.ln_detc()?.exp())
Ok(Float::exp(self.ln_detc()?))
}

fn ln_detc(&self) -> Self::Output {
Expand All @@ -459,7 +459,7 @@ where
type Output = Result<<A as Scalar>::Real>;

fn detc_into(self) -> Self::Output {
Ok(self.ln_detc_into()?.exp())
Ok(Float::exp(self.ln_detc_into()?))
}

fn ln_detc_into(self) -> Self::Output {
Expand Down
6 changes: 3 additions & 3 deletions ndarray-linalg/src/solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ pub trait Determinant<A: Scalar> {
/// Computes the determinant of the matrix.
fn det(&self) -> Result<A> {
let (sign, ln_det) = self.sln_det()?;
Ok(sign * A::from_real(ln_det.exp()))
Ok(sign * A::from_real(Float::exp(ln_det)))
}

/// Computes the `(sign, natural_log)` of the determinant of the matrix.
Expand All @@ -387,7 +387,7 @@ pub trait DeterminantInto<A: Scalar>: Sized {
/// Computes the determinant of the matrix.
fn det_into(self) -> Result<A> {
let (sign, ln_det) = self.sln_det_into()?;
Ok(sign * A::from_real(ln_det.exp()))
Ok(sign * A::from_real(Float::exp(ln_det)))
}

/// Computes the `(sign, natural_log)` of the determinant of the matrix.
Expand Down Expand Up @@ -430,7 +430,7 @@ where
let abs_elem: A::Real = elem.abs();
(
upper_sign * elem / A::from_real(abs_elem),
ln_det + abs_elem.ln(),
ln_det + Float::ln(abs_elem),
)
},
);
Expand Down
12 changes: 6 additions & 6 deletions ndarray-linalg/src/solveh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ where
let elem = unsafe { a.uget((k, k)) }.re();
debug_assert_eq!(elem.im(), Zero::zero());
sign *= elem.signum();
ln_det += elem.abs().ln();
ln_det += Float::ln(Float::abs(elem));
} else {
// 2x2 block at k..k+2.

Expand All @@ -348,7 +348,7 @@ where
// Determinant of 2x2 block.
let block_det = upper_diag * lower_diag - off_diag.square();
sign *= block_det.signum();
ln_det += block_det.abs().ln();
ln_det += Float::ln(Float::abs(block_det));

// Skip the k+1 ipiv value.
ipiv_enum.next();
Expand All @@ -366,7 +366,7 @@ where
/// symmetric) matrix.
pub fn deth(&self) -> A::Real {
let (sign, ln_det) = self.sln_deth();
sign * ln_det.exp()
sign * Float::exp(ln_det)
}

/// Computes the `(sign, natural_log)` of the determinant of the factorized
Expand All @@ -390,7 +390,7 @@ where
/// symmetric) matrix.
pub fn deth_into(self) -> A::Real {
let (sign, ln_det) = self.sln_deth_into();
sign * ln_det.exp()
sign * Float::exp(ln_det)
}

/// Computes the `(sign, natural_log)` of the determinant of the factorized
Expand Down Expand Up @@ -420,7 +420,7 @@ where

fn deth(&self) -> Result<A::Real> {
let (sign, ln_det) = self.sln_deth()?;
Ok(sign * ln_det.exp())
Ok(sign * Float::exp(ln_det))
}

fn sln_deth(&self) -> Result<(A::Real, A::Real)> {
Expand All @@ -445,7 +445,7 @@ where

fn deth_into(self) -> Result<A::Real> {
let (sign, ln_det) = self.sln_deth_into()?;
Ok(sign * ln_det.exp())
Ok(sign * Float::exp(ln_det))
}

fn sln_deth_into(self) -> Result<(A::Real, A::Real)> {
Expand Down
2 changes: 1 addition & 1 deletion ndarray-linalg/tests/det.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn det() {
{
let det = det_naive(&a);
let sign = det.div_real(det.abs());
let ln_det = det.abs().ln();
let ln_det = Float::ln(det.abs());
assert_rclose!(a.factorize().unwrap().det().unwrap(), det, rtol);
{
let result = a.factorize().unwrap().sln_det().unwrap();
Expand Down
1 change: 0 additions & 1 deletion ndarray-linalg/tests/opnorm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use ndarray::*;
use ndarray_linalg::*;
use num_traits::Float;

fn test(a: Array2<f64>, one: f64, inf: f64, fro: f64) {
println!("ONE = {:?}", a.opnorm_one());
Expand Down
1 change: 0 additions & 1 deletion ndarray-linalg/tests/vector.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use ndarray::*;
use ndarray_linalg::*;
use num_traits::Float;

#[test]
fn vector_norm() {
Expand Down