Skip to content

Commit 399e997

Browse files
committed
Use argument name rhs instead of other
1 parent 875ff8d commit 399e997

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

src/lib.rs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,22 +1043,22 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
10431043
}
10441044
}
10451045

1046-
/// Perform an elementwise assigment to `self` from `other`.
1046+
/// Perform an elementwise assigment to `self` from `rhs`.
10471047
///
1048-
/// If their shapes disagree, `other` is broadcast to the shape of `self`.
1048+
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
10491049
///
10501050
/// **Panics** if broadcasting isn't possible.
1051-
pub fn assign<E: Dimension, S2>(&mut self, other: &ArrayBase<S2, E>)
1051+
pub fn assign<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>)
10521052
where S: DataMut,
10531053
A: Clone,
10541054
S2: Data<Elem=A>,
10551055
{
1056-
if self.shape() == other.shape() {
1057-
for (x, y) in self.iter_mut().zip(other.iter()) {
1056+
if self.shape() == rhs.shape() {
1057+
for (x, y) in self.iter_mut().zip(rhs.iter()) {
10581058
*x = y.clone();
10591059
}
10601060
} else {
1061-
let other_iter = other.broadcast_iter_unwrap(self.dim());
1061+
let other_iter = rhs.broadcast_iter_unwrap(self.dim());
10621062
for (x, y) in self.iter_mut().zip(other_iter) {
10631063
*x = y.clone();
10641064
}
@@ -1351,10 +1351,10 @@ impl<A, S> ArrayBase<S, (Ix, Ix)>
13511351
impl<A: Copy + linalg::Ring, S> ArrayBase<S, (Ix, Ix)>
13521352
where S: Data<Elem=A>,
13531353
{
1354-
/// Perform matrix multiplication of rectangular arrays `self` and `other`.
1354+
/// Perform matrix multiplication of rectangular arrays `self` and `rhs`.
13551355
///
13561356
/// The array sizes must agree in the way that
1357-
/// if `self` is *M* × *N*, then `other` is *N* × *K*.
1357+
/// if `self` is *M* × *N*, then `rhs` is *N* × *K*.
13581358
///
13591359
/// Return a result array with shape *M* × *K*.
13601360
///
@@ -1374,9 +1374,9 @@ impl<A: Copy + linalg::Ring, S> ArrayBase<S, (Ix, Ix)>
13741374
/// );
13751375
/// ```
13761376
///
1377-
pub fn mat_mul(&self, other: &ArrayBase<S, (Ix, Ix)>) -> Array<A, (Ix, Ix)>
1377+
pub fn mat_mul(&self, rhs: &ArrayBase<S, (Ix, Ix)>) -> Array<A, (Ix, Ix)>
13781378
{
1379-
let ((m, a), (b, n)) = (self.dim, other.dim);
1379+
let ((m, a), (b, n)) = (self.dim, rhs.dim);
13801380
let (self_columns, other_rows) = (a, b);
13811381
assert!(self_columns == other_rows);
13821382

@@ -1390,7 +1390,7 @@ impl<A: Copy + linalg::Ring, S> ArrayBase<S, (Ix, Ix)>
13901390
for rr in res_elems.iter_mut() {
13911391
unsafe {
13921392
let dot = (0..a).fold(libnum::zero::<A>(),
1393-
|s, k| s + *self.uchk_at((i, k)) * *other.uchk_at((k, j))
1393+
|s, k| s + *self.uchk_at((i, k)) * *rhs.uchk_at((k, j))
13941394
);
13951395
std::ptr::write(rr, dot);
13961396
}
@@ -1406,17 +1406,17 @@ impl<A: Copy + linalg::Ring, S> ArrayBase<S, (Ix, Ix)>
14061406
}
14071407

14081408
/// Perform the matrix multiplication of the rectangular array `self` and
1409-
/// column vector `other`.
1409+
/// column vector `rhs`.
14101410
///
14111411
/// The array sizes must agree in the way that
1412-
/// if `self` is *M* × *N*, then `other` is *N*.
1412+
/// if `self` is *M* × *N*, then `rhs` is *N*.
14131413
///
14141414
/// Return a result array with shape *M*.
14151415
///
14161416
/// **Panics** if sizes are incompatible.
1417-
pub fn mat_mul_col(&self, other: &ArrayBase<S, Ix>) -> Array<A, Ix>
1417+
pub fn mat_mul_col(&self, rhs: &ArrayBase<S, Ix>) -> Array<A, Ix>
14181418
{
1419-
let ((m, a), n) = (self.dim, other.dim);
1419+
let ((m, a), n) = (self.dim, rhs.dim);
14201420
let (self_columns, other_rows) = (a, n);
14211421
assert!(self_columns == other_rows);
14221422

@@ -1429,7 +1429,7 @@ impl<A: Copy + linalg::Ring, S> ArrayBase<S, (Ix, Ix)>
14291429
for rr in res_elems.iter_mut() {
14301430
unsafe {
14311431
let dot = (0..a).fold(libnum::zero::<A>(),
1432-
|s, k| s + *self.uchk_at((i, k)) * *other.uchk_at(k)
1432+
|s, k| s + *self.uchk_at((i, k)) * *rhs.uchk_at(k)
14331433
);
14341434
std::ptr::write(rr, dot);
14351435
}
@@ -1447,10 +1447,10 @@ impl<A: Float + PartialOrd, D: Dimension> Array<A, D>
14471447
/// Return `true` if the arrays' elementwise differences are all within
14481448
/// the given absolute tolerance.<br>
14491449
/// Return `false` otherwise, or if the shapes disagree.
1450-
pub fn allclose(&self, other: &Array<A, D>, tol: A) -> bool
1450+
pub fn allclose(&self, rhs: &Array<A, D>, tol: A) -> bool
14511451
{
1452-
self.shape() == other.shape() &&
1453-
self.iter().zip(other.iter()).all(|(x, y)| (*x - *y).abs() <= tol)
1452+
self.shape() == rhs.shape() &&
1453+
self.iter().zip(rhs.iter()).all(|(x, y)| (*x - *y).abs() <= tol)
14541454
}
14551455
}
14561456

@@ -1466,22 +1466,22 @@ impl<A, S, D> ArrayBase<S, D> where
14661466
{
14671467
/// Perform elementwise
14681468
#[doc=$doc]
1469-
/// between `self` and `other`,
1469+
/// between `self` and `rhs`,
14701470
/// *in place*.
14711471
///
1472-
/// If their shapes disagree, `other` is broadcast to the shape of `self`.
1472+
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
14731473
///
14741474
/// **Panics** if broadcasting isn't possible.
1475-
pub fn $imethod <E: Dimension, S2> (&mut self, other: &ArrayBase<S2, E>)
1475+
pub fn $imethod <E: Dimension, S2> (&mut self, rhs: &ArrayBase<S2, E>)
14761476
where S2: Data<Elem=A>,
14771477
{
1478-
if self.dim.ndim() == other.dim.ndim() &&
1479-
self.shape() == other.shape() {
1480-
for (x, y) in self.iter_mut().zip(other.iter()) {
1478+
if self.dim.ndim() == rhs.dim.ndim() &&
1479+
self.shape() == rhs.shape() {
1480+
for (x, y) in self.iter_mut().zip(rhs.iter()) {
14811481
*x = (x.clone()). $mth (y.clone());
14821482
}
14831483
} else {
1484-
let other_iter = other.broadcast_iter_unwrap(self.dim());
1484+
let other_iter = rhs.broadcast_iter_unwrap(self.dim());
14851485
for (x, y) in self.iter_mut().zip(other_iter) {
14861486
*x = (x.clone()). $mth (y.clone());
14871487
}
@@ -1502,10 +1502,10 @@ impl<A, S, D> ArrayBase<S, D> where
15021502

15031503
/// Perform elementwise
15041504
#[doc=$doc]
1505-
/// between `self` and `other`,
1505+
/// between `self` and `rhs`,
15061506
/// and return the result.
15071507
///
1508-
/// If their shapes disagree, `other` is broadcast to the shape of `self`.
1508+
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
15091509
///
15101510
/// **Panics** if broadcasting isn't possible.
15111511
impl<A, S, S2, D, E> $trt<ArrayBase<S2, E>> for ArrayBase<S, D>
@@ -1516,15 +1516,15 @@ impl<A, S, S2, D, E> $trt<ArrayBase<S2, E>> for ArrayBase<S, D>
15161516
E: Dimension,
15171517
{
15181518
type Output = ArrayBase<S, D>;
1519-
fn $mth (mut self, other: ArrayBase<S2, E>) -> ArrayBase<S, D>
1519+
fn $mth (mut self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
15201520
{
15211521
// FIXME: Can we co-broadcast arrays here? And how?
1522-
if self.shape() == other.shape() {
1523-
for (x, y) in self.iter_mut().zip(other.iter()) {
1522+
if self.shape() == rhs.shape() {
1523+
for (x, y) in self.iter_mut().zip(rhs.iter()) {
15241524
*x = x.clone(). $mth (y.clone());
15251525
}
15261526
} else {
1527-
let other_iter = other.broadcast_iter_unwrap(self.dim());
1527+
let other_iter = rhs.broadcast_iter_unwrap(self.dim());
15281528
for (x, y) in self.iter_mut().zip(other_iter) {
15291529
*x = x.clone(). $mth (y.clone());
15301530
}
@@ -1535,10 +1535,10 @@ impl<A, S, S2, D, E> $trt<ArrayBase<S2, E>> for ArrayBase<S, D>
15351535

15361536
/// Perform elementwise
15371537
#[doc=$doc]
1538-
/// between `self` and `other`,
1538+
/// between `self` and `rhs`,
15391539
/// and return the result.
15401540
///
1541-
/// If their shapes disagree, `other` is broadcast to the shape of `self`.
1541+
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
15421542
///
15431543
/// **Panics** if broadcasting isn't possible.
15441544
impl<'a, A, S, S2, D, E> $trt<&'a ArrayBase<S2, E>> for &'a ArrayBase<S, D>
@@ -1549,16 +1549,16 @@ impl<'a, A, S, S2, D, E> $trt<&'a ArrayBase<S2, E>> for &'a ArrayBase<S, D>
15491549
E: Dimension,
15501550
{
15511551
type Output = OwnedArray<A, D>;
1552-
fn $mth (self, other: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
1552+
fn $mth (self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
15531553
{
15541554
// FIXME: Can we co-broadcast arrays here? And how?
15551555
let mut result = Vec::<A>::with_capacity(self.dim.size());
1556-
if self.shape() == other.shape() {
1557-
for (x, y) in self.iter().zip(other.iter()) {
1556+
if self.shape() == rhs.shape() {
1557+
for (x, y) in self.iter().zip(rhs.iter()) {
15581558
result.push((x.clone()). $mth (y.clone()));
15591559
}
15601560
} else {
1561-
let other_iter = other.broadcast_iter_unwrap(self.dim());
1561+
let other_iter = rhs.broadcast_iter_unwrap(self.dim());
15621562
for (x, y) in self.iter().zip(other_iter) {
15631563
result.push((x.clone()). $mth (y.clone()));
15641564
}
@@ -1602,7 +1602,7 @@ mod assign_ops {
16021602
($trt:ident, $method:ident, $doc:expr) => {
16031603

16041604
#[doc=$doc]
1605-
/// If their shapes disagree, `other` is broadcast to the shape of `self`.
1605+
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
16061606
///
16071607
/// **Panics** if broadcasting isn't possible.
16081608
///
@@ -1614,13 +1614,13 @@ mod assign_ops {
16141614
D: Dimension,
16151615
E: Dimension,
16161616
{
1617-
fn $method(&mut self, other: &ArrayBase<S2, E>) {
1618-
if self.shape() == other.shape() {
1619-
for (x, y) in self.iter_mut().zip(other.iter()) {
1617+
fn $method(&mut self, rhs: &ArrayBase<S2, E>) {
1618+
if self.shape() == rhs.shape() {
1619+
for (x, y) in self.iter_mut().zip(rhs.iter()) {
16201620
x.$method(y.clone());
16211621
}
16221622
} else {
1623-
let other_iter = other.broadcast_iter_unwrap(self.dim());
1623+
let other_iter = rhs.broadcast_iter_unwrap(self.dim());
16241624
for (x, y) in self.iter_mut().zip(other_iter) {
16251625
x.$method(y.clone());
16261626
}
@@ -1632,21 +1632,21 @@ mod assign_ops {
16321632
}
16331633

16341634
impl_assign_op!(AddAssign, add_assign,
1635-
"Implement `self += other` as elementwise addition (in place).\n");
1635+
"Implement `self += rhs` as elementwise addition (in place).\n");
16361636
impl_assign_op!(SubAssign, sub_assign,
1637-
"Implement `self -= other` as elementwise subtraction (in place).\n");
1637+
"Implement `self -= rhs` as elementwise subtraction (in place).\n");
16381638
impl_assign_op!(MulAssign, mul_assign,
1639-
"Implement `self *= other` as elementwise multiplication (in place).\n");
1639+
"Implement `self *= rhs` as elementwise multiplication (in place).\n");
16401640
impl_assign_op!(DivAssign, div_assign,
1641-
"Implement `self /= other` as elementwise division (in place).\n");
1641+
"Implement `self /= rhs` as elementwise division (in place).\n");
16421642
impl_assign_op!(RemAssign, rem_assign,
1643-
"Implement `self %= other` as elementwise remainder (in place).\n");
1643+
"Implement `self %= rhs` as elementwise remainder (in place).\n");
16441644
impl_assign_op!(BitAndAssign, bitand_assign,
1645-
"Implement `self &= other` as elementwise bit and (in place).\n");
1645+
"Implement `self &= rhs` as elementwise bit and (in place).\n");
16461646
impl_assign_op!(BitOrAssign, bitor_assign,
1647-
"Implement `self |= other` as elementwise bit or (in place).\n");
1647+
"Implement `self |= rhs` as elementwise bit or (in place).\n");
16481648
impl_assign_op!(BitXorAssign, bitxor_assign,
1649-
"Implement `self ^= other` as elementwise bit xor (in place).\n");
1649+
"Implement `self ^= rhs` as elementwise bit xor (in place).\n");
16501650
}
16511651

16521652
impl<A: Clone + Neg<Output=A>, D: Dimension>

0 commit comments

Comments
 (0)