mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 07:09:59 +00:00
Improve documentation formatting for Broadcastable trait and element-wise comparison methods
This commit is contained in:
parent
8ed8cecd0e
commit
1865e90956
@ -202,8 +202,8 @@ pub enum Axis {
|
|||||||
Row,
|
Row,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait to turn either a Matrix<T> or a scalar T into a Vec<T> of
|
/// A trait to turn either a `Matrix<T>` or a scalar T into a `Vec<T>` of
|
||||||
/// length rows*cols (broadcasting the scalar).
|
/// length `rows*cols` (broadcasting the scalar).
|
||||||
pub trait Broadcastable<T> {
|
pub trait Broadcastable<T> {
|
||||||
fn to_vec(&self, rows: usize, cols: usize) -> Vec<T>;
|
fn to_vec(&self, rows: usize, cols: usize) -> Vec<T>;
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ impl<T: Clone> Broadcastable<T> for Matrix<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Generates element-wise eq, lt, le, gt and ge methods
|
/// Generates element-wise eq, lt, le, gt and ge methods
|
||||||
/// where the rhs can be a Matrix<T> or a scalar T.
|
/// where the rhs can be a `Matrix<T>` or a scalar T.
|
||||||
macro_rules! impl_elementwise_cmp {
|
macro_rules! impl_elementwise_cmp {
|
||||||
(
|
(
|
||||||
$( $method:ident => $op:tt ),* $(,)?
|
$( $method:ident => $op:tt ),* $(,)?
|
||||||
@ -231,7 +231,7 @@ macro_rules! impl_elementwise_cmp {
|
|||||||
impl<T: PartialOrd + Clone> Matrix<T> {
|
impl<T: PartialOrd + Clone> Matrix<T> {
|
||||||
$(
|
$(
|
||||||
#[doc = concat!("Element-wise comparison `self ", stringify!($op), " rhs`,\n\
|
#[doc = concat!("Element-wise comparison `self ", stringify!($op), " rhs`,\n\
|
||||||
where `rhs` may be a Matrix<T> or a scalar T.")]
|
where `rhs` may be a `Matrix<T>` or a scalar T.")]
|
||||||
pub fn $method<Rhs>(&self, rhs: Rhs) -> BoolMatrix
|
pub fn $method<Rhs>(&self, rhs: Rhs) -> BoolMatrix
|
||||||
where
|
where
|
||||||
Rhs: Broadcastable<T>,
|
Rhs: Broadcastable<T>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user