Rename outer -> kronecker product

This commit is contained in:
2020-08-22 10:38:55 +02:00
parent feeb254468
commit 883a37fb16
3 changed files with 24 additions and 25 deletions

View File

@@ -5,9 +5,9 @@ mod jacobi;
#[cfg(feature = "sparse")]
pub use jacobi::*;
#[cfg(feature = "sparse")]
mod outer_product;
mod kronecker_product;
#[cfg(feature = "sparse")]
pub use outer_product::sparse_sparse_outer_product;
pub use kronecker_product::kronecker_product;
pub struct Direction<T> {
pub north: T,

View File

@@ -2,7 +2,7 @@
/// M = A \kron B
#[allow(non_snake_case)]
#[must_use]
pub fn sparse_sparse_outer_product<
pub fn kronecker_product<
N: num_traits::Num + Copy + Default,
I: sprs::SpIndex,
Iptr: sprs::SpIndex,
@@ -114,7 +114,7 @@ pub fn sparse_sparse_outer_product<
}
#[test]
fn test_outer_product() {
fn test_kronecker_product() {
let mut a = sprs::TriMat::new((2, 3));
a.add_triplet(0, 1, 2);
a.add_triplet(0, 2, 3);
@@ -153,15 +153,15 @@ fn test_outer_product() {
}
};
let c = sparse_sparse_outer_product(a.view(), b.view());
let c = kronecker_product(a.view(), b.view());
check(c.view());
let b = b.to_csc();
let c = sparse_sparse_outer_product(a.view(), b.view());
let c = kronecker_product(a.view(), b.view());
check(c.view());
let a = a.to_csc();
let c = sparse_sparse_outer_product(a.view(), b.view());
let c = kronecker_product(a.view(), b.view());
check(c.view());
let b = b.to_csr();
let c = sparse_sparse_outer_product(a.view(), b.view());
let c = kronecker_product(a.view(), b.view());
check(c.view());
}