veloxx 0.4.0

Veloxx: High-performance, lightweight Rust library for in-memory data processing and analytics. Features DataFrames, Series, advanced I/O (CSV, JSON, Parquet), machine learning (linear regression, K-means, logistic regression), time-series analysis, data visualization, parallel processing, and multi-platform bindings (Python, WebAssembly). Designed for minimal dependencies, optimal memory usage, and blazing speed - ideal for data science, analytics, and performance-critical applications.
Documentation
use crate::series::Series;
use crate::VeloxxError;

impl Series {
    pub fn multiply(&self, other: &Series) -> Result<Series, VeloxxError> {
        match (self, other) {
            (Series::I32(name, values, bitmap), Series::I32(_, other_values, other_bitmap)) => {
                let mut new_values = Vec::with_capacity(values.len());
                let mut new_bitmap = Vec::with_capacity(values.len());
                for i in 0..values.len() {
                    if bitmap[i] && other_bitmap[i] {
                        new_values.push(values[i] * other_values[i]);
                        new_bitmap.push(true);
                    } else {
                        new_values.push(0);
                        new_bitmap.push(false);
                    }
                }
                Ok(Series::I32(name.clone(), new_values, new_bitmap))
            }
            (Series::F64(name, values, bitmap), Series::F64(_, other_values, other_bitmap)) => {
                let mut new_values = Vec::with_capacity(values.len());
                let mut new_bitmap = Vec::with_capacity(values.len());
                for i in 0..values.len() {
                    if bitmap[i] && other_bitmap[i] {
                        new_values.push(values[i] * other_values[i]);
                        new_bitmap.push(true);
                    } else {
                        new_values.push(0.0);
                        new_bitmap.push(false);
                    }
                }
                Ok(Series::F64(name.clone(), new_values, new_bitmap))
            }
            _ => Err(VeloxxError::InvalidOperation(
                "Multiplication not supported for these series types".to_string(),
            )),
        }
    }
}