pub struct ThreeMat { /* private fields */ }
Expand description

Three Matrix

Implementations

Returns a new ThreeMat from three ThreeVecs

Arguments
  • r0 - calcify::ThreeVec
  • r1 - calcify::ThreeVec
  • r2 - calcify::ThreeVec
Example
use calcify::ThreeVec;
use calcify::ThreeMat;
let mat3 = ThreeMat::new(
              ThreeVec::new(1.0,2.0,3.0),
              ThreeVec::new(4.0,5.0,6.0),
              ThreeVec::new(7.0,8.0,9.0)
           );

Returns a new ThreeMat from a slice

Arguments
Panics
  • slice length < 3

Returns a new ThreeMat with three random ThreeVecs using calcify::ThreeVec::random(max: f64)

Arguments
  • max - f64: The absolute maximum value of each individule componant of the constituent ThreeVec
Example
use calcify::ThreeMat;
let mat3 = ThreeMat::random(10.0);

Returns a new ThreeMat identity matrix

Example
use calcify::ThreeMat;
let mat3 = ThreeMat::eye();

assert_eq!(*mat3.r1().x1(),1.0);

Returns a new ThreeMat zero matrix

Example
use calcify::ThreeMat;
let mat3 = ThreeMat::zero();

assert_eq!(*mat3.r1().x1(),0.0);

Returns a new ThreeMat one matrix

Example
use calcify::ThreeMat;
let mat3 = ThreeMat::one();

assert_eq!(*mat3.r1().x1(),1.0);

Returns a reference to the first row of the matrix.

Example
use calcify::ThreeVec;
use calcify::ThreeMat;
let mat3 = ThreeMat::new(
              ThreeVec::new(1.0,2.0,3.0),
              ThreeVec::new(4.0,5.0,6.0),
              ThreeVec::new(7.0,8.0,9.0)
           );
let row_zero: ThreeVec = *mat3.r0();
let element_zero_zero: f64 = *mat3.r0().x0();
assert_eq!(row_zero,ThreeVec::new(1.0,2.0,3.0));
assert_eq!(element_zero_zero,1.0);

Returns a reference to the second row of the matrix.

Example
use calcify::ThreeVec;
use calcify::ThreeMat;
let mat3 = ThreeMat::new(
              ThreeVec::new(1.0,2.0,3.0),
              ThreeVec::new(4.0,5.0,6.0),
              ThreeVec::new(7.0,8.0,9.0)
           );
let row_one: ThreeVec = *mat3.r1();
let element_one_one: f64 = *mat3.r1().x1();
assert_eq!(row_one,ThreeVec::new(4.0,5.0,6.0));
assert_eq!(element_one_one,5.0);

Returns a reference to the third row of the matrix.

Example
use calcify::ThreeVec;
use calcify::ThreeMat;
let mat3 = ThreeMat::new(
              ThreeVec::new(1.0,2.0,3.0),
              ThreeVec::new(4.0,5.0,6.0),
              ThreeVec::new(7.0,8.0,9.0)
           );
let row_two: ThreeVec = *mat3.r2();
let element_two_two: f64 = *mat3.r2().x2();
assert_eq!(row_two,ThreeVec::new(7.0,8.0,9.0));
assert_eq!(element_two_two,9.0);

Returns a new memory ThreeVec of the first column of the matrix.

Example
use calcify::ThreeVec;
use calcify::ThreeMat;
let mat3 = ThreeMat::new(
              ThreeVec::new(1.0,2.0,3.0),
              ThreeVec::new(4.0,5.0,6.0),
              ThreeVec::new(7.0,8.0,9.0)
           );
let col_one: ThreeVec = mat3.c0();
let element_one_one: f64 = *mat3.c0().x0();
assert_eq!(col_one,ThreeVec::new(1.0,4.0,7.0));
assert_eq!(element_one_one,1.0);

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Return Self from string

Return a tuple of Self and a &u8 of remaining unparsed bytes from a byte array

Formats the value using the given formatter. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Matrix multiplication

Example
use calcify::ThreeMat;
use calcify::ThreeVec;

let mat3 = ThreeMat::new(ThreeVec::new(1.0,2.0,3.0),
                            ThreeVec::new(4.0,5.0,6.0),
                            ThreeVec::new(7.0,8.0,9.0));

assert_eq!(
    mat3*mat3,
    ThreeMat::new(ThreeVec::new(30.0,36.0,42.0),
                ThreeVec::new(66.0,81.0,96.0),
                ThreeVec::new(102.0,126.0,150.0)));

The resulting type after applying the * operator.

Matrix multiplication with vector

Note

Only works in one direction ThreeMat*ThreeVec, implying ThreeVec as a column vector.

Example
use calcify::ThreeMat;
use calcify::ThreeVec;

let mat3 = ThreeMat::new(ThreeVec::new(1.0,2.0,3.0),
                            ThreeVec::new(1.0,2.0,3.0),
                            ThreeVec::new(1.0,2.0,3.0));

assert_eq!(
    mat3*ThreeVec::new(2.0,2.0,2.0),
    ThreeVec::new(12.0,12.0,12.0)
);

The resulting type after applying the * operator.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Return object intensive json string Read more

Return Result wrapped Vec in MsgPack Format is not like to_json it is array intensive not object Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.