forked from M-Labs/nalgebra
Use inline instead of inline(always)
This commit is contained in:
parent
b0ffd55962
commit
41425ae52c
@ -126,7 +126,7 @@ where
|
||||
/// ------
|
||||
///
|
||||
/// Panics if `i` or `j` is out of bounds.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn push(&mut self, i: usize, j: usize, v: T) {
|
||||
assert!(i < self.nrows);
|
||||
assert!(j < self.ncols);
|
||||
@ -136,13 +136,13 @@ where
|
||||
}
|
||||
|
||||
/// The number of rows in the matrix.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn nrows(&self) -> usize {
|
||||
self.nrows
|
||||
}
|
||||
|
||||
/// The number of columns in the matrix.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn ncols(&self) -> usize {
|
||||
self.ncols
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ impl<T> CsrMatrix<T> {
|
||||
}
|
||||
|
||||
/// The number of rows in the matrix.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn nrows(&self) -> usize {
|
||||
self.sparsity_pattern.major_dim()
|
||||
}
|
||||
|
||||
/// The number of columns in the matrix.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn ncols(&self) -> usize {
|
||||
self.sparsity_pattern.minor_dim()
|
||||
}
|
||||
@ -42,31 +42,31 @@ impl<T> CsrMatrix<T> {
|
||||
/// Note that this corresponds to the number of explicitly stored entries, *not* the actual
|
||||
/// number of algebraically zero entries in the matrix. Explicitly stored entries can still
|
||||
/// be zero. Corresponds to the number of entries in the sparsity pattern.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn nnz(&self) -> usize {
|
||||
self.sparsity_pattern.nnz()
|
||||
}
|
||||
|
||||
/// The row offsets defining part of the CSR format.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn row_offsets(&self) -> &[usize] {
|
||||
self.sparsity_pattern.major_offsets()
|
||||
}
|
||||
|
||||
/// The column indices defining part of the CSR format.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn column_indices(&self) -> &[usize] {
|
||||
self.sparsity_pattern.minor_indices()
|
||||
}
|
||||
|
||||
/// The non-zero values defining part of the CSR format.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn values(&self) -> &[T] {
|
||||
&self.values
|
||||
}
|
||||
|
||||
/// Mutable access to the non-zero values.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn values_mut(&mut self) -> &mut [T] {
|
||||
&mut self.values
|
||||
}
|
||||
@ -182,7 +182,7 @@ pub struct CsrTripletIterMut<'a, T> {
|
||||
impl<'a, T> Iterator for CsrTripletIterMut<'a, T> {
|
||||
type Item = (usize, usize, &'a mut T);
|
||||
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let next_entry = self.pattern_iter.next();
|
||||
let next_value = self.values_mut_iter.next();
|
||||
|
@ -21,38 +21,38 @@ impl SparsityPattern {
|
||||
}
|
||||
|
||||
/// The offsets for the major dimension.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn major_offsets(&self) -> &[usize] {
|
||||
&self.major_offsets
|
||||
}
|
||||
|
||||
/// The indices for the minor dimension.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn minor_indices(&self) -> &[usize] {
|
||||
&self.minor_indices
|
||||
}
|
||||
|
||||
/// The major dimension.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn major_dim(&self) -> usize {
|
||||
assert!(self.major_offsets.len() > 0);
|
||||
self.major_offsets.len() - 1
|
||||
}
|
||||
|
||||
/// The minor dimension.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn minor_dim(&self) -> usize {
|
||||
self.minor_dim
|
||||
}
|
||||
|
||||
/// The number of "non-zeros", i.e. explicitly stored entries in the pattern.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn nnz(&self) -> usize {
|
||||
self.minor_indices.len()
|
||||
}
|
||||
|
||||
/// Get the lane at the given index.
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
pub fn lane(&self, major_index: usize) -> Option<&[usize]> {
|
||||
let offset_begin = *self.major_offsets().get(major_index)?;
|
||||
let offset_end = *self.major_offsets().get(major_index + 1)?;
|
||||
@ -130,7 +130,7 @@ impl<'a> SparsityPatternIter<'a> {
|
||||
impl<'a> Iterator for SparsityPatternIter<'a> {
|
||||
type Item = (usize, usize);
|
||||
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
// We ensure fast iteration across each lane by iteratively "draining" a slice
|
||||
// corresponding to the remaining column indices in the particular lane.
|
||||
|
Loading…
Reference in New Issue
Block a user