Architecture opinions are on my own
Machine Learning
Big Data
Data Analysis
"We use some tools to help us with math"
Do you like it?
Yes, but it is hard to express math with C or C++
Have you tried Rust?
No, what is Rust?
I think I can _borrow_ you some knowledge
Is it safe?
Octave is very useful for Machine Learning and Data analysis
Normalising the data
Operations with Matrices
Plotting charts
Statistics
https://www.gnu.org/software/octave/download.html
Open Source <3
Electronic circuits and Ohm's Law (U = R x I)
Va
R4
R5
Vb
R1
R2
R3
Va
R4
R5
Vb
R1
R2
R3
V1
V2
i1
i2
i4
i2
i3
i5
i1  i2  i4 = 0
i2  i3  i5 = 0
{
{
{
Expanding the system (lots of Algebraic work):
{
Expanding the system (lots of Algebraic work):
{
template <class T>
Array<T>::Array (int n, const T& val)
{
//code
}
template <class T>
Array<T>&
Array<T>::operator = (const Array<T>& a)
{
if (this != &a && rep != a.rep)
{
if (rep>count <= 0)
delete rep;
rep = a.rep;
rep>count++;
}
// code
return *this;
}
// more code
pub struct Matrix<T> {
rows: usize,
cols: usize,
elements: Vec<T>,
}
[
3 5 8
1 1 9
]
x
[
7 9 1 0
5 3 7 9
1 1 0 4
]
Rows: 2
Cols: 3
Rows: 3
Cols: 4
[
3 5 8
1 1 9
]
x
[
7 9 1 0
5 3 7 9
1 1 0 4
]
Rows: 2
Cols: 3
Rows: 3
Cols: 4
pub struct Matrix<T> {
rows: 2,
cols: 3,
elements: Vec<T>,
}
pub struct Matrix<T> {
rows: 3,
cols: 4,
elements: Vec<T>,
}
Explicit Matrix1.cols == Matrix2.rows
pub struct Matrix<T> {
rows: usize,
cols: usize,
elements: Vec<T>,
}
pub trait Dimension {
// we have a behaviour set
// for Dimensions
}
impl Dimension for Matrix {
}
impl<E, D> Matrix<E, D>
where E: PhantomData,
D: Dimension
{
// better
}
*PhantomData: "PhantomData<T> allows you to describe that a type acts as if it stores a value of type T, even though it does not." https://doc.rustlang.org/std/marker/struct.PhantomData.html
Inspiration: http://jadpole.github.io/rust/typecheckedmatrix
[
3 5
1 1
]
Rows == Cols == 2
Integer
+
Integer
=
Integer
1
+
1
=
2
Adding integers will always result in another integer.
This is not true for division
Integer
/
Integer
=
May not be an Integer
Real
/
Real
=
Real
Real

Real
=
Real
Real
x
Real
=
Real
Real
+
Real
=
Real
Is there any operation within real numbers that does not result in a real number?
√Real
=
May not be Real
√4
=
Not a Real number
Complex Numbers are important because they output complex numbers for all the common algebraic operations
pub struct ComplexNumber<T> {
real: T,
imaginary: T,
}
pub fn pow(&self, exp: T) > ComplexNumber<T> {
// stay inside the Complex number set
}
Why is this important?
trait ClosedSet
[*] https://github.com/rustnum/num
Imagine running a long script in Octave and get a runtime error after several minutes of processing: it can be frustrating.
We can delegate this code to Rust.
These concepts or mindset can be applied to other areas, not only scientific projects.
Example: wouldn't the idea of closed sets be useful for payments?
The idea of creating a trait for specific abstractions, like the Matrix Dimension, could be good as well.
pub unsafe fn from_vector(d: Dimension, v: Vec<A>) > Matrix<T>
{
// at some point calls slice::get_unchecked
}
fn from_safe_vec_impl(d: Dimension, v: Vec<A>)
> Result<Matrix<T>, ConversionError>
{
if d.size_checked() != Some(v.len()) {
return
Err(error::incompatible_shapes(&v.len(),
&dim));
}
unsafe { Ok(Self::from_vector(dim, v)) }
}
}
Fast Fourier Transform (FFT)
fn from_time(s: &mut Signal<Time>) > Signal<Frequency>
fn from_frequency(s: &mut Signal<Frequency>) > Signal<Time>
Fast Fourier Transform (FFT)
fn from_time(s: Signal<Time>) > Signal<Frequency>
fn from_frequency(s: Signal<Frequency>) > Signal<Time>
(this is more appropriate!)
Questions?
hannelita@gmail.com
@hannelita