Coder Social home page Coder Social logo

rustrix's Introduction

Rustrix

Supports macro and basic operations for matrix.

Initialization

use rustrix::*;

let m = mx![
    1, 2, 3;
    4, 5, 6;
];

let (rows, cols, init) = (2, 3, 1);
let m1 = mx!(rows, cols; init);
let m2 = mx![
    1, 1, 1;
    1, 1, 1;
];

assert_eq!(m1, m2)

Add

use rustrix::*;

let m = mx!(2, 3; 2) + mx!(2, 3; 3);

Subtract

use rustrix::*;

let m = mx!(2, 3; 4) - mx!(2, 3; 1);

Dot product

use rustrix::*;

let m1 = mx![
    1, 1;
    2, 2;
];

let m2 = mx![
    1, 1, 1, 1;
    2, 2, 2, 2;
];

let m = m1 * m2;

Transpose

use rustrix::*;

let m1 = mx![
    1, 2;
    3, 4;
    5, 6;
];

let m2 = m1.tp();
let m3 = m1.transpose();

Scalar multiplication

use rustrix::*;

let m1 = mx![
    1, 2, 3;
    4, 5, 6;
];

let m2 = m1.mul_scalar(2);

rustrix's People

Contributors

mk0218 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.