forked from M-Labs/nalgebra
Merge remote-tracking branch 'origin/master' into genericQR
This commit is contained in:
commit
a1fdec3b52
@ -2,7 +2,7 @@
|
||||
|
||||
#![allow(missing_doc)] // we allow missing to avoid having to document the mij components.
|
||||
|
||||
use std::cast;
|
||||
use std::mem;
|
||||
use std::num::{One, Zero};
|
||||
use traits::operations::ApproxEq;
|
||||
use std::slice::{Items, MutItems};
|
||||
|
@ -19,13 +19,13 @@ macro_rules! at_fast_impl(
|
||||
impl<N: Clone> $t<N> {
|
||||
#[inline]
|
||||
pub unsafe fn at_fast(&self, (i, j): (uint, uint)) -> N {
|
||||
(*cast::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self)
|
||||
(*mem::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self)
|
||||
.unsafe_ref(i + j * $dim)).clone()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn set_fast(&mut self, (i, j): (uint, uint), val: N) {
|
||||
(*cast::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)
|
||||
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)
|
||||
.unsafe_mut_ref(i + j * $dim)) = val
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ macro_rules! iterable_impl(
|
||||
#[inline]
|
||||
fn iter<'l>(&'l self) -> Items<'l, N> {
|
||||
unsafe {
|
||||
cast::transmute::<&'l $t<N>, &'l [N, ..$dim * $dim]>(self).iter()
|
||||
mem::transmute::<&'l $t<N>, &'l [N, ..$dim * $dim]>(self).iter()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,7 +153,7 @@ macro_rules! iterable_mut_impl(
|
||||
#[inline]
|
||||
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
|
||||
unsafe {
|
||||
cast::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim * $dim]>(self).mut_iter()
|
||||
mem::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim * $dim]>(self).mut_iter()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,21 +188,21 @@ macro_rules! indexable_impl(
|
||||
#[inline]
|
||||
fn at(&self, (i, j): (uint, uint)) -> N {
|
||||
unsafe {
|
||||
cast::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self)[i + j * $dim].clone()
|
||||
mem::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self)[i + j * $dim].clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set(&mut self, (i, j): (uint, uint), val: N) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)[i + j * $dim] = val
|
||||
mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)[i + j * $dim] = val
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn swap(&mut self, (i1, j1): (uint, uint), (i2, j2): (uint, uint)) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)
|
||||
mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self)
|
||||
.swap(i1 + j1 * $dim, i2 + j2 * $dim)
|
||||
}
|
||||
}
|
||||
@ -214,12 +214,12 @@ macro_rules! indexable_impl(
|
||||
|
||||
#[inline]
|
||||
unsafe fn unsafe_at(&self, (i, j): (uint, uint)) -> N {
|
||||
(*cast::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self).unsafe_ref(i + j * $dim)).clone()
|
||||
(*mem::transmute::<&$t<N>, &[N, ..$dim * $dim]>(self).unsafe_ref(i + j * $dim)).clone()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn unsafe_set(&mut self, (i, j): (uint, uint), val: N) {
|
||||
(*cast::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self).unsafe_mut_ref(i + j * $dim)) = val
|
||||
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim * $dim]>(self).unsafe_mut_ref(i + j * $dim)) = val
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::cast;
|
||||
use std::mem;
|
||||
use std::num::{Zero, One, Float, Bounded};
|
||||
use std::slice::{Items, MutItems};
|
||||
use std::iter::{Iterator, FromIterator};
|
||||
@ -55,14 +55,14 @@ impl<N> vec::Vec0<N> {
|
||||
impl<N> Iterable<N> for vec::Vec0<N> {
|
||||
#[inline]
|
||||
fn iter<'l>(&'l self) -> Items<'l, N> {
|
||||
unsafe { cast::transmute::<&'l vec::Vec0<N>, &'l [N, ..0]>(self).iter() }
|
||||
unsafe { mem::transmute::<&'l vec::Vec0<N>, &'l [N, ..0]>(self).iter() }
|
||||
}
|
||||
}
|
||||
|
||||
impl<N> IterableMut<N> for vec::Vec0<N> {
|
||||
#[inline]
|
||||
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
|
||||
unsafe { cast::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).mut_iter() }
|
||||
unsafe { mem::transmute::<&'l mut vec::Vec0<N>, &'l mut [N, ..0]>(self).mut_iter() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#![allow(missing_doc)] // we allow missing to avoid having to document the vector components.
|
||||
|
||||
use std::cast;
|
||||
use std::mem;
|
||||
use std::num::{Zero, One, Float, Bounded};
|
||||
use std::slice::{Items, MutItems};
|
||||
use std::iter::{Iterator, FromIterator};
|
||||
|
@ -21,14 +21,14 @@ macro_rules! at_fast_impl(
|
||||
/// Unsafe read access to a vector element by index.
|
||||
#[inline]
|
||||
pub unsafe fn at_fast(&self, i: uint) -> N {
|
||||
(*cast::transmute::<&$t<N>, &[N, ..$dim]>(self)
|
||||
(*mem::transmute::<&$t<N>, &[N, ..$dim]>(self)
|
||||
.unsafe_ref(i)).clone()
|
||||
}
|
||||
|
||||
/// Unsafe write access to a vector element by index.
|
||||
#[inline]
|
||||
pub unsafe fn set_fast(&mut self, i: uint, val: N) {
|
||||
(*cast::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut_ref(i)) = val
|
||||
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut_ref(i)) = val
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -154,14 +154,14 @@ macro_rules! indexable_impl(
|
||||
#[inline]
|
||||
fn at(&self, i: uint) -> N {
|
||||
unsafe {
|
||||
cast::transmute::<&$t<N>, &[N, ..$dim]>(self)[i].clone()
|
||||
mem::transmute::<&$t<N>, &[N, ..$dim]>(self)[i].clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set(&mut self, i: uint, val: N) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self)[i] = val
|
||||
mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self)[i] = val
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,18 +173,18 @@ macro_rules! indexable_impl(
|
||||
#[inline]
|
||||
fn swap(&mut self, i1: uint, i2: uint) {
|
||||
unsafe {
|
||||
cast::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).swap(i1, i2)
|
||||
mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).swap(i1, i2)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn unsafe_at(&self, i: uint) -> N {
|
||||
(*cast::transmute::<&$t<N>, &[N, ..$dim]>(self).unsafe_ref(i)).clone()
|
||||
(*mem::transmute::<&$t<N>, &[N, ..$dim]>(self).unsafe_ref(i)).clone()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn unsafe_set(&mut self, i: uint, val: N) {
|
||||
(*cast::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut_ref(i)) = val
|
||||
(*mem::transmute::<&mut $t<N>, &mut [N, ..$dim]>(self).unsafe_mut_ref(i)) = val
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -211,7 +211,7 @@ macro_rules! iterable_impl(
|
||||
#[inline]
|
||||
fn iter<'l>(&'l self) -> Items<'l, N> {
|
||||
unsafe {
|
||||
cast::transmute::<&'l $t<N>, &'l [N, ..$dim]>(self).iter()
|
||||
mem::transmute::<&'l $t<N>, &'l [N, ..$dim]>(self).iter()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ macro_rules! iterable_mut_impl(
|
||||
#[inline]
|
||||
fn mut_iter<'l>(&'l mut self) -> MutItems<'l, N> {
|
||||
unsafe {
|
||||
cast::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim]>(self).mut_iter()
|
||||
mem::transmute::<&'l mut $t<N>, &'l mut [N, ..$dim]>(self).mut_iter()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user