diff --git a/nalgebra-macros/Cargo.toml b/nalgebra-macros/Cargo.toml index 8e98e017..1f27b572 100644 --- a/nalgebra-macros/Cargo.toml +++ b/nalgebra-macros/Cargo.toml @@ -16,4 +16,4 @@ quote = "1.0" proc-macro2 = "1.0" [dev-dependencies] -nalgebra = { version = "0.25.4", path = ".." } +nalgebra = { version = "0.26.1", path = ".." } diff --git a/nalgebra-macros/src/lib.rs b/nalgebra-macros/src/lib.rs index 16fbe6da..154f4876 100644 --- a/nalgebra-macros/src/lib.rs +++ b/nalgebra-macros/src/lib.rs @@ -77,15 +77,14 @@ impl Parse for Matrix { pub fn matrix(stream: TokenStream) -> TokenStream { let matrix = parse_macro_input!(stream as Matrix); - let dim_ident = |dim| format_ident!("U{}", dim); - let row_dim = dim_ident(matrix.nrows()); - let col_dim = dim_ident(matrix.ncols()); + let row_dim = matrix.nrows(); + let col_dim = matrix.ncols(); let entries_col_major = matrix.to_col_major_repr(); // TODO: Use quote_spanned instead?? // TODO: Construct directly from array? let output = quote! { - nalgebra::MatrixMN::<_, nalgebra::#row_dim, nalgebra::dimension::#col_dim> + nalgebra::SMatrix::<_, #row_dim, #col_dim> ::from_column_slice(&[#(#entries_col_major),*]) }; diff --git a/nalgebra-macros/tests/tests.rs b/nalgebra-macros/tests/tests.rs index cd2c3623..5d5a91b0 100644 --- a/nalgebra-macros/tests/tests.rs +++ b/nalgebra-macros/tests/tests.rs @@ -1,13 +1,13 @@ use nalgebra_macros::matrix; -use nalgebra::{MatrixMN, Matrix3x2, U0, U1, Matrix1x2, Matrix1x3, Matrix1x4, Matrix2x1, Matrix2, Matrix2x3, Matrix2x4, Matrix3x1, Matrix3, Matrix3x4, Matrix4x1, Matrix4x2, Matrix4x3, Matrix4}; +use nalgebra::{SMatrix, Matrix3x2, U0, U1, Matrix1x2, Matrix1x3, Matrix1x4, Matrix2x1, Matrix2, Matrix2x3, Matrix2x4, Matrix3x1, Matrix3, Matrix3x4, Matrix4x1, Matrix4x2, Matrix4x3, Matrix4}; #[test] fn matrix_small_dims_exhaustive() { // 0x0 - assert_eq!(matrix![], MatrixMN::::zeros()); + assert_eq!(matrix![], SMatrix::::zeros()); // 1xN - assert_eq!(matrix![1], MatrixMN::::new(1)); + assert_eq!(matrix![1], SMatrix::::new(1)); assert_eq!(matrix![1, 2], Matrix1x2::new(1, 2)); assert_eq!(matrix![1, 2, 3], Matrix1x3::new(1, 2, 3)); assert_eq!(matrix![1, 2, 3, 4], Matrix1x4::new(1, 2, 3, 4));