diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index c35aac0..4bf3030 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use std::{ collections::HashMap, io::{BufReader, Read}, diff --git a/src/interpreter/ops.rs b/src/interpreter/ops.rs index 845e717..48a32fb 100644 --- a/src/interpreter/ops.rs +++ b/src/interpreter/ops.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use num_rational::BigRational; use num_traits::{FromPrimitive, ToPrimitive}; diff --git a/src/interpreter/ops_macros.rs b/src/interpreter/ops_macros.rs index c0ad8a6..5cdcd08 100644 --- a/src/interpreter/ops_macros.rs +++ b/src/interpreter/ops_macros.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use crate::quantity::units::{BaseUnit, DerivedUnit}; use super::{Interpreter, InterpreterError, InterpreterResult}; diff --git a/src/interpreter/ops_variables.rs b/src/interpreter/ops_variables.rs index f4c2fd0..7d636c4 100644 --- a/src/interpreter/ops_variables.rs +++ b/src/interpreter/ops_variables.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use super::{Interpreter, InterpreterError, InterpreterResult}; impl<'a> Interpreter<'a> { diff --git a/src/lib.rs b/src/lib.rs index 823603a..a877a64 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + /// Interpreter for UnitDC expressions. pub mod interpreter; /// A module for evaluating linear systems of equations. diff --git a/src/linear_system.rs b/src/linear_system.rs index 4887318..a8cf15b 100644 --- a/src/linear_system.rs +++ b/src/linear_system.rs @@ -1,5 +1,18 @@ -use log::debug; -use num_traits::Signed; +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use num_traits::{One, Zero}; use std::{ fmt::Debug, ops::{Add, Div, Mul, Neg, Sub}, @@ -26,7 +39,8 @@ where + Div + Neg + Clone - + Signed, + + Zero + + One, { matrix: Vec>, } @@ -40,8 +54,8 @@ where + Neg + PartialOrd + Clone - + Signed - + Debug, + + Zero + + One, { pub fn n(&self) -> usize { self.matrix.len() @@ -126,15 +140,12 @@ where self.n_pivoted() < self.m() - 1 } pub fn solve(&mut self) -> Option> { - debug!("starting matrix: {:?}", self.matrix); for col in 0..if self.n() < self.m() { self.n() } else { self.m() } { - debug!("col: {}", col); self.reduce_column(col); - debug!("matrix: {:?}", self.matrix); } let mut result = Vec::new(); for row in 0..self.n() { diff --git a/src/quantity/mod.rs b/src/quantity/mod.rs index d18cf07..8310082 100644 --- a/src/quantity/mod.rs +++ b/src/quantity/mod.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use std::{ fmt::Display, ops::{Add, Div, Mul, Sub}, diff --git a/src/quantity/units.rs b/src/quantity/units.rs index b9cf13e..c1222bf 100644 --- a/src/quantity/units.rs +++ b/src/quantity/units.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use std::{ collections::HashMap, fmt::{Debug, Display}, diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs index 466ec96..7f618e2 100644 --- a/src/tokenizer/mod.rs +++ b/src/tokenizer/mod.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use std::{ fmt::Display, io::{BufReader, Read}, diff --git a/src/tokenizer/parsing.rs b/src/tokenizer/parsing.rs index 0148c38..485bec5 100644 --- a/src/tokenizer/parsing.rs +++ b/src/tokenizer/parsing.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use super::TokenizerError; use num_bigint::{BigInt, BigUint}; use num_rational::BigRational; diff --git a/src/tokenizer/token.rs b/src/tokenizer/token.rs index 3bee936..a00279a 100644 --- a/src/tokenizer/token.rs +++ b/src/tokenizer/token.rs @@ -1,3 +1,17 @@ +// Copyright 2024 eternal-flame-AD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use num_rational::BigRational; use num_traits::ToPrimitive;