MCPcopy Create free account
hub / github.com/daniel-e/rustml / test_matrix_vector_ops

Function test_matrix_vector_ops

src/ops.rs:565–580  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

563
564 #[test]
565 fn test_matrix_vector_ops() {
566 let m = mat![
567 1.0f32, 2.0;
568 3.0, 4.0;
569 5.0, 6.0;
570 7.0, 8.0
571 ];
572
573 let a = m.add_row(&[2.5, 4.0]);
574 assert_eq!(a.buf(), &vec![3.5, 6.0, 5.5, 8.0, 7.5, 10.0, 9.5, 12.0]);
575
576 let b = m.sub_row(&[4.0, 5.0]);
577 assert_eq!(b.buf(), &vec![-3.0, -3.0, -1.0, -1.0, 1.0, 1.0, 3.0, 3.0]);
578 assert_eq!(m.buf(), &vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]);
579
580 }
581
582 #[test]
583 fn test_vector_scalar_ops() {

Callers

nothing calls this directly

Calls 1

add_rowMethod · 0.80

Tested by

no test coverage detected