use crate::error::{DatarustError, Result};
use crate::matrix::{Matrix, StrMatrix};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Output {
pub numeric: Matrix,
pub categorical: StrMatrix,
}
impl Output {
pub fn new(numeric: Matrix, categorical: StrMatrix) -> Result<Self> {
if numeric.nrows() != categorical.nrows() {
return Err(DatarustError::ShapeMismatch {
expected: format!("{} rows", numeric.nrows()),
actual: format!("{} rows", categorical.nrows()),
});
}
Ok(Self {
numeric,
categorical,
})
}
pub fn nrows(&self) -> usize {
self.numeric.nrows()
}
pub fn ncols(&self) -> usize {
self.numeric.ncols() + self.categorical.ncols()
}
}