Eigen::SparseTriangularView - eigen

I am trying to switch some code from Eigen 3.2.10 to 3.3. I am running into compile errors with this method declaration
/// \brief Returns template expression for the lower triangular part of A.
Eigen::SparseTriangularView < SystemMatrixType, Eigen::Lower >
getLowerTriangular() const;
producing error C2143: syntax error : missing ';' before '<'.
It looks like SparseTriangularView has been renamed or replaced. What should SparseTriangularView or this whole declaration be replaced by?

Just use TriangularView < SystemMatrixType, Eigen::Lower >. Triangular and Selfadjoint views of dense and sparse expressions have been unified in 3.3.

Related

Operands in verilog

I am trying to implement a PID controller using Verilog, but I faced some problems in the coding.
I try to set the position as a parameter like shown in the screens shot:
but, I faced an error which I am not aware of:
Error1:-
Error (10170): Verilog HDL syntax error at Verilog1.v(16) near text: "["; expecting an operand. Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.
Error2:-
Error (10170): Verilog HDL syntax error at Verilog1.v(34) near text: "["; expecting "#", or an operand. Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.
I also tried the like integer position= [0*IRL+1000*CIR+2000*IRR];, but still, I face the same problem. How do I fix this syntax error?
After compiling, parameter values can only be read; not modified. They are runtime constants. An integer type can only be assigned within an procedural block. You can give it an initial value at declarations, but it will not auto update. So you want a procedure assignment or a net type with continuous assignment.
Square brackets ([]) are used for indexing an array or slice of a vector. They cannot be used like parentheses (()) or curly brackets ({}). In your case non are needed.
Change:
integer position= [0*IRL+1000*CIR+2000*IRR];
To:
wire [31:0] position= 0*IRL+1000*CIR+2000*IRR;
Or:
wire [31:0] position;
assign position= 0*IRL+1000*CIR+2000*IRR;
Or:
integer position;
always #* begin
position= 0*IRL+1000*CIR+2000*IRR;
end
Also change:
Proportional<= [position/IRL+CIR+IRR]-1000;
To:
Proportional<= (position/IRL+CIR+IRR)-1000;
Assuming IRL, CIR and IRR are declared as constant type (like parameter), then you should remove the square brackets:
parameter position = 0*IRL+1000*CIR+2000*IRR;

Please Explain Octave-Error : operator /: nonconformant arguments (op1 is 1x1, op2 is 1x10)

I have an issue running a certain script in octave.
This is the code that produces the error:
#germanium
T=410:20:600;
x=linspace(400,410,100);
y=linspace(10^9,10^9,100);
k=8.5*10 .^(-5);
Eg=0.59;
Nc300=1.02*10^13;
Nc=Nc300*((T/300).^(3/2));
n=Nc*(e.^(-Eg/(2*k*T)));
plot(T,n,x,y,'m');
grid on
xlabel('Temprature');
ylabel('Electron Density n');
title('Germanium n(T)');
As mentioned in the Title, the error that is produced is the following:
error: ger5: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x10)
I have done a lot of testing, and I figured that the problem originates from the T variable on the 9th line : n=Nc*(e.^(-Eg/(2*k*T)));
The codes run fine without it. For example :
#germanium
T=410:20:600;
x=linspace(400,410,100);
y=linspace(10^9,10^9,100);
k=8.5*10 .^(-5);
Eg=0.59;
Nc300=1.02*10^13;
Nc=Nc300*((T/300).^(3/2));
n=Nc*(e.^(-Eg/(2*k*500)));
plot(T,n,x,y,'m');
grid on
xlabel('Temprature');
ylabel('Electron Density n');
title('Germanium n(T)');
In which case I simply replaced T with 500 , the code runs perfectly fine.
Sadly T, can not be replaced by a certain number since it is the variable used in my graph. Although I did some digging, I never managed to fully understand this error, or how to fix it, thus any help would be greatly appreciated.
Thanks.
Add a . before your *, /, and ^ signs. This will ensure that octave uses scalar multiplication instead of matrix multiplication.
n=Nc.*(e.^(-Eg./(2.*k.*T)));

Error_Generator expression_spyder(python 3.6)

I develop mathematical model using gurobi solver, in python.
I get the following error while running:
SyntaxError: Generator expression must be parenthesized if not sole argument
My constraint is:
My code is:
for s in S:
m.addConstr(sum(x[s,s0,c,i] for s0 in S0 for c in C for i in D,s!=p) == 1,'C_3')
First of all, everything comes whenever you add that comma: ,s!=p.
I just emulated your code with a model I'm working on, and I obviously got the same error. Look around (e.g. if else in a list comprehension), and you will see that the only mistake you had was that the iterator within the generator wasn't well specified. That means, you had to use an if clause in order to achieve what you wanted:
for s in S:
m.addConstr(
quicksum(x[s,s0,c,i] for s0 in S0 for c in C for i in D if s!=p) == 1,
'C_3_'+str(s) )
By the way, as included in the code, you should use quicksum instead of sum. Furthermore, I would suggest to try changing the order of the iterators; in other words, it's not the same for a computer to enumerate a list of 5 elements 1000 times than to enumerate 5 times a list of 1000 elements, and this is something quite important in Python timing.
As a side note, I got into this question while looking for this:
TypeError: unsupported operand type(s) for +: 'generator' and 'generator'

"Expression Too Complex" error on simple property assignment

I'm getting (fairly reguarly) an "Error 16: Expression too complex" runtime error on a simple assigment to a property from a class.
public property PropertyName() as double
PropertyName = mvarPropertyName
end property
The debug window points to the crash being on the assignment line in the above code.
Some inital reading here and elsewhere suggested that it was related to the line calling the property. However, that now looks like this:
variableName = ObjectName.PropertyName
And all arithmetic is done with variableName.
Even more oddly, if I just hit debug, then resume/F5 immediatley, everything is fine.
Trying to use the error handling code to do this doesn't seem to have worked however.
Any ideas what is causing this error?
Stop using Not (Not MyArray) to test for uninitialized arrays. This uses a bug in the compiler that has a known side effect of destabilizing the run-time leading to "Expression too complex" on random places.
VB6 - Returning/Detecting Empty Arrays is fairly complete thread on different ways to test for empty and uninitialized arrays.
A string expression is too complicated. Strings not assigned to variables (such as those returned by functions) are assigned to temporary locations during string expression evaluation. Having a large number of these strings can cause this error. Try assigning these strings to variables and use the variables in the expression instead.

Use of undeclared identifier ' ' in XCode 4.2

void CityXMLManager::print_patch_to_xml (
patch_type _type,
vector <patch_type> & _neighbours_types,
vector <pair<Vector3, float > > & _obstacles)
Hi,
I would like to ask if the lines above are accepted in terms of syntax? This line of code worked fine previously in Window and Visual Studio 2008 compilation. Then the errors come when the same code is threw into the mac os x environment. Some one passed down these codes to me and I do not understand what is happening in this line.
The errors complained are:
Use of undeclared identifier 'patch_type'
Variable has incomplete type 'void'
'_neighbours_types' was not declared in this scope
'_patch_types' was not declared in this scope
Reference to 'vector' is ambiguous
Thanks in advance!

Resources