Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
faust group
faust
Commits
b3559e2d
Commit
b3559e2d
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add matfaust.aslazylinearoperator shape optional argument and document it.
parent
c49cbf2c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wrapper/matlab/+matfaust/+lazylinop/@LazyLinearOp/LazyLinearOp.m
+26
-5
26 additions, 5 deletions
.../matlab/+matfaust/+lazylinop/@LazyLinearOp/LazyLinearOp.m
wrapper/matlab/+matfaust/+lazylinop/aslazylinearoperator.m
+7
-2
7 additions, 2 deletions
wrapper/matlab/+matfaust/+lazylinop/aslazylinearoperator.m
with
33 additions
and
7 deletions
wrapper/matlab/+matfaust/+lazylinop/@LazyLinearOp/LazyLinearOp.m
+
26
−
5
View file @
b3559e2d
...
...
@@ -545,7 +545,28 @@ classdef LazyLinearOp < handle % needed to use references on objects
b
=
isa
(
obj
,
'matfaust.lazylinop.LazyLinearOp'
);
end
function
lop
=
create_from_op
(
obj
)
%=============================================================
%> Alias of matfaust.lazylinop.aslazylinearoperator.
%=============================================================
function
lop
=
create_from_op
(
obj
,
varargin
)
nargs
=
length
(
varargin
);
if
nargs
>=
1
if
~
strcmp
(
varargin
{
1
},
'shape'
)
error
([
varargin
{
1
},
' is not a valid keyword argument, valid one:
''
shape
''
'
])
end
if
nargs
>=
2
argval
=
varargin
{
2
};
else
error
(
'
''
shape
''
must be followed by a value'
)
end
if
ismatrix
(
varargin
{
2
})
&&
isnumeric
(
varargin
{
2
})
&&
all
(
size
(
varargin
{
2
})
==
[
1
,
2
])
osize
=
varargin
{
2
};
else
error
(
'the value of
''
shape
''
must be a valid row-vector of 2 integers'
)
end
else
osize
=
size
(
obj
);
end
import
matfaust
.
lazylinop
.
LazyLinearOp
lambdas
=
cell
(
1
,
4
);
lambdasT
=
cell
(
1
,
4
);
...
...
@@ -565,13 +586,13 @@ classdef LazyLinearOp < handle % needed to use references on objects
dtype
=
'single'
;
end
lop
=
LazyLinearOp
(
lambdas
,
size
(
obj
)
,
'dtype'
,
dtype
,
...
lop
=
LazyLinearOp
(
lambdas
,
o
size
,
'dtype'
,
dtype
,
...
'root_obj'
,
obj
);
lopT
=
LazyLinearOp
(
lambdasT
,
[
size
(
obj
,
2
),
size
(
obj
,
1
)],
'dtype'
,
dtype
,
...
lopT
=
LazyLinearOp
(
lambdasT
,
[
o
size
(
2
),
o
size
(
1
)],
'dtype'
,
dtype
,
...
'root_obj'
,
obj
);
lopH
=
LazyLinearOp
(
lambdasH
,
[
size
(
obj
,
2
),
size
(
obj
,
1
)],
'dtype'
,
dtype
,
...
lopH
=
LazyLinearOp
(
lambdasH
,
[
o
size
(
2
),
o
size
(
1
)],
'dtype'
,
dtype
,
...
'root_obj'
,
obj
);
lopC
=
LazyLinearOp
(
lambdasC
,
size
(
obj
)
,
'dtype'
,
dtype
,
...
lopC
=
LazyLinearOp
(
lambdasC
,
o
size
,
'dtype'
,
dtype
,
...
'root_obj'
,
obj
);
lop
.
lambdas
{
LazyLinearOp
.
T
}
=
@
()
lopT
;
...
...
This diff is collapsed.
Click to expand it.
wrapper/matlab/+matfaust/+lazylinop/aslazylinearoperator.m
+
7
−
2
View file @
b3559e2d
...
...
@@ -3,9 +3,14 @@
%>
%> @note obj must support operations and attributes defined in the LazyLinearOp class.
%> Any operation not supported would raise an exception at the evaluation time.
%>
%> @param obj: the root object on which the LazyLinearOp is based (it could
%> be a dense matrix, a sparse matrix, a Faust object or almost any
%> object that supports the same kind of functions).
%> @param 'shape', [int, int] (optional): defines the shape of the resulting LazyLinearOp. In most cases
%> this argument shouldn't be used because we can rely on size(obj) but
%> if for any reason size(obj) is not well defined the user can explicitly
%> define the shape of the LazyLinearOp.
%>
%> @retval L: a LazyLinearOp instance based on obj.
%>
...
...
@@ -31,7 +36,7 @@
%>
%> @b See @b also: matfaust.rand.
%=============================================================
function
L
=
aslazylinearoperator
(
obj
)
function
L
=
aslazylinearoperator
(
obj
,
varargin
)
import
matfaust
.
lazylinop
.
LazyLinearOp
L
=
LazyLinearOp
.
create_from_op
(
obj
);
L
=
LazyLinearOp
.
create_from_op
(
obj
,
varargin
{:}
);
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment