Skip to content

Commit

Permalink
Feature/upgrade deps 09 22 (#13)
Browse files Browse the repository at this point in the history
* fix katex to display inline math and math blocks

* upgrade snafu dependency

* upgrade levmar and nalgebra dependencies as much as possible

* fmt

* latest fmt, clippy

* bump version

* Try fix broken coverage report
  • Loading branch information
geo-ant authored Sep 25, 2022
1 parent ddc189c commit 782dc49
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
version: '0.15.0'
#version: '0.15.0'
args: '-- --test-threads 1'

- name: Upload to codecov.io
uses: codecov/codecov-action@v1.0.2
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}

Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "varpro"
version = "0.3.0"
version = "0.4.0"
authors = ["geo-ant"]
edition = "2018"
edition = "2021"
license = "MIT"
homepage = "https://github.com/geo-ant/varpro"
repository = "https://github.com/geo-ant/varpro"
Expand All @@ -14,9 +14,9 @@ keywords = ["nonlinear","least","squares","fitting","regression"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
snafu = "0.6"
levenberg-marquardt = "0.11"
nalgebra = "0.29"
snafu = "0.7"
levenberg-marquardt = "0.12"
nalgebra = "0.30"
num-traits = "0.2"

[dev-dependencies]
Expand All @@ -25,4 +25,4 @@ approx = "0.5"
[package.metadata.docs.rs]
# To build locally use
# RUSTDOCFLAGS="--html-in-header katex-header.html" cargo doc --no-deps --open
rustdoc-args = [ "--html-in-header", "katex-header.html" ]
rustdoc-args = [ "--html-in-header", "katex-header.html" ]
84 changes: 42 additions & 42 deletions katex-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@
.katex { font-size: 1.07em; }
</style>
<script>
"use strict";
document.addEventListener("DOMContentLoaded", function () {
// display blocks
document.querySelectorAll('pre > code.language-math').forEach((el) => {
let p = document.createElement("p");
katex.render(el.innerText, p, {displayMode: true, throwOnError: false});
el.parentNode.parentNode.replaceChild(p, el.parentNode);
});
"use strict";
document.addEventListener("DOMContentLoaded", function () {
var maths = document.getElementsByClassName("language-math");
for (var i=0; i<maths.length; i++) {
var el = maths[i];
katex.render(el.innerText, el, {displayMode: true});

}

// inline blocks
document.querySelectorAll(':not(pre) > code').forEach((el) => {
let text = el.innerText;
if (!text.startsWith('$') || !text.endsWith('$')) {
return;
}
let span = document.createElement("span");
katex.render(text.substr(1, text.length - 2), span, {displayMode: false, throwOnError: false});
el.parentNode.replaceChild(span, el);
});
// inline blocks
document.querySelectorAll(':not(pre) > code').forEach((el) => {
let text = el.innerText;
if (!text.startsWith('$') || !text.endsWith('$')) {
return;
}
let span = document.createElement("span");
katex.render(text.substr(1, text.length - 2), span, {displayMode: false, throwOnError: false});
el.parentNode.replaceChild(span, el);
});

// comment in code
document.querySelectorAll('pre span.comment').forEach((el) => {
let html = el.innerText;
let children = [];
let offset = 0;
[...html.matchAll(/(?:[^\$]|^)(\$(?:\\.|[^\$])+\$)(?!\$)/g)].forEach((match) => {
let textBefore = html.substring(offset, match.index + 1);
children.push(document.createTextNode(textBefore));
let math = match[1].substring(1, match[1].length - 1);
let span = document.createElement("span");
katex.render(math, span, {displayMode: false, throwOnError: false});
children.push(span);
offset = match.index + match[0].length;
// comment in code
document.querySelectorAll('pre span.comment').forEach((el) => {
let html = el.innerText;
let children = [];
let offset = 0;
[...html.matchAll(/(?:[^\$]|^)(\$(?:\\.|[^\$])+\$)(?!\$)/g)].forEach((match) => {
let textBefore = html.substring(offset, match.index + 1);
children.push(document.createTextNode(textBefore));
let math = match[1].substring(1, match[1].length - 1);
let span = document.createElement("span");
katex.render(math, span, {displayMode: false, throwOnError: false});
children.push(span);
offset = match.index + match[0].length;
});
if (offset == 0) {
return;
}
let textAfter = html.substring(offset);
if (textAfter.length > 0) {
children.push(document.createTextNode(textAfter));
}
while (el.firstChild) { el.firstChild.remove(); }
children.forEach((child) => el.appendChild(child));
});
});
if (offset == 0) {
return;
}
let textAfter = html.substring(offset);
if (textAfter.length > 0) {
children.push(document.createTextNode(textAfter));
}
while (el.firstChild) { el.firstChild.remove(); }
children.forEach((child) => el.appendChild(child));
});
});
</script>
2 changes: 1 addition & 1 deletion src/basis_function/detail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ where
if params.len() != Self::ARGUMENT_COUNT {
panic!("Basisfunction expected {} arguments but the provided parameter slice has {} elements.",Self::ARGUMENT_COUNT,params.len());
}
(&self)(x, params[0].clone())
(self)(x, params[0].clone())
}

const ARGUMENT_COUNT: usize = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/linalg_helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::ops::Mul;
/// This internally stores only the diagonal elements
/// # Types
/// ScalarType: the numeric type of the matrix
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DiagDMatrix<ScalarType>
where
ScalarType: Scalar + ComplexField,
Expand Down
4 changes: 2 additions & 2 deletions src/model/builder/error.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use snafu::Snafu;

/// An error structure that contains error variants that occur when building a model.
#[derive(Debug, Clone, Snafu, PartialEq)]
#[snafu(visibility = "pub")]
#[derive(Debug, Clone, Snafu, PartialEq, Eq)]
#[snafu(visibility(pub))]
pub enum ModelBuildError {
/// Model or function parameters contain duplicates
#[snafu(display("Parameter list {:?} contains duplicates! Parameter lists must comprise only unique elements.",function_parameters))]
Expand Down
4 changes: 2 additions & 2 deletions src/model/errors.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use snafu::Snafu;

/// Errors pertaining to use errors of the [SeparableModel].
#[derive(Debug, Clone, Snafu, PartialEq)]
#[snafu(visibility = "pub")]
#[derive(Debug, Clone, Snafu, PartialEq, Eq)]
#[snafu(visibility(pub))]
pub enum ModelError {
/// Base functions are expected to return a vector the same length as the location argument.
/// A function did not adhere to that rule.
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/levmar/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use snafu::Snafu;
use std::ops::Mul;

/// Errors pertaining to use errors of the [LeastSquaresProblemBuilder]
#[derive(Debug, Clone, Snafu, PartialEq)]
#[snafu(visibility = "pub")]
#[derive(Debug, Clone, Snafu, PartialEq, Eq)]
#[snafu(visibility(pub))]
pub enum LevMarBuilderError {
/// the data for the independent variable was not given to the builder
#[snafu(display("Data for vector x not provided."))]
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/levmar/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::ops::Mul;
/// Right now covers only either unit weights (i.e. unweighted problem) or a diagonal
/// matrix for the weights. Can easily be extended in the future, because this structure
/// offers an interface for matrix-matrix multiplication and matrix-vector multiplication
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Weights<ScalarType>
where
ScalarType: Scalar + ComplexField,
Expand Down

0 comments on commit 782dc49

Please sign in to comment.