Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7834739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:17:57+00:00 2026-06-02T13:17:57+00:00

code <- ‘ arma::mat M=Rcpp::as<arma::mat>(m); arma::umat a=trans(M)>M; arma::mat N=a; return Rcpp::wrap(N); ‘ coxFunc <-

  • 0
code <- '
arma::mat M=Rcpp::as<arma::mat>(m);
arma::umat a=trans(M)>M;
arma::mat N=a;
    return Rcpp::wrap(N);
'
coxFunc <- cxxfunction(signature(m="matrix"),
                       code,
                       plugin="RcppArmadillo")

How can I convert from umat to mat on Armadillo?

file53a97e398eed.cpp:33: error: conversion from ‘arma::umat’ to non-scalar type ‘arma::mat’ requested
make: *** [file53a97e398eed.o] Error 1

Thank you,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:17:58+00:00Added an answer on June 2, 2026 at 1:17 pm

    The two other answers already hinted that a straight conversion does not exist. Spending a minute on the Arma web site suggest the conv_to<T>::from(var) function you want here:

    R> code <- '
    +   arma::mat  M = Rcpp::as<arma::mat>(m);
    +   arma::umat a = trans(M) > M;
    +   arma::mat  N = arma::conv_to<arma::mat>::from(a);
    +   return Rcpp::wrap(N);
    + '
    R> coxFunc <- cxxfunction(signature(m="matrix"),
    +                        code,
    +                        plugin="RcppArmadillo")
    R> coxFunc( matrix(1:9, 3, 3) )
         [,1] [,2] [,3]
    [1,]    0    0    0
    [2,]    1    0    0
    [3,]    1    1    0
    R> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code Igniter version '2.0.3' Jquery 1.7 Jquery History plugin I have a CodeIgniter app
Code: if (!IDTextField.value && !FirstNameField.value && !LastNameField.value && !DateOfBirthField.value!GenderField.value) { alert('No criteria Added'); return;
Code: public IList<T> GetByMultipleIds(int[] ids) { List<T> result = _session.Linq<T>() .Where(x => ids.Contains(x.Id)).ToList(); return
Code goes first: class A { public: ... int *foo() const { return _px;
Code: static int counter = 0; int add(int x) { counter++; return ++x; }
code snippet: def after_equals(s): return s.partition(' = ')[-1] for k,s in zip(keyword, score): print
Code static void MyClass::ThreadEntryStatic() { //... } void MyClass::Begin() { CreateThread(..,ThreadEntryStatic,..); } In which
Code for server: http://stikked.com/view/64826511 Network Code for client: http://stikked.com/view/38974838 Basically, the client connects to
Code in the book Beginning iPhone Development (by Dave Mark & Jeff LaMarche) assigns
//CODE $entries = $model->fetchEntries(); $feedUri = '/rss/'; //link from which feed is available $link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.