block and expression must have a const value error

CroCo

I would like to create a matrix B from a block of matrix A. The size of A changes, so I'm trying to achieve the following

Eigen::MatrixXd B(A.block<3,N>(0,0)); 

where N is columns number of A. I get this error the expression must have constant value. How can I solve this problem? I've tried to use const_cast<> but I still get the same problem.

tmlen

I think this would work:

Eigen::MatrixXd B = A.block(0, 0, 3, N);

The API documentation of eigen is here. If N is a variable, it can't be used as a template function argument (<3,N>) because those must be compile-time constants (the compiler generates/instanciates a version of the function block for each combination or template arguments.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error: expression must have constant value. For a Clearly Constant Value

From Dev

Error[Pe028]: expression must have a constant value

From Dev

2-D Array - Expression must have a constant value error

From Dev

Expression must have a constant value error in an array with the size input by user

From Dev

Array definition - Expression must have a constant value

From Dev

C++ Expression must have constant value

From Dev

c++ expression must have a constant value

From Dev

Intellisense expression must have a constant value

From Dev

Expression must have constant value Eigen matrix

From Dev

error: expression must have integral or enum type

From Dev

Error. Expression must have a class type

From Dev

error : expression must have class type

From Dev

error: expression must have a class type

From Dev

error: expression must have integral or enum type

From Dev

Expression must have pointer type error on a pointer?

From Dev

Expression must be a value expression but is a method expression error in jsf 2.2

From Dev

Nullable objects must have value error

From Dev

Retrofit error URL query string must not have replace block

From Dev

Visual C++ Expression must have a constant value

From Dev

"function call must have a constant value in a constant expression"

From Dev

std::vector pointer - expression must have class type error

From Dev

Error: Expression must have integral or unscoped enum type

From Dev

"Expression must have class type" Error, trying to call a class function

From Dev

error: expression must have pointer-to-object type

From Dev

Expression must have pointer-to-class-type error

From Dev

When does error "expression must have pointer type" occur?

From Dev

Error: Initial value to non-const must be an lvalue

From Dev

expression must be a modifiable value

From Dev

Expression must be an L value

Related Related

  1. 1

    Error: expression must have constant value. For a Clearly Constant Value

  2. 2

    Error[Pe028]: expression must have a constant value

  3. 3

    2-D Array - Expression must have a constant value error

  4. 4

    Expression must have a constant value error in an array with the size input by user

  5. 5

    Array definition - Expression must have a constant value

  6. 6

    C++ Expression must have constant value

  7. 7

    c++ expression must have a constant value

  8. 8

    Intellisense expression must have a constant value

  9. 9

    Expression must have constant value Eigen matrix

  10. 10

    error: expression must have integral or enum type

  11. 11

    Error. Expression must have a class type

  12. 12

    error : expression must have class type

  13. 13

    error: expression must have a class type

  14. 14

    error: expression must have integral or enum type

  15. 15

    Expression must have pointer type error on a pointer?

  16. 16

    Expression must be a value expression but is a method expression error in jsf 2.2

  17. 17

    Nullable objects must have value error

  18. 18

    Retrofit error URL query string must not have replace block

  19. 19

    Visual C++ Expression must have a constant value

  20. 20

    "function call must have a constant value in a constant expression"

  21. 21

    std::vector pointer - expression must have class type error

  22. 22

    Error: Expression must have integral or unscoped enum type

  23. 23

    "Expression must have class type" Error, trying to call a class function

  24. 24

    error: expression must have pointer-to-object type

  25. 25

    Expression must have pointer-to-class-type error

  26. 26

    When does error "expression must have pointer type" occur?

  27. 27

    Error: Initial value to non-const must be an lvalue

  28. 28

    expression must be a modifiable value

  29. 29

    Expression must be an L value

HotTag

Archive