Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::dimension::IntoDimension;
use crate::split_at::SplitAt;
use crate::zip::Offset;
use crate::Axis;
use crate::LayoutBitset;
use crate::Layout;
use crate::NdProducer;
use crate::{ArrayBase, Data};

Expand Down Expand Up @@ -193,12 +193,12 @@ impl<D: Dimension + Copy> NdProducer for Indices<D>
IndexPtr { index: self.start }
}

fn layout(&self) -> LayoutBitset
fn layout(&self) -> Layout
{
if self.dim.ndim() <= 1 {
LayoutBitset::one_dimensional()
Layout::one_dimensional()
} else {
LayoutBitset::none()
Layout::none()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/iterators/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::marker::PhantomData;
use crate::imp_prelude::*;
use crate::Baseiter;
use crate::IntoDimension;
use crate::{LayoutBitset, NdProducer};
use crate::{Layout, NdProducer};

impl_ndproducer! {
['a, A, D: Dimension]
Expand Down
2 changes: 1 addition & 1 deletion src/iterators/lanes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::marker::PhantomData;
use super::LanesIter;
use super::LanesIterMut;
use crate::imp_prelude::*;
use crate::{LayoutBitset, NdProducer};
use crate::{Layout, NdProducer};

impl_ndproducer! {
['a, A, D: Dimension]
Expand Down
2 changes: 1 addition & 1 deletion src/iterators/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<$($typarm)*> NdProducer for $fulltype {
self.$base.raw_dim()
}

fn layout(&self) -> LayoutBitset {
fn layout(&self) -> Layout {
self.$base.layout()
}

Expand Down
8 changes: 4 additions & 4 deletions src/iterators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,9 +1191,9 @@ impl<A, D: Dimension> NdProducer for AxisIter<'_, A, D>
type Ptr = *mut A;
type Stride = isize;

fn layout(&self) -> crate::LayoutBitset
fn layout(&self) -> crate::Layout
{
crate::LayoutBitset::one_dimensional()
crate::Layout::one_dimensional()
}

fn raw_dim(&self) -> Self::Dim
Expand Down Expand Up @@ -1250,9 +1250,9 @@ impl<A, D: Dimension> NdProducer for AxisIterMut<'_, A, D>
type Ptr = *mut A;
type Stride = isize;

fn layout(&self) -> crate::LayoutBitset
fn layout(&self) -> crate::Layout
{
crate::LayoutBitset::one_dimensional()
crate::Layout::one_dimensional()
}

fn raw_dim(&self) -> Self::Dim
Expand Down
4 changes: 2 additions & 2 deletions src/iterators/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::marker::PhantomData;
use super::Baseiter;
use crate::imp_prelude::*;
use crate::IntoDimension;
use crate::LayoutBitset;
use crate::Layout;
use crate::NdProducer;
use crate::Slice;

Expand Down Expand Up @@ -176,7 +176,7 @@ impl<'a, A, D: Dimension> NdProducer for AxisWindows<'a, A, D>
Ix1(self.base.raw_dim()[self.axis_idx])
}

fn layout(&self) -> LayoutBitset
fn layout(&self) -> Layout
{
self.base.layout()
}
Expand Down
271 changes: 0 additions & 271 deletions src/layout/bitset.rs

This file was deleted.

32 changes: 32 additions & 0 deletions src/layout/layoutfmt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2017 bluss and ndarray developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use super::Layout;

const LAYOUT_NAMES: &[&str] = &["C", "F", "c", "f"];

use std::fmt;

impl fmt::Debug for Layout
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
if self.0 == 0 {
write!(f, "Custom")?
} else {
(0..32).filter(|&i| self.is(1 << i)).try_fold((), |_, i| {
if let Some(name) = LAYOUT_NAMES.get(i) {
write!(f, "{}", name)
} else {
write!(f, "{:#x}", i)
}
})?;
};
write!(f, " ({:#x})", self.0)
}
}
Loading