1 Star 0 Fork 0

yutiansut / Peroxide

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
julia_macro.rs 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Axect 提交于 2020-06-09 18:01 . Fix little bit of macros
#[macro_export]
macro_rules! hstack {
// Two
( $x:expr, $y:expr ) => {
{
let l = $x.len();
let mut temp = $x;
temp.extend(&$y);
matrix(temp, l, 2, Col)
}
};
// Multi
( $x0:expr, $( $x: expr ),* ) => {
{
let r = $x0.len();
let mut temp0 = $x0;
let mut c = 1usize;
$(
let mut temp = $x;
// Must equal row
assert_eq!(r, temp.len());
// Add column
c += 1;
temp0.extend_from_slice(&temp[..]);
)*
matrix(temp0, r, c, Col)
}
};
}
#[macro_export]
macro_rules! vstack {
// Two
( $x:expr, $y:expr ) => {
{
let l = $x.len();
let mut temp = $x;
temp.extend(&$y);
matrix(temp, 2, l, Row)
}
};
// Multi
( $x0:expr, $( $x: expr ),* ) => {
{
let c = $x0.len();
let mut temp0 = $x0;
let mut r = 1usize;
$(
let mut temp = $x;
// Must equal row
assert_eq!(c, temp.len());
// Add column
r += 1;
temp0.extend_from_slice(&temp[..]);
)*
matrix(temp0, r, c, Row)
}
};
}
1
https://gitee.com/yutiansut/Peroxide.git
git@gitee.com:yutiansut/Peroxide.git
yutiansut
Peroxide
Peroxide
master

搜索帮助