ulaff / notebooks Goto Github PK
View Code? Open in Web Editor NEWProgramming Exercises
Programming Exercises
Running in LAFF v3 environment, this was working before the latest commit but now throws the following error:
AssertionError Traceback (most recent call last)
in ()
6 A = np.matrix('1 -1 2; 2 0 2;-2 0 -4')
7 B = np.matrix('7;4;-10')
----> 8 GJ_Inverse_alt( A, B )
9 print(B)
10
in GJ_Inverse_alt(A, B)
26
27 laff.ger( -1.0, a01, b10t, B00 )
---> 28 laff.copy( -a01, b01 ) #b01 = -a01
29 laff.ger( -1.0, a21, b10t, B20 )
30 laff.copy( -a21, b21 ) #b21 = -a21
Web/laff/LAFF/notebooks/laff/vecvec/copy.py in copy(x, y)
23
24 if m_x is 1 and m_y is 1: # x is a row, y is a row
---> 25 assert n_x == n_y, "laff.copy: size mismatch between x and y"
26 for i in range(n_x): y[0, i] = x[0, i]
27
AssertionError: laff.copy: size mismatch between x and y
However there is nothing wrong in matrices:
A = np.matrix('1 -1 2; 2 0 2;-2 0 -4')
B = np.matrix('7;4;-10')
A*B
Out[11]:
matrix([[-17],
[ -6],
[ 26]])
np.linalg.inv(A) * B
Out[12]:
matrix([[-1.],
[-2.],
[ 3.]])
Hi, I created a new issue here while I was working on 6.2.5 notebook
The original answers notebook throws back error and I've cited many previous notebook throwing errors on laff methods:
Please checkout the whole issue and clarify.
Thanks
In laff.matvec.trsv function, b is a vector with row or column size = 1. At line 75 ,the function trsv_ltu is called as trsv_ltu(A,b) .However,the function laff.matvec.trsv_ltu treats b as a 2D matrix
def trsv_ltu(A,B):
...
So, a call
laff.trsv('Lower triangular','Transpose','Unit diagonal',A,b)
where b is a column vector
will cause an error message
"dots( -l21, b2, beta1 )
NameError: name 'b2' is not defined"
import numpy as np import laff import flame
L = np.matrix( ' 1, 0, 0. 0;\ -2, 1, 0, 0;\ 1,-3, 1, 0;\ 2, 3,-1, 1' )
U = np.matrix( ' 2,-1, 3,-2;\ 0,-2, 1,-1;\ 0, 0, 1, 2;\ 0, 0, 0, 3' )
A = L * U Aold = np.matrix( np.copy( A ) ) B = np.matrix( np.eye( 4 ) )
print( 'A = ' ) print( A )
print( 'B = ' ) print( B )
/laff/LAFF/notebooks/laff/matmat/trsm.py in <module>()
2 from numpy import shape
3 from numpy import transpose
----> 4 from laff.matvec.trsm_lnu import trsm_lnu
5 from laff.matvec.trsm_utn import trsm_utn
6 from laff.matvec.trsm_ltu import trsm_ltu
ImportError: No module named 'laff.matvec.trsm_lnu'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.