<NME> properties.rs
<BEF> ADDFILE
<MSG> compilation issues fixed. up to number library.

<DFF> @@ -0,0 +1,148 @@
+#![doc="Properties of algebraic structures
+"]
+
+#[allow(unused_variables)]
+fn noop<T>(v : T){
+
+}
+
+/// A unary operation defined on a type T
+pub trait UnaryOp<T>{
+    fn un_op(value : &T) -> T;
+}
+
+/// A binary operation defined on a type T
+pub trait BinaryOp<T> {
+    fn bin_op(lhs : &T, rhs: &T) -> T;
+
+}
+
+pub trait Commutativity<T, Operation: BinaryOp<T>>{
+    fn is_commutative(lhs : &T, rhs: &T)-> bool{
+        //let v1 : T = Operation::bin_op(lhs, rhs);
+        //let v2 : T = Operation::bin_op(rhs, lhs);
+        //v1 == v2
+        noop(lhs);
+        noop(rhs);
+        true
+    }
+}
+
+
+/// An algebraic structure which is closed
+pub trait Closure{
+
+}
+
+/// An algebraic structure which is associative
+pub trait Associativity{
+
+}
+
+/// An algebraic structure which has an additive identity element
+pub trait AdditiveIdentity{
+
+}
+
+
+/// An algebraic structure which has a multiplicative identity element
+pub trait MultiplicativeIdentity{
+
+}
+
+
+
+
+pub trait Divisibility{
+
+}
+
+
+pub trait SemiCategory{
+
+}
+
+pub trait Category{
+
+}
+
+pub trait Groupoid{
+
+}
+
+pub trait Magma{
+
+}
+
+pub trait QuasiGroup{
+
+}
+
+pub trait Loop{
+
+}
+
+pub trait SemiGroup{
+
+}
+
+pub trait Monoid{
+
+}
+
+pub trait Group{
+
+}
+
+pub trait CommutativeGroup{
+
+}
+
+pub trait SemiRing{
+
+}
+
+pub trait NonAssociativeRing{
+
+}
+
+
+pub trait Ring{
+
+}
+
+pub trait CommutativeRing{
+
+}
+
+pub trait LieRing{
+
+}
+
+pub trait BooleanRing{
+
+}
+
+
+pub trait IntegralDomain{
+
+}
+
+
+pub trait Field{
+
+}
+
+pub trait SkewLattice{
+
+}
+
+pub trait Lattice{
+
+}
+
+pub trait BoundedLattice{
+
+}
+
+

{'commit': 'diff --git a/Cargo.toml b/Cargo.toml\nindex efdbfe3..b96c862 100644\n--- a/Cargo.toml\n+++ b/Cargo.toml\n@@ -9,6 +9,11 @@ readme="./README.md"\n keywords=["math", "linear-algebra", "statistics", "matrix"]\n license="Apache-2.0"\n \n+\n+[dependencies]\n+log = "0.2.4"\n+\n+\n [[bin]]\n \n name = "scirust_main"\ndiff --git a/src/bin/scirust_main.rs b/src/bin/scirust_main.rs\nindex e6cc064..4f7bf95 100644\n--- a/src/bin/scirust_main.rs\n+++ b/src/bin/scirust_main.rs\n@@ -1,7 +1,7 @@\n-#![feature(globs)]\n extern crate scirust;\n #[cfg(not(test))]\n fn main(){\n+    /*\n     use scirust::api::*;\n     let a = matrix_cw_f64(2,2, [1., 4., 2., 8.].as_slice());\n     println!("{}", a);\n@@ -13,4 +13,5 @@ fn main(){\n     }\n     let m = matrix_cw_c64(2,2, [].as_slice());\n     println!("{}", m);\n+    */\n }\ndiff --git a/src/discrete/modular.rs b/src/discrete/modular.rs\nindex 73a9db2..6c47b5b 100644\n--- a/src/discrete/modular.rs\n+++ b/src/discrete/modular.rs\n@@ -7,12 +7,12 @@ use std::num::SignedInt;\n \n \n #[inline]\n-pub fn mod_n (x : int, n : int) -> uint {\n+pub fn mod_n (x : i64, n : i64) -> u64 {\n     let x = x % n;\n     if x < 0{\n-        (x + n.abs()) as uint\n+        (x + n.abs()) as u64\n     }else{\n-        x as uint\n+        x as u64\n     }\n }\n \ndiff --git a/src/error.rs b/src/error.rs\nindex 1d073e0..45c622c 100644\n--- a/src/error.rs\n+++ b/src/error.rs\n@@ -10,7 +10,7 @@\n \n \n /// Enum for errors related to SciRust library\n-#[deriving(Show)]\n+#[derive(Debug, Copy, Clone)]\n pub enum SRError{\n \n     /******************************************************\ndiff --git a/src/lib.rs b/src/lib.rs\nindex 9ae0c84..e812ff8 100644\n--- a/src/lib.rs\n+++ b/src/lib.rs\n@@ -1,3 +1,5 @@\n+#![feature(collections)]\n+#![feature(core)]\n \n #![doc="A generics based scientific computing library for Rust\n \n@@ -25,7 +27,6 @@ C libraries like BLAS or LAPACK.\n \n "]\n \n-#![feature(unsafe_destructor)]\n #[macro_use(plugin, link)] \n #[macro_use] extern crate log;\n extern crate collections;\n@@ -34,18 +35,18 @@ extern crate collections;\n \n \n // Common modules\n-pub mod number;\n pub mod error;\n+pub mod number;\n \n // Main libraries\n pub mod external;\n-pub mod discrete;\n-pub mod matrix;\n-pub mod linalg;\n+//pub mod discrete;\n+//pub mod matrix;\n+//pub mod linalg;\n // pub mod signal;\n // pub mod dx;\n-pub mod stat;\n-pub mod alg;\n+//pub mod stat;\n+//pub mod alg;\n // pub mod opt;\n pub mod image {\n #![doc="Image processing\n@@ -58,8 +59,8 @@ pub mod audio {\n }\n \n // for internal use only\n-pub mod util;\n-mod testdata;\n+//pub mod util;\n+//mod testdata;\n \n // Overall API of SciRust\n-pub mod api;\n+//pub mod api;\ndiff --git a/src/number/complex.rs b/src/number/complex.rs\nindex 215cf11..b901b57 100644\n--- a/src/number/complex.rs\n+++ b/src/number/complex.rs\n@@ -63,7 +63,7 @@ impl<T:Number+Zero> Complex<T> {\n \n }\n \n-impl<T:Number+Zero+Neg> Complex<T> {\n+impl<T:Number+Zero+Neg<Output=T>> Complex<T> {\n \n     /// Returns the complex conjugate. i.e. `re - i im`\n     #[inline]\n@@ -110,7 +110,8 @@ impl<T: Number + Float + Zero> Complex<T> {\n \n /* arithmetic */\n // (a + i b) + (c + i d) == (a + c) + i (b + d)\n-impl<T:Number + Zero> Add<Complex<T>> for Complex<T> {\n+impl<T:Number + Zero> Add for Complex<T> {\n+    type Output=Self;\n     #[inline]\n     fn add(&self, other: &Complex<T>) -> Complex<T> {\n         Complex::new(self.re + other.re, self.im + other.im)\ndiff --git a/src/number/entry.rs b/src/number/entry.rs\nindex 155977c..52cbe6f 100644\n--- a/src/number/entry.rs\n+++ b/src/number/entry.rs\n@@ -2,7 +2,7 @@\n "]\n \n // std imports\n-use std::fmt::Show;\n+use std::fmt::Debug;\n \n \n \n@@ -10,7 +10,7 @@ use std::fmt::Show;\n use number::zero::Zero;\n \n /// Defines basic requirements for a matrix entry\n-pub trait Entry : Show + Clone + Zero {\n+pub trait Entry : Debug + Clone + Zero {\n \n }\n \n@@ -41,9 +41,6 @@ impl Entry for i64{\n \n }\n \n-impl Entry for int{\n-\n-}\n \n impl Entry for u8{\n \n@@ -61,10 +58,6 @@ impl Entry for u64{\n \n }\n \n-impl Entry for uint{\n-\n-}\n-\n impl Entry for f32{\n \n }\ndiff --git a/src/number/mod.rs b/src/number/mod.rs\nindex 7bf442e..c24360f 100644\n--- a/src/number/mod.rs\n+++ b/src/number/mod.rs\n@@ -8,12 +8,15 @@ pub use self::signed::Signed;\n pub use self::zero::Zero;\n pub use self::one::One;\n pub use self::entry::Entry;\n-pub use self::complex::{Complex, Complex32, Complex64};\n+\n+\n+//pub use self::complex::{Complex, Complex32, Complex64};\n \n pub mod number;\n pub mod entry;\n-pub mod complex;\n pub mod zero;\n pub mod one;\n pub mod signed;\n+pub mod properties;\n \n+//pub mod complex;\ndiff --git a/src/number/number.rs b/src/number/number.rs\nindex 0d45e81..4e922b3 100644\n--- a/src/number/number.rs\n+++ b/src/number/number.rs\n@@ -18,10 +18,10 @@ use number::one::One;\n pub trait Number : Entry\n     + Clone\n     + Copy\n-    + Add<Self>\n-    + Sub<Self> \n-    + Mul<Self> \n-    + Div<Self>\n+    + Add<Output=Self>\n+    + Sub<Output=Self> \n+    + Mul<Output=Self> \n+    + Div<Output=Self>\n     + PartialEq\n     + One\n     + Zero{\n@@ -43,13 +43,13 @@ pub trait Number : Entry\n \n     fn is_signed(&self) -> bool;\n \n-    fn power(&self, n : uint)-> Self{\n+    fn power(&self, n : usize)-> Self{\n         if n == 0 {\n             return One::one();\n         }\n         let mut result = *self;\n-        for _ in range(0, n - 1){\n-            result = result.mul(self);\n+        for _ in 0..(n - 1){\n+            result = self.mul(result);\n         }\n         result\n     }\n@@ -58,7 +58,6 @@ pub trait Number : Entry\n \n \n \n-\n /******************************************************\n  *      i8 implementation\n  ******************************************************/\n@@ -141,26 +140,6 @@ impl Number for i64 {\n \n }\n \n- \n-/******************************************************\n- *      int implementation\n- ******************************************************/\n-\n-/// Indicate that int fits all requirements for being a matrix element.\n-impl Number for int {\n-    \n-    \n-    #[inline]\n-    fn is_signed(&self) -> bool {\n-        true\n-    }\n-\n-    #[inline]\n-    fn is_int(&self) -> bool {\n-        true\n-    }\n-\n-}\n \n \n /******************************************************\n@@ -248,26 +227,6 @@ impl Number for u64 {\n \n }\n \n-/******************************************************\n- *      uint implementation\n- ******************************************************/\n-\n-\n-/// Indicate that uint fits all requirements for being a matrix element.\n-impl Number for uint {\n-    \n-    \n-    #[inline]\n-    fn is_signed(&self) -> bool {\n-        false\n-    }\n-\n-    #[inline]\n-    fn is_int(&self) -> bool {\n-        true\n-    }\n-\n-}\n \n \n /******************************************************\n@@ -326,7 +285,7 @@ pub fn describe<T: Number>(z : T){\n  *******************************************************/\n \n /// An iterator over the range [start, stop)\n-#[deriving(Clone)]\n+#[derive(Clone)]\n pub struct NumRange<A> {\n     state: A,\n     stop: A,\n@@ -342,6 +301,7 @@ pub fn num_range<A: Number + PartialOrd + One>(start: A, stop: A) -> NumRange<A>\n }\n \n impl<A: Number + PartialOrd + One + ToPrimitive> Iterator for NumRange<A> {\n+    type Item = A;\n     #[inline]\n     fn next(&mut self) -> Option<A> {\n         if self.state < self.stop {\n@@ -354,7 +314,7 @@ impl<A: Number + PartialOrd + One + ToPrimitive> Iterator for NumRange<A> {\n     }\n \n     #[inline]\n-    fn size_hint(&self) -> (uint, Option<uint>) {\n+    fn size_hint(&self) -> (usize, Option<usize>) {\n         // This first checks if the elements are representable as i64. If they aren\'t, try u64 (to\n         // handle cases like range(huge, huger)). We don\'t use uint/int because the difference of\n         // the i64/u64 might lie within their range.\ndiff --git a/src/number/one.rs b/src/number/one.rs\nindex 10d93b1..920caa9 100644\n--- a/src/number/one.rs\n+++ b/src/number/one.rs\n@@ -47,13 +47,6 @@ impl One for i64{\n     }\n }\n \n-impl One for int{\n-\n-    #[inline]\n-    fn one() -> int {\n-        1\n-    }\n-}\n \n impl One for u8{\n \n@@ -87,14 +80,6 @@ impl One for u64{\n     }\n }\n \n-impl One for uint{\n-\n-    #[inline]\n-    fn one() -> uint {\n-        1\n-    }\n-}\n-\n impl One for f32{\n \n     #[inline]\ndiff --git a/src/number/properties.rs b/src/number/properties.rs\nnew file mode 100644\nindex 0000000..c3012e8\n--- /dev/null\n+++ b/src/number/properties.rs\n@@ -0,0 +1,148 @@\n+#![doc="Properties of algebraic structures\n+"]\n+\n+#[allow(unused_variables)]\n+fn noop<T>(v : T){\n+\n+}\n+\n+/// A unary operation defined on a type T\n+pub trait UnaryOp<T>{\n+    fn un_op(value : &T) -> T;\n+}\n+\n+/// A binary operation defined on a type T\n+pub trait BinaryOp<T> {\n+    fn bin_op(lhs : &T, rhs: &T) -> T;\n+\n+}\n+\n+pub trait Commutativity<T, Operation: BinaryOp<T>>{\n+    fn is_commutative(lhs : &T, rhs: &T)-> bool{\n+        //let v1 : T = Operation::bin_op(lhs, rhs);\n+        //let v2 : T = Operation::bin_op(rhs, lhs);\n+        //v1 == v2\n+        noop(lhs);\n+        noop(rhs);\n+        true\n+    }\n+}\n+\n+\n+/// An algebraic structure which is closed\n+pub trait Closure{\n+\n+}\n+\n+/// An algebraic structure which is associative\n+pub trait Associativity{\n+\n+}\n+\n+/// An algebraic structure which has an additive identity element\n+pub trait AdditiveIdentity{\n+\n+}\n+\n+\n+/// An algebraic structure which has a multiplicative identity element\n+pub trait MultiplicativeIdentity{\n+\n+}\n+\n+\n+\n+\n+pub trait Divisibility{\n+\n+}\n+\n+\n+pub trait SemiCategory{\n+\n+}\n+\n+pub trait Category{\n+\n+}\n+\n+pub trait Groupoid{\n+\n+}\n+\n+pub trait Magma{\n+\n+}\n+\n+pub trait QuasiGroup{\n+\n+}\n+\n+pub trait Loop{\n+\n+}\n+\n+pub trait SemiGroup{\n+\n+}\n+\n+pub trait Monoid{\n+\n+}\n+\n+pub trait Group{\n+\n+}\n+\n+pub trait CommutativeGroup{\n+\n+}\n+\n+pub trait SemiRing{\n+\n+}\n+\n+pub trait NonAssociativeRing{\n+\n+}\n+\n+\n+pub trait Ring{\n+\n+}\n+\n+pub trait CommutativeRing{\n+\n+}\n+\n+pub trait LieRing{\n+\n+}\n+\n+pub trait BooleanRing{\n+\n+}\n+\n+\n+pub trait IntegralDomain{\n+\n+}\n+\n+\n+pub trait Field{\n+\n+}\n+\n+pub trait SkewLattice{\n+\n+}\n+\n+pub trait Lattice{\n+\n+}\n+\n+pub trait BoundedLattice{\n+\n+}\n+\n+\ndiff --git a/src/number/signed.rs b/src/number/signed.rs\nindex 349c218..afb7f30 100644\n--- a/src/number/signed.rs\n+++ b/src/number/signed.rs\n@@ -31,17 +31,17 @@ impl Signed for i8 {\n \n     #[inline]\n     fn signum(&self) -> i8{\n-        self.signum()\n+        SignedInt::signum(*self)\n     }\n     \n     #[inline]\n     fn is_positive(&self) -> bool{\n-        self.is_positive()\n+        SignedInt::is_positive(*self)\n     }\n     \n     #[inline]\n     fn is_negative(&self) -> bool{\n-        self.is_negative()\n+        SignedInt::is_negative(*self)\n     }\n }\n \n@@ -55,17 +55,17 @@ impl Signed for i16 {\n     \n     #[inline]\n     fn signum(&self) -> i16{\n-        self.signum()\n+        SignedInt::signum(*self)\n     }\n     \n     #[inline]\n     fn is_positive(&self) -> bool{\n-        self.is_positive()\n+        SignedInt::is_positive(*self)\n     }\n     \n     #[inline]\n     fn is_negative(&self) -> bool{\n-        self.is_negative()\n+        SignedInt::is_negative(*self)\n     }\n }\n \n@@ -78,17 +78,17 @@ impl Signed for i32 {\n     \n     #[inline]\n     fn signum(&self) -> i32{\n-        self.signum()\n+        SignedInt::signum(*self)\n     }\n     \n     #[inline]\n     fn is_positive(&self) -> bool{\n-        self.is_positive()\n+        SignedInt::is_positive(*self)\n     }\n     \n     #[inline]\n     fn is_negative(&self) -> bool{\n-        self.is_negative()\n+        SignedInt::is_negative(*self)\n     }\n }\n     \n@@ -101,44 +101,19 @@ impl Signed for i64 {\n     \n     #[inline]\n     fn signum(&self) -> i64{\n-        self.signum()\n+        SignedInt::signum(*self)\n     }\n     \n     #[inline]\n     fn is_positive(&self) -> bool{\n-        self.is_positive()\n+        SignedInt::is_positive(*self)\n     }\n     \n     #[inline]\n     fn is_negative(&self) -> bool{\n-        self.is_negative()\n+        SignedInt::is_negative(*self)\n     }\n-}\n-   \n-\n-impl Signed for int {\n-\n-    #[inline]\n-    fn abs_val(&self) -> int{\n-        self.abs()\n-    }\n-    \n-    #[inline]\n-    fn signum(&self) -> int{\n-        self.signum()\n-    }\n-    \n-    #[inline]\n-    fn is_positive(&self) -> bool{\n-        self.is_positive()\n-    }\n-    \n-    #[inline]\n-    fn is_negative(&self) -> bool{\n-        self.is_negative()\n-    }\n-}\n-    \n+}  \n \n impl Signed for f32 {\n \n@@ -149,17 +124,17 @@ impl Signed for f32 {\n     \n     #[inline]\n     fn signum(&self) -> f32{\n-        self.signum()\n+        Float::signum(*self)\n     }\n     \n     #[inline]\n     fn is_positive(&self) -> bool{\n-        self.is_positive()\n+        Float::is_positive(*self)\n     }\n     \n     #[inline]\n     fn is_negative(&self) -> bool{\n-        self.is_negative()\n+        Float::is_negative(*self)\n     }\n }\n \n@@ -172,17 +147,17 @@ impl Signed for f64 {\n     \n     #[inline]\n     fn signum(&self) -> f64{\n-        self.signum()\n+        Float::signum(*self)\n     }\n     \n     #[inline]\n     fn is_positive(&self) -> bool{\n-        self.is_positive()\n+        Float::is_positive(*self)\n     }\n     \n     #[inline]\n     fn is_negative(&self) -> bool{\n-        self.is_negative()\n+        Float::is_negative(*self)\n     }\n }\n \ndiff --git a/src/number/zero.rs b/src/number/zero.rs\nindex acb8dd1..9d69703 100644\n--- a/src/number/zero.rs\n+++ b/src/number/zero.rs\n@@ -62,17 +62,6 @@ impl Zero for i64{\n     }\n }\n \n-impl Zero for int{\n-    #[inline]\n-    fn zero() -> int{\n-        0\n-    }\n-\n-    #[inline]\n-    fn is_zero(&self) -> bool{\n-        *self == 0\n-    }\n-}\n \n impl Zero for u8{\n     #[inline]\n@@ -122,18 +111,6 @@ impl Zero for u64{\n     }\n }\n \n-impl Zero for uint{\n-    #[inline]\n-    fn zero() -> uint{\n-        0\n-    }\n-\n-    #[inline]\n-    fn is_zero(&self) -> bool{\n-        *self == 0\n-    }\n-}\n-\n impl Zero for f32{\n     #[inline]\n     fn zero() -> f32{\n', 'commit_subject': 'compilation issues fixed. up to number library.', 'repo_name': 'indigits/scirust', 'committer': {'name': 'Shailesh Kumar', 'email': 'a25755a0bd35a75b72634ba9d95af442bcffb48b@indigits.com', 'time_sec': '1424530299', 'tz_offset': '330', 'date': {'seconds': '1424530299'}}, 'commit_tree': 'c200da1f3ae1cb34535d17644bdbb9129ef35410', 'commit_message': 'compilation issues fixed. up to number library.\n', 'language_name': 'Rust', 'license': 'apache-2.0', 'hunks': '@@ -0,0 +1,148 @@\n+#![doc="Properties of algebraic structures\n+"]\n+\n+#[allow(unused_variables)]\n+fn noop<T>(v : T){\n+\n+}\n+\n+/// A unary operation defined on a type T\n+pub trait UnaryOp<T>{\n+    fn un_op(value : &T) -> T;\n+}\n+\n+/// A binary operation defined on a type T\n+pub trait BinaryOp<T> {\n+    fn bin_op(lhs : &T, rhs: &T) -> T;\n+\n+}\n+\n+pub trait Commutativity<T, Operation: BinaryOp<T>>{\n+    fn is_commutative(lhs : &T, rhs: &T)-> bool{\n+        //let v1 : T = Operation::bin_op(lhs, rhs);\n+        //let v2 : T = Operation::bin_op(rhs, lhs);\n+        //v1 == v2\n+        noop(lhs);\n+        noop(rhs);\n+        true\n+    }\n+}\n+\n+\n+/// An algebraic structure which is closed\n+pub trait Closure{\n+\n+}\n+\n+/// An algebraic structure which is associative\n+pub trait Associativity{\n+\n+}\n+\n+/// An algebraic structure which has an additive identity element\n+pub trait AdditiveIdentity{\n+\n+}\n+\n+\n+/// An algebraic structure which has a multiplicative identity element\n+pub trait MultiplicativeIdentity{\n+\n+}\n+\n+\n+\n+\n+pub trait Divisibility{\n+\n+}\n+\n+\n+pub trait SemiCategory{\n+\n+}\n+\n+pub trait Category{\n+\n+}\n+\n+pub trait Groupoid{\n+\n+}\n+\n+pub trait Magma{\n+\n+}\n+\n+pub trait QuasiGroup{\n+\n+}\n+\n+pub trait Loop{\n+\n+}\n+\n+pub trait SemiGroup{\n+\n+}\n+\n+pub trait Monoid{\n+\n+}\n+\n+pub trait Group{\n+\n+}\n+\n+pub trait CommutativeGroup{\n+\n+}\n+\n+pub trait SemiRing{\n+\n+}\n+\n+pub trait NonAssociativeRing{\n+\n+}\n+\n+\n+pub trait Ring{\n+\n+}\n+\n+pub trait CommutativeRing{\n+\n+}\n+\n+pub trait LieRing{\n+\n+}\n+\n+pub trait BooleanRing{\n+\n+}\n+\n+\n+pub trait IntegralDomain{\n+\n+}\n+\n+\n+pub trait Field{\n+\n+}\n+\n+pub trait SkewLattice{\n+\n+}\n+\n+pub trait Lattice{\n+\n+}\n+\n+pub trait BoundedLattice{\n+\n+}\n+\n+\n', 'addition_count': 148, 'deletion_count': 0, 'src_file': '/dev/null', 'tgt_file': 'b/src/number/properties.rs', 'file_extension': '.rs', 'before_file': 'ADDFILE', 'message': 'compilation issues fixed. up to number library.\n', 'author_name': 'Shailesh Kumar', 'lang': 'rs'}