Rcpp_matrix_substract
C++ Function Reference
1 Signature
Rcpp::RObject BigDataStatMeth::Rcpp_matrix_substract(T A, T B)2 Description
Matrix subtraction.
3 Parameters
A(T): First input matrixB(T): Second input matrix (subtracted from A)
4 Returns
Result of matrix subtraction (A - B)
5 Details
Subtracts two matrices element-wise.
6 Source Code
NoteImplementation
File: inst/include/memAlgebra/memSubstract.hpp • Lines 146-165
inline Rcpp::RObject Rcpp_matrix_substract ( T A, T B)
{
Rcpp::NumericMatrix m = Rcpp::as<Rcpp::NumericMatrix>(A);
Rcpp::NumericMatrix m2 = Rcpp::as<Rcpp::NumericMatrix>(B);
if( m.rows() == m2.rows() && m.cols() == m2.cols()) {
Rcpp::NumericVector C = m - m2;
// C.attr("dim") = Rcpp::Dimension( m.rows(), m.cols());
return(C);
} else {
Rcpp::Rcout<<"Error: non-conformable arguments";
}
return(R_NilValue);
}7 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = Rcpp_matrix_substract(...);