Commit 08e8e6d8 authored by Andre Julius's avatar Andre Julius
Browse files

Bump version number, rename project, implement lib into example

The project was renamed to better reflect it's purpose: Being able
to handle different excercises in linear algebra and not only the
Gram-Schmidt Processes:
	https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
parent caa78a42
[package]
name = "orthonormalizing"
version = "0.1.0"
name = "lin_b"
version = "0.2.0"
authors = ["Andre Julius <norom@jimileibniz.de>"]
[dependencies]
extern crate orthonormalizing;
use orthonormalizing::math::complex_number::ComplexNumber;
extern crate lin_b;
use lin_b::math::vector::Vector;
use lin_b::math::complex_number::ComplexNumber;
fn main() {
let a = ComplexNumber::new(1f64, 0f64);
let b = ComplexNumber::new(1f64, 1f64);
println!("a={:?}, b={:?}", a, b);
println!("a+b={:?}", a+b);
let v1 = Vector::new(vec![
ComplexNumber::new(1.0, 0.0),
ComplexNumber::new(0.0, 1.0),
ComplexNumber::new(1.0, 0.0),
ComplexNumber::new(0.0, 1.0),
]);
let v2 = Vector::new(vec![
ComplexNumber::new(1.0, 0.0),
ComplexNumber::new(0.0, 1.0),
ComplexNumber::new(0.0, 0.0),
ComplexNumber::new(0.0, 0.0),
]);
let v3 = Vector::new(vec![
ComplexNumber::new(0.0, 0.0),
ComplexNumber::new(0.0, 0.0),
ComplexNumber::new(1.0, 0.0),
ComplexNumber::new(2.0, 0.0),
]);
println!("Starting vectors:");
println!("v1 = {}", v1);
println!("v2 = {}", v2);
println!("v3 = {}", v2);
let u1 = v1.clone();
let u2 = v2.clone() - u1.orthogonal_projection(&v2);
let u3 = v3.clone() - u1.orthogonal_projection(&v3) - u2.orthogonal_projection(&v3);
println!("Orthogonalized vectors:");
println!("u1 = {}", u1);
println!("u2 = {}", u2);
println!("u3 = {}", u3);
let e1 = u1.clone() / ComplexNumber::new(u1.norm(), 0.0);
let e2 = u2.clone() / ComplexNumber::new(u2.norm(), 0.0);
let e3 = u3.clone() / ComplexNumber::new(u3.norm(), 0.0);
println!("Orthonormalized vectors");
println!("e1 = {}", e1);
println!("e2 = {}", e2);
println!("e3 = {}", e3);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment