Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linsolve: for sparse matrix #56

Closed
Konstantin8105 opened this issue Oct 15, 2021 · 1 comment
Closed

linsolve: for sparse matrix #56

Konstantin8105 opened this issue Oct 15, 2021 · 1 comment

Comments

@Konstantin8105
Copy link

Konstantin8105 commented Oct 15, 2021

Hello,

Now, design in linsolve/iterative.go is:

func Iterative(a MulVecToer, b *mat.VecDense, ...

Matrix a have matrix interface:

type MulVecToer interface {
	// MulVecTo computes A*x or Aᵀ*x and stores the result into dst.
	MulVecTo(dst *mat.VecDense, trans bool, x mat.Vector)
}

For my sparse matrix in my rep cannot implement that interface MulVecToer.

Could you replace type of variable a into type func(trans bool, x mat.Vector).
So, example linsolve/iterative_example_test.go look like:

...


ATx := func(trans bool, x mat.Vector){
       a.MulVecTo(mat.NewVecDense(dim, nil), trans, x)
}
result, err := linsolve.Iterative(ATx, sys.B, &linsolve.CG{}, nil)
if err != nil {
	fmt.Println("Error:", err)
	return
}

...

So, design in linsolve/iterative.go in my point of view:

func Iterative(a func(trans bool, x mat.Vector), b *mat.VecDense, ...

Feel free for ignore.

@Konstantin8105
Copy link
Author

Excuse me, I find the solution without changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant