pub fn from_ram(
        data: Box<[f32]>,
        data_dim: usize,
        labels: MetadataList,
    ) -> PointCloudResult<PointCloud<M>> {
        let mut addresses = IndexMap::new();
        let data_source = Box::new(DataRam::new(data_dim, data)?);
        let labels_scheme = labels.scheme()?;
        let label_source = labels;
        let mut names_to_indexes: IndexMap<PointName, PointIndex> = IndexMap::new();
        let mut indexes_to_names: IndexMap<PointIndex, PointName> = IndexMap::new();

        for j in 0..(data_source.len()) {
            let name = label_source.get_name(j).unwrap_or_else(|| format!("{}", j));
            if names_to_indexes.contains_key(&name) {
                println!("Duplicate {:?} on line {} of file", &name, j);
            } else {
                names_to_indexes.insert(name.clone(), j as PointIndex);
                indexes_to_names.insert(j as PointIndex, name.clone());
                addresses.insert(j as u64, (0,j));
            }
        }
        let chunk = min(15000/data_dim,20);
        Ok(PointCloud {
            data_sources: vec![data_source],
            label_sources: vec![label_source],
            names_to_indexes: names_to_indexes,
            indexes_to_names: indexes_to_names,
            addresses: addresses,
            data_dim,
            loaded_centers: Mutex::new(IndexMap::new()),
            labels_scheme,
            chunk,
            metric: PhantomData,
        })
    }
/// Builds the point cloud from data in ram.
/// This is for complex metadata
Builds the point cloud from data in ram.
This is for complex metadata
Builds the point cloud from data in ram . This is for complex metadata
pub fn from_ram(
        data: Box<[f32]>,
        data_dim: usize,
        labels: MetadataList,
    ) -> PointCloudResult<PointCloud<M>> {
        let mut addresses = IndexMap::new();
        let data_source = Box::new(DataRam::new(data_dim, data)?);
        let labels_scheme = labels.scheme()?;
        let label_source = labels;
        let mut names_to_indexes: IndexMap<PointName, PointIndex> = IndexMap::new();
        let mut indexes_to_names: IndexMap<PointIndex, PointName> = IndexMap::new();
        for j in 0..(data_source.len()) {
            let name = label_source.get_name(j).unwrap_or_else(|| format!("{}", j));
            if names_to_indexes.contains_key(&name) {
                println!("Duplicate {:?} on line {} of file", &name, j);
            } else {
                names_to_indexes.insert(name.clone(), j as PointIndex);
                indexes_to_names.insert(j as PointIndex, name.clone());
                addresses.insert(j as u64, (0,j));
            }
        }
        let chunk = min(15000/data_dim,20);
        Ok(PointCloud {
            data_sources: vec![data_source],
            label_sources: vec![label_source],
            names_to_indexes: names_to_indexes,
            indexes_to_names: indexes_to_names,
            addresses: addresses,
            data_dim,
            loaded_centers: Mutex::new(IndexMap::new()),
            labels_scheme,
            chunk,
            metric: PhantomData,
        })
    }
pub fn from_ram ( data : Box < [ f32 ] > , data_dim : usize , labels : MetadataList , ) -> PointCloudResult < PointCloud < M > > { let mut addresses = IndexMap :: new ( ) ; let data_source = Box :: new ( DataRam :: new ( data_dim , data ) ? ) ; let labels_scheme = labels . scheme ( ) ? ; let label_source = labels ; let mut names_to_indexes : IndexMap < PointName , PointIndex > = IndexMap :: new ( ) ; let mut indexes_to_names : IndexMap < PointIndex , PointName > = IndexMap :: new ( ) ; for j in 0 .. ( data_source . len ( ) ) { let name = label_source . get_name ( j ) . unwrap_or_else ( | | format ! ( " " j ) ) ; if names_to_indexes . contains_key ( & name ) { println ! ( " " name j ) ; } else { names_to_indexes . insert ( name . clone ( ) , j as PointIndex ) ; indexes_to_names . insert ( j as PointIndex , name . clone ( ) ) ; addresses . insert ( j as u64 , ( 0 , j ) ) ; } } let chunk = min ( 15000 / data_dim , 20 ) ; Ok ( PointCloud { data_sources : vec ! [ data_source ] , label_sources : vec ! [ label_source ] , names_to_indexes : names_to_indexes , indexes_to_names : indexes_to_names , addresses : addresses , data_dim , loaded_centers : Mutex :: new ( IndexMap :: new ( ) ) , labels_scheme , chunk , metric : PhantomData , } ) }
Builds the point cloud from data in ram.
Builds the point cloud from data in ram .
data
Box<[f32]>
data_dim
usize
labels
MetadataList
data
Box<[f32]>
data_dim
usize
labels
MetadataList